Manuscript Offprint

arXiv:2610.32213

Head Dimension Matters in Language Models for Long-Context Retrieval

Seiya Tokui, Shoichiro Yamaguchi, Sosuke Kobayashi

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Multi-head attention retrieves and combines context representations through query-key interactions and value aggregation, with head dimension constraining the per-head representation space. In long-context processing, it remains unclear whether allocating a fixed parameter budget to fewer, wider heads improves information retrieval. In this paper, we investigate how head dimension affects the performance of long-context retrieval tasks. Our empirical studies reveal that pretraining loss and short-context non-retrieval task performance are not affected much by head dimension, while long-context retrieval performance improves with wider heads at fixed model sizes. We find that models with wider heads have a higher proportion of retrieval heads, associating more parameters with retrieval. Our ablation studies also show that the retrieval performance improves with wider heads even when the projection weights in attention modules are frozen during long-context continual pretraining, suggesting that wider heads not only benefit updates in attention modules but lead to more effective adaptation of components such as embeddings and MLPs.

1 INTRODUCTION

Large language models (LLMs) are increasingly expected to process long texts including documents, multi-turn conversations, and code repositories, as well as longer reasoning traces used for test-time scaling (Muennighoff et al., 2025). Although modern LLM architectures support processing long inputs, a large supported context window does not necessarily imply effective use of information throughout the context (Hsieh et al., 2024; Liu et al., 2024). It is therefore increasingly important to explore improvements in architectures and training recipes for enhanced long-context capabilities.

The ability to retrieve task-relevant information from a large amount of context is a fundamental prerequisite for effective long-context processing (Hsieh et al., 2024; Yen et al., 2025; Qiu et al., 2025). Recent work suggests that successful retrieval is not uniformly implemented across a Transformer: a small subset of attention heads has been shown to play a central role in extracting relevant information from long inputs (Wu et al., 2025; Zhang et al., 2025).

These findings motivate a specific architectural question: under a fixed attention parameter budget, how does allocating capacity to fewer, wider heads affect long-context retrieval? In this work, we study the relationship between long-context retrieval capability and the head dimension of self attention modules. We train 0.6B and 3B parameter models from scratch through a simplified training pipeline consisting of pretraining (PT) and long-context continual pretraining (CPT) with web and code-centric data mixes, and additionally apply supervised fine-tuning (SFT) to 3B models to examine whether head dimension affects performance on short-context, non-retrieval tasks. Parameter-matched comparisons of models with identical architectures except for the balance between the number of heads and the head dimension reveal that wider heads lead to better performance on retrieval tasks.

To investigate the performance gap between models with different head dimensions, we first measured the retrieval scores of attention heads following Wu et al. (2025). We found that wider-head models have a higher proportion of retrieval heads, with comparable absolute retrieval-head counts despite fewer heads overall. This indicates that wider-head models associate more parameters with retrieval heads. Comparisons between pretrained checkpoints and their corresponding CPT checkpoints further suggest that much of this association is already established during pretraining.

We then repeated CPT with frozen projection weights in attention modules to examine how head dimension affects long-context adaptation. The improvement in retrieval performance after CPT is larger in models with wider heads even with frozen projections in attention, whereas updating all the projections provides similar additional improvements across head dimensions. Further analyses show that the sharpness of attention and changes in token-level attention rankings do not fully explain the performance gap. These results suggest that wider heads improve long-context retrieval by enabling more effective adaptation of the remaining trainable components, including embeddings and MLPs, rather than through greater plasticity of the attention modules themselves.

References (45)