arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2411.07176cs.CLcs.AIcs.LG
收藏

具有负权重的更具表达力的注意力机制

More Expressive Attention with Negative Weights

Renmin University of China(中国人民大学);Machine Learning Platform Department, Tencent(腾讯机器学习平台部);University of Science and Technology of China(中国科学技术大学)

Ang Lv, Ruobing Xie, Shuaipeng Li, Jiayi Liao, Xingwu Sun, Zhanhui Kang, Di Wang, Rui Yan

AI总结:

提出允许负权重的Cog Attention机制,通过增强参数灵活性和防止过度挤压提升模型表达能力与鲁棒性,在语言建模和图像生成任务中表现优于传统softmax注意力。

摘要:

我们提出了一种名为Cog Attention的新型注意力机制,允许注意力权重为负值以增强表达能力,这源于两个关键因素:(1)Cog Attention增强了参数灵活性。例如,传统的softmax注意力头使用静态输出值(OV)矩阵来删除或复制头所关注的输入,而Cog Attention则自然地学会使用动态查询-键(QK)内积的符号来表示这些操作。这使得Cog Attention能够在单个头内同时执行多个操作。同时,Cog Attention的OV矩阵可以更多地专注于细化或修改。(2)Cog Attention通过防止早期token向后续位置的“过度挤压”,增强了模型对表征坍缩的鲁棒性。我们开发了使用Cog Attention作为注意力模块的类Transformer模型,包括用于语言建模的各种规模的decoder-only模型和用于图像生成的U-ViT扩散模型。实验表明,使用Cog Attention的模型相比使用传统softmax注意力模块的模型展现出更优的性能。我们的方法为重新思考和打破传统softmax注意力的固有约束(如非负权重的要求)指明了一个有前景的研究方向。

英文摘要:

We propose a novel attention mechanism, named Cog Attention, that enables attention weights to be negative for enhanced expressiveness, which stems from two key factors: (1) Cog Attention enhances parameter flexibility. For example, unlike traditional softmax attention heads that use a static output-value (OV) matrix to delete or copy inputs that the heads attend to, Cog Attention naturally learns to use the sign of dynamic query-key (QK) inner products to represent these operations. This enables Cog Attention to perform multiple operations simultaneously within a single head. Meanwhile, Cog Attention's OV matrix can focus more on refinement or modification. (2) Cog Attention enhances the model's robustness against representational collapse by preventing the ``over-squashing'' of earlier tokens into later positions. We develop Transformer-like models which use Cog Attention as attention modules, including decoder-only models at various scales for language modeling and U-ViT diffusion models for image generation. Experiments show that models using Cog Attention exhibit superior performance compared to those employing traditional softmax attention modules. Our approach suggests a promising research direction for rethinking and breaking the entrenched constraints of traditional softmax attention, such as the requirement for non-negative weights.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