arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2308.16898cs.LGcs.AIcs.CLmath.OC
收藏

Transformer 作为支持向量机

Transformers as Support Vector Machines

University of Pennsylvania(宾夕法尼亚大学);University of California, Riverside(加利福尼亚大学河滨分校);University of British Columbia(不列颠哥伦比亚大学);University of Michigan(密歇根大学)

Davoud Ataee Tarzanagh, Yingcong Li, Christos Thrampoulidis, Samet Oymak

AI总结:

本文建立了自注意力优化几何与硬间隔 SVM 的形式等价性,刻画了一层 Transformer 在梯度下降下的隐式偏置,并证明过参数化促进全局收敛,为将 Transformer 解释为分离和选择最优 token 的 SVM 层级结构提供了理论与实验依据。

摘要:

自《Attention Is All You Need》提出以来,Transformer 架构在自然语言处理领域带来了革命性进展。Transformer 中的注意力层接收输入 token 序列 $X$,并通过 softmax$(XQK^\ op X^\ op)$ 计算成对相似度使其交互,其中 $(K,Q)$ 是可训练的 key-query 参数。本文建立了自注意力的优化几何与硬间隔 SVM 问题之间的形式等价性,该 SVM 问题利用 token 对的外积上的线性约束将最优输入 token 与非最优 token 分离。这一形式化使我们能够刻画使用梯度下降优化的一层 Transformer 的隐式偏置:(1) 在正则化趋于零的条件下优化由 $(K,Q)$ 参数化的注意力层时,其方向收敛到一个 SVM 解,该解最小化组合参数 $W=KQ^\ op$ 的核范数。相反,直接用 $W$ 参数化则最小化 Frobenius 范数目标。我们刻画了这一收敛过程,并强调其可能收敛到局部最优方向而非全局最优方向。(2) 作为补充,我们证明了在适当几何条件下梯度下降的局部/全局方向收敛。重要的是,我们表明过参数化通过确保 SVM 问题的可行性以及保证优化景观良性无驻点,从而促进全局收敛。(3) 虽然我们的理论主要适用于线性预测头,但我们提出了一个更一般的 SVM 等价形式,用于预测非线性头下的隐式偏置。我们的发现适用于任意数据集,其有效性通过实验得到验证。我们还提出了若干开放问题和研究方向。我们相信这些发现启发将 Transformer 解释为一种 SVM 的层级结构,用于分离和选择最优 token。

英文摘要:

Since its inception in "Attention Is All You Need", transformer architecture has led to revolutionary advancements in NLP. The attention layer within the transformer admits a sequence of input tokens $X$ and makes them interact through pairwise similarities computed as softmax$(XQK^\top X^\top)$, where $(K,Q)$ are the trainable key-query parameters. In this work, we establish a formal equivalence between the optimization geometry of self-attention and a hard-margin SVM problem that separates optimal input tokens from non-optimal tokens using linear constraints on the outer-products of token pairs. This formalism allows us to characterize the implicit bias of 1-layer transformers optimized with gradient descent: (1) Optimizing the attention layer with vanishing regularization, parameterized by $(K,Q)$, converges in direction to an SVM solution minimizing the nuclear norm of the combined parameter $W=KQ^\top$. Instead, directly parameterizing by $W$ minimizes a Frobenius norm objective. We characterize this convergence, highlighting that it can occur toward locally-optimal directions rather than global ones. (2) Complementing this, we prove the local/global directional convergence of gradient descent under suitable geometric conditions. Importantly, we show that over-parameterization catalyzes global convergence by ensuring the feasibility of the SVM problem and by guaranteeing a benign optimization landscape devoid of stationary points. (3) While our theory applies primarily to linear prediction heads, we propose a more general SVM equivalence that predicts the implicit bias with nonlinear heads. Our findings are applicable to arbitrary datasets and their validity is verified via experiments. We also introduce several open problems and research directions. We believe these findings inspire the interpretation of transformers as a hierarchy of SVMs that separates and selects optimal tokens.

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

↑