ChatPaper.aiChatPaper

消除语言模型的位置偏见:一种机制性方法

Eliminating Position Bias of Language Models: A Mechanistic Approach

July 1, 2024
作者: Ziqi Wang, Hanlin Zhang, Xiner Li, Kuan-Hao Huang, Chi Han, Shuiwang Ji, Sham M. Kakade, Hao Peng, Heng Ji
cs.AI

摘要

现代语言模型(LMs)中的位置偏差已被证明是一个普遍问题,这些模型根据给定上下文中的位置优先考虑内容。这种偏见经常导致意外的模型失败,并损害各种应用中的性能、鲁棒性和可靠性。我们的机械分析将位置偏差归因于几乎所有最先进的LMs中使用的两个组件:因果注意力和相对位置编码。具体来说,我们发现因果注意力通常导致模型偏爱远处的内容,而像RoPE这样的相对位置编码根据检索增强问答(QA)的分析更倾向于附近的内容。此外,我们在目标检测的经验研究中发现,位置偏差也存在于视觉语言模型(VLMs)中。 基于以上分析,我们提出通过“无需训练的零样本”方式消除由不同输入片段顺序(例如,LM作为评判员中的选项,QA中检索的文档)引起的位置偏差。我们的方法将因果注意力改为片段之间的双向注意力,并利用模型注意力值来决定片段的相对顺序,而不是使用输入提示中提供的顺序,从而实现片段级别的位置不变推断(PINE)。通过消除位置偏差,模型在LM作为评判员和检索增强QA等广泛存在位置偏差的下游任务中实现更好的性能和可靠性。 值得注意的是,PINE在为评估推理对调整LMs时特别有用:在大多数情况下,它始终提供8到10个百分点的性能增益,并使Llama-3-70B-Instruct在RewardBench推理子集上的表现甚至比GPT-4-0125-preview更好。
English
Position bias has proven to be a prevalent issue of modern language models (LMs), where the models prioritize content based on its position within the given context. This bias often leads to unexpected model failures and hurts performance, robustness, and reliability across various applications. Our mechanistic analysis attributes the position bias to two components employed in nearly all state-of-the-art LMs: causal attention and relative positional encodings. Specifically, we find that causal attention generally causes models to favor distant content, while relative positional encodings like RoPE prefer nearby ones based on the analysis of retrieval-augmented question answering (QA). Further, our empirical study on object detection reveals that position bias is also present in vision-language models (VLMs). Based on the above analyses, we propose to ELIMINATE position bias caused by different input segment orders (e.g., options in LM-as-a-judge, retrieved documents in QA) in a TRAINING-FREE ZERO-SHOT manner. Our method changes the causal attention to bidirectional attention between segments and utilizes model attention values to decide the relative orders of segments instead of using the order provided in input prompts, therefore enabling Position-INvariant inferencE (PINE) at the segment level. By eliminating position bias, models achieve better performance and reliability in downstream tasks where position bias widely exists, such as LM-as-a-judge and retrieval-augmented QA. Notably, PINE is especially useful when adapting LMs for evaluating reasoning pairs: it consistently provides 8 to 10 percentage points performance gains in most cases, and makes Llama-3-70B-Instruct perform even better than GPT-4-0125-preview on the RewardBench reasoning subset.

Summary

AI-Generated Summary

PDF81November 28, 2024