Gated Attention for Large Language Models: Non-linearity, Sparsity, and Attention-Sink-Free
Summary
Compares ~30 gating variants on 15B MoE (15A2B, 2.54B active) and 1.7B dense models trained on up to 3.5T tokens. A head-specific sigmoid gate after SDPA (G1) is best: MoE 400B-token Avg PPL 5.761 vs 6.026 baseline and MMLU 60.82 vs 58.79, beating parameter-matched KV-head/expert expansions. Gains come from non-linearity between low-rank Wv and Wo plus query-dependent sparse gates (mean score 0.116). First-token attention falls 46.7%→4.8%; YaRN-extended RULER at 128k is 58.82 vs 31.65. Gate also damps loss spikes and allows higher LR (8e-3) where the baseline diverges. Claims first attention-sink-free models.
- Venue
- arXiv / Qwen Team / Alibaba
- Purpose
- Test a simple post-SDPA sigmoid gate as an upgrade to softmax attention
- Scale
- 15B MoE (128 experts, top-8) and 1.7B dense; up to 3.5T tokens, seq 4096 then 32k+YaRN 128k; ~30 variants; RULER 4k–128k
- Time period
- 2025-05-10 (arXiv 2505.06708 v1). HF paper publishedAt 2025-05-10.
- Added
- Oct 1, 2026
- Research status
- done
From the source
- Published
- May 10, 2025
- arXiv categories
- cs.CL
- Citations
- 334 (37 influential)
- References
- 77
- Published in
- Neural Information Processing Systems
Abstract (from arXiv)
Gating mechanisms have been widely utilized, from early models like LSTMs and Highway Networks to recent state space models, linear attention, and also softmax attention. Yet, existing literature rarely examines the specific effects of gating. In this work, we conduct comprehensive experiments to systematically investigate gating-augmented softmax attention variants. Specifically, we perform a comprehensive comparison over 30 variants of 15B Mixture-of-Experts (MoE) models and 1.7B dense models trained on a 3.5 trillion token dataset. Our central finding is that a simple modification-applying a head-specific sigmoid gate after the Scaled Dot-Product Attention (SDPA)-consistently improves performance. This modification also enhances training stability, tolerates larger learning rates, and improves scaling properties. By comparing various gating positions and computational variants, we attribute this effectiveness to two key factors: (1) introducing non-linearity upon the low-rank mapping in the softmax attention, and (2) applying query-dependent sparse gating scores to modulate the SDPA output. Notably, we find this sparse gating mechanism mitigates 'attention sink' and enhances long-context extrapolation performance, and we also release related $\href{https://github.com/qiuzh20/gated_attention}{codes}$ and $\href{https://huggingface.co/QwQZh/gated_attention}{models}$ to facilitate future research.
Tags
Topics
attention, architecture, LLM pretraining
Research notes
- Primary: arxiv abs (cs.CL). License not stated on abs/HTML at check. Qwen Team/Alibaba with Edinburgh (Huang), Stanford (Wen), MIT (Yang), Tsinghua (S. Huang). Code https://github.com/qiuzh20/gated_attention (973 stars at check). HF paper page 11 upvotes; 10 linked models (unofficial) not copied into hf_* fields. Discord posted abs. Trains on an internal 3.5T mix; no new public corpus, so no datasets_local row. License field left blank per catalog convention.
Notes about this
- Note
Mixture-of-experts language models: where the work is (overview)
An overview of the 43 entries on mixture-of-experts models: the open releases, load balancing at extreme sparsity, expert design, training and serving, and what the collection lacks. Written by Claude Opus 5.5.
Cites, within this collection
Cited by, within this collection
Similar entries
- Thread Attention Drift in Speculative Decoding (drafter attention sink → recent tokens)
- Paper A Unified View of Attention and Residual Sinks: Outlier-Driven Rescaling is Essential for Transformer Training
- Paper Sparser, Faster, Lighter Transformer Language Models
- Paper Your Transformer Can Hold Two Thoughts at Once: Evidence of Linear Superposition in LLMs
- Paper Scaling Laws for Looped Mixture of Experts
- Paper Towards Physics of Multimodal Pretraining: Knowledge Flow, Modality Synergy, Early Unification, and Recipes