INQUIRING LINE

Most of an AI's attention can be turned into plain code — what are the other 60% actually doing?

What computation remains in the attention heads that programs cannot capture?

This explores what transformer attention heads actually compute once you strip away the parts that can be mechanically rewritten as code — the residue that resists formal capture.


This explores what's left inside attention heads after you subtract the behavior that can be turned into plain executable code. The starting point is a striking result: program synthesis can recover code matching 99% of a given attention head's behavior, and swapping the best-fit 30–40% of heads for those programs preserves a model's question-answering ability Can executable programs replace transformer attention heads?. Read carefully, that number cuts both ways — it means a majority of heads (the other 60–70%) do *not* cleanly reduce to a program. The interesting question isn't the part that compiles; it's the part that doesn't.

One clue about the irreducible remainder is that some heads do a job that's less an algorithm and more a dynamic, content-triggered routing. Fewer than 5% of heads act as 'retrieval heads' — a sparse, universal mechanism that activates depending on what's in the context and is causally necessary for pulling facts out of long inputs; prune them and the model hallucinates even though the answer sits right there in the window What mechanism enables models to retrieve from long context?. A program that fits one context's activation pattern misses the point: the head's value is that it *decides when to fire* across contexts, not that it runs a fixed procedure. Similar story with the handful of input-agnostic 'massive activations' that behave like implicit attention bias terms, silently shaping where probability mass lands Do hidden massive activations act as attention bias terms?. These are global, model-wide regularities, not per-head logic you can transcribe.

There's also a messier residue: noise that turns out to be functional. Cancelling 'attention noise' simultaneously reduces hallucination, stabilizes in-context learning against example ordering, and shrinks activation outliers — suggesting these look like separate bugs but share one root in over-attention to irrelevant context Can fixing attention noise solve multiple LLM failures at once?. A program-synthesis pass that faithfully copies a head would copy this noise too, because from the outside it's indistinguishable from signal. The head's real computation is entangled with its failure modes in a way that clean code abstracts away.

The deepest gap may be temporal. A frozen program captures a head as a snapshot, but a growing line of work treats attention's job as maintaining and updating *state* over time — the long-context bottleneck is now framed not as memory capacity but as the compute needed to consolidate evicted context into fast weights Is long-context bottleneck really about memory or compute?, and architectures like TransformerFAM add feedback loops so a model attends to its own latents and grows an emergent working memory Can models learn working memory by attending to their own latents?. Neural-memory designs like Titans go further, splitting short-term attention from a long-term module that decides which surprising tokens are worth keeping Can neural memory modules scale language models beyond attention limits?. Programs capture the *when-you-give-me-X-I-return-Y* face of a head. What they miss is the head as a participant in an ongoing, stateful, self-modifying process.

So the honest answer is layered: what programs can't capture is (1) content-conditional *routing* — the decision of when to activate, not the fixed transform once activated; (2) global, cross-head regularities like bias-term massive activations that no single head 'owns'; (3) functional noise that's inseparable from signal at the behavioral surface; and (4) the temporal, state-carrying role attention plays across a sequence. There's even a further wrinkle worth sitting with: work decomposing chain-of-thought finds that a lot of apparent 'reasoning' is really output probability and memorization, with genuine step-by-step reasoning a smaller, error-accumulating third factor What three separate factors drive chain-of-thought performance? — which raises the possibility that the truly program-resistant computation isn't some deep algorithm at all, but a statistical shaping of probability that only looks like computation from the outside.


Sources 8 notes

Can executable programs replace transformer attention heads?

Program synthesis recovers executable code matching 99% of attention head behavior. Substituting the best-fit 30–40% of heads with their synthesized programs preserves QA ability, offering formal, testable interpretability instead of natural-language summaries.

What mechanism enables models to retrieve from long context?

Less than 5% of attention heads across all model families function as retrieval heads, are intrinsic to short-context models, dynamically activate by context, and are causally necessary for factuality. Pruning them causes hallucination despite information being present in context.

Do hidden massive activations act as attention bias terms?

A very small number of input-agnostic activations with values up to 100,000× larger than others act as indispensable implicit bias terms and concentrate attention probability onto specific tokens. This phenomenon appears across model sizes and Vision Transformers.

Can fixing attention noise solve multiple LLM failures at once?

Cancelling attention noise through differential attention improves hallucination rates, makes in-context learning robust to example order, and reduces activation outliers—suggesting these separate failure modes share one root cause: over-attention to irrelevant context.

Is long-context bottleneck really about memory or compute?

Research shows the bottleneck is not memory capacity but the compute required to consolidate evicted context into fast weights during offline sleep phases. Performance improves with more consolidation passes, following a test-time scaling pattern on harder reasoning tasks.

Show all 8 sources
Can models learn working memory by attending to their own latents?

TransformerFAM demonstrates that adding a feedback loop lets transformers attend to their own latent representations, fostering emergent working memory for indefinitely long inputs. The approach requires no additional weights and improves long-context performance at 1B, 8B, and 24B scales.

Can neural memory modules scale language models beyond attention limits?

Titans architecture separates attention (short-term, quadratic) from neural memory (long-term, compressed), prioritizing surprising tokens for storage. The model outperforms standard Transformers and linear RNNs across tasks while scaling to 2M+ token contexts without quadratic penalties.

What three separate factors drive chain-of-thought performance?

A shift cipher study decomposed CoT into three independent factors: output probability alone swings accuracy from 26% to 70%, memorization matches pre-training frequency patterns, and genuine reasoning exists but accumulates error with each step. This resolves the reason-or-memorize debate by showing LLMs do both simultaneously.

Papers this line draws on 8

The research behind the notes this line reads — ranked by how closely each paper relates.

Research prompt for your LLMexpand ↓

Copy into ChatGPT or Claude to take this line of inquiry further — it asks the model to find newer work and re-test which earlier constraints still hold.

You are an interpretability analyst. Still-open question: what computation remains inside attention heads that executable programs cannot capture?

What a curated library found — and when (dated claims, not current truth). These span roughly 2020–2025:
- Program synthesis can recover code matching ~99% of a given head's behavior, and swapping the best-fit 30–40% of heads for those programs preserves QA — yet the other 60–70% of heads don't cleanly compile (~2025).
- Fewer than 5% of heads act as 'retrieval heads,' a sparse universal mechanism causally necessary for long-context fact recall; prune them and the model hallucinates with the answer in-window (~2024).
- A handful of input-agnostic 'massive activations' behave like implicit attention-bias terms — global regularities no single head owns (~2024).
- Cancelling 'attention noise' jointly cuts hallucination, stabilizes in-context learning against example order, and shrinks activation outliers — functional noise fused with signal (~2024).
- Chain-of-thought decomposes into output probability, memorization, and a smaller error-accumulating reasoning factor — the program-resistant part may be statistical shaping, not algorithm (~2024).

Anchor papers (verify; mind their dates): Massive Activations in LLMs (2024), Retrieval Head Mechanistically Explains Long-Context Factuality (2024), TransformerFAM (2024), Titans: Learning to Memorize at Test Time (2025).

Your task:
(1) Re-test each constraint. For every finding, judge whether newer models, training, tooling, orchestration (memory, caching, multi-agent), or evaluation has relaxed or overturned it. Separate the durable question from the perishable limit; cite what resolved it and say where a constraint still holds.
(2) Reconcile the threads — routing, global bias terms, functional noise, stateful memory: find work from the last ~6 months that unifies or contradicts them.
(3) Propose 2 research questions assuming the regime has moved.

Cite arXiv IDs; flag anything you cannot ground in a real paper.