Systematic Outliers in Large Language Models

Yongqi An, Xu Zhao, Tao Yu, Ming Tang, Jinqiao Wang

Abstract

Outliers have been widely observed in Large Language Models (LLMs), significantly impacting model performance and posing challenges for model compression. Understanding the functionality and formation mechanisms of these outliers is critically important. Existing works, however, largely focus on reducing the impact of outliers from an algorithmic perspective, lacking an in-depth investigation into their causes and roles. In this work, we provide a detailed analysis of the formation process, underlying causes, and functions of outliers in LLMs. We define and categorize three types of outliers—activation outliers, weight outliers, and attention outliers—and analyze their distributions across different dimensions, uncovering inherent connections between their occurrences and their ultimate influence on the attention mechanism. Based on these observations, we hypothesize and explore the mechanisms by which these outliers arise and function, demonstrating through theoretical derivations and experiments that they emerge due to the self-attention mechanism's softmax operation. These outliers act as implicit context-aware scaling factors within the attention mechanism. As these outliers stem from systematic influences, we term them systematic outliers. Our study not only enhances the understanding of Transformer-based LLMs but also shows that structurally eliminating outliers can accelerate convergence and improve model compression. The code is available at https://github.com/an-yongqi/systematic-outliers.

Introduction

In the internal activations and weights of Large Language Models (LLMs) like LLaMA, a few values are often orders of magnitude larger than the rest. These "outliers" present a significant challenge for model compression. Specifically, they complicate quantization—the process of shrinking models to 8-bit or 4-bit precision—because the extreme range of values forces a loss of precision for the majority of "normal" values.

While previous research has focused on mitigating the damage caused by outliers, this paper investigates their deeper origins: Why do they form, what is their purpose, and can we design models that don't require them? The authors argue that these outliers are a "systematic" necessity forced upon the model by the inherent structure of Transformer attention.

Methodology

The researchers conducted a comprehensive analysis of various LLMs (including LLaMA2, Mistral, and Phi-2) to map the lifecycle of an outlier. Their approach involved:

  1. Categorization: Formally defining and tracking three types: Activation outliers (in layer outputs), Weight outliers (in projection matrices), and Attention outliers (in the attention scores).
  2. Lifecycle Tracking: Visualizing how weight outliers in the Multi-Layer Perceptron (MLP) blocks generate activation outliers, which subsequently propagate into the attention mechanism.
  3. Architectural Modification: Proposing an Explicit Context-Aware Scaling Factor ($S_c(x)$). Instead of forcing the model to "invent" outliers to manage information flow, they introduce a small, learnable parameter that dynamically scales attention weights based on the input.
Transformer layer architecture highlighting the MLP and MHA blocks where outliers propagate.

The study utilized 100 randomly selected samples from the RedPajama dataset for observation and WikiText2 to measure perplexity (PPL) during compression experiments.

The Systematic Nature of Outliers

A key finding is the "Softmax Sink" phenomenon. The softmax operation in self-attention forces attention scores to sum to 1. For "low-information" tokens (such as punctuation or start tokens) that do not require significant contextual updates, the model must "sink" its attention somewhere. To achieve a near-zero update state, the model creates massive logit differences to push attention toward specific keys, resulting in outliers.

Visualization of systematic outliers across activations, weights, and attention scores in LLaMA-2-7B.

These extreme values are not random; they act as implicit, context-aware scaling factors that help the model emphasize or suppress features. The paper demonstrates a 95-100% consistency in where these outliers appear across different dimensions, proving they are part of a unified "systematic" phenomenon. Furthermore, they concentrate on specific "weak semantic" tokens and fixed feature dimensions, protecting the rest of the model's representations.

Key Results

The introduction of explicit scaling factors yielded several significant benefits:

  • Elimination of Outliers: The proposed method completely removed systematic outliers in testbeds like GPT-2 and TinyLLaMA.
  • Enhanced Compressibility: Models with explicit scaling factors proved much more resilient to compression. For example, under 8-bit quantization, the modified GPT-2 achieved a perplexity (PPL) of 29.22, compared to 93.44 for the baseline. In a 50% pruning scenario, the baseline model failed completely (PPL > 7000), while the modified model remained stable at 39.47.
  • Faster Convergence: The new architecture reached lower loss levels earlier in the training process with negligible parameter overhead (less than 0.1%).

Conclusion and Future Work

This research identifies outliers as systematic artifacts of the Transformer architecture rather than random glitches. By replacing these implicit outliers with explicit, learnable scaling factors, models can be made significantly more robust for deployment on resource-constrained hardware. Future work includes validating these structural changes on larger models (70B+ parameters) and investigating whether similar phenomena occur in non-Transformer architectures like State Space Models.

Summary updated

BibTeX
@inproceedings{an2025systematic,
  author = {Yongqi An and Xu Zhao and Tao Yu and Ming Tang and Jinqiao Wang},
  title = {{Systematic Outliers in Large Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=rLX7Vyyzus},
}
Figure