Hierarchical Fault Detection and Diagnosis for Transformer Architectures
Original authors: Sigma Jahan, Saurabh Singh Rajput, Tushar Sharma, Mohammad Masudur Rahman
Original authors: Sigma Jahan, Saurabh Singh Rajput, Tushar Sharma, Mohammad Masudur Rahman
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). ✨ This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Technical Summary: Hierarchical Fault Detection and Diagnosis for Transformer Architectures
Problem Statement
Transformer models underpin critical AI systems, yet their faults often manifest as "silent" failures. Unlike traditional deep neural network (DNN) faults that trigger explicit runtime errors (e.g., NaN values, exploding gradients), transformer faults can alter model behavior—such as degrading representation quality or task performance—while maintaining normal loss curves and numerical stability. Existing debugging techniques, whether rule-based (monitoring predefined symptoms) or learning-based (predicting generic DNN fault categories), operate at the model level. They fail to localize faults to specific transformer components (e.g., QKV projections, masking, positional encoding) or identify the root causes within those components. Consequently, developers lack the granular evidence needed to trace silent failures to their source, particularly when symptoms are latent or when the visible symptom does not uniquely identify the responsible component.
Methodology: DEFault++
The authors propose DEFault++, a hierarchical, learning-based technique designed to detect faults, categorize the affected component, and identify the specific root cause within that component. The methodology relies on three core innovations:
1. Hierarchical Diagnosis Architecture
DEFault++ operates through a three-level diagnostic pipeline:
- Level 1 (Fault Detection): Determines if a training run is faulty or correct.
- Level 2 (Fault Categorization): Assigns the fault to a specific transformer component category (e.g., QKV Projection, Masking, FFN).
- Level 3 (Root-Cause Diagnosis): Identifies the specific root cause within the predicted category (e.g., "Zero Q projection" vs. "Swap Q/K").
2. Feature Representation and Fault Propagation Graph (FPG)
To capture component-level behavior, DEFault++ extracts runtime measurements organized into feature groups corresponding to transformer components (e.g., attention entropy, QKV alignment, residual stream behavior). These features are aggregated across layers, epochs, and training phases.
Crucially, the technique employs a Fault Propagation Graph (FPG) as a structural prior. The FPG is a directed graph where nodes represent transformer components and edges represent data-flow dependencies derived from the transformer's forward and backward equations (e.g., how a QKV fault propagates to attention scores and residual streams). The diagnostic model uses message passing over this graph to exchange information between related feature groups, allowing the model to reason about how faults propagate through the architecture rather than treating components in isolation.
3. Training Objective and Explanation
The model is trained using a shared encoder with a multi-task objective:
- Detection and Categorization: Standard cross-entropy losses.
- Root-Cause Diagnosis: A combination of supervised contrastive learning and prototype matching. Each root cause is represented by a prototype (mean embedding) in the feature space. The model minimizes the distance between samples and their correct prototypes while maximizing the distance to other root causes within the same category.
- Explanation: The prototype-based approach allows the system to decompose the distance metric by feature group. This generates an explanation indicating which feature groups (e.g., "QKV Alignment" or "Optimization") provided the strongest evidence for the diagnosis.
Key Contributions
The paper makes five primary contributions:
- DEFault++: A hierarchical diagnostic technique that detects faults, categorizes affected components, and identifies root causes in transformer models, utilizing component-level measurements and architecture-aware reasoning.
- DEFault-bench: A new benchmark comprising 5,556 labeled training runs across seven models (encoders and decoders) and nine tasks. It is generated via a transformer-specific mutation testing framework that injects 52 distinct mutation operators covering 12 fault categories and 45 root causes.
- Fault Propagation Graph (FPG): A structural prior encoding dependency paths among transformer components, enabling the diagnostic model to leverage architectural structure for reasoning.
- Explainable Diagnosis: A training objective combining contrastive learning with prototype matching, coupled with an FPG-based explanation mechanism that reports the feature groups supporting each diagnosis.
- Comprehensive Evaluation: An evaluation of DEFault++ on the benchmark, against four prior DNN debugging techniques, on real-world GitHub issues, and in a developer study.
Results
Benchmark Performance
On DEFault-bench, DEFault++ significantly outperforms four prior techniques (AutoTrainer, UMLAUT, DeepDiagnosis, DeepFD, and DEFault) in fault detection, achieving an F1 score between 0.826 and 0.909 for encoders and decoders, respectively.
- Fault Categorization: Achieved F1 scores of 0.850 (encoders) and 0.868 (decoders).
- Root-Cause Diagnosis: Achieved F1 scores of 0.851 (encoders) and 0.867 (decoders).
- Ablation Studies: Removing the FPG message passing significantly degraded fault categorization performance, confirming that propagation structure is vital for distinguishing fault types. Removing the separation loss (contrastive/prototype) had the largest negative impact on root-cause diagnosis.
Real-World Evaluation
Evaluated on 11 reproduced real-world transformer faults from open-source repositories:
- Fault Detection: 8/11 detected.
- Fault Categorization: 8/11 correctly categorized.
- Root-Cause Diagnosis: 4/11 correctly identified.
The system successfully diagnosed complex cases, such as a stale QKV projection path in the Hugging Face Diffusers library, identifying the mismatch between LoRA updates and the fused forward path.
Developer Study
In a study with 21 participants, developers were asked to select repair actions for four scenarios with and without DEFault++ assistance.
- Repair Accuracy: Increased from 57.1% (baseline) to 83.3% (with DEFault++).
- Confidence: Self-reported confidence rose from 3.38 to 4.00 (on a 5-point scale).
- Insight: Even when the root-cause prediction was imperfect, the correct fault category and supporting feature groups helped developers select the correct repair direction.
Significance and Claims
The paper claims that transformer fault diagnosis benefits fundamentally from component-level measurements and architecture-aware reasoning rather than relying solely on model-level behavior. The authors posit that silent faults, which evade detection by traditional metrics, leave distinctive patterns within specific components that can be captured and traced via the FPG.
The study concludes that DEFault++ provides a foundation for further research by:
- Demonstrating that hierarchical diagnosis is feasible for complex transformer architectures.
- Providing the first benchmark (DEFault-bench) specifically for transformer fault diagnosis.
- Showing that explainable, component-level diagnosis can materially improve developer repair accuracy.
The authors remain modest regarding limitations, noting that the current evaluation covers single-fault configurations, specific model sizes (66M–125M parameters), and that the FPG represents statistical associations rather than verified causal mechanisms. They suggest future work should address multi-fault scenarios and calibrate edge weights in the FPG based on empirical propagation strength.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.
Get the best AI papers every week.
Trusted by researchers at Stanford, Cambridge, and the French Academy of Sciences.
Check your inbox to confirm your subscription.
Something went wrong. Try again?
No spam, unsubscribe anytime.