View on GitHub

Temperature: how an AI picks the next word

AI engineering planned

Same prompt, different answer every time. One number controls it.

The idea

At every step, a language model outputs a probability for every token in its vocabulary. Something then has to pick one. Temperature reshapes those probabilities before the pick: low temperature makes the top choice dominate, high temperature flattens everything.

Top-k and top-p sampling cut off the long tail of unlikely tokens. Together these settings decide whether an assistant is predictable or surprising.

What the lesson will build

Key ideas

The video

When it’s published, the code will live in ai-engineering/ and this page will link to it.


All topics · Suggest a topic