Practice free →
HomeClaudeaifoundationstransformer_attention › The per-layer complexity of self-attention is

The per-layer complexity of self-attention is

AO(k·n·d²) where k is the convolutional kernel size
BO(r·n·d) for a restricted-neighbourhood variant
CO(n²·d) in n the sequence length and d dimension
DO(n·d²) which equals the complexity for recurrent layers
Answer & Solution
Correct answer: C. O(n²·d) in n the sequence length and d dimension
Self-attention is O(n²·d): all pairs of positions multiplied by representation size. Recurrent layers are O(n·d²) — better when n < d but cannot be parallelised.
Solve this in the app — Claude practice & 24k+ MCQs →
Related questions