mlsanityData to 7 Oct 2026

Llama See, Llama Do: A Mechanistic Perspective on Contextual Entrainment and Distraction in LLMs

arXiv 2505.09338 ↗First posted 14 May 2025cs.CLcited by 6

Not on the map. Why?

Abstract (arXiv)

We observe a novel phenomenon, contextual entrainment, across a wide range of language models (LMs) and prompt settings, providing a new mechanistic perspective on how LMs become distracted by ``irrelevant'' contextual information in the input prompt. Specifically, LMs assign significantly higher logits (or probabilities) to any tokens that have previously appeared in the context prompt, even for random tokens. This suggests that contextual entrainment is a mechanistic phenomenon, occurring independently of the relevance or semantic relation of the tokens to the question or the rest of the sentence. We find statistically significant evidence that the magnitude of contextual entrainment is influenced by semantic factors. Counterfactual prompts have a greater effect compared to factual ones, suggesting that while contextual entrainment is a mechanistic phenomenon, it is modulated by semantic factors. We hypothesise that there is a circuit of attention heads -- the entrainment heads -- that corresponds to the contextual entrainment phenomenon. Using a novel entrainment head discovery method based on differentiable masking, we identify these heads across various settings. When we ``turn off'' these heads, i.e., set their outputs to zero, the effect of contextual entrainment is significantly attenuated, causing the model to generate output that capitulates to what it would produce if no distracting context were provided. Our discovery of contextual entrainment, along with our investigation into LM distraction via the entrainment heads, marks a key step towards the mechanistic analysis and mitigation of the distraction problem.

Key facts. Cited by 6 papers in the map (data through 7 Oct 2026). Builds on 20 of its 33 references that are in the map. First posted on arXiv 14 May 2025.

Builds on

20 of 33 references.

References · 20

  1. 2020Language Models are Few-Shot Learnerscited by 32,199
  2. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
  3. 2022Locating and Editing Factual Associations in GPTcited by 2,609
  4. 2013Estimating or Propagating Gradients Through Stochastic Neurons for Conditional Computationcited by 2,031
  5. 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,130
  6. 2022In-context Learning and Induction Headscited by 930
  7. 2023Large Language Models Can Be Easily Distracted by Irrelevant Contextcited by 820
  8. 2023The Reversal Curse: LLMs trained on "A is B" fail to learn "B is A"cited by 399
  9. 2023Making Retrieval-Augmented Language Models Robust to Irrelevant Contextcited by 364
  10. 2021Measuring and Improving Consistency in Pretrained Language Modelscited by 361
  11. 2024Measuring short-form factuality in large language modelscited by 345
  12. 2024The Power of Noise: Redefining Retrieval for RAG Systemscited by 275
8 more
  1. 2023Linearity of Relation Decoding in Transformer Language Modelscited by 190
  2. 2023Tracr: Compiled Transformers as a Laboratory for Interpretabilitycited by 99
  3. 2024Cutting Off the Head Ends the Conflict: A Mechanism for Interpreting and Mitigating Knowledge Conflicts in Language Modelscited by 87
  4. 2024Finding Transformer Circuits with Edge Pruningcited by 58
  5. 2024What does the Knowledge Neuron Thesis Have to do with Knowledge?cited by 49
  6. 2024Induction Heads as an Essential Mechanism for Pattern Matching in In-context Learningcited by 46
  7. 2024Mechanistic Understanding and Mitigation of Language Model Non-Factual Hallucinationscited by 38
  8. 2024Sheaf Discovery with Joint Computation Graph Pruning and Flexible Granularitycited by 11

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 1; 2026: 5.

6 papers.