arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2408.00539cs.CLcs.AI

间歇半工作掩码:一种新的LLM掩码范式

Intermittent Semi-Working Mask: A New Masking Paradigm for LLMs

Zhejiang University(浙江大学);Ant Group(蚂蚁集团)

HaoYuan Hu, Mingcong Lu, Di Luo, XinYa Wu, Jiangcai Zhu, Taoye Yin, Zheng Li, Hao Wang, Shusheng Zhang, KeZun Zhang, KaiLai Shao, Chao Chen, Feng Wang

AI总结:

间歇半工作掩码通过引入稀疏双向注意力,实现高效多轮对话和上下文密集型任务处理,同时保持推理效率。

摘要:

多轮对话和上下文密集型任务挑战大型语言模型(LLMs)在不牺牲生成质量的前提下整合长历史记录。尽管前缀LLMs可以通过对前缀标记的双向注意力更好地利用历史上下文,但它们在实践中很少被使用,因为多轮训练需要许多重复的三元组,且其双向前缀阻止了推理时KV缓存的重用,导致高成本和延迟。为了在保留前缀掩码的上下文理解的同时保持推理时的效率,我们引入了间歇半工作掩码(ISM),一种将稀疏双向注意力注入因果骨干中的掩码方案。ISM在查询段上交替使用双向注意力,在回答段上使用单向注意力,从而实现上下文合成的同时保持全局因果性。这种设计消除了训练期间的三元组扩展,并在推理期间保持KV缓存的重用,使延迟与标准因果LLMs相当。ISM是架构无关且参数无关的,仅增加极小的延迟。在广泛的评估中,ISM在多轮对话以及数学推理等上下文密集型任务上均优于因果基线。

英文摘要:

Multi-turn dialogues and context-intensive tasks challenge Large Language Models (LLMs) to integrate long histories without sacrificing generation quality. Although prefix LLMs can better exploit historical context via bidirectional attention on prefix tokens, they are rarely used in practice because multi-turn training requires many duplicated triplets, and its bidirectional prefix prevents KV-cache reuse at inference time, driving up high cost and latency. To retain the contextual understanding of prefix mask while preserving the inference-time efficiency of causal mask, we introduce Intermittent Semi-working Mask (ISM), a masking scheme that injects sparse bidirectional attention into the causal backbone. ISM alternates bidirectional attention over query segments with unidirectional attention over answer segments, enabling the synthesis of in-context while preserving global causality. This design eliminates triplet expansion during training and maintains KV-cache reuse during inference, yielding latency comparable to standard causal LLMs. ISM is architecture-agnostic and parameter-free, adding only minimal latency. Across extensive evaluations, ISM outperforms causal baselines not only on multi-turn dialogue, but also on context-intensive tasks like mathematical reasoning.

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

↑