What is: Multi-Head Attention?
Source | Attention Is All You Need |
Year | 2000 |
Data Source | CC BY-SA - https://paperswithcode.com |
Multi-head Attention is a module for attention mechanisms which runs through an attention mechanism several times in parallel. The independent attention outputs are then concatenated and linearly transformed into the expected dimension. Intuitively, multiple attention heads allows for attending to parts of the sequence differently (e.g. longer-term dependencies versus shorter-term dependencies).
Above are all learnable parameter matrices.
Note that scaled dot-product attention is most commonly used in this module, although in principle it can be swapped out for other types of attention mechanism.
Source: Lilian Weng