Neural MRI for AI

See failure coming
before it happens

DeepDrift monitors hidden-state velocity inside your neural network — detecting anomalies 57–168 steps before they reach the output.

rl agent · live demo
ANOMALY DETECTED — velocity exceeds threshold v = —
● NORMAL
WIND: 0 N
collapse in
steps
vt = ‖ht − ht−1‖₂ (semantic velocity) CALIBRATING
Velocity EWMA
‖h_t − h_{t−1}‖₂
Threshold τ
Q₇₅ + 1.5·IQR
Steps to collapse
advance warning
scroll
Mechanism

How DeepDrift works

One formula. 80-step calibration. O(1) per step. No retraining required.

01
Measure hidden velocity
At each forward pass, compute the L2-norm between consecutive hidden states: v_t = ‖h_t − h_{t−1}‖₂. Captures kinetic energy of representations — invisible at the output layer.
↳ Zero training required
02
Calibrate in 80 steps
Run 80–100 normal-operation steps to establish baseline. Threshold τ = Q₇₅ + 1.5·IQR is computed non-parametrically — no Gaussian assumptions, robust to outliers.
↳ Works on any architecture
03
Alert before output fails
When v_t > τ, the network is in a turbulent state. In RL this precedes deviation by 57–168 steps. In ViT OOD detection AUROC reaches 0.869. Overhead <1.5%.
↳ Lagging indicators become leading
0.869
AUROC · ViT-B/16
CIFAR-100→SVHN OOD
168
Steps advance warning
CartPole DQN (AUC 0.985)
1224×
Better than random
distributed orchestration
41%
Compute savings
LoRA fine-tuning
Taxonomy

Seven failure signatures

Distinct velocity patterns across architectures and domains.

Policy Panic
RL agent velocity spikes 57–168 steps before trajectory deviation. AUC 0.985 (CartPole), 0.968 (LunarLander).
Semantic Tremor
LLM hallucination: high-frequency velocity oscillation in transformer layers. Lead time 7.2 tokens. AUC 0.891.
Three-Phase ViT Pattern
OOD: Elevation (L1–7) → Compensation (L8–10, inverted) → Terminal Spike (L11, +26.8%). Peak AUROC 0.983.
Shadow Signature
Adversarial perturbations ε ≥ 0.05 create a characteristic velocity shadow. Nearly invisible at ε=0.001.
Burning Bottleneck
Diffusion memorization in IR band detected at epoch ~300 vs loss divergence at ~1000. 3× earlier.
Avalanche Effect
Deep CNNs under severe shift: exponential velocity cascade across layers before output degrades.

Two lines to start

Attach to any PyTorch layer. No model changes.

# pip install deepdrift
monitor = DeepDriftMonitor(model)
monitor.calibrate(loader) # 80 steps
# each forward pass:
status = monitor.step(batch)
if status.is_anomalous: alert()
Open full monitor GitHub Paper