paper-with-me

홈 › Papers

Mesa-Extrapolation: A Weave Position Encoding Method for Enhanced Extrapolation in LLMs

2024-10-21 · Xin Ma, Yang Liu, Jingjing Liu, Xiaoxu Ma

Large language models (LLMs), although having revolutionized many fields, still suffer from the challenging extrapolation problem, where the inference ability of LLMs sharply declines beyond their max training lengths. In this work, we conduct a theoretical analysis to better understand why No Position Encoding (NoPE) fails outside its effective range, as well as examining the power of Position Encoding (PE) in this context. Our findings reveal that with meticulous weave position, PE can indeed be extended beyond effective range. Our theorems establish that LLMs equipped with weave PE can achieve improved extrapolation performance without additional cost. Furthermore, we introduce a novel weave PE method, Mesa-Extrapolation, which utilizes a chunk-based triangular attention matrix and applies Stair PE to manage the final chunk. This method not only retains competitive performance but also offers substantial benefits such as significantly reduced memory demand and faster inference speed. Extensive experiments validate the effectiveness of Mesa-Extrapolation, demonstrating its potential as a scalable solution to enhancing LLMs applicative reach. Our code is available at \url{https://github.com/soacker/Mesa-Extrapolation}.

📄 PDF Abstract BibTeX arXiv:2410.15859

Code (1)

soacker/mesa-extrapolation 공식 구현 pytorch

Tasks

Position

Methods 이 논문이 사용한 방법론

Softmax The Softmax output function transforms a previous layer's output into a vector of probabilities. It is commonly used for multiclass classification. Given an input vector $x$…
Attention 설명 없음

Similar Papers 제목 키워드 기반

HoPE: A Novel Positional Encoding Without Long-Term Decay for Enhanced Context Awareness and Extrapolation

2024-10-28 · Yuhan Chen, Ang Lv, Jian Luan, Bin Wang 외

Many positional encodings (PEs) are designed to exhibit long-term decay, based on an entrenched and long-standing inductive opinion: tokens farther away from the current position carry less relevant information. We argue…

Position

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

2024-01-29 · Zhenyu He, Guhao Feng, Shengjie Luo, Kai Yang 외

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 encodi…

DisentanglementPosition

HoPE: Hyperbolic Rotary Positional Encoding for Stable Long-Range Dependency Modeling in Large Language Models

2025-09-05 · Chang Dai, Hongyu Shan, Mingyang Song, Di Liang arxiv

Positional encoding mechanisms enable Transformers to model sequential structure and long-range dependencies in text. While absolute positional encodings struggle with extrapolation to longer sequences due to fixed posit…

Bayesian Attention Mechanism: A Probabilistic Framework for Positional Encoding and Context Length Extrapolation

2025-05-28 · Arthur S. Bianchessi, Rodrigo C. Barros, Lucas S. Kupssinskü

Transformer-based language models rely on positional encoding (PE) to handle token order and support context length extrapolation. However, existing PE methods lack theoretical clarity and rely on limited evaluation metr…

Information RetrievalRetrieval

Context-aware Biases for Length Extrapolation

2025-03-11 · Ali Veisi, Amir Mansourian

Transformers' ability to generalize to longer sequences than they have been trained on, known as length extrapolation, degrades as sequence length increases. Most of Relative Positional Encoding (RPE) methods address thi…

Decoder