Summary (Overview)
- Wider attention heads improve long-context retrieval: At fixed model sizes (0.6B and 3B parameters), models with larger head dimensions (d512) consistently outperform models with narrower heads (d128, d256) on the RULER long-context retrieval benchmark, with gains of up to 15 points at the 3B scale.
- Training loss is not a reliable predictor: Pretraining loss and short-context non-retrieval task performance are largely unaffected by head dimension, while long-context retrieval performance shows strong head-dimension dependence, confirming that token-averaged perplexity is a poor proxy for long-context capability.
- Wider heads associate more parameters with retrieval heads: Models with wider heads have a higher proportion of retrieval heads (with comparable absolute counts despite fewer total heads), indicating that more parameters are dedicated to retrieval functions.
- Head-dimension advantage persists with frozen attention projections: Even when attention weight matrices are frozen during long-context continual pretraining, wider-head models show larger retrieval gains, suggesting the benefit comes from adaptation of embeddings and MLPs rather than attention module plasticity.
- QK dimension matters more than V dimension: Asymmetric configurations show that larger query-key dimensions benefit retrieval more than larger value dimensions, indicating a QK bottleneck in information selection.
Introduction and Theoretical Foundation
The paper addresses a fundamental question in Transformer architecture design: how should a fixed attention parameter budget be allocated across heads? Multi-head attention (MHA) retrieves and combines context representations through query-key interactions and value aggregation, with head dimension constraining the per-head representation space.
The theoretical foundation builds on several key observations:
-
Retrieval is not uniformly distributed across heads: Prior work (Wu et al., 2025; Zhang et al., 2025) shows that a small subset of attention heads plays a central role in extracting relevant information from long inputs.
-
Head dimension as capacity constraint: Bhojanapalli et al. (2020) demonstrated that low-dimensional query-key parameterizations can restrict attainable attention distributions, motivating head dimension as a capacity constraint rather than merely an implementation choice.
-
Fixed-budget allocation problem: For a fixed model dimension , attention parameters scale as and dense attention computation as . When is fixed, changing head count and dimension leaves parameter count, computation, and KV-cache size essentially unchanged—only the allocation across heads changes.
The multi-head attention mechanism is formalized as:
where is the head dimension, , , , , and represents the causal or sliding window mask.
Methodology
Model Architecture
The authors train decoder-only Transformers from scratch through a three-stage pipeline:
- Pretraining (PT): 100B tokens at 4,096 sequence length
- Continual Pretraining (CPT): 8B tokens at 262,144 sequence length
- Supervised Fine-tuning (SFT): 1B tokens (3B models only)
Models use sliding window attention (SWA) with window size 512 and full attention layers interleaved in 3:1 ratio, with RoPE applied to SWA heads and 64-dimensional partial RoPE to full attention heads.
Experimental Configurations
Table 1: Architecture configurations (query/key dimensions and head counts for full-attention layers)
| Model Name | Params | Q/K Dim. | V Dim. | #Q Heads | #KV Heads |
|---|---|---|---|---|---|
| 0.6B-d128 | 0.6B | 128 | 128 | 16 | 4 |
| 0.6B-d256 | 0.6B | 256 | 256 | 8 | 2 |
| 0.6B-d512 | 0.6B | 512 | 512 | 4 | 1 |
| 0.6B-k512-v128 | 0.6B | 512 | 128 | 8 | 2 |
| 0.6B-k128-v512 | 0.6B | 128 | 512 | 8 | 2 |
| 3B-d128 | 3B | 128 | 128 | 32 | 8 |
| 3B-d256 | 3B | 256 | 256 | 16 | 4 |
| 3B-d512 | 3B | 512 | 512 | 8 | 2 |
Evaluation
- RULER-100: 13 tasks (8 needle-retrieval variants, variable tracking, common-word extraction, frequent-word extraction, 2 QA tasks) across 7 context lengths from 4K to 256K
- Short-context tasks: ARC, HellaSwag, WinoGrande, RACE, PIQA, OpenBookQA, CommonsenseQA
- Retrieval head identification: Single-needle tasks with retrieval score threshold (following Wu et al., 2025)
Empirical Validation / Results
Main Performance Results
Table 2: RULER-100 overall scores (0–100 scale, averaged over 13 tasks and 7 lengths)
| Model size | Stage | d128 | d256 | d512 | k512-v128 | k128-v512 |
|---|---|---|---|---|---|---|
| 0.6B | CPT | 31.25 ± 7.75 | 35.46 ± 3.60 | 41.21 ± 5.86 | 37.78 ± 4.15 | 31.28 ± 2.61 |
| 3B | CPT | 35.93 | 36.72 | 50.93 | - | - |
| 3B | SFT | 48.28 | 51.81 | 58.49 | - | - |
Key findings:
- d512 wins at every context length in all settings
- At 0.6B: d512 exceeds d128 by 9.96 points and d256 by 5.75 points
- At 3B: d512 exceeds d128 by 15.00 points and d256 by 14.21 points
- QK dimension is the bottleneck: k512-v128 (37.78) outperforms d256 (35.46), while k128-v512 (31.28) shows no gain over d128 (31.25)
Short-Context Performance
Table 3: Short-context tasks for 3B models after SFT
| Head Size | ARC-C | ARC-E | HS | WG | RACE | PIQA | OBQA | CSQA | Avg |
|---|---|---|---|---|---|---|---|---|---|
| d128 | 35.6 | 62.3 | 58.2 | 57.4 | 36.2 | 73.0 | 36.6 | 38.1 | 49.7 |
| d256 | 35.8 | 61.0 | 58.1 | 59.4 | 35.0 | 73.3 | 37.4 | 28.9 | 48.6 |
| d512 | 33.9 | 64.0 | 58.7 | 57.9 | 37.4 | 73.7 | 39.0 | 39.6 | 50.5 |
No trade-off exists between long-context retrieval and short-context performance; d512 performs best on average.
Retrieval Head Analysis
Table 4: Retrieval-head counts before and after CPT (0.6B models)
| Model | PT (attention scaling) | CPT | Shared |
|---|---|---|---|
| 0.6B-d128 | 4.00 | 7.00 | 4.00 |
| 0.6B-d256 | 8.33 | 8.33 | 8.00 |
| 0.6B-d512 | 5.00 | 6.33 | 5.00 |
- Wider-head models have higher retrieval-head fractions (e.g., d512: ~25% vs. d128: ~7.3% after CPT)
- Absolute retrieval-head counts are comparable despite fewer total heads
- Much of the retrieval-head structure is already established during pretraining
Frozen Projection Experiments
With attention weight matrices frozen during CPT:
| Configuration | Frozen CPT gain over PT | Full CPT additional gain |
|---|---|---|
| d128 | -0.01 | +2.19 |
| d256 | +3.97 | +1.85 |
| d512 | +7.35 | +2.32 |
The head-dimension dependence persists without projection updates, while the incremental benefit of updating projections is similar across configurations.
Attention Map Diagnostics
- Attention entropy: Lower after CPT for all configurations, but d256 and d512 have similar entropy despite performance gaps—concentration alone doesn't explain the head-dimension effect
- Token reordering: Greater under Full CPT than Frozen CPT, but differences across head dimensions are small and don't consistently track retrieval performance
- Residual-stream effective rank: Wider-head models show higher effective ranks in intermediate blocks (layers 7–19), visible already in scaled PT and persisting under Frozen CPT
Theoretical and Practical Implications
-
Architecture design guidance: For long-context applications, allocating attention capacity to fewer, wider heads is beneficial at fixed parameter budgets. This contrasts with common practice where head count scales with model size while head dimension stays fixed.
-
Mechanistic understanding: The benefit of wider heads appears to operate through two channels:
- Parameter association: Wider heads naturally associate more parameters with retrieval functions
- Component adaptation: The advantage persists even when attention projections are frozen, implicating embeddings and MLPs in the retrieval improvement
-
Evaluation methodology: Training loss is insufficient for evaluating long-context capabilities; retrieval-specific benchmarks like RULER are necessary.
-
Practical constraints: The study is limited to head dimensions ≤ 512; further increases require efficient attention computation improvements (e.g., FlashAttention-style kernels).
Conclusion
This paper demonstrates that head dimension is a critical architectural choice for long-context retrieval capability in language models. The key takeaways are:
- Wider heads consistently improve long-context retrieval at fixed model sizes, with no trade-off in short-context performance
- QK dimension is the primary bottleneck for retrieval, more so than V dimension
- The benefit emerges from broader parameter association with retrieval functions and more effective adaptation of non-attention components during continual pretraining
- Standard training loss metrics fail to capture this architectural effect
Future work should explore:
- Head dimensions beyond 512 (requiring efficient attention computation)
- Whether these findings generalize to other model families and training recipes
- Deeper mechanistic understanding of how head dimension interacts with embeddings and MLP adaptation during long-context training
Related papers
- Not All Thinking is Created Equal: Latent Reasoning Discovers a Recurrent Search Algorithm for Depth Generalization
Latent reasoning models discover a generalizable recurrent forward-search algorithm, while token-based methods like CoT rely on local shortcuts that fail out-of-distribution.
- Delivered, Not Used: Evaluating Agent Memory at Its Point of Use
MemUse reveals that LLM memory systems deliver mostly irrelevant or unused content, with task outcomes hiding beneficial use in failures and harmful use in successes.
- Evolving in Thought Space: Training a Small Model at Test Time Unlocks Better Discoveries (Guidance-TTT)
Guidance-TTT decouples strategic adaptation from solution generation via a small trained guidance model, achieving state-of-the-art results across four scientific discovery domains at 58% lower cost.