NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Massive Values in Self-Attention Modules are the Key to Contextual Knowledge Understanding

Mingyu Jin, Kai Mei, Wujiang Xu, Mingjie Sun, Ruixiang Tang, Mengnan Du, Zirui Liu, Yongfeng Zhang

Abstract

Large Language Models (LLMs) are characterized by "spiky" internal activations, where a small number of features exhibit magnitudes significantly larger than the average. While these outliers complicate model quantization and compression, their functional purpose has remained poorly understood. This study investigates the origin and role of these "massive values" within the Query (Q) and Key (K) modules of Transformer architectures. Our findings reveal that these values are primarily induced by Rotary Positional Encoding (RoPE) and serve as critical anchors for contextual reasoning. By systematically disrupting these values, we demonstrate a double dissociation: massive values are indispensable for processing information provided in the prompt (contextual knowledge) but are largely redundant for retrieving facts learned during pre-training (parametric knowledge).

Introduction

The presence of extreme outliers in LLM activations is a well-documented phenomenon that presents a significant hurdle for 8-bit and 4-bit quantization. Clipping these spikes typically results in catastrophic performance degradation. However, the research community has long debated whether these values are merely artifacts of training instability or functional components of the model's architecture.

This paper explores the hypothesis that massive values are not noise, but rather the mechanism through which models anchor their attention to specific parts of the input context. We specifically examine the relationship between these values and the model's ability to distinguish between its internal "memory" and the immediate "context" provided by the user.

Methodology

To investigate the nature of these outliers, the researchers analyzed several state-of-the-art LLMs, including Llama 3, Gemma 2, and Qwen 2.5. The study employed a four-pronged approach:

  1. Identification: Massive values were defined as elements with an L2 norm at least five times the average of their respective dimensions.
  2. Ablation Studies: The researchers developed a surgical disruption method to replace these massive values during the prefilling stage with zeros, mean values, or minimums to observe the functional impact.
  3. Architectural Comparison: The study compared models utilizing Rotary Positional Encoding (RoPE) against those using absolute positional embeddings (e.g., GPT-2, OPT) or hybrid architectures (e.g., Jamba).
  4. Quantization Analysis: The team evaluated how different quantization algorithms—specifically AWQ, SmoothQuant, and GPTQ—interact with these massive values and how their preservation affects reasoning performance.

The RoPE Connection

A primary discovery of this research is the "smoking gun" linking massive values to Rotary Positional Encoding (RoPE). The outliers concentrate almost exclusively in the low-frequency dimensions of the Q and K matrices. Because RoPE is applied to the Query and Key but not the Value (V) matrix, the V matrix remains relatively free of such outliers. This structural symmetry aligns perfectly with the mirrored patterns RoPE uses to pair dimensions for rotation, suggesting that the positional encoding mechanism itself is the catalyst for these numerical spikes.

Contextual vs. Parametric Knowledge

The most significant finding lies in the functional split between two types of knowledge:

  • Contextual Knowledge: This involves reasoning based on the immediate prompt, such as solving math problems (GSM8K) or following complex instructions. Massive values are the primary drivers of this capability. When disrupted, Llama3-8B’s accuracy on the GSM8K benchmark plummeted from 76.9% to 4.0%.
  • Parametric Knowledge: This refers to the factual data stored in the model's weights during pre-training. Interestingly, factual retrieval (e.g., identifying the capital of a country) proved highly resilient to the removal of massive values. For instance, Gemma2-9B only saw a minor dip in factual accuracy (99.7% to 76.4%) compared to its total collapse in reasoning tasks.

The Knowledge Conflict Paradox

This distinction was further highlighted in "knowledge conflict" tests, where models were given prompts containing false information (e.g., "New York is in the UK"). Standard models often prioritize the prompt's context over their internal facts. However, when massive values were removed, the models "forgot" the misleading context and reverted to their internal parametric knowledge, correctly identifying the facts. This suggests that massive values act as the "glue" that forces the model to pay attention to the user's specific input over its pre-trained biases.

Implications for Quantization

The study provides a theoretical explanation for why certain quantization methods succeed where others fail. Algorithms like AWQ and SmoothQuant are effective because they explicitly protect or redistribute these massive values. In contrast, methods like GPTQ, which do not prioritize these outliers, suffer significantly higher performance losses on reasoning-heavy tasks.

Conclusion

Massive values are not a flaw of LLM training but a fundamental feature of the attention mechanism in RoPE-based models. They serve as the essential infrastructure for contextual understanding and reasoning. While their presence makes hardware optimization difficult, they are the key to the "intelligence" that allows LLMs to follow instructions and solve complex problems. Future research may focus on developing new positional encodings that maintain this contextual anchoring without the numerical instability caused by extreme outliers.

Summary updated

BibTeX
@inproceedings{jin2025massive,
  author = {Mingyu Jin and Kai Mei and Wujiang Xu and Mingjie Sun and Ruixiang Tang and Mengnan Du and Zirui Liu and Yongfeng Zhang},
  title = {{Massive Values in Self-Attention Modules are the Key to Contextual Knowledge Understanding}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=1SMcxxQiSL},
}
Figure