When Can Attention Heads Be Statically Defined?

Weixian Waylon Li, Yintao Tai, Marcio Fonseca, Shay B. Cohen
9/28/2026
cs.LGcs.CL
transformer-attention

No confident code implementation found for this paper.

Abstract

Some attention heads learn similar patterns across inputs. Reusing these patterns could reduce training cost by avoiding repeated query-key score computation and softmax.

Show full abstract

Through controlled pretraining comparisons, we identify Selective Attention Freezing (SAF), which selects heads with low attention-pattern variance and replaces their attention weights with fitted post-softmax means halfway through training. We represent these fixed patterns with absolute-position and relative-distance preferences, reducing storage from quadratic to linear in sequence length. A fused kernel reconstructs the patterns and executes ordinary-attention and replaced heads together. At matched training-token budgets, replacing 25% of attention heads gives 1.056x faster post-replacement optimiser updates at 124M parameters and 4K context, with a 0.77% perplexity increase. At 1B and 8K context, post-replacement updates are 1.068x faster on four GPUs including communication, with a 0.51% perplexity increase. The resulting models also accelerate long-input finetuning and causal prefill. After associative-recall adaptation, the 124M model with 25% replacement generalises to more key-value pairs at a fixed length better than ordinary attention and two pruning controls.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{li2026when,
  title  = {When Can Attention Heads Be Statically Defined?},
  author = {Weixian Waylon Li and Yintao Tai and Marcio Fonseca and Shay B. Cohen},
  year   = {2026},
  eprint = {2609.34650},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2609.34650v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2609.34650.svg)](https://codeofpaper.com/paper/2609.34650)

Discussion