Your LLM Does Group Theory Every Time It Reads a Sentence

15 September, 2026 · RoPE, Fourier characters, and the strange mathematics of giving Transformers a sense of position

For a very long time, I was thoroughly classical-ML-pilled, thanks largely to my love of statistics. But since starting my internship, I have been learning LLM theory from the bottom up. Somewhere along the way, I got stuck on a question that felt too basic to be interesting: how does a Transformer know that the dog bit the man is not the man bit the dog?

The question bothered me because classical machine learning had trained a very particular reflex into me. I was used to a dataset being a table: one row per observation, one column per feature, a target somewhere to the right. Shuffle the rows before fitting a model and nothing essential should change. In fact, we usually shuffle them on purpose. The seventh patient in a regression table does not become sicker merely because we move their row above the sixth patient.

Language breaks that instinct immediately. A sentence is not a bag of exchangeable observations. Its entries occupy places, and those places participate in the meaning. Shuffle the rows of a sentence and you have not reorganized the same evidence; you have described a different event. That was the bridge from the statistics I already loved to the LLM theory I had started learning: before asking how a model predicts the next token, I had to ask how it represents the simple fact that one token came before another.

The words are the same. Their token embeddings are the same. Attention is very good at asking which words resemble or matter to which other words, but a bare dot product contains no left, no right, no before, and no after. Somewhere between the tokenizer and the answer, order has to enter the machine.

I expected the answer to be an engineering detail. I found an abstract-algebra lecture hiding in the query and key vectors.

RoPE is not really a positional-encoding hack. It is a representation of the translation group.

That sentence is literal. Token positions are integers. Moving along a sentence means adding integers. RoPE turns each such addition into a rotation, and it does so in exactly the way a group representation is required to. The relative-position identity people usually present as RoPE's clever trick then stops being a trick. It is forced by the algebra.

The story gets stranger. Those rotations are also Fourier characters. A modern LLM watches its context through a bank of periodic clocks, from frantic clocks that distinguish nearby tokens to slow clocks that track long-range structure. Extending a context window therefore means asking those clocks to remain useful far beyond the phase patterns on which the model learned to read them.

And in 2026, two papers pulled this picture in opposite directions. GRAPE rebuilt positional encoding explicitly from group representations.[3] DroPE trained models with RoPE, removed it, and argued that the geometry which helps a model learn order can later obstruct length extrapolation.[10] I wanted to understand how both claims could be true.

Attention has no ruler

Let us build the problem from the ground up. A tokenizer first turns text into an ordered list of token IDs. Each ID is used to look up an embedding: a long list of learned numbers that acts as the token's starting coordinates. The model does not receive the word dog as ink on a page. It receives a vector. Before context and position are mixed in, the lookup vector for dog is the same whether the word appears first, fifth, or five-hundredth.

A vector is useful because it lets the network learn many soft properties at once. There is no single coordinate labelled “is an animal” or “can be a subject,” but directions in the vector space can encode combinations of such tendencies. The exact interpretation is distributed across dimensions and layers. For our story, the important fact is simpler: vectors can be transformed, compared, and combined using linear algebra.

Self-attention performs those three jobs with queries, keys, and values. A query says what the current token is looking for. A key says what another token offers. Their dot product is a compatibility score: vectors pointing in similar learned directions produce a larger number. A value is the information that gets carried across if the compatibility is high. The library metaphor is imperfect but useful: the query is a search request, keys are catalogue entries, and values are the books retrieved from the matching shelves.

Start with one self-attention layer. If the token representations are rows of \(X\), it forms

\[ Q=XW_Q,\qquad K=XW_K,\qquad V=XW_V, \]

and then computes

\[ \operatorname{Attention}(X) =\operatorname{softmax}\!\left(\frac{QK^\top}{\sqrt{d_h}}\right)V. \]

The matrices \(W_Q\), \(W_K\), and \(W_V\) are learned. Multiplying \(X\) by them produces a query, key, and value for every token. The matrix \(QK^\top\) then contains every query-key comparison: row \(i\), column \(j\) asks how much token \(i\) should attend to token \(j\). Dividing by \(\sqrt{d_h}\) keeps the scores from growing wildly as the head dimension grows. Softmax turns each permitted row into positive weights that sum to one, and multiplying by \(V\) forms a weighted mixture of the information carried by the values.

