Attention Is All You Need
Vaswani et al., 2017, Attention Is All You Need (Advances in Neural Information Processing Systems 30 (NIPS 2017))
Subscriber deck — free during early access
2 cards in “3.2.2 Multi-Head Attention” · whole deck
3.2.2 Multi-Head Attention
- What is multi-head attention?Project queries, keys and values \(h\) times with different learned matrices, run attention in parallel on each projection, concatenate and project again: \(\text{MultiHead}(Q, K, V) = \text{Concat}(\text{head}_1, \ldots, \text{head}_h) W^O\), \(\text{head}_i = \text{Attention}(Q W_i^Q, K W_i^K, V W_i^V)\).
- Vaswani et al., 2017, Attention Is All You Need (Advances in Neural Information Processing Systems 30 (NIPS 2017)), §3.2.2
- Why use several attention heads, and what does it cost?Heads can jointly attend to information from different representation subspaces at different positions; a single head averages them. With \(h = 8\) and \(d_k = d_v = d_{\text{model}}/h = 64\), the total cost is similar to single-head attention with full dimensionality.
- Vaswani et al., 2017, Attention Is All You Need (Advances in Neural Information Processing Systems 30 (NIPS 2017)), §3.2.2
Source
- Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser and Illia Polosukhin. 2017. Attention Is All You Need. In Advances in Neural Information Processing Systems 30 (NIPS 2017). https://papers.nips.cc/paper/2017/hash/3f5ee243547dee91fbd053c1c4a845aa-Abstract.html