Hacker News

Favorites Setup
Understanding Positional Embeddings in Modern LLMs (magazine.sebastianraschka.com)
2026-11-15 Sun | 140 points by vismit2000 | original
[−]programjames · 2026-11-15 Sun 16:08 UTC · link
This article is only about understanding the implementation of positional embeddings, but to really understand positional embeddings you have to understand the theory. Positional embeddings are group representations. This is how you find them, and this is also how you parameterize them to make them differentiable/learnable. To give a few examples:

1. Rotary positional embeddings are representations of the translation group. The n-dimensional translation group ℝⁿ is abelian, so its irreducible representations are all one-dimensional ρ: ℝⁿ → ℂ, specified by a momentum vector m: ρₘ(x) = exp(i⟨m, x⟩). You can get a multi-dimensional representation by choosing several m, which are your learnable parameters.

2. If you wanted RoPE embeddings to also preserve rotation (perhaps you have scenes viewed at arbitrary angles), you are looking for representations of the special Euclidean group. The irreducible representations in four dimensions are your familiar particles: electrons, protons, etc., and in general are parameterized by a momentum vector and a discrete spin vector. You would have to do some kind of annealing process to train the spin vector (or you could just make it constant).

3. If you want to do attention on quadtrees, well, what is the group? Suppose every node in the quadtree has local coordinates scaled to [0, 1]. Moving up/down/to a neighbor in the quadtree requires an affine transformation of the local coordinates, which compose, so we can label every node by its affine transformation to the root (x, d): y → x + 2⁻ᵈy, where x is the node's translation in the image and d is its depth in the tree. The finite-dimensional irreducible representations are parameterized by momentum vectors m as well as a modulus M and basis vectors {e₁, e₂, ..., eₖ} where k = ord₂(M) and look like ρₘ,ₑ(x, d) = DPᵈ where D is the diagonal matrix with entries Dⱼⱼ = exp(2πi⟨2ʲm, x⟩ / M) and P permutes the basis vectors.

[−]augment_me · 2026-11-15 Sun 17:07 UTC · link
I dont think the target audience for the blog is abstract algebra grad students

However would be good to add that the solution can be structural(like in NoPE), then you dont need explicit representations and it just falls out of your architecture.

[−]programjames · 2026-11-15 Sun 17:18 UTC · link
When I see a title "Understanding..." I assume it will be about understanding theory not implementation or the theory of implementation. When I see a title "Surveying..." or "Understanding Implementation..." I assume it will be about surveying the implementation of that theory. There was just a title mismatch so I felt it was prudent to fill in the gap in understanding the blog did not cover.

Also, I expect the target audience of the blog is ML researchers, since he goes into some of the math, and umm... the kind of ML researcher that is not at least aware of the basics of abstract algebra is closer to an alchemist than a researcher.

[−]monocasa · 2026-11-15 Sun 18:53 UTC · link
I think you're constraining your language to a specific academic dialect and misapplying to other circumstances.

I don't expect a blog post to use the same phrasing as an academic article in several regards, including what you've described.

[−]empiricus · 2026-11-15 Sun 18:50 UTC · link
At the quantum level, nature seems to use the half spin ireps, but I fail to see if they are useful for 2D images or maybe 3D shapes as inputs for LLMs. Any ideas?