Quality over Quantity in Attention Layers: When Adding More Heads Hurts

Noah Amsel, Gilad Yehudai, Joan BrunaICLR 2025

In the design of Transformer architectures, the machine learning community has largely adhered to a specific set of "golden rules" for hyperparameters. One of the most persistent conventions is the relationship between the number of attention heads ($H$) and the attention rank ($r$). Standard practice dictates setting $H = d/r$, keeping the rank $r$ relatively small (typically 64 or 128) even as the embedding dimension $d$ scales into the thousands.

A recent paper from researchers at NYU and the Flatiron Institute challenges this status quo. The authors argue that the prevailing obsession with adding more heads at the expense of rank is a theoretical and empirical misstep that can severely cripple a model's performance on fundamental tasks.

The Problem with Standard Scaling

Since the introduction of the Transformer in 2017, models have scaled massively, yet the "attention rank"—the dimension of the query and key vectors—has remained strangely stagnant. For instance, in LLaMA, the embedding dimension is 8,192, but the rank is still just 128. This scaling convention is so entrenched that it is practically hard-coded into popular libraries like PyTorch and xFormers.

The authors ask a critical question: Is there a theoretical justification for this? Their findings suggest there is not. By artificially constraining the rank to accommodate more heads, practitioners may be severely limiting the "expressive power" of their models, specifically their capacity for high-dimensional geometric reasoning.

Theoretical Framework and Methods

The researchers approach this problem through the lens of approximation theory, focusing on a natural target function: Nearest Neighbor (NN) search. Given a query vector and a sequence of keys, the attention mechanism's goal is to identify and retrieve the key closest to the query.

Using tools from harmonic analysis on the sphere, the authors compare the representational capacity of a "full-rank" attention layer ($r=d$) against "low-rank" layers ($r \ll d$). They evaluate these theoretical findings using synthetic geometric datasets (points drawn uniformly from a unit sphere), an in-context linear regression benchmark, and a farthest-neighbor retrieval task.

Key Insights and Results

The core finding of the paper is a "rank separation" theorem: a target function that is easily represented by a single full-rank head requires an exponential number of low-rank heads—specifically $\Omega((d/r)^{1/\epsilon})$ heads of rank $r$—to approximate.

The Low-Rank Bottleneck

A single full-rank head can solve the nearest-neighbor problem perfectly. Conversely, a low-rank head can only "see" a small projection of the high-dimensional space. For certain functions, rank—not the total number of parameters—is the ultimate determining factor of an attention layer’s capability.

The "Standard Scaling" Trap

Because model tuning typically keeps the total parameter count constant, adding more heads ($H$) mathematically forces the rank ($r$) to decrease. This creates a detrimental tradeoff where "adding more heads" directly starves the individual heads of the dimensional rank they need to function effectively.

Mean Squared Error increases as the number of attention heads increases, demonstrating the negative impact of lowering rank to accommodate more heads.

In experiments reproducing in-context linear regression, the authors demonstrated that simply reducing the number of heads (thereby increasing the rank) while keeping total parameters constant led to significantly better accuracy. As shown in the data, increasing the number of heads consistently drives up the Mean Squared Error. Similar results were observed in farthest-neighbor tasks, where high-rank models consistently outperformed low-rank models across various network depths.

Depth vs. Rank

While adding more layers (depth) can help low-rank models approximate these functions through a "majority voting" mechanism across layers, this approach is highly inefficient. The authors conjecture that for long sequences, full-rank attention is strictly necessary, regardless of how deep the model is.

Limitations and Future Work

The primary limitation of this study is its reliance on synthetic, geometrically-driven tasks. While these tasks isolate the fundamental mechanics of attention, it remains an open question how perfectly these results translate to natural language processing, where data distributions are discrete and highly structured rather than uniform on a sphere.

However, the implications are clear: future "scaling laws" must look beyond merely scaling parameters and data. The community needs to rigorously investigate the optimal trade-offs between rank, heads, and depth. If the authors' conjectures hold for sequence length, full-rank attention may become a structural necessity for the next generation of truly long-context models.

Summary updated

BibTeX
@inproceedings{amsel2025quality,
  author = {Noah Amsel and Gilad Yehudai and Joan Bruna},
  title = {{Quality over Quantity in Attention Layers: When Adding More Heads Hurts}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=y9Xp9NozPR},
}
Figure