arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2506.13541cs.CLcs.LG
收藏

面向动态逐Token KV优化的权重共享异构组注意力专家混合模型

Mixture of Weight-shared Heterogeneous Group Attention Experts for Dynamic Token-wise KV Optimization

University of Chinese Academy of Sciences(中国科学院大学);Shenzhen Institutes of Advanced Technology, Chinese Academy of Sciences(中国科学院深圳先进技术研究院);University of Macau(澳门大学);Shenzhen University of Advanced Technology(深圳先进技术大学)

Guanghui Song, Dongping Liao, Yiren Zhao, Kejiang Ye, Cheng-zhong Xu, Xitong Gao

AI总结:

针对Transformer模型因果语言建模中KV缓存扩展性差的问题,提出mixSGA专家混合方法,通过逐Token路由、权重共享和辅助损失实现动态KV优化,在多模型上的效率和效果均优于静态基线。

摘要:

在因果语言建模(CLM)任务中,Transformer模型因不断增长的键值(KV)缓存内存分配效率低下,面临可扩展性挑战,这给计算和存储资源带来了压力。现有方法如分组查询注意力(GQA)和Token级KV优化虽能提升效率,但依赖刚性资源分配,通常会丢弃“低优先级”Token或对其进行静态分组,无法适配Token重要性的动态变化特性。我们提出mixSGA,这是一种新型的专家混合(MoE)方法,可动态优化逐Token的计算与内存分配。与现有方法不同,mixSGA保留所有Token,同时将其自适应路由到具有不同KV组大小的专用专家,实现粒度与效率的平衡。我们的核心创新点包括:(1)由学习到的重要性分数引导的逐Token专家选择路由机制,可在不丢弃Token的前提下实现成比例的资源分配;(2)跨分组注意力投影的权重共享机制,以最小化参数开销;(3)一种辅助损失,用于确保因果语言模型训练与推理一致性的独热路由决策。我们在Llama3、TinyLlama、OPT和Gemma2模型系列上开展了广泛评估,结果表明mixSGA优于静态基线方法。在指令遵循和持续预训练任务中,在相同KV预算下,mixSGA取得了更高的ROUGE-L分数和更低的困惑度。

英文摘要:

Transformer models face scalability challenges in causal language modeling (CLM) due to inefficient memory allocation for growing key-value (KV) caches, which strains compute and storage resources. Existing methods like Grouped Query Attention (GQA) and token-level KV optimization improve efficiency but rely on rigid resource allocation, often discarding "low-priority" tokens or statically grouping them, failing to address the dynamic spectrum of token importance. We propose mixSGA, a novel mixture-of-expert (MoE) approach that dynamically optimizes token-wise computation and memory allocation. Unlike prior approaches, mixSGA retains all tokens while adaptively routing them to specialized experts with varying KV group sizes, balancing granularity and efficiency. Our key novelties include: (1) a token-wise expert-choice routing mechanism guided by learned importance scores, enabling proportional resource allocation without token discard; (2) weight-sharing across grouped attention projections to minimize parameter overhead; and (3) an auxiliary loss to ensure one-hot routing decisions for training-inference consistency in CLMs. Extensive evaluations across Llama3, TinyLlama, OPT, and Gemma2 model families show mixSGA's superiority over static baselines. On instruction-following and continued pretraining tasks, mixSGA achieves higher ROUGE-L and lower perplexity under the same KV budgets.

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

↑