TL;DR
As Transformer language models stretch to handle longer and longer contexts, how should they keep track of where words are? This position paper argues that we can evaluate relative positional embeddings by looking at their asymptotic behavior—what happens as context length and word distances approach infinity. By formalizing two competing goals—remembering nearby words and still being able to reach distant ones—the authors show that logarithmic positional penalties hit the mathematical sweet spot.
What Problem Does This Paper Address?
Transformers don't naturally know word order; without positional information, they treat a sentence like a bag of words. Relative positional embeddings (RPEs) fix this by injecting information about the distance between tokens directly into the attention mechanism.
While everyone agrees that RPEs should depend only on relative distance (shift invariance), there is no consensus on what else they should achieve, especially as context windows grow massive. The authors focus on a fundamental tug-of-war between two goals:
- Local attention preservation: A model needs to aggregate information from nearby words. As the context grows longer and longer, the attention paid to a fixed local neighborhood shouldn't wash out to zero.
- Long-range accessibility: A model also needs to retrieve relevant information from far away (like in "needle-in-a-haystack" tasks). Positional penalties shouldn't become so harsh that distant, relevant tokens become unreachable.
Because attention weights must sum to one, giving more weight to nearby tokens leaves less for distant ones. The paper asks: how can we formalize this trade-off mathematically, and which existing methods actually balance both?
Methods
The authors take a theoretical approach, analyzing attention in the limit as context length $n \to \infty$ and relative distance $r \to \infty$.
They split the pre-softmax attention score $\ell_n(r)$ into two parts: a content score $c_n(r)$ (how well the query and key match semantically, assumed to be uniformly bounded) and a positional bias $\Delta\ell_n(r)$. They then group positional biases into three asymptotic classes:
- Asymptotically Content-Preserving (ACP): The bias approaches a finite constant at large distances (e.g., NoPE, T5 bias).
- Asymptotically Distance-Suppressing (ADS): The bias drops to $-\infty$ as distance grows (e.g., ALiBi, KERPLE-log).
- Asymptotically Oscillatory (AO): The bias stays bounded but never converges, oscillating instead (e.g., RoPE, Transformer-XL).
Using this setup, the authors translate their two desiderata into exact mathematical conditions for additive, distance-only biases:
- Local preservation is formalized as the total attention mass within a fixed window $R$ staying strictly above zero as $n \to \infty$.
- Long-range accessibility is formalized as the attention ratio between a relevant distant key (at distance $r$) and an irrelevant reference key (at distance $0$) not dropping by more than a constant factor $\epsilon$ whenever the distance $r$ is doubled.
Datasets
Not discussed in the paper. (This is a theoretical position paper; while it references prior empirical findings on perplexity and passkey retrieval, it does not introduce or evaluate on any datasets.)
Key Insights and Ideas
- Local preservation equals summability (Theorem 1): A model preserves local attention if and only if the infinite sum of its exponentiated positional biases—what the authors call the limiting "positional partition function," $Z_\infty^\Delta = \sum_{r=0}^\infty \exp(\Delta\ell(r))$—is finite. If the bias doesn't decay fast enough, the sheer number of distant tokens eventually drowns out the local neighborhood.
- Long-range accessibility equals bounded doubling penalties (Theorem 2): A model maintains long-range accessibility if and only if doubling the distance to a key adds at most a constant penalty: $\Delta\ell(r) - \Delta\ell(2r) \le C$.
- Logarithmic penalties are the sweet spot (Theorems 3 & 4): If a positional bias is eventually nonincreasing, the only way to satisfy both desiderata simultaneously is for the penalty to grow logarithmically: $-\Delta\ell(r) = \Theta(\log r)$. Specifically, for a logarithmic bias like $\Delta\ell(r) = -\alpha \log(1+r)$, both properties hold if and only if $\alpha > 1$.
Key Results
The authors classify eight popular positional embedding methods under their framework:
- Neither or only one satisfied: Methods like NoPE, T5 relative bias, and Wavelet PE satisfy long-range accessibility (their penalties don't blow up), but fail local preservation because their positional partition functions diverge. Conversely, ALiBi (which uses linear penalties) satisfies local preservation but fails long-range accessibility, which aligns with prior observations that ALiBi struggles on long-context passkey retrieval beyond its training length.
- Both satisfied: KERPLE-log (with $\alpha > 1$) is the standout example among additive biases that satisfies both local preservation and long-range accessibility.
- The RoPE nuance: RoPE satisfies long-range accessibility (with fixed content vectors) and is non-monotonic/oscillatory, though its fixed-window mass tends to zero under the paper's simplified assumptions.
Limitations and Future Work
The authors are upfront that infinite-context math doesn't tell the whole story at finite lengths. For instance, T5 bias fails local preservation asymptotically, and RoPE satisfies long-range accessibility, yet both show very different empirical behaviors in finite-context language modeling and passkey retrieval.
To bridge this gap, the authors suggest two main directions for future work:
- Extending the framework to non-monotonic, oscillatory methods like RoPE, perhaps by analyzing the upper and lower envelopes of their positional scores.
- Translating these asymptotic limits into finite-context metrics, such as measuring the exact content-score margin needed to retrieve a distant key at a specific, finite context length.
Summary updated