Skip to content
nonconvexcard

Attention is permutation equivariant

ProofIntermediate⏱ 30 minDeep Learningattentionpermutationpositional encoding

Problem

Prove that Attention⁡\operatorname{Attention} applied to permuted inputs returns the permuted output, and deduce that a transformer without positional information computes a function of the input multiset. Verify that the MLP and normalisation sublayers do not break the symmetry.

Write a complete argument. Every inequality you use should be one you could state precisely.

Solution

Opening this before you have a real attempt on paper is the fastest way to feel like you understand something you cannot reproduce.

Related problems

All problems
SolvedProblemFieldTypeDifficultyTime
When does attention dominate the MLP?Deep LearningNumericalBeginner30 min
Implement multi-head attention from scratch runDeep LearningCodingIntermediate3 hours
The softmax Jacobian as a variance, and saturationDeep LearningProofIntermediate30 min
Why attention divides by the square root of d_kDeep LearningProofIntermediate30 min
Multi-head attention is a sum of low-rank mapsDeep LearningProofAdvanced30 min