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

翻译中注意力池化函数的一种替代公式

An alternative formulation of attention pooling function in translation

Universitat de Barcelona(巴塞罗那大学)

Eddie Conti

AI总结:

本文提出一种翻译任务中注意力池化函数的替代公式,通过将注意力评分矩阵投影到带状矩阵与稀疏误差矩阵构成的紧子空间,并实验验证其逼近效果及参数影响。

摘要:

本文旨在提出翻译任务中注意力评分函数的一种替代公式。一般而言,语言具有深层结构,这一点反映在注意力评分矩阵中。我们利用这一性质来定义注意力池化函数,并将这一方面纳入考虑。在前几章中,我们以数学术语介绍注意力机制,并解释其局限性和替代公式。接下来,我们重点介绍导出该替代公式的实验过程。本质上,我们引导查询和键以特定方式交互,编码注意力头的不同角色,并指导值在何处寻找上下文。用数学术语来说,我们可以将该公式视为将注意力评分矩阵(记为 $H$)投影到具有固定带宽的带状矩阵空间上。这个凸子空间显然是有限维的,因此是闭的。因此,在该空间上的投影是适定的且唯一的。然而,以失去投影唯一性(即对 $H$ 的最佳逼近)为代价,我们定义了一个由带状矩阵加误差稀疏矩阵组成的新空间。我们证明这是一个紧子空间,从而保证存在一个最佳逼近 $H$ 的矩阵。我们通过验证新公式来结束论文,即计算新的注意力评分公式对原始公式的逼近程度。此外,我们探讨了不同参数(如 $w$(上下文窗口)和 num-pos(句子中相关词的数量))的影响。这些分析为语言如何被处理和翻译提供了更深入的见解,揭示了上下文和词相关性作用中的细微差别。

英文摘要:

The aim of this paper is to present an alternative formulation of the attention scoring function in translation tasks. Generally speaking, language is deeply structured, and this is reflected in the attention scoring matrix. We exploit this property to define the attention pooling function, taking this aspect into account. In the first chapters, we introduce the attention mechanism in mathematical terms and explain its limitations and alternative formulations. Next, we focus on the experimental session that led to the alternative formulation. Essentially, we guide queries and keys to interact in a specific manner, encoding the distinct roles of attention heads and directing values on where to seek context. In mathematical terms, we can think of this formula as projecting the attention scores matrix, say $H$, onto the space of band matrices with fixed bandwidth. This convex subspace is clearly finite-dimensional and therefore closed. As a consequence, the projection on this space is well-posed and unique. However, at the price of losing the uniqueness of the projection (i.e., the best approximation for $H$), we defined a new space consisting of band matrices plus error sparse matrices. We prove that this is a compact subspace which guarantees the existence of a matrix that best approximates $H$. We conclude the thesis by validating the new formula, namely calculating how well the new formula for attention scores approximates the original one. Additionally, we explore the impact of different parameters such as w (context windows) and num-pos (number of relevant words in a sentence). These analyses provide deeper insights into how languages are processed and translated, revealing nuances in the roles of context and word relevance.

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

↑