The Open Model EcosystemLesson 41 of 71

Module 5 · Getting good output

The sampler, and the defaults that ship broken

In this lesson

  • 9 min read
  • 6 reading sections
  • Knowledge check
  • Lesson 1 of 10 in this chapter

This chapter’s goalTake an open model producing bad output and identify whether the fault lies in the sampler, the prompt, the examples, the schema, the language or the model itself; then apply the cheapest correct fix, from a temperature change to a grammar-constrained decoder to a separate guardrail model, and demonstrate the improvement on a held set.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available
Two sets of sampler settings, and why the shipped defaults suit neitherExtraction, classification, routing, schemastemperature 0top_p 1, top_k 0repetition_penalty 1.0The same input must give the same outputWriting, brainstorming, variationtemperature 0.7 to 1.0min_p about 0.05, or top_p 0.9repetition_penalty 1.05 to 1.1 is defensibleReasoning models: follow the card, often 0.6Most local interfaces start at temperature 0.8, top_p 0.95 and a repetition penalty near 1.1. Quotes,colons, commas and braces are what JSON is made of, so that penalty is arguing against correct syntaxby the fifth field.
Most local interfaces start at temperature 0.8, top_p 0.95 and a repetition penalty near 1.1. Quotes, colons, commas and braces are what JSON is made of, so that penalty is arguing against correct syntax by the fifth field.

Figure 5.1

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 7Free · no account needed
Lesson steps

What happens after the forward pass

The model outputs a logit for every token in the vocabulary: 150,000 raw scores. The sampler turns those into one chosen token, and every parameter you have heard of is a step in that conversion.

Temperature divides the logits before the softmax. Below 1 the distribution sharpens and the likeliest tokens dominate; above 1 it flattens and unlikely tokens get a chance. At 0 most implementations skip sampling entirely and take the highest-scoring token, which is greedy decoding.

top_k keeps only the k highest-scoring tokens and renormalises. Blunt: k=40 is far too many when the model is certain and far too few when it is uncertain across a wide field.

top_p, or nucleus sampling, keeps the smallest set of tokens whose probabilities sum to p. Adaptive in the right direction: a confident step keeps two tokens, an open one keeps forty.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the Maths You Actually Need exam.

Stuck on something?Ask Anjali, your AI tutor

How to cite: Addaly (2026) ‘The sampler, and the defaults that ship broken’, in The Open Model Ecosystem. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/open-models/sampling-parameters (Accessed: 29 November 2026).