发现语言模型会无差别重复上下文内容,导致错误输出。
Llama See, Llama Do: A Mechanistic Perspective on Contextual Entrainment and Distraction in LLMs
- 发现模型对上下文任何词都倾向重复,无论是否相关。
- 用新方法找到负责重复的注意力头,关闭后干扰大幅减少。
- 适合研究模型机制与可解释性的研究人员阅读。
我们在多种语言模型和提示设置中观察到一种新现象——上下文同步,即模型对上下文中出现过的任何词(包括随机词)都会分配显著更高的逻辑值(或概率),表明这种同步是机制性而非语义驱动的。尽管如此,我们发现语义因素会影响同步强度:反事实提示引起的同步效应强于事实提示。我们假设存在一组特定的注意力头(称作同步头)负责此现象,并基于可微分掩码提出新方法识别这些头。当这些头被关闭(输出置零)时,上下文干扰明显减弱,模型输出更接近无干扰情况。该发现为理解并缓解模型干扰问题提供了关键机制视角。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。