Strip away the notation and the mechanism is beautifully direct. Each token looks across the sequence, scores the other tokens, and collects information from them. Several attention heads can learn different notions of relevance: one might track a nearby modifier, another a matching bracket, another a name mentioned much earlier. But relevance and location are different questions. A dot product can learn that dog and bit belong in a grammatical relationship without knowing which one appeared on the left.

The score between token \(i\) and token \(j\) begins as \(q_i^\top k_j\). It sees their content, but neither \(i\) nor \(j\) appears in the formula.

This has a precise consequence. Let \(P\) be a matrix that shuffles the tokens. Without positional information or a mask,

\[ \operatorname{Attention}(PX)=P\operatorname{Attention}(X). \]

The layer is permutation equivariant: shuffle the inputs and the same outputs simply follow them to their new places. It has no private notion of where those places are. The original Transformer repaired this by adding sine and cosine vectors to the token embeddings.[1]

Equivariant is worth unpacking because it sounds more forbidding than it is. Imagine giving every token a numbered envelope, running attention, and then rearranging the envelopes. If the mechanism has no positional signal, rearranging before the calculation merely rearranges the answers in the same way. The calculation respects the shuffle. It does not notice that a story has been scrambled; it only follows each vector to its new slot.

There is one caveat worth putting here rather than hiding at the end. A decoder-only LLM also has a causal mask. The mask tells a token which side is the past, and a sufficiently capable model without explicit positional embeddings can recover more positional structure from that asymmetry. What the raw attention score still lacks is a ruler: it does not directly know whether a visible key is one token away or one thousand.

The mask is a triangular rule placed over the attention matrix. While predicting the next token, position \(i\) may look at positions up to \(i\), but never at the future positions to its right. That asymmetry already gives the sequence an arrow of time. The first token has almost nothing to inspect; later tokens have progressively longer prefixes. This is why it would be too strong to say that a causal Transformer without explicit positional encoding knows absolutely nothing about order. Yet the mask supplies a direction, not a calibrated distance. It says “this happened earlier,” not “this happened exactly 37 steps ago.” RoPE supplies that richer geometry.

Then somebody rotated the vectors

Rotation sounds like an oddly physical operation to perform on a word, so begin with an arrow drawn on paper. An arrow has an \(x\)-coordinate and a \(y\)-coordinate. Turning it by 30 degrees changes both coordinates but preserves its length. Turn it by another 30 degrees and you get exactly the same result as one 60-degree turn. Turn it backwards by 60 degrees and you return to the start. Those elementary facts are the entire mechanism in miniature.

RoPE enters after the content vectors have become queries and keys. Take two coordinates of a query, put them in a plane, and rotate the pair by an angle proportional to its position. For one pair, the rotation is

\[ R(\phi)= \begin{bmatrix} \cos\phi&-\sin\phi\\ \sin\phi&\cos\phi \end{bmatrix}. \]

You can read this matrix operationally. Feed it the point \((x,y)\); the sines and cosines return the coordinates of the same point after a turn by \(\phi\). Nothing is stretched or crushed. The inverse operation is simply a turn by \(-\phi\), and the inverse matrix is also the transpose. Those facts will matter when a rotated query meets a rotated key.

At position \(n\), RoPE uses \(\phi=n\theta\). It repeats the operation across coordinate pairs using different frequencies \(\theta_1,\ldots,\theta_{d/2}\). For an even head dimension \(d\), define

\[ \rho(n)=\operatorname{diag}\!\bigl( R(n\theta_1),R(n\theta_2),\ldots,R(n\theta_{d/2}) \bigr). \]

Suppose one coordinate pair uses an angle of \(\theta\) radians per token. Position zero is not turned at all. Position one is turned by \(\theta\), position two by \(2\theta\), and position \(n\) by \(n\theta\). Moving one token forward is therefore always the same additional rotation. RoPE takes a high-dimensional query, pairs coordinate 0 with 1, coordinate 2 with 3, and so on, then runs this construction in every plane at once.

The different pairs do not all rotate at the same speed. If they did, the model would effectively own one repeating clock copied many times. Instead, RoPE gives each pair its own \(\theta_i\). Some pairs turn substantially between neighboring tokens; others barely move. Taken together, their phases provide a multi-scale signature of position.

The position-aware vectors are then

\[ \widetilde q_n=\rho(n)q_n, \qquad \widetilde k_n=\rho(n)k_n. \]

No vector of position features is added to the content. Position acts on the content. That distinction is the conceptual leap. The original Transformer placed a position vector beside the token information by addition. RoPE transforms the query and key themselves, so the later dot product can compare how far each was rotated. Values are usually left unrotated: position changes who attends to whom, while the selected value vectors still carry the information being gathered.

