arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2401.17426cs.LGcs.AIstat.ML
收藏

上下文线性回归中多头注意力的优越性

Superiority of Multi-Head Attention in In-Context Linear Regression

Michigan State University(密歇根州立大学)

Yingqian Cui, Jie Ren, Pengfei He, Jiliang Tang, Yue Xing

AI总结:

该研究通过理论分析对比Transformer单头与多头注意力在上下文线性回归任务中的性能,证明嵌入维度足够大时多头注意力更优,且损失均为O(1/D)但多头乘积常数更小,验证了多头注意力设计的有效性。

摘要:

我们针对采用softmax注意力的Transformer在线性回归任务的上下文学习中的性能开展了理论分析。现有文献主要聚焦单头/多头注意力Transformer的收敛性,本研究则侧重对比二者的性能。我们通过精确的理论分析证明,当嵌入维度足够大时,多头注意力的表现优于单头注意力。当上下文示例数量D增加时,单头与多头注意力的预测损失均处于O(1/D)量级,且多头注意力的乘积常数更小。除最简单的数据分布设置外,我们还考虑了更多场景,例如带噪标签、局部示例、相关特征及先验知识。我们发现总体而言多头注意力比单头注意力更具优势。研究结果验证了Transformer架构中多头注意力设计的有效性。

英文摘要:

We present a theoretical analysis of the performance of transformer with softmax attention in in-context learning with linear regression tasks. While the existing literature predominantly focuses on the convergence of transformers with single-/multi-head attention, our research centers on comparing their performance. We conduct an exact theoretical analysis to demonstrate that multi-head attention with a substantial embedding dimension performs better than single-head attention. When the number of in-context examples D increases, the prediction loss using single-/multi-head attention is in O(1/D), and the one for multi-head attention has a smaller multiplicative constant. In addition to the simplest data distribution setting, we consider more scenarios, e.g., noisy labels, local examples, correlated features, and prior knowledge. We observe that, in general, multi-head attention is preferred over single-head attention. Our results verify the effectiveness of the design of multi-head attention in the transformer architecture.

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

↑