扩展线性自注意力,实现灵活矩阵运算,助力上下文学习
An extension of linear self-attention for in-context learning
- 在输入中引入偏置矩阵,扩展线性自注意力能力
- 可生成任意常数矩阵、输入矩阵及多矩阵乘积结果
- 适合研究自注意力机制设计或需灵活计算的场景
上下文学习是Transformer模型的重要特性,而注意力机制是其核心组件,通过注意力矩阵编码词间关系并作为加权依据。然而,朴素自注意力在一般任务中进行上下文学习时可能受限于矩阵乘法的计算形式。本文针对线性自注意力,通过引入额外的偏置矩阵扩展其结构。该扩展虽简单,却能输出任意常数矩阵、输入矩阵以及两个或三个矩阵的乘积。第二项性质表明其具备跳跃连接能力,因此可通过串联多个扩展后的线性自注意力模块实现灵活的矩阵操作。作为实例,本文在合理输入形式下,构造了批量梯度下降求解岭回归的启发式方法。
原文摘要 · Abstract (English)
In-context learning is a remarkable property of transformers and has been the focus of recent research. An attention mechanism is a key component in transformers, in which an attention matrix encodes relationships between words in a sentence and is used as weights for words in a sentence. This mechanism is effective for capturing language representations. However, it is questionable whether naive self-attention is suitable for in-context learning in general tasks, since the computation implemented by self-attention is somewhat restrictive in terms of matrix multiplication. In fact, we may need appropriate input form designs when considering heuristic implementations of computational algorithms. In this paper, in case of linear self-attention, we extend it by introducing a bias matrix in addition to a weight matrix for an input. Despite the simple extension, the extended linear self-attention can output any constant matrix, input matrix and multiplications of two or three matrices in the input. Note that the second property implies that it can be a skip connection. Therefore, flexible matrix manipulations can be implemented by connecting the extended linear self-attention components. As an example of implementation using the extended linear self-attention, we show a heuristic construction of a batch-type gradient descent of ridge regression under a reasonable input form.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。