Because rotations preserve lengths, RoPE does not make a query stronger merely because it appears late in a document. It changes orientation, not magnitude. And because the same position-dependent operation is applied to queries and keys, their interaction has a controlled algebraic form. The original RoFormer paper derived this construction in both real rotation matrices and complex notation, then showed how relative displacement appears inside the query-key product.[2]

The integers were there all along

This is where the phrase group theory used to make the story feel more advanced than it is. A group is not, at first, a collection of frightening symbols. It is a disciplined description of reversible moves. You need a rule for composing two moves, an identity move that changes nothing, an inverse that undoes each move, and consistency about how several moves associate. Rotations of a circle form a group. So do the rotations and reflections of a square. So do shifts along an infinite line.

Token positions naturally live in that last example. A move three places to the right followed by a move five places to the right is a move eight places to the right. Move zero places and nothing happens. Move five places right and then five places left and you are back where you began. The integers under addition, \((\mathbb Z,+)\), record every such translation: compose moves by adding them, use zero as the identity, and use \(-n\) to undo \(n\).

Notice the subtle change of viewpoint. The number 137 is no longer merely a label attached to one box in an array. It is the result of applying the one-step translation 137 times. Position becomes a journey from an origin. Once positions are journeys, the gap between two positions is the journey that carries one to the other.

A representation translates those abstract moves into concrete linear transformations while preserving how they compose. For RoPE,

\[ \rho:(\mathbb Z,+)\longrightarrow SO(d), \]

Here representation has a precise mathematical meaning, different from the loose ML habit of calling any hidden vector a representation. We begin with an abstract move such as “advance by seven tokens” and assign it a concrete matrix that acts on vectors. The assignment is valid only if it respects composition. Advancing by three and then four must produce the same matrix as advancing by seven in one step.

The target \(SO(d)\) is the group of \(d\)-dimensional rotations: linear transformations that preserve lengths and orientation. RoPE uses a particularly simple corner of it, the product of independent planar rotations \(SO(2)^{d/2}\subset SO(d)\). Each two-coordinate plane gets its own little clock, and the block-diagonal matrix runs all of them simultaneously. The defining calculation is only one line:

\[ \begin{aligned} \rho(m+n) &=\operatorname{diag}\bigl(R((m+n)\theta_i)\bigr)\\ &=\operatorname{diag}\bigl(R(m\theta_i)R(n\theta_i)\bigr)\\ &=\rho(m)\rho(n). \end{aligned} \]

Position addition has become matrix multiplication. Also \(\rho(0)=I\) and \(\rho(-n)=\rho(n)^{-1}\). This is not a metaphor laid over RoPE after the fact. It is the homomorphism law implemented by the code.

A useful analogy is a mechanical odometer. The abstract event is “travel one more kilometre”; the concrete representation is the new arrangement of numbered wheels. Travel \(m\) kilometres and then \(n\), and the wheels end in the same state as travelling \(m+n\) at once. A single wheel eventually repeats, so it cannot uniquely record an unlimited journey. Several wheels turning at different rates preserve much more information. RoPE replaces decimal wheels with circular phases, but the structural promise is the same: composing movement composes state.

Integer positions represented as rotations A number line with positions zero, one, and two maps to three circles. A vector is unrotated at zero, rotated by theta at one, and rotated by two theta at two. Moving one step twice corresponds to multiplying the one-step rotation twice. translation group: add positions 0 1 2 ρ(0) = I ρ(1) = R(θ) ρ(2) = R(2θ) × ρ(1) × ρ(1) 1 + 1 = 2 becomes ρ(1)ρ(1) = ρ(2)
One coordinate pair is shown. Real RoPE runs many such clocks at once. The important structure is not the particular angle in the drawing; it is that composing translations composes their rotations.

Relative position falls out automatically

Now put a query at position \(m\) and a key at position \(n\). Their attention score contains

\[ \begin{aligned} \widetilde q_m^\top\widetilde k_n &=(\rho(m)q_m)^\top(\rho(n)k_n)\\ &=q_m^\top\rho(m)^\top\rho(n)k_n. \end{aligned} \]

The middle expression is the whole trick waiting to simplify. Transposing the left-hand rotation moves it between the query and key. Geometrically, this says: instead of comparing two arrows after separately turning both of them, hold the query fixed, undo its turn, and measure how much turn remains on the key. Comparing two orientations never requires knowing where the zero-angle mark was; it requires only the angle between them.

