The model does not choose the word
At each text-generation step, the model supplies next-token scores. A decoding procedure uses them to select output, sometimes with sampling and sometimes without it. Model scores, decoding settings and the surrounding serving system all contribute to the observed behaviour.
Always selecting a highest-scoring next token is greedy decoding. Research on particular open-ended generation tasks found that likelihood-focused decoding could produce bland or repetitive text. That does not mean greedy decoding always loops or is unsuitable for every task.
When sampling is enabled, two familiar controls are temperature and top-p. Their availability, defaults and interaction depend on the model and software.
Temperature changes how sharply the scores favour leading tokens before sampling. Lower positive values usually concentrate the distribution; higher ones usually flatten it. Some systems use zero to request greedy decoding. There is no universal “creative” value or temperature at which all models become nonsensical, so consult the actual implementation and test it.
Top-p, or nucleus sampling, keeps a smallest high-probability set whose cumulative probability reaches a chosen threshold, then samples after renormalisation. At p equal to 0.9, the retained set covers at least ninety per cent of the original probability mass. Its size can vary by step. That probability mass is about possible continuations, not the truth of an answer.
What this means for your work
Where controls are exposed, choose and evaluate them for the task. A setting is not a substitute for checking the output.
- Extraction, classification, data cleaning or code: test a low-variability configuration and validate the result against task-specific rules. Low temperature does not make facts correct.
- Brainstorming or alternative phrasing: test whether sampling produces useful variety without losing the constraints.
- Comparing versions or prompts: hold the model, input and settings as constant as possible, record them and evaluate repeated outputs on representative cases.
APIs and local generation tools may expose these settings; chat interfaces may not. Asking for “the most likely answer” changes the input text but does not necessarily change an external decoding parameter. Repeated answers can help assess stability, though stability alone does not establish correctness.
The uncomfortable detail
Setting temperature to 0 does not guarantee identical output, and this catches out people trying to test carefully.
Floating-point arithmetic and some parallel operations can produce small numerical differences across implementations or runs. A small difference near a tie can change the selected token and later continuation. PyTorch’s reproducibility documentation also warns that identical results are not guaranteed across all releases and platforms. These are possible mechanisms to investigate, not a diagnosis from one differing answer.
The served model, software, tools or selected context can also change. Record an exact model version and relevant configuration where the service exposes them. A product name alone may be insufficient for a controlled comparison; do not assume that an unannounced model switch caused a particular difference.
The habit this should create
Do not estimate a success rate from one demonstration.
One good answer shows that result was possible under those conditions; one failure identifies a case to investigate. To estimate reliability, define success, choose representative cases, repeat where relevant and report uncertainty. Rare but serious failures can matter even when an average score is high.
Five or ten trials can reveal obvious instability, but they are a small sample. Nine successes in ten trials do not establish a stable ninety-per-cent success rate. If, hypothetically, a system really failed on ten per cent of one hundred daily uses, the expected count would be about ten failures per day, not one per week. The stakes determine how much testing and oversight are needed.
“It worked yesterday and not today” is a starting point for investigation. Compare inputs, context, settings, retrieved material and model versions where available. Variation may come from sampling or numerical effects, but two observations alone do not identify the cause.
And a note on repetition
Repetition can have several causes, including decoding choices, the model, the prompt and the growing output prefix. Inspect the generation settings, stopping rules and input; test a shorter request or a fresh generation. Changing temperature or a repetition penalty may help in some setups, but there is no universal cure and greater randomness can introduce other errors.
Check your understanding
An engineer uses greedy decoding and identical input but observes occasional differences. Which is a possible numerical mechanism to investigate, rather than proof of a unique cause?
Pick the one you would defend. Your answer stays private.
Your place and first choices stay on this browser. Classroom credit is recorded separately.
Stuck on something?Ask Meenal, your AI tutor