How do Performer / Linformer / linear attention reduce ?
hardAnswer
- Performer: replace with a positive-feature kernel φ(q)·φ(k) that lets you re-associate the matmul as — instead of .
- Linformer: project the sequence-length dimension of K, V from n to a small constant k → O(n * k * d).
- Trade-offs: approximation error, sometimes worse quality on long-range benchmarks vs full attention.
Check yourself — multiple choice
- Same as vanilla attention
- Kernel approximation (Performer) or low-rank projection (Linformer) → or O(n·k·d) but with approximation
- Removes softmax exactly
- No trade-offs
Performer / Linformer: kernel or low-rank tricks → linear-in-n attention with approx error.
#attention#efficient-attention#transformers
Practise Deep Learning
214 interview questions in this topic.
Related questions
- Why is standard self-attention O(n²) in sequence length?
- What is sparse / sliding-window attention?
- How do Longformer / BigBird combine sparse and global attention?
- What is Flash Attention?
- What is the KV cache in transformer inference?
- Attention is quadratic in sequence length. Why is FlashAttention still a major win without changing that?