Skip to content

The Most Complete Breakdown of LLM Positional Encoding: Absolute, Relative, Rotary, and No Positional Encoding at All

About 3565 wordsAbout 12 min

positional-encodingtransformerllmhung-yi-lee

2026-07-22

Abstract: Transformer's Self-Attention itself does not perceive token order — shuffling the tokens of "the cat ate the fish" produces exactly the same Attention output. This article systematically traces the complete technical evolution of Positional Embedding: from the clock-hand analogy of Sinusoidal absolute positional encoding, to ALiBi and T5 relative positional biases, to the mathematical principles of RoPE (Rotary Position Embedding), and finally exploring Train Short Test Long extension methods and the "no positional encoding" NoPE/DroPE approaches.

Copyright Ownership: Kstheme, Contributors: Kstheme


01 A Basic Question: How Does Transformer Know the Order of Tokens?

The original Transformer has no way to consider the order of input. How does it process input tokens?

Input tokens become Embeddings, which then become inputs to a Layer. Each layer contains Self-Attention, which outputs another set of tokens.

But there's a problem: Self-Attention itself does not consider the order of input tokens.

If I swap the positions of Token A and Token C and compute Self-Attention again, you'll find that the output ODO_D is completely unaffected.

So we must find a way to "inject" positional information into the Transformer. This is what Positional Embedding solves.

This article covers:

  1. Absolute Positional Embedding (Sinusoidal)
  2. Relative Positional Embedding (ALiBi, T5)
  3. RoPE (Rotary Position Embedding)
  4. Train Short, Test Long (Position Interpolation, Frequency-Based Methods, YaRN, Dynamic Scaling, LongRoPE)
  5. No Positional Embedding (NoPE, DroPE)

02 Absolute Positional Embedding

The earliest Positional Embedding idea was straightforward: assign a special Embedding to each position. This Embedding represents positional information.

We use P0P_0 through P3P_3 to represent the special Embedding for each position, then add this Embedding to our vectors.

When tokens change order, their Embeddings become different, and the final Self-Attention output also differs.

Sinusoidal Positional Embedding

Reference: https://arxiv.org/abs/1706.03762

This Positional Embedding existed from the birth of the Transformer.

Let dd represent the length of the Embedding (d=128 or 256d = 128 \text{ or } 256).

We use p[i]\boldsymbol{p}[i] to represent its values.

How does Sinusoidal Position Embedding construct all Embeddings? The formula is:

pk[2i]=sin(k100002i/d)pk[2i+1]=cos(k100002i/d)\begin{align} \boldsymbol{p_k}[2i] &= \sin\left(\frac{k}{10000^{2i/d}}\right) \\ \boldsymbol{p_k}[2i+1] &= \cos\left(\frac{k}{10000^{2i/d}}\right) \end{align}

Visual Understanding

If we take p0[0]\boldsymbol{p_0}[0] through p49[0]\boldsymbol{p_{49}}[0], we'll see a Sine function.

Next, p0[1]\boldsymbol{p_0}[1] through p49[1]\boldsymbol{p_{49}}[1] form a Cosine function.

Next, p0[10]\boldsymbol{p_0}[10] through p49[10]\boldsymbol{p_{49}}[10] also form a Sine function, but with a larger period.

Plotting all Position Embeddings would look like this:

Clock Hand Analogy: Second Hand, Minute Hand, Hour Hand

We can view Sinusoidal Positional Embedding differently: even dimensions use Sine, odd dimensions use Cosine. So we can imagine each pair 2i2i and 2i+12i+1 as a 2D vector (a clock hand on a 2D plane). This hand rotates as kk increases — when kk rises, the hand rotates counterclockwise.

The rotation period is:

k100002i/d=2π\frac{k}{10000^{2i/d}} = 2\pi

The number of kk needed for one full rotation:

k=2π100002i/dk = 2\pi \cdot 10000^{2i/d}

