Study the lesson
Work through every section at your own pace, from start to finish.
You have crafted a careful prompt, but two runs of the same request produce very different results. One response is crisp and on-target, the next meanders. Or perhaps you need deterministic output for a classification task but keep getting variation you cannot account for. The culprit, more often than not, is not the prompt. It is the generation parameters you are using, or not using deliberately. Large language models do not produce text the way a calculator produces a number. At each step the model outputs a probability distribution across tens of thousands of possible next tokens, the basic units of text, and generation parameters determine how it samples from that distribution. Change the parameters and you change the character of the output entirely, without touching a single word of your prompt. This lesson demystifies the parameters practitioners meet most: temperature, top-p and top-k, repetition and frequency penalties, and max tokens.
Unlock the full lesson, the quiz, and your verifiable completion.
Continue with GoogleBy continuing you agree to the Institute of AI terms of use and privacy policy.
None of these are hard requirements. The lesson is easier if they are already familiar, but everything it uses is explained along the way, so you can start without them.
Section one is open to everyone. Create a free account to work through the rest and take the quiz.
Before a model picks the next token, it produces raw scores called logits for every token in its vocabulary, which are converted into probabilities by a softmax function. Temperature is applied before that conversion: each logit is divided by the temperature value, and softmax then converts the result into probabilities. A temperature of 1.0 leaves the distribution exactly as the model produced it. Below 1.0 the distribution sharpens, so the highest-probability tokens become relatively more likely and lower-probability tokens are further suppressed. At the extreme, temperature 0 is effectively greedy decoding: the model always picks the single highest-probability token, producing highly consistent output for the same input. Above 1.0 the distribution flattens, so tokens the model considered unlikely become more competitive, producing more varied and potentially surprising output. Pushed too high, this tips into incoherence as the model starts selecting tokens it would ordinarily dismiss. Think of it as a confidence dial: at low temperature you get a cautious expert who gives one clear, considered answer, while at high temperature you get a freewheeling brainstorm where unusual connections emerge but nonsense occasionally slips in too. A common misconception is that temperature changes what the model knows. It does not. It changes how the model samples from what it knows. A temperature of 0 does not make the model more accurate, it makes it more consistent, and if the most probable token happens to be wrong you will get the same wrong answer every time. As starting points that vary by model and task, extraction and classification suit a temperature around 0 to 0.2, summarisation and question-answering around 0.3 to 0.5, and creative or generative tasks around 0.7 to 1.0.
Work through every section at your own pace, from start to finish.
A short set of questions on what you have just covered.
Every completion has a certificate that you can share publicly for anyone to verify.
Pass the quiz and the Institute of AI issues you a record of completion with your score. Every completion has its own public verification page, so the link you put on your CV or LinkedIn profile can be checked by anyone, at any time.
Free lessons, a quiz to test what you have learned, and a completion you can verify publicly. All from the UK's professional body for artificial intelligence.
Every AI lesson is free to start, free to finish, and ends in a completion you can verify publicly.