Why is self-attention permutation-equivariant without positional information?

Last updated 22 November 2026

  • Attention weights depend only on token contents, not indices, so Attn(PX) = P·Attn(X) for any permutation P. Shuffling inputs just shuffles outputs.

  • FFN, LayerNorm and residuals act per token, so the whole stack is equivariant. After pooling, "dog bites man" looks identical to "man bites dog".

  • The fix is to inject position: absolute encodings (sinusoidal or learned) or relative methods like RoPE and ALiBi that modify the attention scores.

  • https://huggingface.co/blog/designing-positional-encoding
  • https://mbrenndoerfer.com/writing/position-problem-self-attention-word-order
  • https://www.emergentmind.com/topics/permutation-invariant-self-attention
All Transformers interview questions