Rúben GalvãoThe Rabbit Hole

The Rabbit Hole / AI and machine learning / Language models / Giving tokens a sense of position

NoPE: attention with no position information at all

No positional embeddings (NoPE) removes explicit position information. Can attention still keep track of the order of the text?

Partial RoPE left some coordinates without position. What if a whole layer had none?

Without positions, “the bat chased the moth” and “the moth chased the bat” contain the same tokens. Would the layer even know which came first?

The mask already counts

In a language model, each column may only read itself and the columns before it. So the first column reads one token, and the fifth reads five.

The causal mask tells each column how many tokens it can readA causal mask for the sentence "the bat chased the moth": the first column reads one token, the fifth reads five. With attention spread evenly, the first token's share falls from 1 to one fifth.readsthebatchasedthemothshare for the first “the”the1bat1/2chased1/3the1/4moth1/5
Each row is one column reading. With no positions, a column can still count what it may read: spread evenly, the first token's share is 1, ½, ⅓, ¼, ⅕.

That difference is enough. Spread attention evenly, and the share a column gives the first token tells it how far along it is.

Order shows too. “bat” in “the bat chased” reads different words from “moth” in “the moth chased”, so the columns come out different, and later layers can tell the sentences apart.

A layer with no position encoding is called NoPE.

Why leave position out?

RoPE’s angles go wrong past the training length, and distance weakens even perfect matches. A NoPE layer has neither problem: it can read the whole text with nothing to stretch.

Nearby order still matters, so most models mix the two.

Where four models use layers without position encodingLlama 4: 36 RoPE + 12 NoPE. Command A: 48 RoPE + 16 NoPE. SmolLM3: 27 RoPE + 9 NoPE. Jamba: 28 Mamba + 4 NoPE.Llama 436 RoPE +12 NoPECommand A48 RoPE +16 NoPESmolLM327 RoPE +9 NoPEJamba28 Mamba +4 NoPERoPENoPEMamba
Most models keep RoPE in the layers that read nearby text and drop it in the few that read everything. Jamba drops it entirely: its Mamba layers already read the text in order.

Llama 4 and Command A read nearby text with RoPE in three of every four layers, then read everything without positions in the fourth. Jamba leaves positions out entirely: its attention layers rely on Mamba layers that already read the text in order.

What are those layers that read in order? Next, state-space models.

Sources and assumptions

The mask figure assumes attention spread evenly over the visible tokens, the simplest pattern that shows the count. Real layers learn other patterns, and how they recover position is studied in the papers above. The layer figure shows the first eight layers of each model.

← Browse all subjectsBack to the beginning ↑