Attention Mechanisms
PremiumFrom MHA / Causal / GQA to Attention Sink and Gated Attention, understand the design, flaws, and evolution of attention
Overview
Attention is the core of the Transformer. This series starts from the most basic Self-Attention. We first make clear the three forms you must master in practice: MHA, Causal Attention, and GQA. Then we reveal a counterintuitive phenomenon shared by all modern softmax-based LLMs, Attention Sink: why the first token absorbs the vast majority of attention, along with the mechanism, cost, and removal paths of this phenomenon. Finally we move into Gated Attention, an architectural change proposed by the Qwen team in 2025 that uses a single head-wise sigmoid gate to simultaneously address sink, low-rank collapse, and training stability.
After finishing this series, you should be able to answer:
- What problem each of MHA / Causal / GQA solves, and what cost each leaves behind
- Why softmax + causal inevitably produces attention sink, and what cost this phenomenon brings to the system
- Why GQA suffers "low-rank collapse" along the path, and why this point ultimately becomes the leverage point for Gated Attention
- What exactly a head-specific sigmoid gate added after the SDPA output is improving
Log in to continue reading
This is premium content. Please log in to access the full article.