A Conditional No-Hair Theorem for Transformers: How Language Models Forget Their Prompt
AuthorsShuyang Xiang
AffiliationsIndependent researcher
The paper finds that a transformer’s direct memory of its prompt fades as it generates text, while the text itself can carry that memory forward.
Key results
Prompt-offset decay exponent on real-corpus pairs at step 0.
Prompt-offset decay exponent after 143,000 training steps.
Relay suppression and faster forgetting appear within the first billion training tokens.
Qwen2.5-0.5B-Instruct generations fully in French.
Qwen2.5-0.5B-Instruct generations fully in French at boost strength 0.5.
What the paper found
A transformer can retain every prompt token in its context and still gradually lose the prompt’s influence. To measure that loss, the study compares hidden states for two different prompts followed by the same fixed continuation, isolating the prompt’s contribution. In Pythia and Qwen2.5, that prompt offset decays approximately as a power law. The paper proves a conditional no-hair theorem for finite-depth pre-LN transformers: with bounded attention logits and nonzero pre-norm activations, the offset is at most O(P(log t)^(L−1)/t). The mechanism is geometric dilution: as the context grows, attention to the fixed prompt shrinks, while continuation tokens relay its influence with at most logarithmic corrections. An exactly solvable uniform-attention model attains this bound. Training changes the decay by suppressing relay: in Pythia-160m’s last layer, the measured exponent α rises from 0.36 at initialization to 0.66 after training, and the onset appears within the first 1B training tokens—before attention sinks form. Adding a log-time attention bias to the prompt can slow or reverse forgetting, but tests with Qwen2.5-0.5B-Instruct show the trade-off: a boost raises fully French outputs from 31% to 94%, while a constant boost of equal mean strength performs similarly. The central distinction is that a prompt’s influence on the next token fades when the generated text is held fixed; properties such as language can persist because the prompt has already shaped the text itself.
Original abstract
We ask how much an autoregressive transformer retains of its prompt after generating $t$ tokens. Consider two different prompts followed by the same continuation text, so that any difference in their hidden states comes from the prompt alone, and we find that the distance between their hidden states decays approximately as a power law $t^{-α}$, where $α=1$ is the rate at which a fixed prompt's share of uniform attention shrinks and smaller values mean longer memory. Trained models forget fast ($α\approx0.55$--$0.7$), untrained ones slowly ($α\approx0.2$--$0.5$). We prove that this offset is $O\big(P(\log t)^{L-1}/t\big)$ for a prompt of length $P$ and depth $L$. The bound holds for finite-depth pre-LN softmax transformers with bounded attention logits, under one additional condition: the pre-norm activations stay away from zero. The mechanism is geometric: the prompt's direct influence is diluted as the context grows, and \emph{relay} --- continuation tokens passing on what earlier tokens read from the prompt --- can only add logarithmic factors. This is what we call the \emph{conditional no-hair theorem}: given the text generated so far, the prompt's influence on the next token vanishes as $t$ grows, so any property of the prompt that survives, such as its language, must be carried by the text itself. An exactly solvable linear relay model shows that the bound cannot be improved and reproduces the rise of the local exponent towards $1$ seen in untrained networks. Cancelling the dilution with a logit bias stops the decay early in training and reverses it after, so dilution is necessary for the forgetting we measure; untrained networks and the solvable model show it is also sufficient.
Read the original paperMore in Transformers
Browse all 48 papers →DAGFormer: Global Topology Prediction for Transformer Cross-Layer Connections
Xiaocong Yang, Yuren Hao, ChengXiang Zhai
DAGFormer lets a Transformer learn how information should flow across its layers, improving language-model performance across several evaluations.
Towards Looped Models Done Right, Part I: Topology, Input Injection, Recurrent-State Design
Benhao Huang, Chufan Shi, Junlin Chen, Shicheng Wen, Zhengzhong Liu, Eric Xing, Xuezhe Ma
The paper finds that a carefully designed looped Transformer can outperform comparable models while using far fewer resident parameters.
Decoding the Functional Roles of Register and High-Norm Patch Tokens in Vision Transformers
Neel Varma, Andrew Rufail, Dipika Khullar, Vasu Sharma
This study shows that ViT register tokens carry crucial high-level semantics, while high-norm patch tokens mainly encode lower-level visual structure and contribute little to overall representations.