If d=128d = 128, then i=0,...,d21=0,...,63i = 0, ..., \frac{d}{2} - 1 = 0, ..., 63.

Different ii values have different periods:

ii valuekk value
i=0i = 0 (dimensions 0, 1)6.3
i=32i = 32 (dimensions 64, 65)628.3
i=63i = 63 (dimensions 126, 127)54410.1

The first two dimensions rotate fastest — about 6.3 tokens per cycle. Dimensions 10-11 rotate more slowly. Dimensions 100-101 barely change within the first 6 tokens.

Every two dimensions form a hand. The fastest is the second hand, slower is the minute hand, slowest is the hour hand. With dimension 128, we have 64 hands. The Transformer uses these 64 hands and their positions to determine each token's location.

Using clock hands to represent position seems reasonable, but why did the authors choose this approach? Because they wanted Positional Embedding to handle Relative Position.


Relative Positioning is Crucial!

Relative Position means: in the sentence "the cat ate the fish," cat and fish are two tokens apart. When Transformer considers which token should follow fish, it looks back at cat. Fish's attention score for cat is 0.7.

If I insert many tokens before cat — say 1000 tokens — but the relative position between cat and fish remains unchanged, we want fish's attention on cat to remain unchanged. Even if fish is at position 1004 and cat at 1001, fish's attention score for cat remains 0.7.

But if cat is at position 1 and fish at position 1004 — very far apart — we want fish's attention score for cat to be small.

Sinusoidal Positional Embedding was chosen because it has special properties that help with Relative Position.

pk+r=Mrpk\boldsymbol{p_{k+r}} = M_r \boldsymbol{p_k}

Where pk\boldsymbol{p_k} represents position kk and pk+r\boldsymbol{p_{k+r}} represents position k+rk+r.

This formula is independent of kk — it only depends on the relative position between k+rk+r and kk:

p4=M3p1p14=M3p11p104=M3p101\begin{align} \boldsymbol{p_{4}} &= M_3 \boldsymbol{p_{1}} \\ \boldsymbol{p_{14}} &= M_3 \boldsymbol{p_{11}} \\ \boldsymbol{p_{104}} &= M_3 \boldsymbol{p_{101}} \end{align}

Let's examine how Sinusoidal Positional Embedding satisfies the Relative Position condition.

Position kk formula:

pk[2i]=sin(k100002i/d)pk[2i+1]=cos(k100002i/d)\begin{align} \boldsymbol{p_k}[2i] &= \sin\left(\frac{k}{10000^{2i/d}}\right) \\ \boldsymbol{p_k}[2i+1] &= \cos\left(\frac{k}{10000^{2i/d}}\right) \end{align}

Position k+rk+r formula:

pk+r[2i]=sin(k+r100002i/d)pk+r[2i+1]=cos(k+r100002i/d)\begin{align} \boldsymbol{p_{k+r}}[2i] &= \sin\left(\frac{k+r}{10000^{2i/d}}\right) \\ \boldsymbol{p_{k+r}}[2i+1] &= \cos\left(\frac{k+r}{10000^{2i/d}}\right) \end{align}

Using sine and cosine addition formulas:

sin(a+b)=sin(a)cos(b)+cos(a)sin(b)cos(a+b)=cos(a)cos(b)sin(a)sin(b)\begin{align} \sin(a+b) &= \sin(a)\cos(b) + \cos(a)\sin(b) \\ \cos(a+b) &= \cos(a)\cos(b) - \sin(a)\sin(b) \end{align}

Expand pk+r\boldsymbol{p_{k+r}}:

pk+r[2i]=sin(k+r100002i/d)=pk[2i]cos(r100002i/d)+pk[2i+1]sin(r100002i/d)\begin{align} \boldsymbol{p_{k+r}}[2i] &= \sin\left(\frac{k+r}{10000^{2i/d}}\right) \\ &= \boldsymbol{p_k}[2i] \cos\left(\frac{r}{10000^{2i/d}}\right) + \boldsymbol{p_k}[2i+1] \sin\left(\frac{r}{10000^{2i/d}}\right) \end{align}

