Measuring Affinity between Attention-Head Weight Subspaces via the Projection Kernel
Hiroaki Yamagiwa, Yusuke Takase, Hidetoshi Shimodaira
TL;DR
Measuring subspace overlap between attention-head weight matrices using the Projection Kernel (PK), defined as $\text{PK}(\mathcal{S},\mathcal{S}')=\sum_{i=1}^m \cos^2\theta_i = \|\mathbf{U}^{\top}\mathbf{U}'\|_{\mathrm{F}}^2$, PK provides a rotation-invariant, principal-angle-based view of head relationships. The study shows PK better reproduces IOI-related head interactions than the Composition Score (CS) on GPT2-small, and introduces a framework to compare PK distributions against random baselines via KL divergence. It identifies L4H7 as an Identity Head acting as a hub and demonstrates how projecting the unembedding matrix onto head subspaces yields interpretable, token-level insights. Overall, PK offers a robust, input-agnostic lens on global head structure that complements input-dependent mechanistic interpretability analyses.
Abstract
Understanding relationships between attention heads is essential for interpreting the internal structure of Transformers, yet existing metrics do not capture this structure well. We focus on the subspaces spanned by attention-head weight matrices and quantify head-to-head relationships using the Projection Kernel (PK), a principal-angle-based measure of subspace similarity. Experiments show that PK reproduces known head-to-head interactions on the IOI task more clearly than prior metrics such as the Composition Score. We further introduce a framework to quantify the informativeness of PK distributions by comparing them with a reference distribution derived from random orthogonal subspaces. As an application, we analyze a directed graph constructed from PK and show that, in GPT2-small, L4H7 acts as a hub by functioning as an identity head.
