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

LoRA-Switch:通过系统-算法协同设计提升动态LLM适配器的效率

LoRA-Switch: Boosting the Efficiency of Dynamic LLM Adapters via System-Algorithm Co-design

Shanghai Jiao Tong University(上海交通大学);Institute for AI Industry Research (AIR), Tsinghua University(清华大学人工智能产业研究院);National University of Singapore(新加坡国立大学);Shanghai Artificial Intelligence Laboratory(上海人工智能实验室)

Rui Kong, Qiyang Li, Xinyu Fang, Qingtian Feng, Qingfeng He, Yazhu Dong, Weijun Wang, Yuanchun Li, Linghe Kong, Yunxin Liu

AI总结:

针对动态LoRA适配器推理延迟高的问题,提出系统-算法协同设计的LoRA-Switch架构,采用令牌级路由和CUDA内核融合,在保持精度的同时将解码延迟降低2.4倍以上。

摘要:

近期文献发现,定制或进一步改进大型语言模型(LLM)的有效方法是添加动态适配器,例如具有混合专家(MoE)结构的低秩适配器(LoRA)。尽管此类动态适配器引入的计算复杂度适中,但令人惊讶的是,它们导致了巨大的推理延迟开销,使解码速度减慢2.5倍以上。在本文中,我们分析了动态适配器的细粒度成本,并发现碎片化的CUDA内核调用是根本原因。因此,我们提出了LoRA-Switch,一种用于高效动态适配器的系统-算法协同设计架构。与大多数采用层间或块间动态路由的现有动态结构不同,LoRA-Switch引入了令牌级路由机制。它为每个令牌切换LoRA适配器和权重,并将它们合并到骨干网络中进行推理。为了提高效率,这种切换通过优化的CUDA内核实现,该内核一次性融合所有LoRA适配器的合并操作。基于在常见基准上对流行的开源LLM进行的实验,我们的方法展示了与现有动态适配器相似的精度提升,同时将解码延迟降低了2.4倍以上。

英文摘要:

Recent literature has found that an effective method to customize or further improve large language models (LLMs) is to add dynamic adapters, such as low-rank adapters (LoRA) with Mixture-of-Experts (MoE) structures. Though such dynamic adapters incur modest computational complexity, they surprisingly lead to huge inference latency overhead, slowing down the decoding speed by 2.5+ times. In this paper, we analyze the fine-grained costs of the dynamic adapters and find that the fragmented CUDA kernel calls are the root cause. Therefore, we propose LoRA-Switch, a system-algorithm co-designed architecture for efficient dynamic adapters. Unlike most existing dynamic structures that adopt layer-wise or block-wise dynamic routing, LoRA-Switch introduces a token-wise routing mechanism. It switches the LoRA adapters and weights for each token and merges them into the backbone for inference. For efficiency, this switching is implemented with an optimized CUDA kernel, which fuses the merging operations for all LoRA adapters at once. Based on experiments with popular open-source LLMs on common benchmarks, our approach has demonstrated similar accuracy improvement as existing dynamic adapters, while reducing the decoding latency by more than 2.4 times.

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

↑