Introduction
Large Language Models (LLMs) like GPT-2 and GPT-J demonstrate a remarkable capacity for storing and retrieving factual knowledge. While previous research has identified Multi-Layer Perceptron (MLP) sublayers as the primary storage for these associations, the mechanical process of how this information is retrieved during inference has remained opaque. This study investigates the internal "information flow" to map the specific steps of factual recall.
Methodology
The researchers employed several interventionist techniques to reverse-engineer the model's internal processes:
- Attention and Sublayer Knockout: Artificially blocking specific attention edges or zeroing out updates from MLP/MHSA sublayers to identify critical components.
- Vocabulary Projection (Logit Lens): Mapping intermediate hidden states to the vocabulary to observe concept activation.
- Patching: Swapping representations between layers to test information readiness.
Experiments were conducted primarily on the COUNTERFACT dataset, focusing on factual triplets (Subject, Relation, Attribute) where the models already exhibited correct predictions.
The Three-Step Mechanism of Factual Recall
The study reveals a consistent three-step internal pipeline for retrieving facts:
- Subject Enrichment: In early layers, MLP sublayers enrich the subject's representation by activating related concepts (e.g., "Iron Man" activates "Marvel" and "Tony Stark").
- Relation Propagation: Information regarding the relation (e.g., "is owned by") is moved to the final token position, transforming it into a specific query.
- Attribute Extraction: In the upper layers, specific Multi-Head Self-Attention (MHSA) sublayers—termed "Knowledge Hubs"—perform the final extraction of the attribute from the enriched subject representation.
Key Results
The findings challenge the prevailing view that MLPs handle the entirety of knowledge processing. While MLPs are crucial for initial enrichment, the extraction phase is dominated by attention mechanisms.
- Extraction Dominance: In GPT-2, MHSA sublayers achieved an extraction rate of 68.2%, compared to only 31.3% for MLPs in the final stages. This identifies specific attention heads as the primary "executors" of retrieval for approximately 70% of studied facts.
- Enrichment Engine: Conversely, early MLP updates are vital for enrichment; canceling them reduced the "attribute rate" (presence of related facts) by approximately 88%.
- Knowledge Hubs: The researchers identified approximately 150 attention heads in GPT-2 that specifically encode factual mappings within their weights.
Discussion and Limitations
This work provides a blueprint for understanding factual recall but notes several limitations. The "knockout" method may suffer from information leakage, and vocabulary projection remains an approximation of complex internal states. Furthermore, the study focused on simple factual triplets; the generalizability to multi-hop reasoning remains a subject for future research. These insights open new avenues for precise "Knowledge Editing," potentially allowing for the correction of model facts by targeting specific Knowledge Hub attention heads.
Summary updated