Definition
Multi-Head Attention extends the standard attention mechanism by running it multiple times in parallel with different learned linear projections. This enables the model to jointly attend to information from different positional subspaces at different positions. By capturing diverse relationships within the input sequence, such as syntactic and semantic dependencies, it significantly enhances the model’s ability to understand context. It is a foundational component of modern Large Language Models (LLMs) and vision transformers, providing robust feature extraction capabilities.
Summary
A mechanism in transformer models that allows the model to attend to information from different representation subspaces simultaneously.
Key Concepts
- Self-Attention
- Linear Projections
- Concatenation
Use Cases
- Natural Language Processing (NLP)
- Machine Translation
- Image Classification with Vision Transformers
Code Example
| |