No. A research team showed on 17 November 2026 that temperature alone is insufficient: together with the sampler it determines how wide the candidate space becomes, so long code agent trajectories can diverge. Reproducible code requires recording model version, prompt, sampler, random state, software environment and execution results.
A widely used but overly simple rule of thumb is: set the temperature to zero and you get reproducible code. That rule of thumb is wrong. In the study Long-Context Generation Is a Sampling Problem (When You Turn Up the Heat) of 17 November 2026, the authors showed with twenty-nine open-weight models and code agent benchmarks that the combination of temperature and truncation sampler is strongly related to the question of whether long generations hold up or collapse.
Temperature controls how sharply or flatly the model chooses between possible next words (tokens). The sampler then determines which candidates may be chosen from at all. For directors, lawyers and CISOs who rely on AI-generated code or agent output, the practical consequence is that a single setting does not provide proof of repeatability.
What does the study of 17 November 2026 show about temperature and sampler?
The study measures in SWE-bench experiments, a benchmark in which AI agents solve real software tasks, that at high temperature the configurations with top-p, top-k and pure sampling collapsed. Samplers that tightly constrain the candidate set remained more robust. We therefore read the study as linking the combination of temperature setting and sampler directly to the failure or preservation of long code agent trajectories.
The core point is that temperature cannot be assessed independently of the sampler, and even the order matters: whether temperature is applied before or after truncating the candidate list changes the outcome. In our estimation this undermines the widespread assumption that one number in an API call is the determinism dial.
Why does the same prompt still produce different code at the same temperature?
Because visible text is not the full input. The tutorial The Token Not Taken of July 2026 describes how temperature rescales the probability distribution, how sampling then makes pseudo-random choices, and how variation also arises through context assembly, model version, batching, numerical execution, orchestration and external tools.
A fixed random seed only helps under strictly controlled conditions. As soon as the model version, the way the prompt is assembled, the retrieval, the batch size, the numerical kernels or a tool result changes, the same seed can still produce different code. That explains why two seemingly identical runs diverge in practice. We saw comparable dynamics earlier in why output variation requires repeated runs.
What should directors, lawyers and CISOs do about this now?
Our analysis: because temperature does not control the candidate space on its own, organisations that report only temperature zero run, in our estimation, the risk that an audit or dispute undermines their reproducibility claim; that is why we advise those responsible to have the full sampling configuration and execution environment recorded in every code delivery flow from now on. Because a fixed seed fails as soon as the model version or tool result changes, CISOs face, in our analysis, a concrete attack and drift problem; that is why model revision and tokenizer revision should be pinned in the change management pipeline and changed through a controlled release, not silently by the supplier. Because the study How Much Can Repeated Running Buy? shows that findings on repeated runs and variance are tied to the evaluation setup and sampling configuration used, we advise lawyers to require in supplier and acceptance contracts that benchmark results state the exact sampling setting and the number of repetitions; otherwise the performance claim is not fully verifiable. Because the ACL publication Reason-Code shows how executable tests can be used to select candidates and trigger conditional repairs, teams should, in our estimation, run generated code in a fixed sandbox against versioned tests before it counts as delivered; the authors themselves, incidentally, show no universal advantage of their search method over simpler repair, so the gain lies, in our analysis, in the verification, not in a specific algorithm.
As a summary of that analysis:
- Pin model and tokenizer revisions and change them only through a controlled release.
- Require in contracts that benchmarks explicitly state temperature, sampler and number of repetitions.
- Run generated code in a fixed sandbox against versioned tests before delivery.
- Never report only temperature zero as proof of reproducibility.
Which data do you record to make code generation reproducible?
In our analysis, reproducibility is a property of the whole generation and execution chain, not of a single parameter. The four studies together point to a fixed set of data to record, so that an independent party can recompute a result or settle a dispute.
- Model version and tokenizer revision of the system used.
- The full serialised prompt, tool definitions and context provided.
- Temperature and the active sampler (top-p, top-k, min-p or other) with the order in which parameters are applied.
- The random state and, where applicable, the seed.
- Limited or logged retries and parser fallbacks.
- A snapshot of dependencies and runtime environment.
- The generated source code with hash, plus the test results and the points at which runs diverged.
This list aligns with broader methods we described earlier in AI auditing methods that leave an evidence trail and with the broader topic hub on AI verification and evidence. Those taking AI code into production will find related assurance in assuring software quality with AI-generated code. In our estimation, the most important shift is that code evaluations and agent benchmarks must from now on document the complete sampling configuration and execution environment, rather than only varying the temperature.
Sources and references
- Long-Context Generation Is a Sampling Problem (When You Turn Up the Heat)
- The Token Not Taken: Sampling, State, and the Stochasticity of AI Agents
- How Much Can Repeated Running Buy? A Measured Variance Ceiling for LLM Code Evaluation
- Reason-Code: Reliable Code Generation via Test-Driven Monte Carlo Tree Search
Sources: The article draws on four academic publications on arXiv and in the ACL Anthology about temperature, sampling and the reproducibility of code generation.