Salvato in:
Dettagli Bibliografici
Autori principali: Kong, Rui, Li, Qiyang, Fang, Xinyu, Feng, Qingtian, He, Qingfeng, Dong, Yazhu, Wang, Weijun, Li, Yuanchun, Kong, Linghe, Liu, Yunxin
Natura: Preprint
Pubblicazione: 2024
Soggetti:
Accesso online:https://arxiv.org/abs/2405.17741
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866910460601696256
author Kong, Rui
Li, Qiyang
Fang, Xinyu
Feng, Qingtian
He, Qingfeng
Dong, Yazhu
Wang, Weijun
Li, Yuanchun
Kong, Linghe
Liu, Yunxin
author_facet Kong, Rui
Li, Qiyang
Fang, Xinyu
Feng, Qingtian
He, Qingfeng
Dong, Yazhu
Wang, Weijun
Li, Yuanchun
Kong, Linghe
Liu, Yunxin
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2405_17741
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle LoRA-Switch: Boosting the Efficiency of Dynamic LLM Adapters via System-Algorithm Co-design
Kong, Rui
Li, Qiyang
Fang, Xinyu
Feng, Qingtian
He, Qingfeng
Dong, Yazhu
Wang, Weijun
Li, Yuanchun
Kong, Linghe
Liu, Yunxin
Artificial Intelligence
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.
title LoRA-Switch: Boosting the Efficiency of Dynamic LLM Adapters via System-Algorithm Co-design
topic Artificial Intelligence
url https://arxiv.org/abs/2405.17741