注意力投影中的非线性:非线性查询的情况
Beyond Linearity in Attention Projections: The Case for Nonlinear Queries
AI总结:
本文提出用非线性残差替换注意力中的查询投影W_Q,通过瓶颈MLP实现,在GPT-3小模型上验证了性能提升。
摘要:
最近的代数分析表明,在仅解码器和仅编码器Transformer中,查询投影$W_Q$可以设置为恒等映射而不会显著降低性能。这是因为注意力仅通过乘积$XW_Q, XW_K, XW_V$依赖于$X$,允许基变换被相邻层吸收并通过网络传播。我们将$W_Q \in \R^{d imes d}$替换为非线性残差形式$Q(X) = X + f_θ(X)$,其中$f_θ$是一个瓶颈MLP,具有$d^2 + O(d)$个参数。恒等项将非线性锚定到已知良好的先验。在GPT-3小规模风格模型上的实验显示,与基线相比持续改进(验证对数损失降低$2.40\%$,困惑度降低$6.81\%$),轻松优于参数增加12.5%的非嵌入参数模型。这些结果激励在更大规模和多模态上的研究。
英文摘要:
Recent algebraic analysis shows that in decoder-only and encoder-only transformers, the Query projection $W_Q$ may be set to identity without noticeable performance deterioration. This is possible because attention depends on $X$ only through the products $XW_Q, XW_K, XW_V$, allowing basis transformations to be absorbed by adjacent layers and propagated through the network. We replace $W_Q \in \R^{d \times d}$ with a nonlinear residual of the form $Q(X) = X + f_θ(X)$, where $f_θ$ is a bottleneck MLP with $d^2 + O(d)$ parameters. The identity term anchors the nonlinearity to a known-good prior. Experiments on GPT-3 small style models show consistent improvement over the baseline ($2.40\%$ lower validation log-loss, $6.81\%$ lower perplexity), comfortably outperforming a model with 12.5\% more non-embedding parameters. These results motivate investigation at larger scales and across modalities.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。