Mitigating Position Bias in Transformers via Layer-Specific Positional Embedding Scaling
作者: Changze Lv, Zhenghua Wang, Yiran Ding, Yixin Wu, Tianlong Li, Zhibo Xu, Muling Wu, Tianyuan Shi, Shizheng Li, Qi Qian, Xuanjing Huang, Xiaoqing Zheng
分类: cs.CL
发布日期: 2026-06-26
💡 一句话要点
提出层特定位置嵌入缩放方法以解决长文本信息丢失问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 长文本处理 位置嵌入 注意力机制 遗传算法 模型优化
📋 核心要点
- 现有方法在处理长文本时,常常无法有效捕捉中间关键信息,导致信息丢失或低估。
- 本文提出层特定位置嵌入缩放(LPES)方法,为每一层分配独特的缩放因子,从而实现更均衡的注意力分布。
- 实验结果显示,LPES在多个长文本基准上均表现出显著提升,尤其在关键值检索数据集上提高了11.2%的准确率。
📝 摘要(中文)
大型语言模型(LLMs)在处理长文本输入时,常常面临“迷失在中间”的问题,即位于中间的关键信息往往被低估或丢失。现有方法通过结合多尺度旋转位置嵌入(RoPE)来解决这一问题,但通常存在高延迟或依赖于次优的手工缩放策略。为克服这些局限性,本文提出了一种层特定位置嵌入缩放(LPES)方法,为每一层分配不同的缩放因子。LPES在不微调模型参数或增加推理延迟的情况下,实现了更均衡的注意力分布。通过设计的遗传算法有效选择每层的最优缩放因子,结合Bézier曲线显著减少搜索空间。大量实验表明,LPES有效减轻了位置注意力偏差,并在多个长文本基准上实现了一致的性能提升,在关键值检索数据集上最高可提高11.2%的准确率。
🔬 方法详解
问题定义:本文旨在解决大型语言模型在处理长文本输入时的“迷失在中间”问题,现有方法通常因高延迟或次优的缩放策略而无法有效捕捉中间信息。
核心思路:提出层特定位置嵌入缩放(LPES)方法,通过为每层分配不同的缩放因子,优化注意力分布,避免了对模型参数的微调和推理延迟的增加。
技术框架:整体架构包括输入层、位置嵌入层和注意力机制层,LPES在位置嵌入层中引入层特定的缩放因子,并通过遗传算法优化这些因子。
关键创新:最重要的创新在于引入层特定的缩放因子,使得每层的注意力分布更加均衡,显著区别于传统的全局缩放方法。
关键设计:采用遗传算法选择最优缩放因子,并结合Bézier曲线来减少搜索空间,确保了高效的参数优化。
🖼️ 关键图片
📊 实验亮点
实验结果表明,LPES方法在多个长文本基准上均实现了显著的性能提升,尤其在关键值检索数据集上,准确率提高了11.2%。与现有方法相比,LPES在保持推理速度的同时,有效减轻了位置注意力偏差。
🎯 应用场景
该研究的潜在应用领域包括自然语言处理、信息检索和对话系统等,能够有效提升长文本理解的准确性和效率。未来,LPES方法可能会在更广泛的模型架构中得到应用,推动大型语言模型在复杂任务中的表现。
📄 摘要(原文)
Large Language Models (LLMs) still struggle with the ``lost-in-the-middle'' problem, where critical information located in the middle of long-context inputs is often underrepresented or lost. While existing methods attempt to address this by combining multi-scale rotary position embeddings (RoPE), they typically suffer from high latency or rely on suboptimal hand-crafted scaling strategies. To overcome these limitations, we introduce a layer-specific positional embedding scaling~(LPES) method that assigns distinct scaling factors to each layer. LPES achieves a more balanced attention distribution without fine-tuning model parameters or increasing inference delay. A specially designed genetic algorithm is employed to efficiently select the optimal scaling factors for each layer by incorporating Bézier curves to significantly reduce the search space. Extensive experiments demonstrate that LPES effectively mitigates positional attention bias and delivers consistent improvements across multiple long-context benchmarks, yielding up to an $11.2$\% accuracy gain on the key-value retrieval dataset.