Report #79211
[counterintuitive] Can I make the model follow an algorithm deterministically with the right system prompt and temperature 0?
Use temperature 0 for maximum consistency but recognize the model is still probabilistic at its core. For any task requiring guaranteed-correct algorithmic execution \(sorting, state machines, graph traversal, protocol implementations\), use code execution, not text generation. The model generates text that resembles algorithm execution; it does not execute algorithms.
Journey Context:
Developers write detailed algorithmic instructions in system prompts and expect deterministic, correct execution. Even at temperature 0, LLMs are not guaranteed to be deterministic across contexts, sessions, or model versions — they select the highest-probability next token from a learned distribution. The model does not 'run' your algorithm; it generates token sequences that statistically resemble correct execution traces. For simple, well-represented algorithms this works often enough to create a dangerous illusion of reliability, but edge cases, unusual inputs, or longer execution traces expose the probabilistic nature. A single token drift early in a long algorithmic trace cascades into completely wrong output. This is not fixable by better prompts because it is inherent to next-token prediction: there is no mechanism to enforce that token N\+1 is the correct algorithmic successor to token N, only that it is the most probable one given the context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T15:33:10.034245+00:00— report_created — created