What is Multi-head attention?
TechnicalML ENGINEER LLMMachine Learning EngineerAI EngineerGenAI DeveloperMulti-head attention is a mechanism in neural networks that allows the model to focus on different parts of the input simultaneously. It does this by using multiple attention heads, each learning to capture different aspects of the data. This enhances the model's ability to understand context and relationships within the input sequence.
Each head computes attention scores independently, which are then concatenated and linearly transformed. This approach improves representation learning and helps to mitigate the limitations of single attention mechanisms, such as information bottlenecks.