Raschka publishes long explainer on positional embeddings and RoPE in LLMs
Sebastian Raschka published a long article on LLM positional embeddings on Substack, using diagrams, math derivations and a small PyTorch implementation to explain the difference between GPT-2-style absolute position vectors and RoPE, rotary positional encoding that adjusts attention by relative distance. The article's core conclusion is that RoPE remains the most common positional encoding among current open-weight models, and that from 2025 to 2026 partial RoPE, which rotates only some dimensions, went from a minority approach to the majority. It also notes a few exceptions: Inkling borrows from T5 and adds a learnable relative position bias to attention scores before the softmax, while NoPE-RoPE-style architectures omit RoPE in some layers. The article targets readers with basic architecture knowledge; the author says the content is technical and too detailed for some, and positions it as follow-up reading to his Build a Large Language Model (From Scratch).
The Transformer's attention mechanism does not distinguish word order by itself: to it, "the red fox jumps over the gray fox" and "the gray fox jumps over the red fox" are the same bag of words. The model therefore has to inject position information separately. Early GPT models added a position vector to each word vector at the input layer, while modern models mostly rotate query and key vectors with RoPE inside attention, so that attention scores depend only on the relative distance between two words.
For developers choosing or fine-tuning models, the practical takeaway is this: when reading the architecture diagram of an open-weight model, the positional encoding slot will most likely still be RoPE, and partial RoPE has become mainstream, which means common practices and tuning experience for long-context extrapolation can largely carry over. For models such as Inkling that add a bias to attention scores, or that skip RoPE in some layers, long-text performance needs to be reassessed under the new structure.
On Hacker News, a commenter (programjames) argued that the article covers only implementation and not theory, and maintained that positional encoding is essentially a group representation, with RoPE corresponding to a representation of the translation group, and that this is the path to deriving and parameterising learnable positional encodings. This is the commenter's personal view; the article itself does not develop this perspective.