pk+r[2i+1]=cos(k+r100002i/d)=pk[2i+1]cos(r100002i/d)pk[2i]sin(r100002i/d)\begin{align} \boldsymbol{p_{k+r}}[2i+1] &= \cos\left(\frac{k+r}{10000^{2i/d}}\right) \\ &= \boldsymbol{p_k}[2i+1] \cos\left(\frac{r}{10000^{2i/d}}\right) - \boldsymbol{p_k}[2i] \sin\left(\frac{r}{10000^{2i/d}}\right) \end{align}

In matrix form:

[pk+r[2i]pk+r[2i+1]]=[cos(r100002i/d)sin(r100002i/d)sin(r100002i/d)cos(r100002i/d)][pk[2i]pk[2i+1]]\begin{bmatrix} \boldsymbol{p_{k+r}}[2i] \\ \boldsymbol{p_{k+r}}[2i + 1] \end{bmatrix} = \begin{bmatrix} \cos\left(\frac{r}{10000^{2i/d}}\right) & \sin\left(\frac{r}{10000^{2i/d}}\right) \\ -\sin\left(\frac{r}{10000^{2i/d}}\right) & \cos\left(\frac{r}{10000^{2i/d}}\right) \end{bmatrix} \begin{bmatrix} \boldsymbol{p_{k}}[2i] \\ \boldsymbol{p_{k}}[2i + 1] \end{bmatrix}

The rotation matrix is denoted as Mr,iM_{r,i}.

How does this design affect Self-Attention? Using pnp_n and pmp_m for positions, the attention score aa is:

a=qBkA=(Wq(xB+pm))TWk(xA+pn)=xBWqTWkxA+xBTWqTWkpn+pmTWqTWkxA+pmTWqTWkpn\begin{align} a &= \boldsymbol{q_B} \cdot \boldsymbol{k_A} \\ &= (W_q (\boldsymbol{x_{B}} + \boldsymbol{p_m}))^T W_k (\boldsymbol{x_A} + \boldsymbol{p_n}) \\ &= \boldsymbol{x_{B}} W_q^T W_k \boldsymbol{x_A} + \boldsymbol{x_{B}}^T W_q^T W_k \boldsymbol{p_n} + \boldsymbol{p_m}^T W_q^T W_k \boldsymbol{x_A} + \boldsymbol{p_m}^T W_q^T W_k \boldsymbol{p_n} \end{align}

The term pmTWqTWkpn\boldsymbol{p_m}^T W_q^T W_k \boldsymbol{p_n} shows absolute position. Converting to relative position:

pmTWqTWkpn=(Mmnpn)TWqTWkpn=(pn)TMmnWqTWkpn\begin{align} \boldsymbol{p_m}^T W_q^T W_k \boldsymbol{p_n} &= (M_{m-n} \boldsymbol{p_n})^T W_q^T W_k \boldsymbol{p_n} \\ &= (\boldsymbol{p_n})^T M_{m-n} W_q^T W_k \boldsymbol{p_n} \end{align}

Where MmnM_{m-n} only depends on the relative position, but the overall formula still contains absolute position correlations.


03 Relative Positional Embedding

Since using Absolute Positional Embedding to achieve relative positioning is circuitous, a natural question arises: can we directly modify the Attention computation based on relative position?

ALiBi (Attention with Linear Biases)

Reference: https://arxiv.org/abs/2108.12409

ALiBi's approach: discard Positional Embedding entirely. Compute Attention scores without positional information, then subtract b(mn)b(m-n) — the relative distance between positions mm and nn. This makes Attention smaller for distant tokens. The constant bb is manually set and can differ per Attention Head.

ALiBi outperforms Sinusoidal methods across the board, especially on longer sequences.

T5's Learnable Relative Bias

