Softmax函数
门控
计算机科学
人工智能
外推法
钥匙(锁)
任务(项目管理)
机器学习
机制(生物学)
特征(语言学)
缩放比例
架空(工程)
语言模型
简单(哲学)
模式识别(心理学)
语音识别
自然语言处理
安全性令牌
注意力网络
乙状窦函数
任务分析
国家(计算机科学)
作者
Qiu, Zihan,Wang, Zekun,Zheng Bo,Huang Ze-yu,Wen, Kaiyue,Yang Song-lin,Men Rui,Yu Le,Huang Fei,Huang, Suozhi,Liu, Dayiheng,Zhou, Jingren,Lin, Junyang
标识
DOI:10.48550/arxiv.2505.06708
摘要
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.
科研通智能强力驱动
Strongly Powered by AbleSci AI