Can subtracting attention maps remove noise from context?
Standard softmax attention spreads probability across all tokens, creating a noise floor even on irrelevant ones. Could computing attention as the difference between two softmax maps cancel this shared noise and sharpen focus on relevant tokens?
The standard Transformer over-allocates attention to irrelevant context. Visualized on a needle-in-a-haystack retrieval task, only a small fraction of the attention mass lands on the correct answer while the bulk is smeared across distractors. This is not a training defect so much as a structural property of softmax: because the weights must be non-negative and sum to one, every token gets some mass, and across a long context that residual noise floor accumulates into real distraction.
DIFF Transformer's fix is elegant because it is mechanical rather than learned. It computes attention as the difference between two separate softmax attention maps. Each map carries the same underlying noise; subtracting them cancels the common-mode noise while preserving the differential signal — exactly the common-mode-rejection principle behind differential amplifiers and noise-cancelling headphones. What survives is a sparse attention pattern focused on relevant tokens. Crucially it stays FlashAttention-compatible, so the fix costs no efficiency. This is a distinct solution to a problem the vault has already diagnosed: since Does transformer attention architecture inherently favor repeated content?, the over-attention that produces sycophancy and lost-in-the-middle behavior is architectural — and where that note treats it as a bias to work around, DIFF Transformer removes it at the mechanism. It converges with What mechanism enables models to retrieve from long context?: both point to sparse attention as the substrate of reliable retrieval, one by discovering the heads that already do it, the other by engineering the whole layer toward it.
Inquiring lines that read this note 2
This note is a source for these research framings, grouped by the broader line of inquiry each explores. Scan the bold lines of inquiry; follow any specific question forward.
What structural biases does transformer attention create in language model outputs? How do transformer attention mechanisms implement memory and algorithmic functions?Related concepts in this collection 2
This note in its neighbourhood — explore the map, then jump to a related concept in the list below.
Click a node to walk · click center to open · click Open in graph to see this note in the full knowledge graph
-
Does transformer attention architecture inherently favor repeated content?
Explores whether soft attention's tendency to over-weight repeated and prominent tokens explains sycophancy independent of training. Questions whether architectural bias precedes and enables RLHF effects.
the architectural over-attention problem DIFF Transformer cancels rather than works around
-
What mechanism enables models to retrieve from long context?
Do attention heads specialize in retrieving relevant information from long context windows, and if so, what makes them universal across models and necessary for factual generation?
converges on sparse attention as the substrate of reliable retrieval
Related papers in this collection 8
Papers most semantically related to this note, ranked by cosine similarity in the embedding space.
- Differential Transformer
- Multi-Token Attention
- TransformerFAM: Feedback attention is working memory
- System 2 Attention (is something you might need too)
- Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention
- Reasoning Circuits in Language Models: A Mechanistic Interpretation of Syllogistic Inference
- The Sparse Frontier: Sparse Attention Trade-offs in Transformer LLMs
- Energy-Based Transformers are Scalable Learners and Thinkers
Original note title
differential attention subtracts two softmax maps to cancel attention noise — the same common-mode-rejection trick that noise-cancelling headphones use applied to context