Rotations are orthogonal, so transposing is the same as inverting:

\[ \rho(m)^\top=\rho(m)^{-1}=\rho(-m). \]

Use the representation law once more:

\[ \rho(m)^\top\rho(n) =\rho(-m)\rho(n) =\rho(n-m). \]

Therefore

\[ \boxed{\widetilde q_m^\top\widetilde k_n =q_m^\top\rho(n-m)k_n.} \]

The content still matters through \(q_m\) and \(k_n\). But the positional part of the score no longer cares about the two origins separately. It sees the group displacement \(n-m\).

Make it concrete. Put a query at position 14 and a key at position 11. Their positional interaction contains \(\rho(-3)\): the key lies three steps behind the query. Move the same pair deeper into a document, to positions 114 and 111, and the factor is still \(\rho(111-114)=\rho(-3)\). The absolute indices changed by one hundred; the relationship did not. Reverse the two positions and the sign changes, so “three tokens before” and “three tokens after” are distinct rotations.

Shift the whole sentence by \(s\) positions and nothing changes in that positional factor:

\[ \rho(m+s)^\top\rho(n+s)=\rho(n-m). \]

This is the deeper reason RoPE converts absolute indices on individual vectors into relative offsets inside attention. A common translation cancels because group inverses cancel it. The famous feature is not an extra property bolted onto the rotations; it is what the representation law was always going to produce.

Now the abstract language has paid rent. Calling \(\rho\) a group representation predicted the behavior before we multiplied the matrices. Any position mechanism built from the same representation pattern inherits this cancellation. The result is not that content disappears—\(q_m\) and \(k_n\) remain different, learned vectors—but that their positional comparison is anchored to separation rather than to an arbitrary beginning of the document.

The clocks are Fourier characters

If the group-theory description tells us why relative position appears, Fourier analysis tells us what kind of positional signal the model receives. The bridge is the same humble two-dimensional rotation. Complex numbers are not an additional machine bolted onto RoPE; they are a compact language for a plane. The real part gives the horizontal coordinate, the imaginary part the vertical coordinate, and multiplication by a unit complex number turns the point without changing its distance from the origin.

There is a second way to read the same two coordinates. Identify the real pair \((x_1,x_2)\) with one complex number \(z=x_1+ix_2\). A planar rotation becomes multiplication:

\[ R(n\theta) \quad\longleftrightarrow\quad z\mapsto ze^{in\theta}. \]

Euler's formula says \(e^{i\alpha}=\cos\alpha+i\sin\alpha\), so you can picture \(e^{in\theta}\) as a clock hand whose angle is \(n\theta\). Increment \(n\) and the hand advances by the same amount. Multiplying by another such term adds the angles, exactly mirroring the composition law we just derived with rotation matrices.

The function

\[ \chi_\theta(n)=e^{in\theta} \]

is a character of the additive group \(\mathbb Z\): a one-dimensional complex representation satisfying

\[ \chi_\theta(m+n)=\chi_\theta(m)\chi_\theta(n). \]

Characters are the elementary waves of Fourier analysis. Fourier analysis on the integers studies signals by resolving them against exactly these functions. RoPE is not secretly running an FFT over the sentence, but it is using the same mathematical atoms: each coordinate pair carries the content on one Fourier character of translation.

The word character here has nothing to do with letters in a string. It names a representation that turns group composition into multiplication by complex phases. If ordinary Fourier analysis feels more familiar, think of separating a musical chord into notes. A complicated waveform becomes understandable as a mixture of simple oscillations at different frequencies. RoPE does something conceptually adjacent for displacement: it exposes a token gap through many simple phase changes at once.

In standard RoPE, the frequencies are geometrically spaced. With base \(b\), a common convention is

\[ \theta_i=b^{-2i/d}, \qquad i=0,1,\ldots,d/2-1. \]

The first pairs rotate quickly. They can make adjacent offsets look sharply different. Later pairs rotate slowly and preserve a coarse phase over much larger distances. Their wavelengths are

\[ \lambda_i=\frac{2\pi}{\theta_i}. \]

The model therefore receives not one position clock but a whole watchmaker's drawer of them.

One fast clock may complete several turns while a slow clock has barely left noon. At a particular displacement, the state of the positional system is the joint reading of every clock. Two offsets that look identical on one fast clock can still look different on the slower clocks, just as the minute hand can return to twelve while the hour hand tells you that an hour has passed. This joint phase signature is why reducing RoPE to “sine waves repeat” misses most of the design.