Reference: https://arxiv.org/abs/1910.10683

T5 uses a learnable parameter for the bias bmnb_{m-n} instead of manually setting it. However, the hand-crafted ALiBi actually outperformed the trained T5 approach.

ALiBi eventually gave way to stronger methods, but its lesson remains: Relative Position matters greatly.

RoPE: Rotary Position Embedding

Reference: https://arxiv.org/abs/2104.09864

RoPE is one of today's most popular methods. Instead of adding a positional embedding, it applies a rotation to kk and qq vectors to encode positional information.

The Attention weight is then:

a=(kAn)TqBm=(kA)TRmnqBa = (\boldsymbol{k^n_A})^T \boldsymbol{q^m_B} = \boldsymbol{(k_A)}^T R_{m-n} \boldsymbol{q_B}

RmnR_{m-n} only depends on the relative position between A and B, directly encoding relative position into the attention computation.

Key advantage: It doesn't affect the Attention computation process itself — only qq and kk are modified, and the transformed kk can be stored in KV Cache.

Rotation as Position

Consider only the first two dimensions of kk and qq:

These two dimensions form a vector on a 2D plane.

Adding positional information means rotating this vector. To encode position nn, rotate the first two dimensions of kk by nθn\theta:

Similarly for qq, rotate by mθm\theta:

RoPE applies this rotation to every pair of dimensions:

Each pair of dimensions uses a different rotation angle nθin\theta_i, where:

θi=1100002i/d\theta_i = \frac{1}{10000^{2i/d}}

with i=0,1,...,d21i = 0, 1, ..., \frac{d}{2} - 1.

RoPE's Key Property: Relative Position Invariance

If we move kk from position nn to n+rn+r and qq from mm to m+rm+r, their relative position stays the same, and the Attention value remains unchanged:

kAnqBm=kAn+rqBm+r\boldsymbol{k^n_A} \cdot \boldsymbol{q^m_B} = \boldsymbol{k^{n+r}_A} \cdot \boldsymbol{q^{m+r}_B}

Suppose cat is at position 1 and fish at position 3. We add position 1 to cat's kk and position 3 to fish's kk. Fish gets its Query, adds position to get qB3\boldsymbol{q^3_B}, then computes attention aa with cat's kk.

Adding many tokens before cat and fish doesn't affect their Embeddings. If cat is at 101 and fish at 103, the attention value is identical to when cat was at 1 and fish at 3.

Why does RoPE achieve this? Comparing original kk and kk with position nn:

If kk is moved to position n+rn+r, it is rotated by (n+r)θ(n+r)\theta:

The angle between [kAn[0]kAn[1]]\begin{bmatrix} \boldsymbol{k^n_A}[0] \\ \boldsymbol{k^n_A}[1] \end{bmatrix} and [kAn+r[0]kAn+r[1]]\begin{bmatrix} \boldsymbol{k^{n+r}_A}[0] \\ \boldsymbol{k^{n+r}_A}[1] \end{bmatrix} is rθr\theta. Same for qB\boldsymbol{q_B}:

The dot product of [kAn[0]kAn[1]]\begin{bmatrix} \boldsymbol{k^n_A}[0] \\ \boldsymbol{k^n_A}[1] \end{bmatrix} and [qBm[0]qBm[1]]\begin{bmatrix} \boldsymbol{q^m_B}[0] \\ \boldsymbol{q^m_B}[1] \end{bmatrix} equals that of [kAn+r[0]kAn+r[1]]\begin{bmatrix} \boldsymbol{k^{n+r}_A}[0] \\ \boldsymbol{k^{n+r}_A}[1] \end{bmatrix} and [qBm+r[0]qBm+r[1]]\begin{bmatrix} \boldsymbol{q^{m+r}_B}[0] \\ \boldsymbol{q^{m+r}_B}[1] \end{bmatrix}, because equal rotation doesn't change the inner product.

RoPE Mathematical Derivation

