Case & CodeA FIELD GUIDE TO AI
Start learning
Intermediate

Sampling

Also: decoding, decoding method, decoding strategy, probability distribution

In plain words

How the model picks the next word from its list of likely candidates. It can always take the top one, or roll the dice among the top few.

Same question, different dice
Low temperature

Always picks the most likely next word. Ask twice, get the same answer twice.

High temperature

Sometimes picks a less likely word. Ask twice, get two different answers.

Neither setting makes the answer more true. Low temperature makes mistakes repeatable; high temperature makes them varied.

The fuller definition

Sampling selects an output from a probability distribution. In language generation, a decoding strategy selects successive tokens from model scores.

Go deeper

Choosing the next token after “We expect to”
deliver0.46
complete0.24
ship0.15
finalize0.09
other0.06

Invented probabilities. Always picking the top candidate gives the same wording every run; sampling sometimes picks a lower one. Neither setting checks whether the sentence is true.

A concrete example

Different runs may choose different plausible next words for the same sentence.

The distinction that matters

Variation can be useful for drafting but does not itself provide independent evidence.

Related terms

Where it is taught

How models learn from examples

Source and further reading

Hugging Face · LLM course

The definition and example are written for this library. The link gives background, official documentation or legal authority as labelled. Legal scope depends on the jurisdiction and current text; product features depend on release and settings.

Lessons, terms, practical guides and sources ESC