The geometric spacing of frequencies spreads those clocks across scales. It is the same broad instinct behind logarithmic axes: devote some capacity to fine distinctions nearby and some to orders-of-magnitude changes farther away. No coordinate pair understands “syntax” or “paragraph structure” by itself. Training decides how the query and key projections use the available spectrum. The frequency bank merely gives those learned projections a palette of local and long-range phase relationships.

RoPE as a bank of fast and slow phase clocks Three cosine-like waves run across token displacement. The high-frequency wave cycles many times, the middle wave cycles several times, and the low-frequency wave changes slowly. The original training range ends at N; a shaded region to the right marks longer positions not seen during pretraining. seen during pretraining new phase combinations high frequencylocal detail middle frequencymid-range low frequencyglobal phase 0 N kN relative token displacement
A schematic oscillator bank, not the exact spectrum of one checkpoint. Fast modes provide fine local variation; slow modes provide long-range phase. RoPE remains mathematically defined to the right of \(N\), but the model did not learn on those combined phases.

A context window is where the clocks remain familiar

“Context window” is used for several ceilings that are easy to blur together. There is the maximum length the software will accept. There is the range of lengths and relative distances seen during training. And there is the effective context the trained model can actually use to answer a question. Changing a configuration value may raise the first ceiling without moving the other two. A prompt fitting in memory does not imply that evidence near its beginning will influence the answer well.

Now the question I originally thought was about a configuration file becomes mathematical:

What does “increasing an LLM's context window” mean?
It means taking a representation used during training on displacements roughly bounded by \(N\), then asking learned attention weights to interpret it on displacements approaching \(kN\).

Imagine teaching someone to navigate a city using a map that covers ten neighbourhoods. The coordinate grid can be extended across the entire country with a ruler; the arithmetic does not fail at the city boundary. But the traveller has learned decisions from streets, landmarks, and distances inside the mapped region. Coordinates outside it are valid without being familiar. Long-context extrapolation creates a similar gap between a positional rule that remains defined and a network trained to interpret only part of its output.

The map \(\rho(n)\) itself does not stop at \(N\). Sines, cosines, and rotations can be evaluated at any integer. The problem is that computable is not the same as familiar. During pretraining, the query and key weights adapt to a particular distribution of phase differences. Beyond that range, individual clocks may have wrapped around many more times, slow clocks may enter unseen parts of their cycle, and new combinations of phases can change the geometry of attention.

This is an ordinary statistical warning in unusual clothing. Generalization is safest near the support of the training distribution. The network has not learned a symbolic rule saying “interpret every possible phase tuple correctly.” Gradient descent has shaped weights using the phase tuples that occurred in finite training sequences. Asking for a much longer sequence means asking those same weights to behave sensibly under a systematic covariate shift in relative position.

For one frequency, offsets separated by a whole wavelength have the same phase:

\[ e^{i(n+\lambda)\theta}=e^{in\theta} \quad\text{when}\quad \lambda\theta\in2\pi\mathbb Z. \]

Across the full bank, the situation is less cartoonish. Different clocks wrap at different rates, and with the usual real-valued frequencies they need not share one exact integer period. The combined code can distinguish positions long after any single clock repeats. Still, approximate phase collisions, finite precision, and out-of-training phase patterns are real concerns.

Even “distinguish” needs care. RoPE does not issue a barcode that downstream layers simply read. It rotates content-dependent queries and keys, and those vectors are then mixed through attention, residual streams, nonlinearities, and many layers. A positional signature can be mathematically distinct yet too unfamiliar or too weakly used to support retrieval. That is why long-context claims are tested with tasks—finding distant facts, combining evidence, tracking perplexity—not proved by showing that two phase vectors differ.

A February 2026 preprint makes this oscillator-bank view explicit and derives aliasing-like, low-frequency-drift, depth, and floating-point constraints on RoPE bases.[4] I find the signal-processing language useful, with one guardrail: a bound on one positional mode is not by itself a universal cliff at which every full LLM forgets its context. Model weights, the whole frequency bank, training, and evaluation all sit between a phase calculation and an observed failure.

Scaling RoPE means retuning a representation

Most context-extension methods can now be described without memorising their names. They change how far each clock advances per token.

