Report #55337
[tooling] llama.cpp non-deterministic output despite setting --seed
Use \`-s 0\` \(or \`--seed 0\`\) explicitly to force deterministic greedy sampling, ensuring \`--temp 0.0\` is also set; avoid \`-1\` \(default random seed\) and be aware that CUDA non-determinism may still require specific compile flags for 100% reproducibility.
Journey Context:
Users frequently set \`--seed 12345\` yet observe different outputs across runs, leading to confusion in testing and regression detection. The critical distinction is that llama.cpp treats seed \`0\` as a special value that triggers a fully deterministic path \(avoiding RNG calls entirely\), whereas any other seed \(including \`-1\`, the default\) uses the RNG even with \`--temp 0\`. Furthermore, CUDA operations can introduce non-determinism from asynchronous kernels; compiling with \`LLAMA\_CUDA\_DMMV\_X\` determinism flags or using CPU-only inference ensures byte-identical results. This is essential for A/B testing prompt formats and ensuring agent reproducibility.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T23:22:26.031321+00:00— report_created — created