Determinism Operation Catalog#
This content is for developers reviewing or extending deterministic-mode coverage. Terms are defined in the glossary.
The catalog has two buckets:
Operations with a deterministic code path
Operations that deterministic mode cannot support yet
The project goal is to shrink the second bucket and make the first bucket faster.
Most operations in a training step need no entry here. The following are deterministic as-is:
Elementwise ops
GEMMs under the pinned cuBLAS workspace
Rank-indexed collectives (all-gather, all-to-all, broadcast)
Stable sorts
Unique-index writes
The tables list only the operations where a choice is made.
Deterministic Code Path Operations#
Selected by torch.are_deterministic_algorithms_enabled() or
config.deterministic_mode. The default-mode path stays in the other branch.
Operation |
Where |
Deterministic Path |
Default Path |
|---|---|---|---|
MoE token unpermute (combine) |
|
|
|
MoE routing map and probabilities |
|
|
out-of-place |
Vocab-parallel embedding |
|
direct indexing |
|
Gated-delta-net kernel |
|
torch |
FLA fused kernel |
Gated-delta-net causal conv1d |
|
|
FLA |
Mamba/SSM Triton ops |
|
one fixed autotune config plus a zero-initialized tiled workspace reduced with an ordered |
timing-based autotune, uninitialized workspace |
Mamba/GDP causal conv1d |
|
causal_conv1d >= 1.6.0 — per-block workspace for the weight and bias gradients, reduced with an ordered |
|
Transformer Engine attention |
|
requires |
TE picks freely, including atomic-accumulation attention backward |
Inference DP scheduling and RL rollout order |
|
sort by stable key |
completion order |
The two conv rows are different kernels. Mamba and GDP call Dao-AILab’s
causal_conv1d, which has its own deterministic reduction; gated-delta-net binds
FLA’s, which does not, so it falls back to F.conv1d.
The following environment controls make the rest of the step deterministic.
The flag --deterministic-mode validates and defaults these settings. For
details, refer to megatron/training/determinism.py.
NCCL_ALGO=Ring. The tree is rejected because its reduction order is not user-controllable.CUBLAS_WORKSPACE_CONFIG=:4096:8(or:16:8).NVTE_ALLOW_NONDETERMINISTIC_ALGO=0.MAMBA_DETERMINISTICmust not be disabled.CAUSAL_CONV1D_DETERMINISTICmust not be disabled. Needs causal_conv1d >= 1.6.0.
Operations Without Determinism Support#
Deterministic mode either rejects these at validation (fails closed) or they are known open gaps.
Operation or Feature |
Where Enforced or Observed |
Status |
|---|---|---|
Fused cross-entropy loss ( |
rejected by |
The fused kernel is non-deterministic. Whether a deterministic variant is feasible remains an open question. Until then, the framework uses the native vocab-parallel path. |
TP communication overlap ( |
rejected by |
Overlapped collective ordering is not reproducible. |
Packed sequence ( |
assertion in |
No deterministic packed-sequence SSM path exists yet. |
Cross-allocation floating-point collectives (TP all-reduce, DP grad reduce-scatter) |
open gap |
|
Performance Notes#
The deterministic paths above cost roughly 15% of step time compared to default mode, which varies by model. Models that rely heavily on Mixture of Experts (MoE) pay more. Measured examples range from approximately four percent on a large dense model to approximately 17% on a hybrid MoE model. The measured hotspots are:
The deterministic MoE scatter and unpermute path
The sorted router top-k
Attention backward
Grouped-GEMM weight gradient (wgrad)
Reducing this cost is a tracked workstream in
issue #5785. A change to
any row above needs a bit-exact test and a comparison of deterministic and
default performance (tests/performance_tests/shell_test_utils/determinism/).