提出新型注意力函数,更好捕捉翻译中的上下文关系。
An alternative formulation of attention pooling function in translation
- 将注意力矩阵投影到带状矩阵空间,增强结构化建模能力。
- 新公式在不同上下文窗口下表现更稳定,提升翻译准确性。
- 适合关注注意力机制设计与语言结构建模的研究者。
本文旨在提出一种翻译任务中注意力评分函数的替代形式。语言具有深层结构,这一特性反映在注意力评分矩阵中。我们利用此性质定义注意力池化函数,综合考虑其内在结构特征。首先从数学角度介绍注意力机制,分析其局限性及替代方案;随后通过实验验证新的形式。核心思想是引导查询与键以特定方式交互,编码注意力头的差异化角色,并指导值向何处寻找上下文。数学上,该公式可视为将注意力分数矩阵 $H$ 投影至固定带宽的带状矩阵空间。该凸子空间有限维且闭合,投影存在且唯一。为兼顾逼近效果,我们引入带状矩阵加稀疏误差矩阵的新空间,证明其为紧致子空间,保证最佳逼近矩阵的存在性。最后通过计算新公式对原公式的逼近程度进行验证,并分析参数 $w$(上下文窗口)和 $num-pos$(句子中相关词数)的影响,揭示语言处理与翻译中上下文与词重要性的细微作用。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。