nnTrace: Detecting and Localizing Silent Bugs in Distributed Training
Haitian Jiang, Shaowei Zhu, Zhen Zhang, Zhenyu Song, Xinwei Fu, Zhen Jia, Yida Wang, Jinyang Li
NeurIPS 2026
TL;DR. nnTrace enables the rapid detection and localization of silent bugs in distributed training by using a principled perturbation-based proxy to distinguish logic errors from numerical noise within a single iteration.
Abstract. Distributed training is essential for scaling LLM training across thousands of GPUs. However, as distributed training requires complex implementations, they are prone to silent bugs, which do not produce explicit error signals but lead to in correct training outcomes. Common debugging practices based on monitoring training loss or gradient norm curves are slow or unable to detect bugs and also do not help localize bugs.
We design and implement nnTrace, the first systematic differential testing system for detecting and localizing silent bugs in distributed training. nnTrace aligns intermediate tensors from distributed training with those from a trusted reference implementation. To properly compare the floating-point values in the corresponding tensors, we propose a novel mathematical analysis that provides a guideline for setting tolerances, enabling nnTrace to distinguish bug-induced errors from numerical errors. Experimental results demonstrate that nnTrace effectively detects 11 existing bugs and 3 new bugs in the widely used Megatron-LM framework. nnTrace is effective in various training recipes, including low-precision recipes involving BF16 and FP8. Notably, Megatron-LM has already adopted the method proposed by nnTrace in its development workflow. Our code is available at https://github.com/haitian-jiang/nnTrace.
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperedit · history
NeurIPS 2026
Accept (spotlight) · 4 reviews · OpenReview
Updated 25 Nov 2026, 03:43 UTC.
- Decision
- Accept (spotlight)
Read decision
Meta-review
The reviewers and I are positive about this paper. The paper addresses a critical and timely problem: silent bugs in distributed training frameworks, and provides a well-engineered, practically impactful solution that has been verified via Megatron-LM. The perturbation-based tolerance estimation is a novel and theoretically grounded approach, and the evaluation across diverse architectures and parallelization strategies is convincing.
The paper received consistently high ratings from four reviewers (5/5/5/4). In the rebuttal, the authors have provide adequate responses to the questions raised by the reviewers. Based on the review comments and my own judgement, I recommend accept (spotlight).
Final justification
The paper received consistently high ratings from four reviewers (5/5/5/4). In the rebuttal, the authors have provide adequate responses to the questions raised by the reviewers. Based on the review comments and my own judgement, I recommend accept (spotlight).
Read meta-review
Meta-review
The reviewers and I are positive about this paper. The paper addresses a critical and timely problem: silent bugs in distributed training frameworks, and provides a well-engineered, practically impactful solution that has been verified via Megatron-LM. The perturbation-based tolerance estimation is a novel and theoretically grounded approach, and the evaluation across diverse architectures and parallelization strategies is convincing.
The paper received consistently high ratings from four reviewers (5/5/5/4). In the rebuttal, the authors have provide adequate responses to the questions raised by the reviewers. Based on the review comments and my own judgement, I recommend accept (spotlight).
Final justification
The paper received consistently high ratings from four reviewers (5/5/5/4). In the rebuttal, the authors have provide adequate responses to the questions raised by the reviewers. Based on the review comments and my own judgement, I recommend accept (spotlight).
1 comment
- Rating
- 4/6
- Confidence
- 4/5
- Quality
- 3/4
- Clarity
- 4/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
The paper introduces nnTrace, a systematic differential testing system designed to detect and localize silent bugs in distributed training frameworks. Because distributed training implementations are highly complex, they are prone to silent errors that do not crash the system but quietly degrade model quality. Instead of relying on slow, coarse-grained loss curve monitoring, nnTrace compares a distributed candidate run against a trusted reference implementation for a single training iteration. To handle the non-associative nature of floating-point arithmetic at native low precisions (e.g., BF16, FP8), nnTrace dynamically estimates a per-tensor numerical error tolerance using machine-epsilon-scale perturbations. If a discrepancy exceeds this tolerance, nnTrace employs module-wise input rewriting to isolate the fault and prevent error propagation, successfully localizing the bug. The authors evaluated nnTrace on Megatron-LM, detecting 14 silent bugs, including 3 previously unknown ones.
Strengths and weaknesses
Strength:
- Practical and High-Impact Domain: The paper addresses a critical, time-consuming pain point in modern machine learning: debugging complex distributed training pipelines.
- Novel Error Tolerance Estimation: The use of a perturbation-based proxy to empirically probe local numerical sensitivity and estimate dynamic, per-tensor tolerances at native precisions is a highly novel and theoretically grounded approach.
- Precise Fault Localization: nnTrace's module-wise input rewriting effectively decouples modules, preventing errors from cascading and allowing for fine-grained localization at the PyTorch module level.
- Solid Evaluation Across Architectures: The system was comprehensively evaluated across diverse, state-of-the-art model architectures (GPT, Llama, Mamba, MoE) and multiple parallelization strategies (TP, DP, PP, CP, SP).
Weakness:
- Manual Annotation Overhead: To construct the canonical mapping that aligns distributed shards with the reference tensor, nnTrace requires user-provided annotations. While the authors claim this is lightweight, it still introduces a manual burden and a potential source of human error when mapping complex or novel parallelization strategies.
- Inability to Detect Nondeterministic Bugs: Because the system tests execution traces from a single training iteration, it is structurally unable to detect nondeterministic bugs [1, 2], that do not reliably reproduce within that single snapshot.
- Overhead for Large Reference Models: For massive models where a single-device reference is impossible, nnTrace relies on a pipeline parallelism setup for the reference. This introduces device-to-host memory movement overheads, resulting in extended tracing times (e.g., over 22 minutes for a 671B model) compared to the highly optimized candidate implementations.
[1] Pham, H. V., Qian, S., Wang, J., Lutellier, T., Rosenthal, J., Tan, L., ... & Nagappan, N. (2020, December). Problems and opportunities in training deep learning software systems: An analysis of variance. In Proceedings of the 35th IEEE/ACM international conference on automated software engineering (pp. 771-783).
[2] Qian, S., Pham, V. H., Lutellier, T., Hu, Z., Kim, J., Tan, L., ... & Shah, S. (2021). Are my deep learning systems fair? An empirical study of fixed-seed training. Advances in Neural Information Processing Systems, 34, 30211-30227.
Questions
-
Could you provide more detail on the complexity of the manual annotations required for highly entangled parallelization strategies (e.g., combining Sequence Parallelism with Tensor Parallelism)? How prone is this annotation step to human error?
-
How does nnTrace handle stateful bugs that might not manifest as an immediate tensor anomaly in the first iteration, but rather corrupt the optimizer state (like momentum) subtly over several steps?
-
Are there theoretical or practical scenarios (e.g., highly discontinuous activation functions or heavily unconditioned custom kernels) where the perturbation response completely fails to act as a reliable proxy for internal round-off errors?
-
The module-wise rewrite feature generates consistent logical tensors to decouple modules for fault localization. Does this mechanism introduce significant memory bottlenecks for the test environment when dealing with extremely large hidden dimensions or sequence lengths?
Limitations
Yes
Final justification
Dear Authors, thank you for your rebuttals. I am happy to keep my positive assessment of this work.
Please discuss the limitations on the nondeterminism bugs and related work in the final version. Thanks!
Formatting concerns
No
1 comment
Rebuttal
Thanks for the positive feedback and constructive questions.
Comment: [Weakness 1] Manual Annotation Overhead: To construct the canonical mapping that aligns distributed shards with the reference tensor, nnTrace requires user-provided annotations. While the authors claim this is lightweight, it still introduces a manual burden and a potential source of human error when mapping complex or novel parallelization strategies.
Response: Although we do require manual annotations, these annotations are low effort; they are defined at module level and only requires several lines of code per module. Moreover, these annotations can be reused across different models containing the same modules. Thus, the annotation effort is largely reusable rather than repeated for every model or test configuration. Please see the response to Question 1 about the human errors in the annotations.
Comment: [Question 1 and Meta Review Question 1] Could you provide more detail on the complexity of the manual annotations required for highly entangled parallelization strategies (e.g., combining Sequence Parallelism with Tensor Parallelism)? How prone is this annotation step to human error?
Response: Thank you for this question. The annotation scheme is compositional: each parallelism strategy specifies the tensor dimension that it partitions, rather than requiring a separate annotation for every combination of strategies. For example, for modules combining tensor and sequence parallelism, the annotations remain concise:
self_attention.linear_proj:
output:
sp_dim: 0 # sequence parallelism is on first dimension of output tensor
mlp.linear_fc2:
input:
tp_dim: -1 # tensor parallelism is on last dimension of input tensor
output:
sp_dim: 0 # sequence parallelism is on first dimension of output tensor
The paper also provides a combined-parallelism example in Appendix B.1.
We agree that manual annotation can introduce errors and may lead to incorrect mappings. In practice, most annotation errors are easy to identify because reconstructing the logical tensor produces an immediate shape mismatch. Therefore, we can run a quick test to catch potential annotation errors using tensors with distint dimensions to induce shape mismatch.
Comment: [Weakness 2] Inability to Detect Nondeterministic Bugs: Because the system tests execution traces from a single training iteration, it is structurally unable to detect nondeterministic bugs that do not reliably reproduce within that single snapshot.
[Meta Review Question 2] Could the authors clarify the scope boundary more explicitly in the paper and discuss potential extensions for nondeterministic bugs?
Response: We agree that the current design primarily targets bugs that can be deterministicly reproduced, nondeterministic bugs such as race conditions and hardware failures like silent data corruption are out of scope. We will state this scope boundary more explicitly in the revised manuscript.
A possible extension is to repeat the same test under varied execution conditions to increase the probability of triggering nondeterministic failures by collecting many trajectories. Once such bug is triggered, nnTrace's existing localization mechanisms may still help identify the affected component.
Comment: [Weakness 3] Overhead for Large Reference Models: For massive models where a single-device reference is impossible, nnTrace relies on a pipeline parallelism setup for the reference. This introduces device-to-host memory movement overheads, resulting in extended tracing times (e.g., over 22 minutes for a 671B model) compared to the highly optimized candidate implementations.
[Meta Review Question 4] Could the authors discuss potential optimizations or whether this overhead is acceptable in the context of the debugging workflow it replaces?
Response: Typically the code path of the candidate implementation is independent of the tensor sizes in the training framework code, so the correctness of such framework code can be checked with a down-scaled model, avoiding running a large reference model altogether. In the case where a large reference model must be run, nnTrace's tracing time, (22 minutes for 671B model) is still significantly less than the tens of hours in alternative debugging frameworks [1].
[1] Lu, Y., Miao, Y., Tan, C., Huang, P., Zhu, Y., Zhang, X., & Yang, F. (2025, October). Trainverify: Equivalence-based verification for distributed llm training. In Proceedings of the ACM SIGOPS 31st Symposium on Operating Systems Principles (pp. 237-253).
Comment: [Question 2] How does nnTrace handle stateful bugs that might not manifest as an immediate tensor anomaly in the first iteration, but rather corrupt the optimizer state (like momentum) subtly over several steps?
Response: Thank you for this question. nnTrace is not inherently restricted to a single iteration; we use one iteration in our evaluation primarily for efficiency. The same tracing procedure can be applied over multiple consecutive iterations to compare gradient and parameter trajectories, allowing bugs whose effects accumulate over several optimizer steps to be detected. nnTrace also traces the optimizer update itself: it records the main gradients before the update and the parameters after the update. By providing consistent main gradients to the reference and candidate implementations, nnTrace isolates the optimizer behavior, so a corrupted optimizer state that affects the update will manifest as a discrepancy in the post-update parameters. This mechanism has already detected optimizer-update bugs, including Bugs 5 and 9 in Table 1.
Comment: [Question 3] Are there theoretical or practical scenarios (e.g., highly discontinuous activation functions or heavily unconditioned custom kernels) where the perturbation response completely fails to act as a reliable proxy for internal round-off errors?
Response: Theoretically one can construct such cases to break the assumptions. However, in practice, such regimes are largely excluded: operators severely ill-conditioned would destabilize gradient-based optimization itself, while trainable architectures are deliberately well-conditioned (e.g., layer norm, residual connections), and the activation functions are continuous. For operators whose implementation is not numerically stable, the perturbation response is not guaranteed to provide a reliable estimate. In such cases, an unusually large or unstable perturbation response may itself indicate problematic numerical implementation.
Comment: [Question 4] The module-wise rewrite feature generates consistent logical tensors to decouple modules for fault localization. Does this mechanism introduce significant memory bottlenecks for the test environment when dealing with extremely large hidden dimensions or sequence lengths?
Response: No. The module-wise rewrite functionality does not introduce additional memory bottlenecks because the module inputs are rewritten in place.
- Rating
- 5/6
- Confidence
- 3/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper proposes a differential testing system designed to detect and localize silent bugs in distributed machine learning training pipelines within a single iteration. The system aligns fragmented tensor shards into canonical logical tensors for comparison against a trusted reference, dynamically estimating numerical tolerances via machine-epsilon-scale perturbations to distinguish genuine bugs from benign floating-point roundoff. Experiments show that nnTrace successfully identified 11 existing and 3 previously unknown silent bugs inside the widely used Megatron-LM framework.
Strengths and weaknesses
Strengths
-
The paper targets an important and timely problem. The proposed system detected 11 existing silent bugs and 3 previously unkonwn silent bugs across the widely used Megatron-LM and TransformerEngine frameworks.
-
The empirical results are supported in solid mathematical error bounds derived for Pre-LN Transformers.
-
Sgnificantly faster than traditional loss-curve divergence error detection.
Weaknesses
-
It seems the proposed system only works for deterministic bugs. It's unclear if the proposed system can capture non-deterministic concurrecy bugs such as race conditions.
-
The system still requires users to manually provide lightweight sharding annotations for parameters and module inputs/outputs.
Questions
Please see comments above.
Limitations
yes
Final justification
This paper tackles an important problem with a practical, well-engineered solution. Despite its restriction to deterministic bugs and the requirement for manual sharding annotations, the system's ability to quickly and reliably localize silent errors across various architectures makes it a valuable contribution to the community. I maintain my original Accept rating.
Formatting concerns
none
1 comment
Rebuttal
Thanks for the positive feedback and acknowledging the importance of the problem.
Comment: [Weakness 1] It seems the proposed system only works for deterministic bugs. It's unclear if the proposed system can capture non-deterministic concurrency bugs such as race conditions.
Response: We agree that the current design primarily targets bugs that can be deterministicly reproduced, nondeterministic bugs such as race conditions and hardware failures like silent data corruption are out of scope. We will state this scope boundary more explicitly in the revised manuscript.
Comment: [Weakness 2] The system still requires users to manually provide lightweight sharding annotations for parameters and module inputs/outputs.
Response: Although we do require manual annotations, these annotations are low effort; they are defined at module level and only requires several lines of code per module. Moreover, these annotations can be reused across different models containing the same modules. Thus, the annotation effort is largely reusable rather than repeated for every model or test configuration.
- Rating
- 5/6
- Confidence
- 4/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 4/4
- Originality
- 4/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
The paper introduced nnTrace, a system to automate efficient detection of bugs in LLM distributed training techniques. nnTrace tackles the high cost of reproducing and fixing training bugs introduced by scalability techniques such as parallelism, memory, compute, and communication optimizations. The key insight is that these bugs manifest early in training as deviations in intermediate tensor values between the buggy optimized implementation and a correct reference implementation. Thus, nntrace automates fine-grained differential testing of the reference and buggy implementation to detect such deviations and localize to the error source. Evaluation demonstrates the practical value of nnTrace by reporting the effectiveness and efficiency in detecting 11 known bugs and 3 new bugs in the state-of-the-art Megatron-LM framework, leading to adoption into the framework's workflow.
Strengths and weaknesses
Strengths
- Important problem: nnTrace is tackling a common modeling pain point since quality bugs in distributed training are often introduced by unavoidable scaling techniques. Thus, this paper is broadly valuable to the community.
- Novelty: While the differential testing approach of nnTrace is is not novel, to my knowledge this is the first automation this workflow. I think is technically impressive that the authors have distilled key insights from differential testing into a tool with tolerable false positives/negatives. Along the way, they addressed multiple tricky issues (e.g., precision error tolerance, tensor sharding, etc.) with reasonable and well explained solutions
- Usefulness: Differential testing is currently manual and error-prone, resulting in sparsely distributed expertise, and hard-to-reuse artifacts. By automating the process, nnTrace is simultaneously democratizing this critical capability, and hopefully inspiring a practical solution to a common source of AI project delays and failures.
- Convincing evaluation: The evaluation clearly demonstrates the value of nnTrace for model developers.
Weaknesses
-
Limited scope: nnTrace assumes the availability of a correct reference implementation, and thus appears unusable otherwise. I think this is critical limitation that should be more clearly articulated. In particular, I think the writing should quickly clarify that nnTrace is a differential testing optimization system to distinguish static or dynamic analysis of buggy implementations for errors.
-
False negatives claims: I find the false negatives claims in 5.4 a bit misleading, albeit the provided caveat. I think a testing approach by definition cannot make tangible claims about bugs that it missed.
Questions
Clarification questions
- How do you align global batch size of the (single gpu) reference implementation with a data-parallel multi-gpu buggy implementation? Does the reference implementation use gradient accumulation?
- Does nnTrace generalize to other optimization frameworks such as DeepSpeed and FSDP, or is it Megatron-LM specific?
Extension questions
- Could nnTrace be applied to inference?
- Could nnTrace help improve unit tests?
Limitations
See weaknesses
Final justification
The is general consensus that nnTrace is a timely productivity tool for ML practitioners. The authors have committed to make the writing changes to address my concerns of appropriate scoping and claims.
Formatting concerns
No
1 comment
Rebuttal
Thanks for the positive feedback and acknowledging the novelty and usefulness of our work.
Comment: [Weakness 1] Limited scope: nnTrace assumes the availability of a correct reference implementation, and thus appears unusable otherwise. I think this is critical limitation that should be more clearly articulated. In particular, I think the writing should quickly clarify that nnTrace is a differential testing optimization system to distinguish static or dynamic analysis of buggy implementations for errors.
Response: Thanks for the suggestion. We will clarify the scope explicitly in the revised manuscript.
Comment: [Weakness 2] False negatives claims: I find the false negatives claims in 5.4 a bit misleading, albeit the provided caveat. I think a testing approach by definition cannot make tangible claims about bugs that it missed.
Response: Thanks for the suggestion. we will revise the writing to make it clear that the false negative discussions in section 5.4 are not tangible claims, but are just speculations of potential failure modes of nnTrace.
Comment: [Clarification Question 1] How do you align global batch size of the (single GPU) reference implementation with a data-parallel multi-GPU buggy implementation? Does the reference implementation use gradient accumulation?
Response: Yes, the reference implementation uses gradient accumulation.
Comment: [Clarification Question 2 and Meta Review Question 3] Does nnTrace generalize to other optimization frameworks such as DeepSpeed and FSDP, or is it Megatron-LM specific?
Response: nnTrace’s core methodology is framework-agnostic. The main integration requirement is establishing the shard mapping between distributed tensors and their logical full tensors. For FSDP or DeepSpeed, this mapping may be derived from framework-managed sharding metadata, potentially reducing the need for manual annotations. We have not yet evaluated these integrations.
Comment: [Extension Question 1] Could nnTrace be applied to inference?
Response: Yes. nnTrace methodology can be applied to inference. Inference is the forward-only subset of what nnTrace already traces, so its canonical mapping, consistent tensor generation, and dynamic-tolerance comparison apply directly, without the gradient and optimizer machinery. For serving engines like vLLM and SGLang, nnTrace cannot handle the bugs in scheduling or continuous batching logic.
Comment: [Extension Question 2] Could nnTrace help improve unit tests?
Response:
Yes. Existing unit tests for numerical code rely on fixed atol/rtol thresholds, which produce spurious failures when set too strictly and fail to detect genuine bugs when set too loosely (Table 2). nnTrace's per-tensor dynamic tolerance can replace these fixed thresholds.
- Rating
- 5/6
- Confidence
- 2/5
- Quality
- 3/4
- Clarity
- 4/4
- Significance
- 4/4
- Originality
- 4/4
- Contribution type
- general
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
The paper presents a systematic differential testing system explicitly designed to detect and localize silent bugs in distributed Large Language Model (LLM) training frameworks.
Strengths and weaknesses
Strengths:
- This method compresses a classic multi-hour debugging loop which requires waiting over 6+ hours into a single, automated execution pass lasting under 54 seconds.
- The introduction of module-wise input rewriting effectively truncates downstream error propagation. This is notably effective for Mixture-of-Experts (MoE) routing, keeping the reference and candidate aligned on inputs even when minor floating-point shifts trigger disparate token dispatches. Weaknesses:
- To establish clean logical tensor maps, the system requires a manual, developer-provided framework annotation layer
Questions
Modern compilation toolkits automatically change model sharding configurations dynamically mid-run. Since your system relies on fixed structural annotations, can nnTrace adapt to auto-parallelization engines (like nnScaler) where tensor shard allocations are not manually hardcoded by the developer?
Limitations
Because it maps linear computation pathways over a single iteration, it cannot reliably catch non-deterministic runtime errors
Formatting concerns
No
1 comment
Rebuttal
Thanks for the positive feedback. We address each constructive comment in turn below.
Comment: [Weakness] To establish clean logical tensor maps, the system requires a manual, developer-provided framework annotation layer.
Response: Although we do require manual annotations, these annotations are low effort; they are defined at module level and only requires several lines of code per module. Moreover, these annotations can be reused across different models containing the same modules. Thus, the annotation effort is largely reusable rather than repeated for every model or test configuration.
Comment: [Question] Modern compilation toolkits automatically change model sharding configurations dynamically mid-run. Since your system relies on fixed structural annotations, can nnTrace adapt to auto-parallelization engines (like nnScaler) where tensor shard allocations are not manually hardcoded by the developer?
Response: Yes. nnTrace does not intrinsically require manual annotations. For auto parallelization engines like nnScaler, they already encode the mapping of logical and physical tensors in their parallelization plans, like the pTensor and vTensor abstractions in nnScaler. Therefore nnTrace can adapt to those engines by obtaining the mapping directly from the parallelization plans.
Comment: [Limitation] Because nnTrace maps linear computation pathways over a single iteration, it cannot reliably catch non-deterministic runtime errors
Response: We agree that the current design primarily targets bugs that can be deterministicly reproduced, nondeterministic bugs such as race conditions and hardware failures like silent data corruption are out of scope.
From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.
Loading the discussion…
Response to meta review
Thank you for the positive feedbacks of this paper.
Since there was no place to respond the meta review during the rebuttal period before the discussion starts, we put the response to each meta review question at the response to the corresponding original question, and they can be find at the places below:
Comment: [Question 1] Manual annotation overhead: Could the authors provide more detail on the complexity of the manual annotations required for highly entangled parallelization strategies (e.g., combining SP with TP) and how prone this step is to human error?
Response: Please see the response to Weakness 1 in reviewer PgQ3.
Comment: [Question 2] Nondeterministic bugs: The system is structurally limited to deterministic bugs that reproduce within a single iteration. Could the authors clarify the scope boundary more explicitly in the paper and discuss potential extensions for nondeterministic bugs?
Response: Please see the response to Weakness 2 in reviewer PgQ3.
Comment: [Question 3] Generalization beyond Megatron-LM: Could nnTrace generalize to other optimization frameworks such as DeepSpeed and FSDP? A brief discussion would broaden the paper's appeal.
Response: Please see the response to Clarification Question 2 in reviewer VGma.
Comment: [Question 4] Overhead for very large models: The 22+ minute tracing time for 671B models is significant. Could the authors discuss potential optimizations or whether this overhead is acceptable in the context of the debugging workflow it replaces?
Response: Please see the response to Weakness 3 in reviewer PgQ3.