Let's examine why RoPE only depends on the relative position of kk and qq, using the first two dimensions.

Rotating kk by nθn\theta:

[kAn[0]kAn[1]]=[cos(nθ)sin(nθ)sin(nθ)cos(nθ)][kA[0]kA[1]]\begin{bmatrix} \boldsymbol{k^n_A}[0] \\ \boldsymbol{k^n_A}[1] \end{bmatrix}= \begin{bmatrix} \cos(n\theta) & -\sin(n\theta) \\ \sin(n\theta) & \cos(n\theta) \end{bmatrix} \begin{bmatrix} \boldsymbol{k_A}[0] \\ \boldsymbol{k_A}[1] \end{bmatrix}

Rotating qq by mθm\theta:

[qBm[0]qBm[1]]=[cos(mθ)sin(mθ)sin(mθ)cos(mθ)][qB[0]qB[1]]\begin{bmatrix} \boldsymbol{q^m_B}[0] \\ \boldsymbol{q^m_B}[1] \end{bmatrix}= \begin{bmatrix} \cos(m\theta) & -\sin(m\theta) \\ \sin(m\theta) & \cos(m\theta) \end{bmatrix} \begin{bmatrix} \boldsymbol{q_B}[0] \\ \boldsymbol{q_B}[1] \end{bmatrix}

Computing the dot product:

[kAn[0]kAn[1]][qBm[0]qBm[1]]=[kA[0]kA[1]] ⁣T[cos(nθ)sin(nθ)sin(nθ)cos(nθ)] ⁣T[cos(mθ)sin(mθ)sin(mθ)cos(mθ)][qB[0]qB[1]]=[kA[0]kA[1]] ⁣T[cos((mn)θ)sin((mn)θ)sin((mn)θ)cos((mn)θ)][qB[0]qB[1]]\begin{align} \begin{bmatrix} \boldsymbol{k^n_A}[0] \\ \boldsymbol{k^n_A}[1] \end{bmatrix} \cdot \begin{bmatrix} \boldsymbol{q^m_B}[0] \\ \boldsymbol{q^m_B}[1] \end{bmatrix} &= \begin{bmatrix} \boldsymbol{k_A}[0] \\ \boldsymbol{k_A}[1] \end{bmatrix}^{\!T} \begin{bmatrix} \cos(n\theta) & -\sin(n\theta) \\ \sin(n\theta) & \cos(n\theta) \end{bmatrix}^{\!T} \begin{bmatrix} \cos(m\theta) & -\sin(m\theta) \\ \sin(m\theta) & \cos(m\theta) \end{bmatrix} \begin{bmatrix} \boldsymbol{q_B}[0] \\ \boldsymbol{q_B}[1] \end{bmatrix} \\[1em] &= \begin{bmatrix} \boldsymbol{k_A}[0] \\ \boldsymbol{k_A}[1] \end{bmatrix}^{\!T} \begin{bmatrix} \cos((m-n)\theta) & -\sin((m-n)\theta) \\ \sin((m-n)\theta) & \cos((m-n)\theta) \end{bmatrix} \begin{bmatrix} \boldsymbol{q_B}[0] \\ \boldsymbol{q_B}[1] \end{bmatrix} \end{align}

The rotation matrices combine: nθ-n\theta (transpose) +mθ=(mn)θ+ m\theta = (m-n)\theta.

Replacing kAn\boldsymbol{k^n_A} with kAn+r\boldsymbol{k^{n+r}_A} and qBm\boldsymbol{q^m_B} with qBm+r\boldsymbol{q^{m+r}_B}:

