xPos (Extrapolatable Position Embedding) is a position representation that, in addition to the rotation of RoPE, scales the queries and keys up or down according to position so that the score decays exponentially with distance. It was proposed by Sun et al. at Microsoft in 2022. Its goal is to keep accuracy from collapsing when inference runs on sequences longer than in training.
RoPE rotates the queries and keys by an angle proportional to position so that their dot product depends only on distance. The paper points out a weakness of RoPE: the expected score oscillates sharply as distance grows. When the monotonic relation "the farther the word, the smaller the score" breaks down, the model has difficulty telling positions apart, and accuracy drops on sequences longer than in training.
xPos suppresses this oscillation by decaying more strongly the fast-rotating dimension pairs that cause it. The paper calls the model that combines this with blockwise causal attention (BCA) at inference time the LEX Transformer, and shows that a model trained at length 1024 keeps decreasing in perplexity even when the length is extended to 4096.
The left of the figure at the top of the article shows where position information is injected. It has the same layout as the figure in the RoPE article: after the queries and keys are rotated, the query is multiplied by and the key by . The top right shows the expected score per distance computed for RoPE and xPos (the same quantity as Figure 1 in the paper), and the bottom right shows the decay strength of each dimension pair.

