Paper commentary
Revealing Long-context Potential of Attention Heads via Frequency Kernels
Static attention head weights reveal long-context heads without running long inputs
- Problem Finding the attention heads that handle long contexts means running long prompts through the model and reading attention or ablation effects. That costs a lot of compute and memory, and the heads found depend on the task used.
- Method LPS ranks each head by how its static query and key weights spread energy over RoPE frequencies, favouring low frequencies. It needs no inference, so the ranking uses only the stored parameters.
- Results Masking the top 20 LPS heads cut Llama-3.1-8B-Instruct's 128K RULER score to 7.93, compared with 74.70 for 20 random heads and 75.81 unmasked.
Why finding long-context heads is expensive
Only a small set of attention heads does most of the work when an LLM reads a long context. Existing detection methods run the model on long inputs and read off attention patterns or ablation effects, often on Needle-in-a-Haystack prompts. That costs a lot of compute and memory, and the heads found this way tend to depend on the task used.
The authors ask whether the same heads can be picked from the stored parameters alone.
Most head-level studies, including the retrieval head work of Wu et al. (2025), probe behaviour during inference and leave the head parameters aside. Kernel analyses come closest, but Chiang and Yogatama look at RoPE kernels without analysing whole heads. Xiong et al. suppress noise in the low-frequency RoPE components, whereas the authors want to use those components.
Splitting a head into frequency kernels
The key idea is to cut each head's query and key weights into RoPE frequency pairs, so every pair gives its own kernel that depends only on relative distance. For pair f, the query block q_f and key block k_f give the kernel \(K_f(n)=q_f^\top R_f(n)\,k_f\), where R_f(n) is a 2 by 2 rotation. The rotation angle is θ_f(n)=ω_f n with ω_f = base^(−f/d), so a larger index f means a lower frequency and a slower change with n.
Summing the frequency kernels gives the head kernel K(n), which carries the head's whole static relation between distance and attention.
The authors argue that low-frequency pairs are less sensitive to relative position, so they can keep carrying signal from far away. The scoring that follows asks where a head's energy sits along this frequency axis.
Scoring heads with LPS
Each frequency kernel gets an energy share, \(p_f=\|K_f(n)\|_F^2/\sum_i\|K_i(n)\|_F^2\), so the shares add up to one. Effective rank is the exponential of the Shannon entropy of these shares, so a head whose energy sits in a few frequencies gets a low value. The rank score \(s_{\mathrm{eRank}}=1-\mathrm{eRank}(K(n))/d\) rewards low effective rank.
The distribution score is \(s_{\mathrm{dist}}=\sum_f f\,p_f/d\), a weighted average of the frequency index, so energy at low frequencies raises it. LPS joins the two as \(s_{\mathrm{LPS}}=s_{\mathrm{dist}}^{\alpha}\,s_{\mathrm{eRank}}^{1-\alpha}\), with α = 0.4 in the authors' practice. Scoring uses one large distance, n = −32768, because the authors found the energy shares hardly change with the rotation angle.
In layer 14 of Llama-3.2-3B-Instruct, L14H22 has an effective rank of 29.75, which marks it as a concentrated head.
Separating induction heads with the symmetry score
Modifying induction heads did not improve long-context performance in the authors' tests, so the top LPS list needed cleaning. An induction head should respond most when query and key carry the same token, which points to a kernel close to symmetric.
They compute \(s_{\mathrm{RPS}}=s_{\mathrm{LPS}}-\beta\,s_{\mathrm{sym}}\), which subtracts a scaled symmetry term from LPS. Like LPS, RPS needs no model inference.
Masking top heads hurts long-context results
The test zeroes each chosen head's contribution to the residual stream, then runs long-context tasks on the modified model. Llama-3.1-8B-Instruct dropped to 7.93 with 20 top LPS heads, compared to 74.70 for 20 random heads and 75.81 unmasked.
To check that the effect is tied to long inputs, the authors also scored MMLU, HellaSwag, ARC-Challenge, OpenBookQA and GSM8K. Most of these general scores stayed close to baseline, but GSM8K on Llama-3.2-3B-Instruct dropped from 76.95 to 69.83. The authors tie that drop to the chain-of-thought reasoning GSM8K needs, which fits the findings of Wu et al.
The result shows these heads matter on these tasks and three models, not that they are the only heads involved.
Overlap with retrieval-score heads
Wu et al.'s retrieval score is computed from inference, so the authors treat its heads as the reference. Among the top 10% of heads by RPS, 38 heads overlap for Llama-3.2-3B-Instruct, a 58.2% overlap, and 57 heads overlap for Qwen3-4B, at 49.6%. The authors say this overlap is much higher than random selection would give.
The overlap is therefore about half, so the static method agrees with inference-based retrieval heads only in part. Some retrieval heads don't rank high on RPS, yet still show the expected kernel pattern, so the ranking shouldn't be read too literally.
What retrieval and induction heads do in NIAH
In a 32K NIAH prompt, both L14H2 and L8H8 give high attention to the needle for a relevant query. L8H8 focuses on a token matching the current input rather than on the next word to predict. When the needle is absent, L14H2 spreads its attention and puts more weight on the BOS token, while L8H8 keeps matching identical tokens.
The authors then average L8H8's attention distribution, which removes its match-to-identical-token behaviour. The attention of L14H2 to the needle drops sharply, which the authors read as induction heads helping retrieval heads find needle tokens. This rests on one prompt and one head pair, so it is a worked example rather than a general rule.
Which frequency bands carry the needle attention
Breaking the attention of four top retrieval heads into frequency contributions at n = −32k shows the high-frequency bands near zero. In the low-frequency bands where energy is concentrated, contributions to the needle become generally positive, which lifts the head's attention to the needle. The useful band is low but not the lowest, which the authors summarise as low frequency contributes more.
The very last components, indices 48-63 in their example, oscillate on the needle. Their response to the needle then looks like their response to random tokens, as the gray lines in Figure 5b show. Those extremely low frequencies give stable positive contributions to the BOS token, so the authors call them a BOS extractor. This matches the view that low RoPE frequencies help produce attention sinks, as Gu et al.
and Xiong et al. argue.
Amplifying low-frequency kernels
The enhancement multiplies the query block q_f and key block k_f of a chosen head by an amplification factor c_f, so the kernel becomes \(c_fK_f\). Its energy grows by c_f squared, which raises the share of low-frequency kernels and lowers the high-frequency share. The factor schedule follows each model's energy distribution, so in Llama-3.2-3B-Instruct it boosts low frequencies and leaves the very low oscillating ones alone.
The edit changes stored parameters once and runs no training or long-input inference. The authors amplified 10 top RPS heads in Llama-3.2-3B-Instruct, about 1.5% of its heads, 20 in Llama-3.1-8B-Instruct, about 2%, and 20 in Qwen3-4B, about 1.7%. Qwen3-4B's retrieval heads hold non-negligible energy in the high-frequency band, so the Llama schedule doesn't transfer directly.
Amplification results
On NIAH, the authors report better retrieval at 64K and 128K distances after amplification, as Figure 7 shows.
Amplifying 10 random heads in Llama-3.2-3B-Instruct gave 64.38 at 128K, so the random control also fell. The authors say RULER improves in most cases, and the table shows the gain is not uniform across models and lengths. Only about 1.5% to 2% of heads changed, so the authors take these results as evidence for the role of low-frequency energy in retrieval.
Limitations
The scoring distance n = −32768 is fixed, because the authors found the energy shares barely change with the rotation angle. α = 0.4 and β = 0.5 are the values used in the authors' practice, and only those values are reported. The main verification uses three instruct models: Llama-3.2-3B-Instruct, Llama-3.1-8B-Instruct and no-thinking Qwen3-4B.
The amplification schedule is tailored per model, and Qwen3-4B needs a different shape. The head-level case studies rest on one NIAH prompt and one layer-14 pair.
The overlap with inference-based retrieval heads is about half, so the two methods agree only in part. Amplification gains on RULER are mixed, and the random-head control also moved the scores. No model outside these three was tested, so transfer to other model families is open.
Paper info
- Authors
- Senyu Han, Yilu Cao, Kai Yu, Lu Chen
- Venue
- International Conference on Machine Learning · Published
- First published
- 2026-9-29
- Added
- 2026-11-27
- Original paper terms
- Check in the original ↗
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Senyu Han, Yilu Cao, Kai Yu, Lu Chen (2026). Revealing Long-context Potential of Attention Heads via Frequency Kernels. International Conference on Machine Learning. https://proceedings.mlr.press/v306/han26e.html
BibTeX
@article{han2026revealing,
title = {{Revealing Long-context Potential of Attention Heads via Frequency Kernels}},
author = {Senyu Han and Yilu Cao and Kai Yu and Lu Chen},
year = {2026},
journal = {International Conference on Machine Learning},
url = {https://proceedings.mlr.press/v306/han26e.html}
}