The simplest mental picture is a rubber ruler. Suppose a model learned on a ruler ending at \(N\), but we want to place \(sN\) tokens along it. We can squeeze the new positions so that the last one still lands near the old endpoint. Every old phase remains reachable and no clock is forced as far into unseen territory. The price is that neighboring tick marks sit closer together: we bought range by giving up positional resolution.

That global squeeze is only the beginning of the design space. Local language patterns often depend on fine distinctions among nearby tokens, so slowing the fastest clocks can damage behavior the model already performs well. The slow clocks are the ones most directly responsible for broad changes across a long span. Modern recipes therefore ask whether every frequency should be stretched equally, whether some should be protected, and whether the model needs a small amount of additional training to adapt to the new geometry.

Method What changes mathematically The trade-off
Position Interpolation Replace \(n\) by \(n/s\), so every frequency becomes \(\theta_i/s\). The longer sequence fits inside the old phase range, but nearby positions become less separated.
NTK-aware scaling Change the RoPE base, slowing low-frequency dimensions more while leaving the fastest end closer to its original rate. Preserves more local resolution, but the frequency distortion is uneven and checkpoint-dependent.
YaRN Blend between interpolation and no interpolation by frequency band, then adjust attention magnitude. Protects short-range detail while extending slow clocks, at the cost of another calibration recipe.
LongRoPE Search for non-uniform scale factors across dimensions and positions, then extend progressively. More flexibility and longer reported windows, with search and adaptation replacing a closed-form rule.

Position Interpolation is the cleanest example. To extend by a factor \(s\), it uses

\[ \rho_{\mathrm{PI}}(n)=\rho(n/s). \]

If a model trained up to 8,000 tokens must accept 32,000, choose \(s=4\). The new position 32,000 is presented with roughly the phase formerly used at 8,000. A displacement of 400 tokens now produces the phase change that 100 tokens produced before. Nothing about the underlying text became shorter; we changed the coordinate system through which attention sees its distance.

The largest new position now produces approximately the largest phase seen during training. The authors extended LLaMA checkpoints from 2,048 to as many as 32,768 tokens with short fine-tuning, while reporting a modest cost on some original-length tasks.[5] The representation has gained range by spending resolution.

Short fine-tuning matters because the weights learned to interpret the old ruler. After interpolation, the same syntactic or retrieval pattern arrives with altered phases. Adaptation gives the network examples of the remapped relationship. Frequency-selective methods such as YaRN try to make this adjustment gentler: preserve more of the high-frequency behavior that supports local distinctions, while stretching the lower-frequency dimensions that need room to cover the longer span.

YaRN makes the exchange frequency-specific: keep high-frequency clocks closer to their original speeds, interpolate the slow clocks that would leave the useful global range, blend the middle, and correct the resulting attention scale. Its paper reported 128K extensions with far less fine-tuning data than the preceding recipes.[6] LongRoPE later searched for separate rescalings rather than prescribing one smooth schedule.[7]

This is not merely historical. Qwen's current documentation says Qwen3 was pretrained to 32,768 tokens and can be extended to 131,072 using RoPE scaling validated with YaRN. It also warns that static YaRN can hurt shorter inputs and recommends enabling it when long context is actually needed.[8] The warning is the whole trade-off in one deployment note: stretching the ruler changes the inches you already knew.

Nine years of teaching attention where it is

The timeline helped me see that the mathematics did not arrive after the engineering. The same structure kept being exposed one layer at a time.

Timeline of positional encoding engineering and its mathematical interpretation Two horizontal lanes from 2017 to 2026. The upper engineering lane marks sinusoidal encoding, RoPE, Position Interpolation and YaRN, LongRoPE, and DroPE. The lower mathematical lane marks Fourier clocks, the relative rotation law, phase-modulation analysis, and GRAPE's group-action framework. position engineering mathematical lens sinusoids addedto embeddings RoPE rotatesqueries and keys PI + YaRNrescale phases LongRoPE searchesper-clock scales DroPE trains withthe clocks, then drops them a Fourierfrequency bank translation becomesrotation phase-modulationanalysis GRAPE starts fromgroup actions 2017 2021 2023 2024 2026
The upper lane is what practitioners changed; the lower lane is the structure those changes exposed. Dates follow the original Transformer, RoFormer, PI, YaRN, LongRoPE, the DroPE release, the 2026 phase preprint, and ICLR 2026 GRAPE.[1][2][3][4][5][6][7][10]

An August 2026 survey now treats positional encoding and RoPE scaling as one continuous design problem, from absolute coordinates through relative biases to PI, YaRN, and LongRoPE. Its most useful warning is that a model accepting a nominal length is not proof that it can use that length reliably.[9]

