Decoding and Determinism
About 30 min
Goal
By the end of this lesson, you can design a reproducible stochastic decoding evaluation that records its workflow contract, trial provenance, and success rate.
Level 6 introduced temperature, top-k, and top-p. Now treat those settings as part of a workflow contract. If a prompt evaluation cannot be repeated under known conditions, it becomes hard to tell whether a change improved the prompt or merely changed the random sample.
Recall the decoding controls from Level 6
Level 6 already established the mechanics: greedy decoding chooses the highest-scoring token, sampling draws from a distribution, and temperature, top-k, top-p, and seeds change how that selection experiment behaves.
Here the question changes from “How does decoding work?” to “How do we evaluate a decoding workflow fairly?”
Treat generation settings as a workflow contract
A reproducible comparison records the conditions that are supposed to stay fixed:
model/checkpoint identity
+ prompt or evaluation case
+ decoding mode and settings
+ seed policy and trial count
+ runtime/provider identity
+ success rule
If one of those changes without being recorded, an apparent improvement may come from a different experiment rather than a better prompt or model.
Determinism is not correctness
A model can return the same wrong answer every time. Reproducibility makes a behavior easier to measure and debug; it does not make the behavior good.
Sampling variation is not automatically a defect either. If several outputs are valid, the useful question may be how often the workflow satisfies the task rather than whether every string is identical.
Evaluate stochastic behavior with repeated trials
Suppose one sampled run passes. That single result does not tell you whether the workflow succeeds 99% of the time or 55% of the time.
For stochastic workflows, run the same evaluation case under the same recorded configuration across several trial seeds. Then report a quantity such as:
- format-pass rate;
- unsupported-claim rate;
- task success rate;
- number of distinct valid outputs.
The number of trials should match the risk and cost of the application. A classroom Lab can use a small fixed seed set. A high-stakes production system needs stronger evaluation design and uncertainty analysis.
A seed is only one field in the contract
A fixed seed controls one source of sampling variation. It does not freeze model weights, tokenizer behavior, numerical kernels, batching, hardware math, provider implementation, or server-side changes.
That is why “same seed” is weaker than “same recorded workflow.” Record model and runtime identity alongside decoding settings, the seed policy, and the planned trial count. Record the exact seeds used in a particular run as run provenance so someone can replay that batch.
Here is the distinction in concrete terms:
- Seed policy: “Before running the evaluation, use 12 distinct seeds chosen in advance.”
- Run provenance: “This particular run used seeds 1 through 12.”
If you repeat the measurement with seeds 61 through 72, the exact trial IDs change, but the policy can stay the same: 12 distinct seeds chosen in advance. If you instead decide to use only one hand-picked seed, you changed the evaluation policy itself.
Predict
Run the Lab
The Lab turns one sampled distribution into a small reliability evaluation. Token C is the toy failure case; A or B counts as a pass.
Because this toy distribution is fully known, its true pass probability is visible: 0.60 + 0.30 = 0.90. The Lab prints that 0.900 reference beside the measured pass rate. This is a teaching convenience: with a real LLM workflow, the underlying success probability is usually not known exactly, so repeated trials are used to estimate it.
- Click Run unchanged. The single sampled trial uses the first seed in the current batch. Compare the repeated-trial pass rate with the printed true pass probability of
0.900. - Inspect the printed workflow contract. Confirm that it records the model ID, runtime ID, prompt case, decoding mode, weights, seed policy, planned trial count, and success rule.
- Inspect
run provenance. The exact trial seeds belong there because they identify this particular measurement batch. The batch should contain exactly the 12 distinct seeds promised by the contract. - Notice that the reported rate comes from a set of trials, not from whichever sample looked best. Before editing, predict whether another batch chosen under the same 12-seed policy must give exactly the same pass rate.
- Change only
trial_seeds = list(range(1, 13))totrial_seeds = list(range(61, 73)). - Click Run and compare the rate with
0.900again. The workflow contract stayed fixed while the recorded trial batch changed, so the finite estimate can move a little even though the underlying toy probability did not. - Explain the policy/ID distinction with this example: “use 12 distinct seeds chosen in advance” is the seed policy; “this run used 61 through 72” is run provenance. Changing the first creates a different evaluation configuration. Changing only the second can be a repeated measurement under the same policy.
- Press Reset afterward.
Loading lab…
Quick Check
Explain it back
Describe a sampled evaluation with repeated trials. List the fields you would record in its workflow contract, state the success rule, and explain why one successful sample is not enough evidence for a reliability claim.
Check your explanation
A strong answer mentions:
- Record the checkpoint, prompt, context, decoding settings, runtime, seed policy, trial count, and success criterion.
- Run the same evaluation case for several documented trial seeds; score each result using the same pass/fail rule.
- One success does not establish a high success rate when sampling can vary; a fixed seed helps reproduction but is not a cross-runtime guarantee.
Key Takeaways
- Level 6 decoding controls become recorded inputs to a Level 7 evaluation workflow.
- A seed controls one source of sampling randomness but is not a universal cross-runtime guarantee.
- Deterministic output can still be wrong.
- Probabilistic systems may require repeated trials per evaluation case.
- Record checkpoint, prompt, decoding configuration, seed policy, planned trial count, runtime identity, and success rule in the workflow contract; record exact trial seeds as run provenance.
Next Lesson
Next, distinguish fluent generation from grounded knowledge and design workflows that can abstain when evidence is missing.
References
- Radford et al., Language Models are Unsupervised Multitask Learners.
Completion is stored locally on this device.