LLM basics for builders · core
Temperature, top-p and repeatable answers
The model gives a probability for every next token. Temperature and top-p change how the next token is picked, but even temperature zero does not promise the same answer twice.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- The model scores every possible next token. Temperature reshapes those scores: low makes the top token dominate, high makes the choice flatter.
- Top-p (nucleus sampling) keeps the smallest set of tokens whose probabilities add up to p, and picks from that set. Top-k keeps the k most likely tokens.
- Use low temperature for extraction, classification and code. Use higher temperature for creative writing. Usually tune temperature or top-p, not both.
- Temperature zero is close to greedy decoding. It is not a promise: server batching changes the order of floating-point sums, routing inside some models changes with the batch, and providers update the model behind a name.
- A seed parameter, where offered, is best effort only.
- For repeatable results: cache answers for identical inputs, constrain the output with an enum or schema, and pin a dated model version.
- Reasoning models often fix or limit the sampling settings. Read the provider docs for the model you use.
The red pen
Common traps: mistake → fix
Mistake: Temperature zero gives the same answer every time
Fix: it is close to deterministic, but batching, model updates and near-ties can still change the output.
Mistake: Higher temperature makes the model smarter or more correct
Fix: it only makes the output more random.
Mistake: Set both temperature and top-p to extreme values for control
Fix: tune one, and test the result.
Easy to hard
Questions interviewers ask, easy to hard
- What does temperature do?
- What is top-p?
- Which settings would you use for a ticket classifier? For a story writer?
- We set temperature to zero and still get different answers. Why?
- How do you make an LLM feature repeatable for tests?
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.