On determinism in software systems
Nondeterminism is a slow poison. It lets bugs hide, makes benchmarks meaningless, and turns debugging into archaeology.
When a pipeline fails, the first question I ask is: given the same input, does it always fail the same way? If the answer is no, the problem isn't the bug — the problem is the environment. Fix the environment first.
What makes a system nondeterministic?
- Time: anything that depends on wall-clock time,
datetime.now(),Date.now() - Ordering: hash maps, concurrent execution, unordered queries
- External state: network calls, file system, environment variables read at runtime
- Randomness: obvious, but often hidden inside libraries
The eval problem
This is why AI agent evaluation is so hard. The model is nondeterministic by design. Temperature > 0 means you can never get exactly the same output twice. If your eval harness is also nondeterministic (sampling from a dataset, randomised timeout thresholds), you've compounded the problem.
The fix: make everything except the model deterministic. Seed your samplers. Fix your dataset splits. Version your prompts.
A useful mental model
Think of nondeterminism as entropy. It naturally increases unless you actively work against it. Explicit seeding, explicit ordering, and logging inputs/outputs at every boundary are how you fight entropy in software.
This note represents thinking in progress. I refine these notes as I test ideas against production systems.
← Back to Notes