Tree Rotary Positional Encoding for Extreme Length Extrapolation from Scratch
qiu wu chen, Ziteng Huang, Shuhai Zhang, Zimo Liu, Linxiao Li, Ying Sun, Yuchen Li, Yifan Zhang, Yaofo Chen, Mingkui Tan
NeurIPS page · OpenReview · Open on the map
Category: Interpretability & Model Adaptation › Transformer Length and Memory Scaling · Type: new method · Keywords: positional encoding, length extrapolation, tree-structured, multi-scale, offset training
Areas: Long Context › Long-context mechanisms › In-context learning; Model Architectures & Sequence Modeling › Language Model Architectures › Transformer Memory and Reasoning
Summary
Tree Rotary Positional Encoding (TPE) introduces a structured multi-scale positional encoding designed for training from scratch, representing absolute positions through combinatorial components and using an offset-based training strategy to improve interactions, achieving extreme length extrapolation with a 64× increase to 32K tokens and a large perplexity drop.
Explained to a 5-year-old
Big computer programs need to remember where each word is in a sentence. They usually learn on short sentences, but sometimes they need to handle very long ones. The old way uses one number for everything, which doesn't work well for very long sentences. This paper creates a new way to give positions using many small numbers that work together like a tree, and they also change how the program learns to use these numbers. This helps the program understand much longer sentences without forgetting.
Explained to a 5-year-old, longer
Big computers that read words, like language models, need to know the order of the words. They are usually taught using short pieces of text, like a few sentences. When they meet a very long text, like a book, they often get confused about where each word belongs. The usual way to give them this order uses a single number for every position, which works fine for short texts. This single number makes it hard for the model to guess the correct order when the text is much longer than what it saw during training. The authors noticed this problem and decided to try something different. They split the position information into several smaller parts that are organized like a tree, so each part handles a different scale of length. By using many small parts instead of one big number, the model can combine them to figure out positions it has never seen before. They also changed how the model learns these parts by adding a small shift to the training process, which helps the parts work together better. This new training trick makes the model pay attention to the relationships between the different parts of the position information. As a result, the model can now handle texts that are thousands of words long, even though it was only trained on texts of a few hundred words. The improvement is huge: the model’s mistakes drop dramatically, and it still runs quickly.
For a technical reader
The paper addresses the challenge of extending language models to handle contexts far longer than those seen during training. It points out that current rotary positional encodings rely on a single global index, which limits extrapolation capability. The proposed solution decomposes positional encoding into a hierarchical, tree-structured representation and introduces an offset-based training regimen to improve component interactions. Theoretical analysis demonstrates that this decomposition provides combinatorial coverage of positions, enabling the model to infer positions at scales beyond the training range. Experiments on a 1.2 B parameter model show a 64× length extrapolation to 32 K tokens with a substantial drop in perplexity while maintaining inference efficiency.
Problem
Large language models are trained on short sequences but need to handle much longer contexts, requiring positional encodings that remain distinguishable and can generalize beyond the training length.
Method
The approach decomposes positional encoding into multiple components organized in a tree structure, representing positions combinatorially, and introduces an offset-based training strategy to enhance learning interactions among components, enabling better length extrapolation.
Results
The approach achieves a 64× length extrapolation to 32K tokens, lowering perplexity from about 4532 to about 150 while keeping inference efficiency comparable.
Contributions
The paper presents a tree-structured multi-scale positional encoding and an offset-based training strategy, provides theoretical analysis of its combinatorial position coverage, and demonstrates substantial improvements in extreme length extrapolation.
Research questions this paper is counted under
This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction