English

Two Stones Hit One Bird: Bilevel Positional Encoding for Better Length Extrapolation

Machine Learning 2024-06-18 v2 Artificial Intelligence Computation and Language Machine Learning

Abstract

In this work, we leverage the intrinsic segmentation of language sequences and design a new positional encoding method called Bilevel Positional Encoding (BiPE). For each position, our BiPE blends an intra-segment encoding and an inter-segment encoding. The intra-segment encoding identifies the locations within a segment and helps the model capture the semantic information therein via absolute positional encoding. The inter-segment encoding specifies the segment index, models the relationships between segments, and aims to improve extrapolation capabilities via relative positional encoding. Theoretical analysis shows this disentanglement of positional information makes learning more effective. The empirical results also show that our BiPE has superior length extrapolation capabilities across a wide range of tasks in diverse text modalities.

Keywords

Cite

@article{arxiv.2401.16421,
  title  = {Two Stones Hit One Bird: Bilevel Positional Encoding for Better Length Extrapolation},
  author = {Zhenyu He and Guhao Feng and Shengjie Luo and Kai Yang and Liwei Wang and Jingjing Xu and Zhi Zhang and Hongxia Yang and Di He},
  journal= {arXiv preprint arXiv:2401.16421},
  year   = {2024}
}

Comments

17 pages, 7 figures, 8 tables; ICML 2024 Camera Ready version; Code: https://github.com/zhenyuhe00/BiPE

R2 v1 2026-06-28T14:30:38.910Z