GRAPE starts from the group

GRAPE, published at ICLR 2026, reverses the usual order of explanation. Instead of inventing a positional formula and later noticing its symmetries, it begins with a group action.[3]

That reversal is similar to designing a bridge from load-bearing principles instead of drawing a shape and checking afterward whether it stands. First decide what positions are allowed to do when they compose. Then choose a family of transformations that obeys those rules. RoPE becomes one answer inside the family rather than an isolated clever trick.

Its multiplicative version writes position as

\[ G(n)=\exp(n\omega L), \]

The notation is denser than the idea. The matrix \(L\) is a generator: it specifies the instantaneous direction of a tiny motion, much as velocity specifies how a location begins to change. The matrix exponential accumulates that tiny motion into a finite transformation at position \(n\). Requiring \(L^\top=-L\)—skew symmetry—ensures that the accumulated transformation is a norm-preserving rotation in \(SO(d)\). In two dimensions, the familiar generator is the quarter-turn pattern with zeros on the diagonal and opposite signs off it.

Because every position is produced from the same generator, consecutive motions compose cleanly:

\[ G(m+n)=G(m)G(n) \]

This again supplies the exact relative law. Standard RoPE appears when the generators rotate the canonical coordinate pairs independently and the frequencies follow the familiar log-spaced spectrum. GRAPE can instead learn the planes, or couple subspaces more richly.

The framework also has an additive branch. By lifting vectors into a slightly larger space and using unipotent transformations, it recovers linear attention biases such as ALiBi as another kind of group action. That is the part I find most convincing. RoPE and ALiBi look like unrelated choices in a library dropdown—one rotates vectors, the other adds a distance penalty—but both can be organized by asking the same questions: what group describes position, how does it act, and which quantities should remain unchanged?

ALiBi is easier to picture before the larger-space construction: it subtracts a head-dependent penalty that grows with distance, nudging attention toward nearer keys. A rotation and a linear penalty seem to belong to different mathematical species. The lifting argument shows that both can arise from transformations representing translation; one changes orientations multiplicatively, while the other appears as an additive bias after an extra coordinate is introduced. “Unipotent” describes the resulting shear-like matrices, but the narrative is simple: enlarge the stage and addition can be expressed as a linear action too.

This is why I do not think the group-theory reading is decorative. It generated a design space.

Then DroPE removes the group action

In January 2026, Sakana AI announced DroPE, and the punchline sounded almost rude after all this algebra: train with positional embeddings, then take them away.[10]

At first this seems contradictory. If rotations provide the ruler that attention lacks, removing them should make the model less capable, not more. The contradiction dissolves once we separate two jobs: helping a network learn during optimization and constraining how the finished network behaves at inference. The best scaffold for constructing something need not remain part of the completed structure.

The paper's argument has three parts. First, explicit position creates a powerful inductive bias during training. A RoPE model begins with non-uniform, displacement-sensitive attention, while a NoPE model has to discover useful positional behavior through the causal mask and data. Second, the learned reliance on fixed phases becomes a liability when inference moves far beyond the training length. Third, after pretraining has already taught the network language and order, a short recalibration at the original context length can remove RoPE without erasing those abilities.

Think back to the causal mask. It already distinguishes earlier from later and creates different computational histories at different positions. During pretraining, RoPE makes useful distance patterns cheap to discover; the model does not have to infer them all from that asymmetry. By the end of training, however, many layers have internalized patterns about syntax, recurrence, and retrieval. DroPE asks whether those learned circuits can keep working after the explicit phase rotation is removed and the weights are briefly adjusted to the new attention geometry.

\[ \underbrace{\text{RoPE}}_{\text{training scaffold}} \longrightarrow \underbrace{\text{short recalibration}}_{\text{remove the rotations}} \longrightarrow \underbrace{\text{NoPE inference}}_{\text{no unseen phases}} \]

The short recalibration step is why “drop” should not be read as deleting RoPE from an arbitrary checkpoint and expecting a miracle. Removing the rotations changes every query-key score. Recalibration lets the model absorb that intervention while examples are still within the length regime it knows. Once the fixed periodic map is gone, inference no longer feeds the network phase combinations beyond that map's training range—although all the other difficulties of long-context reasoning remain.

