arXiv:2410.14581cs.LGcs.AI2024-10被引 10

用镜像下降优化注意力,实现更优的关键词选择与泛化性能

Optimizing Attention with Mirror Descent: Generalized Max-Margin Token Selection

  • 采用基于ℓ_p范数的镜像下降算法优化注意力机制
  • 收敛方向等价于带ℓ_p目标的广义硬间隔SVM,提升分类效果
  • 实测表明比传统梯度下降更擅长挑选关键信息,适合高精度任务

注意力机制在自然语言处理和计算机视觉等领域广泛应用,使模型能聚焦输入中的关键部分。尽管已有研究揭示了梯度下降(GD)在注意力模型中的优化动态与解的结构特性,但对更一般的镜像下降(MD)算法了解较少。本文研究了一类专用于softmax注意力机制的MD算法,其势函数为ℓ_p范数的p次幂。结果表明,当应用于分类任务时,该算法的方向收敛至一个具有ℓ_p范数目标的广义硬间隔SVM。理论分析显示,尽管问题高度非线性和非凸,其收敛速度仍与简单模型中的传统GD相当。进一步分析了键-查询矩阵与解码器的联合优化动态,给出了它们分别收敛至各自硬间隔SVM解的条件。最后,真实数据上的数值实验验证了MD算法在泛化能力和最优令牌选择方面优于标准GD。

原文摘要 · Abstract (English)

Attention mechanisms have revolutionized several domains of artificial intelligence, such as natural language processing and computer vision, by enabling models to selectively focus on relevant parts of the input data. While recent work has characterized the optimization dynamics of gradient descent (GD) in attention-based models and the structural properties of its preferred solutions, less is known about more general optimization algorithms such as mirror descent (MD). In this paper, we investigate the convergence properties and implicit biases of a family of MD algorithms tailored for softmax attention mechanisms, with the potential function chosen as the $p$-th power of the $\ell_p$-norm. Specifically, we show that these algorithms converge in direction to a generalized hard-margin SVM with an $\ell_p$-norm objective when applied to a classification problem using a softmax attention model. Notably, our theoretical results reveal that the convergence rate is comparable to that of traditional GD in simpler models, despite the highly nonlinear and nonconvex nature of the present problem. Additionally, we delve into the joint optimization dynamics of the key-query matrix and the decoder, establishing conditions under which this complex joint optimization converges to their respective hard-margin SVM solutions. Lastly, our numerical experiments on real data demonstrate that MD algorithms improve generalization over standard GD and excel in optimal token selection.

注意力机制镜像下降泛化能力令牌选择

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。