AI 译本 · Equalang
新上架PDF · 2026年11月翻译 · 公式优化
加载中…
arXiv · 2026
具有织机注意力的 Transformer 中可重连的电路
Da Xiao, Qingye Meng, Shengping Li, Xingyuan Yuan
We propose loom attention, which allows a Transformer to dynamically rewire its circuits at every token by interweaving a head's vertical attention over the outputs of earlier heads (to obtain its query, key and value) with its horizontal attention over tokens. We instantiate vertical attention efficiently with normalized and gated linear attention over a per-token matrix memory, which stores the compressed head outputs and serves as a second residual stream. This yields LoomFormer, a dual-stream architecture that splits control and content between the vector and matrix streams. Across model sizes and training token budgets in language modeling and downstream tasks, LoomFormer matches Transformers trained with over 3x compute and recent residual-stream baselines (HC/mHC, MUDDFormer, AttnRes) trained with ~1.7-2.8x. For example, trained on the same 300B tokens with only 2% extra FLOPs, LoomPythia-2.8B achieves ~1.6x the average downstream gain of mHC-Pythia-2.8B over Pythia-2.8B, and matches (0-shot) or surpasses (5-shot) Pythia-12B. Code is available at https://github.com/Caiyun-AI/LoomFormer
我们提出了织机注意力,使 Transformer 能够在每个 token 处动态重连其电路:将一个注意力头对先前注意力头输出的纵向注意力(用于获取该头的查询、键和值)与其对 token 的横向注意力交织起来。我们通过对每个 token 的矩阵记忆进行归一化门控线性注意力,高效实现纵向注意力。矩阵记忆存储压缩后的注意力头输出,并充当第二条残差流。由此得到 LoomFormer,这是一种双流架构,在向量流和矩阵流之间拆分控制与内容。在语言建模和下游任务中,针对不同模型规模和训练 token 预算,LoomFormer 的表现可媲美计算量超过其 3 倍的 Transformer,也可媲美以约 1.7 至 2.8 倍计算量训练的近期残差流基线模型(HC/mHC、MUDDFormer、AttnRes)。例如,在相同的 300B 个 token 上训练、仅额外使用 2% FLOPs 时,LoomPythia-2.8B 相较于 Pythia-2.8B 的平均下游任务增益约为 mHC-Pythia-2.8B 的 1.6 倍,并且在零样本设置下达到、在五样本设置下超过 Pythia-12B。代码见 https://github.com/Caiyun-AI/LoomFormer
PDF · 2026年11月翻译 · 公式优化