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

Differential Transformer

Tianzhu Ye, Li Dong, Yuqing Xia, Yutao Sun, Yi Zhu, Gao Huang, Furu Wei

Introduction

The Differential Transformer (DIFF Transformer) introduces a novel attention mechanism that subtracts two separate softmax attention maps to cancel out "attention noise." This simple yet profound architectural change allows models to focus more sharply on relevant information, resulting in superior scaling, better long-context retrieval, and significantly improved robustness to hallucinations and quantization.

The Distraction Problem: Attention Noise

Despite their dominance, standard Transformers suffer from a fundamental distraction problem: the softmax attention mechanism tends to over-allocate attention to irrelevant parts of the input sequence. The authors identify this as attention noise.

Comparison of attention scores and retrieval accuracy between standard Transformer and Differential Transformer.

This noise is the root cause of several persistent issues in Large Language Models (LLMs):

  • The "Lost in the Middle" Phenomenon: Models struggle to retrieve key information when it's buried in long contexts because attention is diluted across irrelevant tokens.
  • Hallucinations: Models often generate incorrect facts after being distracted by extraneous context.
  • In-Context Learning (ICL) Fragility: A model's performance can change drastically simply by reordering the examples in the prompt.
  • Activation Outliers: Large spikes in internal activations make it difficult to quantize models (e.g., compressing them to 4-bit or 8-bit) without losing accuracy.

The Solution: Differential Attention

The core innovation of the paper is the Differential Attention mechanism. Inspired by differential amplifiers and noise-canceling headphones in electrical engineering—which subtract two signals to eliminate "common-mode" noise—the authors apply the same logic to the attention mechanism.

Architecture and pseudo-code for the Differential Attention mechanism.

Instead of a single softmax operation, the DIFF Transformer:

  1. Splits the query and key vectors into two groups ($Q_1, K_1$ and $Q_2, K_2$).
  2. Calculates two separate softmax attention maps.
  3. Subtracts the second map from the first, controlled by a learnable scalar $\lambda$: $$DiffAttn(X) = \left(\text{softmax}\left(\frac{Q_1 K_1^T}{\sqrt{d}}\right) - \lambda \cdot \text{softmax}\left(\frac{Q_2 K_2^T}{\sqrt{d}}\right)\right)V$$

By subtracting the two maps, the model effectively "nulls out" the background noise present in both, leaving behind a sparser, higher-signal attention pattern. The authors also introduce Headwise Normalization (using GroupNorm) to ensure that different attention heads remain stable despite their sparser activation patterns.

Key Findings and Performance

The researchers conducted a massive evaluation, pre-training 3B-size models on a 1-trillion token corpus and testing across downstream benchmarks, long-context retrieval, and mathematical reasoning.

  • Efficiency through Denoising: The DIFF Transformer is remarkably efficient. Scaling curves indicate it requires only about 65% of the parameters or training tokens to match the performance of a standard Transformer. For instance, a 6.8B DIFF Transformer performs similarly to an 11B standard Transformer.
  • Massive Retrieval Power: Visualizations confirm that while standard Transformers assign high scores to irrelevant context, the DIFF Transformer assigns significantly higher scores to actual answer spans. In multi-needle retrieval tasks, the DIFF Transformer achieved 85% accuracy compared to the standard Transformer's 55%, and showed a 76% accuracy improvement when information was located at specific depths (e.g., 25% depth) in a 64K context.
  • Robust In-Context Learning: While standard Transformers see wild swings in accuracy based on the order of prompt examples, the DIFF Transformer's performance remains stable, effectively solving a chronic robustness issue in prompt engineering.
  • Quantization-Friendly: Because the DIFF Transformer naturally suppresses extreme activation outliers, it is highly amenable to low-bit quantization. A 4-bit DIFF Transformer can actually outperform a 6-bit standard Transformer.
  • Reduced Hallucinations & Better Math: Across multiple QA and summarization datasets, the DIFF Transformer consistently reduced hallucinations. Furthermore, after distilling reasoning capabilities (o1-style), it outperformed the standard Transformer on 8 math benchmarks with an average accuracy gain of 7.5%.

Limitations and Future Directions

While the authors developed a customized FlashAttention kernel to keep the computational overhead minimal (within 5-10% of standard Transformers), the differential mechanism inherently requires more memory and compute than a single softmax. Future work will likely focus on even more efficient kernels.

Additionally, because the DIFF Transformer produces much sparser attention patterns, there is a massive opportunity to develop new methods for compressing the Key-Value (KV) cache—a major bottleneck for long-context serving. Finally, while tested up to 13B parameters, it remains to be seen if these noise-canceling advantages hold at the 100B+ parameter scale used by frontier models.

Summary updated

BibTeX
@inproceedings{ye2025differential,
  author = {Tianzhu Ye and Li Dong and Yuqing Xia and Yutao Sun and Yi Zhu and Gao Huang and Furu Wei},
  title = {{Differential Transformer}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
}
Figure