Llama See, Llama Do: A Mechanistic Perspective on Contextual Entrainment and Distraction in LLMs
Jingcheng Niu, Xingdi Yuan, Tong Wang, Hamidreza Saghir, Amir H. Abdi

TL;DR
This paper uncovers a phenomenon called contextual entrainment in language models, where models are distracted by irrelevant context, and identifies specific attention heads responsible for this effect, offering insights into model distraction mechanisms.
Contribution
It introduces the concept of contextual entrainment, demonstrates its mechanistic basis via attention heads, and proposes a method to mitigate distraction in language models.
Findings
Contextual entrainment occurs across various LMs and prompt types.
Entrainment is influenced by semantic factors and is stronger with counterfactual prompts.
Turning off entrainment heads reduces distraction effects significantly.
Abstract
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
Taxonomy
TopicsDispute Resolution and Class Actions · Corporate Governance and Law · Corporate Insolvency and Governance
MethodsSoftmax · Attention Is All You Need · Sparse Evolutionary Training
