+24
Gap (healthy → bug)
100%
Detection rate
0%
False positives
Anomalies detected: 0 (healthy) → 24 (bug) → 1 (fixed)
1. The Bug
The MPS backend (Apple Silicon GPU) produces gradients that are 100x–100,000x too large. The gradients are finite (no NaN), so standard monitoring doesn't catch them — the model silently converges to wrong weights.
Upstream: pytorch#177116 — OPEN, labeled module: mps, triaged.
2. Reproduction (CPU simulation)
model = nn.Sequential(nn.Linear(8,32), nn.ReLU(), nn.Linear(32,16), nn.ReLU(), nn.Linear(16,2))
x_corrupted = torch.randn(4, 8) * 100 # simulates MPS corruption
out = model(x_corrupted); out.sum().backward()
# Gradients: ~100-100,000x too large — but still finite!
3. NeuralDBG Diagnosis
With the DeepMLP architecture (12 layers, skip connections), NeuralDBG captures 24 anomalies vs 0 in the healthy baseline:
data_anomalyat LayerNorm_0: distribution_shiftgradient_health_transitionat Linear_head: NORMAL → EXPLODINGoptimizer_instabilityat optimizer: diverging
4. Why Standard Tools Miss This
| Signal | TensorBoard | W&B | NeuralDBG |
|---|---|---|---|
| Loss NaN | Yes | Yes | Yes |
| Gradient norm spike | Manual | Manual | Auto |
| Gradient health transition | No | No | Yes |
| Causal chain | No | No | Yes |
5. End-to-End Pipeline
The full NeuralSuite closed loop works on this bug:
[1/4] Healthy: 0 anomalies
[2/4] Bug: 24 anomalies (DETECTED, gap +24)
Chain: data_anomaly → gradient[exploding] → optimizer[diverging]
[3/4] Fix: normal data restored
[4/4] Validate: 1 anomaly (RESOLVED)
VERDICT: PASS
Causal Chain
graph LR
A["data_anomaly
LayerNorm_0
[distribution_shift]"] -->|"Temporal(0)
conf=0.80"| B["gradient_health
Linear_head
[exploding]"] B -->|"Temporal(2)
conf=0.70"| C["optimizer_instability
optimizer
[diverging]"] style A fill:#a371f7,stroke:#a371f7,color:#fff style B fill:#f85149,stroke:#f85149,color:#fff style C fill:#d29922,stroke:#d29922,color:#fff
LayerNorm_0
[distribution_shift]"] -->|"Temporal(0)
conf=0.80"| B["gradient_health
Linear_head
[exploding]"] B -->|"Temporal(2)
conf=0.70"| C["optimizer_instability
optimizer
[diverging]"] style A fill:#a371f7,stroke:#a371f7,color:#fff style B fill:#f85149,stroke:#f85149,color:#fff style C fill:#d29922,stroke:#d29922,color:#fff
Detection Metrics
| Phase | Anomalies | Events | Status |
|---|---|---|---|
| Healthy baseline | 0 | 46 | Clean |
| Bug injected | 24 | 70 | Detected |
| After fix | 1 | 46 | Resolved |
Key insight: Gradients can be wrong but finite — invisible to NaN-based monitoring. NeuralDBG catches the NORMAL→EXPLODING state transition before NaN appears.