[kAn+r[0]kAn+r[1]][qBm+r[0]qBm+r[1]]=[kA[0]kA[1]] ⁣T[cos(((m+r)(n+r))θ)sin(((m+r)(n+r))θ)sin(((m+r)(n+r))θ)cos(((m+r)(n+r))θ)][qB[0]qB[1]]\begin{align} \begin{bmatrix} \boldsymbol{k^{n+r}_A}[0] \\ \boldsymbol{k^{n+r}_A}[1] \end{bmatrix} \cdot \begin{bmatrix} \boldsymbol{q^{m+r}_B}[0] \\ \boldsymbol{q^{m+r}_B}[1] \end{bmatrix} &= \begin{bmatrix} \boldsymbol{k_A}[0] \\ \boldsymbol{k_A}[1] \end{bmatrix}^{\!T} \begin{bmatrix} \cos(((m+r)-(n+r))\theta) & -\sin(((m+r)-(n+r))\theta) \\ \sin(((m+r)-(n+r))\theta) & \cos(((m+r)-(n+r))\theta) \end{bmatrix} \begin{bmatrix} \boldsymbol{q_B}[0] \\ \boldsymbol{q_B}[1] \end{bmatrix} \end{align}

Since ((m+r)(n+r))θ=(mn)θ((m+r)-(n+r))\theta = (m-n)\theta, the result is identical — confirming relative position invariance.

RoPE Implementation Details

RoPE rotates kk and qq separately before computing Attention:

This is equivalent to multiplying qq by RmnR_{m-n}, computing only qq's rotation:

In practice, the first approach is preferred. With the first method, both position-encoded kk and qq can be stored in KV Cache. With the second, qq would need to multiply by different RmnR_{m-n} each time. RoPE's compatibility with KV Cache is key to its popularity.

RoPE vs ALiBi: An Important Distinction

Many misunderstand RoPE — thinking like ALiBi, farther kk and qq have smaller Attention weights. But RoPE does not guarantee this.

This isn't necessarily a weakness. RoPE can do something ALiBi cannot: skip intermediate tokens to attend directly to earlier ones. In ALiBi, farther tokens always have smaller attention. With RoPE, rotation angles can bring certain positions into alignment regardless of distance.

For example, "my cat" and "his dog" — "cat" should attend to "my" and "dog" to "his," not to the middle word "the." RoPE enables this nuanced attention.

If qq and kk differ by 2θ2\theta, but qq at n+1n+1 and kk at nn differ by just θ\theta, and qq at n+2n+2 and kk at nn might have the same angle — attention scores can actually increase despite greater distance, allowing the model to skip intermediate tokens.


04 Train Short, Test Long

Reference: https://amaarora.github.io/posts/2025-09-21-rope-context-extension.html

Can we train on short sequences but handle very long sequences during testing without failure?

This is crucial for Agents that need to run indefinitely with very large context windows.

During training, we may not have very long corpora. The goal is positional encoding that supports Train Short, Test Long.

Intuitively, during training we only see NN tokens with positions 1,2,...,N1, 2, ..., N.

When testing with LNLN tokens, can we just assign positions up to LNLN?

Can RoPE handle this? It seems not.

