TL;DR
This paper reveals that transformer models actively "erase" information in their internal "memory" (the residual stream) to manage limited bandwidth. This "erasure" phenomenon can significantly mislead common interpretation techniques like Direct Logit Attribution (DLA), making it seem like certain components are important when they are actually being undone by others.
What Problem Does This Paper Address?
Understanding how large language models (LLMs) work internally is a major challenge. One proposed mechanism for how LLMs manage their internal computations is through a "memory management" system, where parts of the model might clear out information from earlier layers to make space for new information. This is analogous to how a computer's RAM might be managed. However, concrete evidence for this "erasure" phenomenon has been lacking. Furthermore, techniques like Direct Logit Attribution (DLA), which aim to pinpoint which parts of a model contribute to its output, often assume that information flows linearly and is never removed. This paper investigates whether this "erasure" actually happens and, crucially, if it breaks the assumptions of DLA, leading to incorrect interpretations of model behavior.
Methods
The researchers developed a framework to identify and quantify "erasure" in transformer models. Their approach involves:
- Identifying Writing Components: They use a "projection ratio" to measure how much of a component's output remains in the residual stream as it passes through subsequent layers. A high ratio indicates the information is preserved.
- Identifying Erasing Components: They look for components that write to the residual stream in the opposite direction of previously identified "writing" components. This suggests they are actively canceling out existing information.
- Investigating Causality: To confirm that erasure is not just a correlation, they use "activation patching." This technique involves selectively zeroing out the output of a suspected "writing" component and observing how the suspected "erasing" component's behavior changes. If the erasure disappears when the writing component's output is removed, it suggests a causal link.
- Testing DLA: They then apply DLA to identify contributions to the final output. To see if erasure confounds DLA, they specifically isolate the "erasing effect" by comparing DLA results on a standard forward pass versus a modified pass where the writing component's output is zeroed out. They also construct adversarial examples where DLA suggests a high contribution from a component, but activation patching shows no actual effect on the output.
Datasets
The experiments were conducted on a GELU-4L model trained on a dataset of 22 billion tokens, consisting of 80% web text and 20% Python code. The paper also mentions using prompts from the model's training dataset for evaluation.
Key Insights and Ideas
- Erasure is Real: The study provides concrete evidence that specific attention heads in a transformer model actively "erase" information written by earlier components. This isn't just a passive fading of information but an active cancellation.
- Memory Management in Action: This erasure appears to be a form of "memory management," where the model clears out old information to make room for new computations, likely due to the limited bandwidth of the residual stream.
- DLA is Vulnerable: Direct Logit Attribution (DLA), a popular tool for understanding LLMs, can be severely misled by this erasure phenomenon. It can attribute importance to a component that is later undone by an erasing component, leading to an overestimation of its true impact.
- Anti-Correlation is Key: The DLA contributions of writing and erasing components are often strongly anti-correlated. This means when DLA suggests a writing component is strongly contributing, the erasing component is likely strongly removing that contribution, leading to a net effect much smaller than DLA suggests.
- Adversarial Examples Highlight the Problem: The paper constructs specific examples where DLA shows a significant contribution from a component, but when that component's input is altered (patched), the DLA result remains unchanged. This demonstrates that DLA can be picking up on artifacts of erasure rather than genuine contributions.
Key Results
- An attention head in layer 0 (L0H2) was identified as a "writing" component, with its output initially fully present in the residual stream.
- Several attention heads in layer 2 were identified as "erasing" components, collectively removing approximately 90.7% of L0H2's output.
- Activation patching experiments showed that about 85% of the erasure of L0H2 in layer 2 was dependent on the "V-composition" (direct path) between L0H2 and the erasing heads.
- A strong negative correlation (r = -0.702) was found between the DLA contributions of the writing head L0H2 and the erasing heads in layer 2. The best linear fit indicated that erasing heads removed about 61% of L0H2's apparent contribution to the final logits.
- Adversarial examples demonstrated that DLA values for L0H2 could be high, but patching its input had no effect on the logit difference, suggesting DLA was not capturing a direct contribution.
Limitations and Future Work
- Single Model and Head: The study focused on a specific 4-layer transformer model and a particular attention head (L0H2). The authors acknowledge that further research is needed to determine if these erasure phenomena generalize across different model architectures, sizes, and components.
- Generalizing DLA Mitigation: While the paper suggests complementing DLA with activation patching and testing across varied prompts, it doesn't offer a definitive solution for DLA in the presence of erasure.
- Future Work: The authors recommend testing effects across varied prompts to average out spurious results and using activation patching alongside DLA to measure both direct and indirect effects of model components. They also implicitly suggest exploring how to build more robust interpretation methods that account for such phenomena.
Summary updated