Skip to content

What Mechanistic Interpretability Can Actually Explain About Agent Failures

#mechanistic-interpretability #activation-steering #sparse-autoencoders #agent-failures #attention-dynamics #hidden-states

What Mechanistic Interpretability Can Actually Explain About Agent Failures ​

A web agent clicks a button that isn't on the page. Qwen2.5-7B-Instruct, a live website, a real DOM, no synthetic fixtures. The failure is easy to spot and hard to explain, which is the case where interpretability has to earn its keep.

A linear probe trained on the last prompt token predicts these hallucinations before the model emits a single character, at 0.80 AUC. Read that as a ranking result: given one hallucinated action and one valid action, the probe puts the hallucination first about four times in five. Good enough to flag a request for a second look. Not good enough to auto-block without a human.

Steering along the same probe direction corrects 85 percent of the hallucinated actions. It also breaks 7 percent of valid ones. Roughly one working click lost for every twelve broken ones fixed. Whether that trade is acceptable depends on what a wrong click costs, and for most browsing agents I'd say no, at least not as a silent default.

The result that matters most comes next. Change how actions are represented in the prompt, a minor formatting change to the action list, and much of the steering effect goes away. The direction is format-locked. It was reading the surface layout as much as the decision state.

Circuit identification runs into the same wall from a different angle. The computation behind the hallucination spreads across multiple components and token positions, and the information the agent actually relies on shifts from example to example. You can patch a path and get a component list. You don't get a mechanism.

That sets the tone for everything below. The tools work. They work on the version of the task you trained them on.

Steering is a budget problem, not an amplitude problem ​

Standard activation steering applies the vector at every generated token. Every token gets displaced. The model drifts off the distribution it was trained on, and you notice it as a model that writes in a slightly wrong register, or repeats itself, or starts every sentence with "Sure."

Reframe it as allocation. Fix a budget of tokens you're allowed to steer. The only free variable is which tokens receive the signal.

That framing makes two gates comparable. Contrastive Feature Projection is memoryless: score each token by how poorly it aligns with the target behavior through a sparse feature projection, then steer the worst offenders. Closed-Loop Adaptive Bernoulli Steering tracks how much alignment the generation has accumulated and spends budget where the trajectory has fallen behind. On a linear steering-response model the second one has an explicit stability region, and its integral term reduces steady-state tracking offset.

At matched budgets these gated methods produce the largest behavioral shift, with the closed-loop version winning under the tight budgets where allocation actually matters. It also preserves fluency best, which is the part that decides whether you can ship it.

Steering vectors not transferring across prompt formats is the thing I keep running into. I built a refusal direction on one chat template, it worked cleanly, then I switched templates to add tool calling and the effect dropped to noise. Same model, same weights, same direction, different formatting around the actions. If your eval set uses one template and production uses three, you're measuring the wrong thing.

Quick take: interpretability now gives you usable signal before generation and coarse control during it, but the representations it finds are more format-bound and more distributed than the papers' framing suggests.

Five tools, five different questions ​

The cluster of papers here spans probes, steering, sparse autoencoders, live memory forensics, and token-embedding geometry. They answer different questions and fail in different ways.

ToolQuestion it answersCostWhere it breaks
Linear probe on the last prompt tokenWill this request produce a bad action?One training run on labeled tracesFormat-locked; needs relabeling when the prompt template moves
Direction steering from a probe or SAE featureCan I push behavior at inference time?Cheap, one forward hookFluency loss at high amplitude; collateral damage on valid cases
Circuit discovery via path patchingWhich components implement this behavior?Expensive, run per taskComputation spreads across positions and varies per example
Sparse autoencoder decompositionWhat does a layer represent?GPU-hours to train, more to labelFeatures split and absorb; codes drift across domains
Live residual-stream acquisitionWhat did a running service actually compute?Debugger access to the processNeeds per-platform adapters; observational only, no causal handle

The last row is the newest and the strangest. More on it later.

Generated tokens don't walk the embedding graph ​

Build a similarity network from the input embeddings of six open LLMs and you get a scale-free, heavy-tailed graph. Random embeddings with matched covariance are also scale-free and heavy-tailed, but far more fragmented. The real one has more structure than chance. Distillation barely changes the topology, because input embeddings are largely inherited from pre-training rather than shaped by the fine-tuning objective.

Map a generation onto that network and something odd shows up. Consecutive generated tokens rarely land on graph neighbors, and in most models no more often than shuffled order would. The visited tokens cluster inside a region of the network without following its edges. Generation behaves like a selection over a neighborhood, not a traversal of the graph.

Practical consequence: when a model degenerates into repetition, it stays confined to a small domain-specific subgraph. That's an inference-time monitor you can compute from embeddings alone, no probe training required. The layer-by-layer logit lens shows tokens settling late in depth for most models, which gives you a second, cruder signal from the same forward pass.

Depth buys persistence, and persistence is measurable ​

Define the autocorrelation of a layer as the average dot product between its activations at two context positions separated by a lag. Slowly decaying tails mean something is holding state across the context. Those tails grow with depth, in synthetic data with controlled hierarchical latents and in real text.

In real text, SAE features stand in for latent variables. Their persistence correlates strongly with the magnitude of autocorrelations across datasets and models, and persistence time increases with depth. Ablate the persistent features and the autocorrelations drop.