In the authors' experiments, this produced zero-shot extension beyond the pretrained sequence length without long-context fine-tuning, across models up to 7B parameters. It is evidence for a fascinating distinction, not a funeral for RoPE. Qwen's deployed recipe scales the representation; GRAPE generalizes it; DroPE removes it after using it to make optimization easier. All three can be sensible because they solve different parts of the problem.

The question I ended up with is better than the one I started with:

Does an LLM need geometry to learn order, only to eventually outgrow that same geometry?

What this story does not say

It does not say every LLM uses RoPE. Learned absolute embeddings, relative biases, ALiBi, hybrids, and NoPE models all exist. The title applies most literally to the large family of RoPE-based models.

It does not say the whole Transformer is translation-equivariant. The positional part of a RoPE attention logit obeys an exact relative law. The causal boundary, changing token content, finite windows, and the rest of the network break the clean symmetry in useful ways.

It does not say periodic clocks make two distant positions automatically identical. One frequency wraps; the bank combines many frequencies; content vectors change too. “Aliasing” is a lens on a failure mechanism, not a substitute for evaluating retrieval, perplexity, reasoning, and short-context retention at the claimed length.

And it does not say changing RoPE is sufficient to create a long-context model. Attention cost, KV-cache memory, long-sequence training data, optimization, and whether the model learned to use distant evidence remain separate problems. Increasing max_position_embeddings can make an input fit without making its last token matter.

The geometry was doing work

I began with two sentences containing the same words in a different order. The first answer is that attention needs some source of order. The more interesting answer is what RoPE chooses that source to be.

It does not label token 137 with an arbitrary name. It says: move 137 steps through the translation group, compose the corresponding rotation 137 times, and let every query-key comparison reduce the two journeys to their difference. In complex coordinates, it asks a bank of Fourier characters how far apart the tokens are.

That is an astonishing amount of mathematics for a few sines and cosines in a model implementation.

It also explains the long-context problem more honestly. The model has learned to read from several periodic clocks. We can slow all of them, slow some of them, search for better clocks, learn a larger family of group actions, or—after they have taught the model how to read—take the clocks off the wall.

So yes: every time a RoPE-based LLM reads a sentence, it does group theory. The open question is how long that particular representation of space should remain in the room.

References and links

  1. A. Vaswani et al., “Attention Is All You Need”, NeurIPS, 2017. Section 3.5 introduces the fixed sinusoidal positional encoding.
  2. J. Su, Y. Lu, S. Pan, A. Murtadha, B. Wen, and Y. Liu, “RoFormer: Enhanced Transformer with Rotary Position Embedding”, first posted 2021, revised 2023. Equations 12–16 give the complex and block-rotation forms and the relative-position identity.
  3. Y. Zhang et al., “Group Representational Position Encoding”, ICLR 2026. GRAPE derives multiplicative and additive positional mechanisms from group actions and recovers RoPE and ALiBi as special cases.
  4. F. Liu, “Rotary Positional Embeddings as Phase Modulation: Theoretical Bounds on the RoPE Base for Long-Context Transformers”, arXiv preprint, February 2026. This is the source for the oscillator-bank, aliasing-like, depth, and numerical-precision analysis; it is a preprint rather than a settled universal bound on model behavior.
  5. S. Chen, S. Wong, L. Chen, and Y. Tian, “Extending Context Window of Large Language Models via Position Interpolation”, 2023.
  6. B. Peng, J. Quesnelle, H. Fan, and E. Shippole, “YaRN: Efficient Context Window Extension of Large Language Models”, 2023; revised 2026.
  7. Y. Ding et al., “LongRoPE: Extending LLM Context Window Beyond 2 Million Tokens”, 2024.
  8. Qwen Team, “Enabling Long Context”, Qwen documentation. The page documents Qwen3's 32,768-token pretraining length, 131,072-token YaRN configuration, and the short-context warning for static YaRN; accessed 15 September 2026.
  9. J. Li, “Position Encoding in Transformers: From Absolute and Relative Methods to Rotary Position Embeddings and Long-Context Scaling”, arXiv preprint, August 2026.
  10. Y. Gelberg, K. Eguchi, T. Akiba, and E. Cetin, “Extending the Context of Pretrained LLMs by Dropping Their Positional Embeddings”, arXiv preprint, December 2025; Sakana AI's January 2026 release includes the paper, interactive site, and code.

All diagrams are schematic explanations drawn for this article. The oscillator plot illustrates relative rates rather than the exact frequencies of a particular checkpoint. Product context lengths and recommendations are stated as documented by their authors and should not be read as independent benchmark verification.