arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.02536cs.CLcs.LG
收藏

通过缩放单一维度缓解大语言模型中的位置偏差

Mitigate Position Bias in Large Language Models via Scaling a Single Dimension

Tsinghua University(清华大学);Microsoft Corporation(微软公司)

Yijiong Yu, Huiqiang Jiang, Xufang Luo, Qianhui Wu, Chin-Yew Lin, Dongsheng Li, Yuqing Yang, Yongfeng Huang, Lili Qiu

AI总结:

本文发现位置偏差源于注意力权重和因果掩码产生的位置特定隐藏状态,提出缩放该隐藏状态单一维度的方法,在多项任务上提升性能高达15.2%。

摘要:

大语言模型(LLMs)因其出色的泛化能力和稳健的生成能力,正越来越多地被应用于各种现实场景。然而,它们表现出位置偏差,也称为“中间丢失”现象,这一现象在长上下文场景中尤为明显,表明提示中关键信息放置在不同位置会显著影响准确性。本文首先探讨了位置偏差的微观层面表现,得出结论:注意力权重是位置偏差的微观层面表达。进一步发现,除了位置嵌入外,因果注意力掩码也通过创建位置特定的隐藏状态而导致位置偏差。基于这些见解,我们提出了一种通过缩放这种位置隐藏状态来缓解位置偏差的方法。在NaturalQuestions多文档问答、KV检索、LongBench和时间线重排任务上,使用包括RoPE模型、上下文窗口扩展模型和Alibi模型在内的多种模型进行的实验,证明了我们方法的有效性和泛化性。我们的方法仅通过修改隐藏状态的一个维度,即可将性能提升高达15.2%。我们的代码可在 https://aka.ms/PositionalHidden 获取。

英文摘要:

Large Language Models (LLMs) are increasingly applied in various real-world scenarios due to their excellent generalization capabilities and robust generative abilities. However, they exhibit position bias, also known as "lost in the middle", a phenomenon that is especially pronounced in long-context scenarios, which indicates the placement of the key information in different positions of a prompt can significantly affect accuracy. This paper first explores the micro-level manifestations of position bias, concluding that attention weights are a micro-level expression of position bias. It further identifies that, in addition to position embeddings, causal attention mask also contributes to position bias by creating position-specific hidden states. Based on these insights, we propose a method to mitigate position bias by scaling this positional hidden states. Experiments on the NaturalQuestions Multi-document QA, KV retrieval, LongBench and timeline reorder tasks, using various models including RoPE models, context windowextended models, and Alibi models, demonstrate the effectiveness and generalizability of our approach. Our method can improve performance by up to 15.2% by modifying just one dimension of hidden states. Our code is available at https://aka.ms/PositionalHidden.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