So when people say deeper layers encode more abstract features, there's now an operational reading: deeper features stay alive longer across the context. A feature that persists over hundreds of tokens is the model's running memory of document structure. A feature that flickers for three tokens is a local surface pattern. That distinction is testable, and it's the first quantitative handle I've seen on the abstraction claim that doesn't require a human to label what the feature means.

Sparse codes outlast the dense vectors they replace ​

Medical retrieval is a good stress test for SAE interpretability, because the failure mode matters: a system that retrieves the wrong guideline is worse than one that retrieves nothing.

Train sparse codes on top of dense embeddings with a reconstruction objective plus an InfoNCE contrastive loss that directly preserves query-document relevance. Across three embedding models and six medical retrieval datasets, the sparse codes improve in-domain retrieval over the original dense embeddings. On out-of-domain corpora they lose less performance than their dense counterparts, and the gap widens when the target corpus is far from the training one.

The qualitative win is that features become readable. You can look at which queries and documents activate a given feature most strongly and infer what it tracks. That gives you a reason for a specific retrieval, not just a score. My reading of the out-of-domain result is that the contrastive term is doing most of the work, and the sparsity is doing the explaining. Both matter, but only one of them is why the numbers went up.

Reading residual streams off a running GPU ​

The forensics paper is the one that changes what "interpretability" can mean operationally. Instead of loading a checkpoint and analyzing it offline, attach a non-modifying debugger to a live inference process and pull per-layer residual-stream activations out of video memory.

The method needs no prior knowledge of the model's architecture parameters or weights, and it's validated on 33 open-source decoder-only models across nine architecture classes with byte-exact recovery. Probes trained on ordinary framework activations, moved over to the recovered states, separate refusal from compliance at 0.88 AUROC on held-out prompts.

The interesting part isn't the accuracy. It's that a deployed service which you cannot restart or modify is now an audit target. You can ask what a specific request actually computed. That's a different category of evidence from prompt logs.

0.80 AUC: a last-token probe flags web-action hallucinations before generation starts. 85 percent vs 7 percent: applying that direction as a steering signal fixes most hallucinations and breaks valid actions at roughly one twelfth the rate. 0.88 AUROC: refusal-versus-compliance probing still works on residual streams recovered from a live GPU process. 33 models across 9 architecture classes: the validation set for byte-exact live recovery of decoder-only checkpoints.

What trips people up ​

Evaluating a probe on the same prompt template it was trained on is the most common mistake, and it's the one that produced the 85/7 headline. Hold out an entire template, not just examples. If your probe survives a reformatted action list, you have something real. If it doesn't, you have a template detector.

Don't steer every token. The per-token approach costs fluency and buys no extra behavioral shift over a budgeted gate. If you're going to intervene, decide where.

Don't assume a single circuit exists for an agent behavior. Path patching gives you a component ranking, and the ranking shifts between examples. Treat the output as a hypothesis about where to look, not as a mechanism.

Don't treat SAE features as ground-truth latents. They're proxies, and the persistence work uses them explicitly as proxies. Feature splitting and absorption are real, and a feature that reads cleanly on one corpus will drift on another.

Don't read 0.80 AUC as a solved problem. Ranking metrics don't tell you calibration at the threshold you'd actually deploy, and an agent that fires a review request four times out of five still misses one in five.

Attention collapses onto two directions ​

Causal attention dynamics converge to two clusters aligned with the eigenvectors of the largest eigenvalue of the value transformation, provided that eigenvalue is positive. When it's zero or negative, the claim generally fails. The two-cluster regime shows up often in practice and is harder to analyze than the classical single-cluster case.

The structural result is a dimension reduction you can actually use. Token trajectories evolve in a high-dimensional embedding space but collapse onto a two-dimensional structure governed by a handful of dominant directions. Simulations and Group Query Attention layers both show it. There's a framework built on instability in the flow that handles non-monotone, non-autonomous dynamics, which is the regime real attention operates in.

For practitioners, this explains why some attention heads behave like binary switches: split tokens into two camps and let one camp dominate. If you've ever watched a head dump attention onto a delimiter and the first token and almost nothing else, you've seen the two-cluster regime from the outside.

One thing to remember ​

Every result in this set is conditional on the exact surface form of the input. The web agent's probe direction dies on a formatting change, the token graph shows generation ignoring its own edges, and the attention analysis depends on an eigenvalue sign. Interpretability artifacts are as brittle as the prompts they were fit to. Retrain when the template moves.

What this means ​

If you're shipping an agent with a fixed action vocabulary and a stable prompt template, a last-token probe is cheap insurance. Budget a few hours of trace labeling, deploy it as a review trigger rather than a block, and put the template hash next to the probe version so you know when to retrain.

If you're constrained on fluency, replace per-token steering with a budgeted gate. Closed-loop allocation gets more behavioral shift per steered token and keeps generation readable at the same amplitude, which is the difference between a steering feature you can ship and one you have to disable after a week.

If you're auditing a deployed service you can't restart, expect live residual-stream acquisition to move from research demo to procurement question within the next two release cycles. Refusal probing at 0.88 AUROC on recovered bytes is already good enough for compliance review, and that shifts what vendors will be asked to prove.