Mitigating Position Bias in Transformers via Layer-Specific Positional Embedding Scaling

Changze Lv, Zhenghua Wang, Yiran Ding, Yixin Wu, Tianlong Li +7 more
6/26/2026
cs.CL
transformer-attention

No confident code implementation found for this paper.

Abstract

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{lv2026mitigating,
  title  = {Mitigating Position Bias in Transformers via Layer-Specific Positional Embedding Scaling},
  author = {Changze Lv and Zhenghua Wang and Yiran Ding and Yixin Wu and Tianlong Li and Zhibo Xu and Muling Wu and Tianyuan Shi and Shizheng Li and Qi Qian and Xuanjing Huang and Xiaoqing Zheng},
  year   = {2026},
  eprint = {2606.27705},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2606.27705v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2606.27705.svg)](https://codeofpaper.com/paper/2606.27705)

Discussion