arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2412.18487cs.CL
收藏

面向GPT的基于分段的注意力掩码

Segment-Based Attention Masking for GPTs

Blavatnik School of Computer Science, Tel Aviv University(特拉维夫大学布拉瓦尼克计算机科学学院);Department of Computer Science, Technion – Israel Institute of Technology(以色列理工学院计算机科学系);Department of Electrical and Computer Engineering, Technion – Israel Institute of Technology(以色列理工学院电气与计算机工程系)

Shahar Katz, Liran Ringel, Yaniv Romano, Lior Wolf

AI总结:

本文提出在GPT预填充阶段基于已知块结构进行注意力掩码的分段方案,使块内词元可非因果访问,后续保持传统自回归生成,无额外计算开销且在Llama和Qwen等模型上实现最先进性能。

摘要:

现代语言模型(LMs)的成功很大程度上归功于掩码因果注意力,这是生成式预训练Transformer(GPT)模型的支柱。尽管GPT可以一次性处理整个用户提示,但因果掩码是逐步应用于所有输入词元的,以模仿生成过程。这在初始的“预填充”阶段施加了不必要的约束,该阶段模型处理输入提示并在生成任何输出词元之前生成内部表示。在这项工作中,注意力在预填充阶段基于已知的块结构进行掩码,之后采用传统的逐词元自回归过程。例如,在典型的聊天提示中,系统提示被视为一个块,用户提示被视为下一个块。每个块被视为掩码的单元,使得每个块中的前几个词元可以以非因果方式访问后续词元。然后,模型以传统因果方式生成答案。这种分段方案不产生额外的计算开销。将其集成到Llama和Qwen等模型中时,始终实现了最先进的性能。

英文摘要:

Modern Language Models (LMs) owe much of their success to masked causal attention, the backbone of Generative Pre-Trained Transformer (GPT) models. Although GPTs can process the entire user prompt at once, the causal masking is applied to all input tokens step-by-step, mimicking the generation process. This imposes an unnecessary constraint during the initial "prefill" phase when the model processes the input prompt and generates the internal representations before producing any output tokens. In this work, attention is masked based on the known block structure at the prefill phase, followed by the conventional token-by-token autoregressive process after that. For example, in a typical chat prompt, the system prompt is treated as one block, and the user prompt as the next one. Each of these is treated as a unit for the purpose of masking, such that the first tokens in each block can access the subsequent tokens in a non-causal manner. Then, the model answer is generated in the conventional causal manner. This Segment-by-Segment scheme entails no additional computational overhead. When integrating it into models such as Llama and Qwen, state-of-the-art performance is consistently achieved.

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

↑