← Hub
Inference & sampling05 / 08 · Intermediate

Module 05 · Intermediate · ~10 min

Inference & sampling — how AI speaks

Pause generation mid-token, inspect probabilities, fork the timeline.

Loading module…

Common questions this module answers

What does temperature do in an LLM?

Temperature rescales the model's next-token probabilities before sampling. Low temperature (→0) makes it always pick the most likely token (deterministic); high temperature flattens the distribution so unlikely tokens get picked more — more creative, more error-prone.

What is top-p (nucleus) sampling?

Top-p keeps the smallest set of tokens whose probabilities sum to p (say 0.9) and samples only from those, cutting off the long tail of implausible tokens while keeping flexibility among likely ones.

What is a context window?

The maximum number of tokens the model can consider at once — prompt plus generated output. Everything outside the window simply does not exist for the model.