arXiv:2611.12206cs.LGNov 2026

Manuscript Offprint

arXiv:2611.12206

A Geometric Invariant of Attention Predicts Head Specialization from Weights Alone

Miguel P. Bento

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

Abstract

Transformers are built with continuous symmetries in the attention mechanism. We derive ρ\rho, a scalar invariant that measures each head's capacity to couple to rotary positional encodings. This framework allows us to analyze heads without forward passes, opening a new research direction into data-independent analysis of modern LLMs. Empirically, we find that ρ\rho predicts induction heads, the most-studied circuit type in mechanistic interpretability, with Spearman correlation between −0.55-0.55 and −0.74-0.74 across four bias-free RoPE models spanning 135M to 7B parameters. As a preliminary proof of concept, we use ρ\rho to apply YaRN to only the top-50% positional heads, which degrades perplexity less than uniform application. Code is available at https://github.com/MPedraBento/rho-invariant.

Keywords: invariants, symmetry, attention heads, mechanistic interpretability, rotary position encoding

1. Introduction

Mechanistic interpretability is grounded in the meaning behind transformer head activations. Some approaches are activation patching (Conmy et al., 2023), probing classifiers, or behavioral diagnostics on crafted inputs (Olsson et al., 2022). Recent work connecting RoPE to heads relies heavily on data (Barbero et al., 2024). In this paper we ask: how much can we learn from the weights alone? Analogously to physics, where theories often have fewer observables than parameters, the attention mechanism admits basis-invariant quantities. These, in turn, characterize heads independently of the choice of basis.

The attention mechanism works by using quadratic forms in the query-key space GQK=WQ⊤WK∈Rd×dG_{QK} = W_Q^\top W_K \in \mathbb{R}^{d \times d} and the value-output space GVO=WOWV∈Rd×dG_{VO} = W_O W_V \in \mathbb{R}^{d \times d}. The static composite GQK(0)=WQ⊤WKG_{QK}(0) = W_Q^\top W_K is invariant under the full head-space reparameterization (WQ,WK)↦(M−⊤WQ,MWK)(W_Q, W_K) \mapsto (M^{-\top} W_Q, MW_K) for any M∈GL(dh)M \in GL(d_h). In RoPE-based models the rotation R(Δ)R(\Delta) is block-diagonal with one 2×22 \times 2 rotation per frequency plane, and requiring invariance of the whole family GQK(Δ)G_{QK}(\Delta) breaks GL(dh)GL(d_h) down to the group (C∗)dh/2≅(SO(2)×R>0)dh/2(\mathbb{C}^*)^{d_h/2} \cong (SO(2) \times \mathbb{R}_{>0})^{d_h/2}, such that within each plane a rotation RR and a positive rescaling DD act as WQ↦D−1RWQW_Q \mapsto D^{-1}R W_Q, WK↦DRWKW_K \mapsto DR W_K leaving GQK(Δ)G_{QK}(\Delta) unchanged. The form GQKG_{QK} is thus invariant under this residual symmetry, making it a basis-independent observable of the head's structure (Elhage et al., 2021).