arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.23819cs.LG
收藏

权重衰减诱导低秩注意力层

Weight decay induces low-rank attention layers

ETH Zürich(苏黎世联邦理工学院);Google(谷歌公司)

Seijin Kobayashi, Yassir Akram, Johannes Von Oswald

AI总结:

该研究揭示权重衰减与L2正则化会使注意力层的矩阵乘积趋于低秩,补充了L2正则化与低秩正则化的关联理论,并通过实验验证解耦注意力层权重衰减可提升语言模型性能。

摘要:

人们对训练深度神经网络时权重衰减等正则化项的作用尚未充分理解。本文研究了训练参数矩阵以乘法方式交互的神经网络模型时,权重衰减以及$L_2$正则化的影响。这种参数化方式是Transformer的核心组件——注意力层的常见形式,因此该组合尤为值得关注:在注意力层中,键-查询参数矩阵以及值投影参数矩阵会直接相乘,即$W_K^TW_Q$和$PW_V$。本文拓展了已有研究结果,一方面证明形如$L(AB^\top) + λ(\|A\|^2 + \|B\|^2)$的$L_2$正则化损失的任意局部最小值,与核范数正则化损失$L(AB^\top) + λ\|AB^\top\|_*$的最小值一致;另一方面证明这两种损失在训练过程中会以指数速度趋于相同。由此本文补充了将$L_2$正则化与低秩正则化关联的现有研究,尤其解释了作用于矩阵乘积的此类正则化为何会影响训练的早期阶段。基于这些理论洞见,本文通过实验验证:在视觉任务和语言建模的常规训练中,采用权重衰减优化时,注意力层内的键-查询矩阵乘积$W_K^TW_Q$与值投影矩阵乘积$PW_V$确实会出现秩的显著降低,即便在完全在线训练中也是如此。本文发现,与现有研究结论一致,注意力矩阵乘积的低秩诱导会损害语言模型的性能,同时观察到将注意力层的权重衰减与其余参数的权重衰减解耦具有优势。

英文摘要:

The effect of regularizers such as weight decay when training deep neural networks is not well understood. We study the influence of weight decay as well as $L2$-regularization when training neural network models in which parameter matrices interact multiplicatively. This combination is of particular interest as this parametrization is common in attention layers, the workhorse of transformers. Here, key-query, as well as value-projection parameter matrices, are multiplied directly with each other: $W_K^TW_Q$ and $PW_V$. We extend previous results and show on one hand that any local minimum of a $L2$-regularized loss of the form $L(AB^\top) + λ(\|A\|^2 + \|B\|^2)$ coincides with a minimum of the nuclear norm-regularized loss $L(AB^\top) + λ\|AB^\top\|_*$, and on the other hand that the 2 losses become identical exponentially quickly during training. We thus complement existing works linking $L2$-regularization with low-rank regularization, and in particular, explain why such regularization on the matrix product affects early stages of training. Based on these theoretical insights, we verify empirically that the key-query and value-projection matrix products $W_K^TW_Q, PW_V$ within attention layers, when optimized with weight decay, as usually done in vision tasks and language modelling, indeed induce a significant reduction in the rank of $W_K^TW_Q$ and $PW_V$, even in fully online training. We find that, in accordance with existing work, inducing low rank in attention matrix products can damage language model performance, and observe advantages when decoupling weight decay in attention layers from the rest of the parameters.

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

↑