Module Specialization in Transformer Factual Recall under Correlated Fact Distributions

Dong-Jae Lee, Junmo KimNeurIPS 2026

TL;DR

How a Transformer stores and recalls facts doesn't just depend on its architecture—it depends on the shape of the knowledge itself. By testing synthetic fact tables with controlled patterns of repetition, the authors show that sharing entire attribute profiles across subjects shifts where answers become readable inside the network compared to simply repeating a few common answers. Ultimately, interpreting how model components specialize requires looking at both the statistical structure of the data and the distinct lenses of passive probing versus causal intervention.

What Problem Does This Paper Address?

If you ask a language model for the capital of France, it pulls "Paris" right out of its parameters. Mechanistic interpretability research has shown that inside Transformers, MLP layers often act like key–value memory banks, while attention heads route relevant attributes. However, simplified studies of associative memory often treat facts as isolated, independent items.

Real-world knowledge is messy and deeply correlated. Two people from the same town might share a cluster of attributes (country, continent, language, timezone); different questions about one subject might yield the same answer; and certain answers (like "Asia" or "English") simply show up everywhere. Both shared patterns and frequent answers introduce repetition, which lowers entropy—but do they push a Transformer to organize its internal computations in the same way? That is the core question this paper tackles.

Methods

The authors train small, two-layer pre-LayerNorm Transformers (width 128) on a controlled factual-recall task. Inputs are 16-token sequences containing a subject $s$ and relation $r$ amidst random noise tokens, with $r$ repeated at the final query position where the model predicts the answer.

Overview of the controlled fact tables, sequence structure, and measurement sites.

To look under the hood, they pair two standard interpretability toolkits in a novel comparative setup across structured fact distributions:

  • Linear Probes (Readability): Classifiers trained on intermediate residual states right after each module ($L_1^{\text{attn}}, L_1^{\text{mlp}}, L_2^{\text{attn}}, L_2^{\text{mlp}}$) to see when the final answer becomes linearly decodable.
  • Causal Interventions (Sensitivity): Mean ablation (replacing a module's output across all positions with its mean) and restoration / activation patching (swapping a clean query-position output into a corrupted run) to test how much predictions actually rely on a module. They also use receiver-input restoration to trace how specific downstream modules consume upstream signals.

Datasets

  • Controlled Synthetic Fact Tables: Newly constructed $128 \times 128$ grids (16,384 facts over 256 possible answers) with a correlation parameter ($c = 0.9$ default) governing four regimes:
  • Independent: Uniformly random answers.
  • Subject sharing: Subjects are grouped into $K_s$ classes that share identical row patterns across relations.
  • Relation sharing: Relations are grouped into $K_r$ classes returning the same answer for a given subject (repeated columns).
  • Answer concentration: Structured entries are drawn independently from a tiny pool of $K_a$ frequent answers.
  • Natural Facts (CounterFact): To test external scope on frozen pretrained models (Pythia-1.4B/2.8B and LLaMA-3.2-1B-Instruct/3.1-8B), the authors evaluate three relations from the existing CounterFact benchmark as rough proxies for their synthetic conditions: mother tongue (P103), continent (P30), and place of birth (P19). They also fine-tune Pythia-160M on synthetic identities.

Key Insights and Ideas

  • Not all repetition is created equal: Repeating entire attribute rows across subjects (subject sharing) and repeating individual popular outputs (answer concentration) simplify the table in fundamentally different ways. Under subject sharing, the answer is already readable before the final MLP; under answer concentration, the final MLP still does heavy lifting to make the answer linearly decodable.
  • Readability $\neq$ Causal Dispensability: Just because a linear probe shows near-zero accuracy gain across a module doesn't mean that module—or earlier routing—isn't doing vital work. Passive probes measure what is linearly accessible in the residual stream, whereas interventions measure functional sensitivity.
  • A candidate grouping pathway: Through a bookkeeping cost model and receiver-input patching, the authors propose that strong subject sharing allows the network to group subjects into classes early on via an $L_1^{\text{attn}} \to L_1^{\text{mlp}} \to L_2^{\text{mlp}}$ pathway, rather than memorizing every individual subject–relation pair until a late lookup.

Key Results

  • Probe Increments ($\Delta_2$): Under extreme subject sharing ($K_s = 2$), the accuracy jump across the final MLP ($\Delta_2$) is tiny—just 0.42 percentage points (pp), because probe accuracy is already 84.5% right after the first attention layer (finishing at 99.8%). By contrast, extreme answer concentration ($K_a = 4$) starts at 47.9% after first attention and still requires a 17.07 pp boost across the final MLP (compared to ~38–43 pp for ungrouped baselines).
  • Early Attention Dominance: Despite vastly different probe curves, the first attention module ($L_1^{\text{attn}}$) consistently shows the largest causal impact. Mean-ablating it drops accuracy by 97.5 pp (independent), 53.4 pp (subject sharing), and 67.7 pp (answer concentration). Restoring it recovers 87.6 to 97.8 pp of clean-answer probability.
  • Pathway Tracing: In subject sharing, restoring $L_1^{\text{attn}}$ specifically into $L_1^{\text{mlp}}$ recovers 63.2 pp (against a 97.3 pp module baseline), and $L_1^{\text{mlp}}$ into $L_2^{\text{mlp}}$ recovers 58.9 pp, outpacing independent and concentrated-answer baselines.
  • Pretrained LLMs: Across all four frozen LLMs, the concentrated-answer proxy (continent, with only a handful of valid outputs) showed the highest peak edge-to-module localization ratio—reaching 30.1% in Pythia-1.4B and 17.8% in LLaMA-3.2-1B-Instruct, compared to just 1.5% and 2.2% for place of birth.

Limitations and Future Work

The authors are refreshingly transparent about their study's boundaries:

  • Architectural quirks: Repeating the relation token at the final query position creates an asymmetry between subjects and relations, complicating direct subject-vs.-relation comparisons. Furthermore, receiver-input interventions still include residual skip connections, preventing strict isolation of single graph edges.
  • Scale and seed variance: Several sweeps and the main restoration panel rely on a single seed or separate model cohorts, and wider synthetic models ($d \ge 256$) exhibit high seed-to-seed variance (up to ~41 pp SD in patching effects).
  • Natural data proxies: Three CounterFact relations cannot cleanly isolate statistical structure from prompt phrasing or semantics. Future work will require broader relation coverage, matched-checkpoint evaluations, and strictly isolated joint path interventions to turn candidate pathways into ironclad circuit proofs.

Summary updated

BibTeX
@inproceedings{lee2026module,
  author = {Dong-Jae Lee and Junmo Kim},
  title = {{Module Specialization in Transformer Factual Recall under Correlated Fact Distributions}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=zA0npfmnIS},
}
Figure