arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.13762cs.LGcs.AIcs.CLcs.CVstat.ML
收藏

通过核主成分分析揭示自注意力的隐藏结构

Unveiling the Hidden Structure of Self-Attention via Kernel Principal Component Analysis

National University of Singapore(新加坡国立大学)

Rachel S. Y. Teo, Tan M. Nguyen

AI总结:

本研究从核主成分分析推导自注意力,揭示其隐藏结构,提出鲁棒主成分注意力RPC-Attention,在多个视觉与语言任务上优于softmax注意力。

摘要:

Transformer在序列建模任务中取得了显著成功,涵盖自然语言处理与计算机视觉的各类应用,这一成就归功于自注意力的关键作用。与大多数深度学习模型的发展类似,这些注意力机制的构建依赖启发式方法与经验。在本研究中,我们从核主成分分析(kernel PCA,核主成分分析)推导出自注意力,并证明自注意力将其查询向量投影到特征空间中键矩阵的主成分轴上。随后我们推导出自注意力中值矩阵的精确公式,从理论和实证上证明该值矩阵捕获了自注意力中键向量的格拉姆矩阵的特征向量。借助我们的核PCA框架,我们提出了鲁棒主成分注意力(RPC-Attention),这是一类新型的鲁棒注意力,能够抵御数据污染。我们在ImageNet-1K目标分类、WikiText-103语言建模以及ADE20K图像分割任务上,通过实证证明了RPC-Attention相较于softmax注意力的优势。

英文摘要:

The remarkable success of transformers in sequence modeling tasks, spanning various applications in natural language processing and computer vision, is attributed to the critical role of self-attention. Similar to the development of most deep learning models, the construction of these attention mechanisms relies on heuristics and experience. In our work, we derive self-attention from kernel principal component analysis (kernel PCA) and show that self-attention projects its query vectors onto the principal component axes of its key matrix in a feature space. We then formulate the exact formula for the value matrix in self-attention, theoretically and empirically demonstrating that this value matrix captures the eigenvectors of the Gram matrix of the key vectors in self-attention. Leveraging our kernel PCA framework, we propose Attention with Robust Principal Components (RPC-Attention), a novel class of robust attention that is resilient to data contamination. We empirically demonstrate the advantages of RPC-Attention over softmax attention on the ImageNet-1K object classification, WikiText-103 language modeling, and ADE20K image segmentation task.

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

↑