(From: https://arxiv.org/abs/2108.12409)

When testing with very long sequences:

  • Sinusoidal: fails immediately on longer sequences.
  • RoPE: slightly better than Sinusoidal, but also degrades with length.
  • ALiBi: the only one that holds up, because it uses hand-crafted rather than learned parameters — proving surprisingly robust.

Why Does RoPE Fail on Long Sequences?

During training, the maximum rotation angle seen is NθN\theta. Testing at 2Nθ2N\theta presents an angle the model has never seen, and RoPE "freaks out."

Position Interpolation

References:

Solution: don't assign rotation angles beyond NN.

With LNLN tokens, position numbers don't have to be 11 to LNLN — they can be 1L\frac{1}{L} to NN:

This is Position Interpolation, though it still requires fine-tuning.

Frequency-Based Approach

RoPE processes dimensions in pairs, and Position Interpolation treats all dimensions identically. Frequency-Based Approach asks: can different dimensions be treated differently?

When extending from NN to LNLN, can we multiply by a function that depends on both the extension factor and the dimension?

Principle: θ0\theta_0 is high-frequency, larger ii means lower frequency. High-frequency vectors can stay unchanged; low-frequency vectors need compression.

Every two dimensions form a rotating pointer. For the first two dimensions, the pointer rotates very fast. With N=128N=128, θ0\theta_0 may have seen the entire plane many times over, while θ32\theta_{32} has barely covered 1/4.

For θ0\theta_0, positions beyond NN are fine — it's seen it all. But for θ32\theta_{32}, extending NN to 256 means encountering an unseen rotation angle.

NTK-aware Scaling

f(L,i)=(1L)2id2f(L, i) = \left(\frac{1}{L}\right)^{\frac{2i}{d-2}}

Meaning:

  • i=0i=0: f(L,0)=1f(L,0)=1, no compression at highest frequency.
  • i=d21i=\frac{d}{2}-1: f(L,d21)=1Lf(L, \frac{d}{2}-1)=\frac{1}{L}, maximum compression at lowest frequency.

Reference: https://www.reddit.com/r/LocalLLaMA/comments/14lz7j5/ntkaware_scaled_rope_allows_llama_models_to_have/

YaRN

YaRN (Yet another RoPE extensionN method). Reference: https://arxiv.org/abs/2309.00071

Keep some low-frequency scaling unchanged, keep some high-frequency scaling unchanged, only modify the middle frequencies.

Dynamic Scaling

Previous methods handle long sequences, but performance on short sequences may degrade.

Reference: https://www.reddit.com/r/LocalLLaMA/comments/14mrgpr/dynamically_scaled_rope_further_increases/

Dynamic Scaling: use different treatments for different sequence lengths. For short sequences, don't modify — performance stays good since training saw these lengths.

One variant: don't modify positions at the beginning of the sequence, only apply scaling after a certain proportion.

Dynamic Scaling combined with Position Interpolation or NTK outperforms both alone.

Frequency-Based + Dynamic: LongRoPE

Frequency-Based determines the compression function; Dynamic Scaling determines where compression begins. LongRoPE uses Evolutionary Search to find optimal strategies.

Reference: https://arxiv.org/abs/2402.13753

This achieves remarkable results — models handling up to 2048K input length.


05 No Positional Embedding?!

Does Self-Attention Really Have No Positional Information?

Single-layer Self-Attention has no positional information. But multi-layer Self-Attention is different.

The first layer captures relationships between tokens. The second layer sees these relationships embedded — "cat relates to 'ate'" and "fish relates to 'ate'" produce different representations. So "cat ate fish" and "fish ate cat" yield different final Embeddings even without Positional Embedding.

NoPE: No Positional Embedding

Reference: https://arxiv.org/pdf/2305.19466

Experiments show that No Position Embedding works surprisingly well. On Copy tasks, models with Positional Embedding degraded on long sequences, while NoPE maintained high accuracy.

However, comparing RoPE vs NoPE during training — NoPE underperforms RoPE.

We need Positional Embedding because it helps during training.

DroPE: Dropping Positional Embedding Late in Training

Start training with Positional Embedding, then remove it near the end. Loss spikes briefly but recovers quickly. Training without Position Embedding can match RoPE's loss.

DroPE outperforms RoPE + YaRN on extended contexts. Training at 2K context, then removing positional embedding enables good performance at inference contexts far beyond 2K.

Reference: https://arxiv.org/pdf/2512.12167


References

  1. Sinusoidal Positional Embedding (Original Transformer)
  2. ALiBi (Attention with Linear Biases)
  3. T5 (Text-to-Text Transfer Transformer)
  4. RoPE (Rotary Position Embedding)
  5. Train Short Test Long (RoPE Context Extension Survey)
  6. Position Interpolation
  7. Position Interpolation (Kaiokendev blog)
  8. NTK-aware Scaling
  9. YaRN
  10. Dynamic Scaling
  11. LongRoPE
  12. NoPE
  13. DroPE