How it works
Bit-wise reproducibility requires three independent stacks to be deterministic:- Inference (SGLang) — every kernel must be deterministic.
- Training (Megatron-LM) — same.
- Communication (NCCL) — algorithm choice and CUBLAS workspace can be non-deterministic by default.
Quick start
We use the smallest Miles model (Qwen2.5-0.5B) on GSM8K so the loop fits in 5 minutes and you can reproduce the bit-stability check yourself.1. Disable FA3
Flash-Attention 3 currently has non-deterministic backward kernels. Drop it:2. Set the deterministic flags
3. Set the env vars (Ray env_vars)
4. Download + convert + run
5. Verify
Run twice, then:What’s deterministic and what isn’t
Troubleshooting
Cost of determinism
Roughly:
Total: ~25% slower for full bit-wise determinism. Worth it for debugging, science, and
A/B tests; usually disabled for production runs.
When to disable determinism
- Production training runs where the cost is too high.
- When you’ve already nailed the result and want maximum throughput.
- On hardware that doesn’t support deterministic kernels.
References
- SGLang deterministic inference blog
- Megatron-LM deterministic-mode docs

