Spontaneous Context Restoration: How Language Models Recover from Corrupted Inputs
On the map: Mechanistic interpretability → Knowledge and representations inside LLMs also fits: Probing deception, bias and beliefs
Abstract (arXiv)
Language models sometimes produce correct outputs even when their inputs are corrupted by deletion, replacement, or misspelling. We study the internal processes accompanying this behavior, which we call context restoration, in controlled attention-only transformers and five pretrained LLMs (1B-32B parameters) across arithmetic, reading comprehension, and multiple-choice reasoning tasks. In the attention-only transformers, restoration emerges spontaneously despite training exclusively on clean sequences, without corruption training or an explicit denoising objective. We find that context restoration follows a two-phase process: early layers localize effects associated with repair at corrupted positions, while later layers accumulate these effects at uncorrupted positions through the residual stream and ultimately concentrate them at the output position. Repair outcome is predictable from hidden states: cosine alignment with the clean state is highly predictive in attention-only models, while linear probes recover additional information in pretrained LLMs. A linear probe using only the corrupted prompt's first-block hidden state predicts failure with mean ROC-AUC 0.78. This enables failure triage under matched or even partially shifted deployment conditions and may reduce unnecessary verification or computation. Failed examples also show substantially greater nonlinearity along corruption directions. Moderate-corruption finetuning increases corruption tolerance while simultaneously reducing displacement-normalized linearization error, associating improved robustness with a more nearly linear response to corruption.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Placed in Knowledge and representations inside LLMs, one of 13 directions in Mechanistic interpretability. Builds on 27 of its 37 references that are in the map. First posted on arXiv 28 Sep 2026.
Builds on
27 of 37 references.
Closest ancestors · 1
Same direction, newest first
Other references · 26
- 2018Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challengecited by 4,886
- 2016SQuAD: 100,000+ Questions for Machine Comprehension of Textcited by 4,148
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,455
- 2022Locating and Editing Factual Associations in GPTcited by 2,691
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,434
- 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,165
- 2019Right for the Wrong Reasons: Diagnosing Syntactic Heuristics in Natural Language Inferencecited by 876
- 2023The Geometry of Truth: Emergent Linear Structure in Large Language Model Representations of True/False Datasetscited by 712
- 2024How to use and interpret activation patchingcited by 214
- 2024Not All Language Model Features Are One-Dimensionally Linearcited by 212
- 2023Localizing Model Behavior with Path Patchingcited by 195
- 2020How Context Affects Language Models' Factual Predictionscited by 181
14 more
- 2023The Hydra Effect: Emergent Self-repair in Language Model Computationscited by 156
- 2024Robust Prompt Optimization for Defending Language Models Against Jailbreaking Attackscited by 156
- 2024The Remarkable Robustness of LLMs: Stages of Inference?cited by 146
- 2021Measure and Improve Robustness in NLP Models: A Surveycited by 107
- 2022DisentQA: Disentangling Parametric and Contextual Knowledge with Counterfactual Question Answeringcited by 96
- 2024Transformers represent belief state geometry in their residual streamcited by 77
- 2024Interpreting and Improving Large Language Models in Arithmetic Calculationcited by 45
- 2024Can Language Models Perform Robust Reasoning in Chain-of-thought Prompting with Noisy Rationales?cited by 41
- 2024Competition of Mechanisms: Tracing How Language Models Handle Facts and Counterfactualscited by 40
- 2024Explorations of Self-Repair in Language Modelscited by 39
- 2024Interpreting Arithmetic Mechanism in Large Language Models through Comparative Neuron Analysiscited by 31
- 2024Robustness of Large Language Models to Perturbations in Textcited by 11
- 2023Evaluating Concurrent Robustness of Language Models Across Diverse Challenge Setscited by 6
- 2026Improving the Robustness of Large Language Models for Code Tasks via Fine-tuning with Perturbed Datacited by 1
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2026Lexical Perturbations Disrupt LLM Reasoning: An Empirical Study of Attention Diversion
- 2024A Theoretical Understanding of Self-Correction through In-context Alignment
- 2026Cortex: Consolidating Context into Parametric Memory
- 2026When Does Context Help? Error Dynamics of Contextual Information in Large Language Models
- 2026Word Recovery in Large Language Models Enables Character-Level Tokenization Robustness
- 2026Understanding Contextual Recall in Transformers: How Finetuning Enables In-Context Reasoning over Pretraining Knowledge
- 2025Masks Can Be Distracting: On Context Comprehension in Diffusion Language Models
- 2026FOCUS & RePAIR: Mitigating Text Degeneration via Token-Level Guidance for Pruned Large Language Models