Decomposing Attention To Find Context-Sensitive Neurons
Alex Gibson
TL;DR
The paper investigates how transformer attention encodes high-level contextual properties by decomposing first-layer attention into position-based and content-dependent components. It shows that, under a fixed token distribution, softmax denominators of certain heads are stable, enabling a calibration-text–based contextual circuit that linearly summarizes surrounding text for downstream readout. This circuit allows systematic discovery of context-sensitive neurons from model weights, demonstrated by a Commonwealth vs American English neuron, with strong alignment (median $r \approx 0.95$, $FVU \approx 0.14$) between approximate and true contributions. The approach provides a mechanistic, calibration-text–driven pathway to interpretability in transformers and suggests generalizable methods for deeper layers and varied positional schemes.
Abstract
We study transformer language models, analyzing attention heads whose attention patterns are spread out, and whose attention scores depend weakly on content. We argue that the softmax denominators of these heads are stable when the underlying token distribution is fixed. By sampling softmax denominators from a "calibration text", we can combine together the outputs of multiple such stable heads in the first layer of GPT2-Small, approximating their combined output by a linear summary of the surrounding text. This approximation enables a procedure where from the weights alone - and a single calibration text - we can uncover hundreds of first layer neurons that respond to high-level contextual properties of the surrounding text, including neurons that didn't activate on the calibration text.
