The last lesson left you holding a probability for every next token. That is not the answer yet — it is raw material. These three knobs reshape that distribution before a token is drawn, trading focus against creativity. Every one is live to play with.
You already know softmax turns raw scores into probabilities. Temperature is one number that goes inside it — dividing every score before the squash.
Even a good distribution has a long tail of junk tokens, each with a tiny chance. Sampling could still pick one. Top-k and top-p both chop that tail off first — they just measure the cut differently.
Left alone, a confident model loops — 'the cat sat on the mat, the cat sat on the mat …'. A repetition penalty leans against tokens it has just used, so it stops circling.
You've now seen the whole forward path — text in, one token out, knobs and all. But where do the weights that produce those scores come from? Next, backpropagation: how the model measures its own mistakes and rewrites its weights to make better predictions.