Why is self-attention permutation-equivariant without positional information?
Last updated
Attention weights depend only on token contents, not indices, so
Attn(PX) = P·Attn(X)for any permutationP. 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.