arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2311.03285cs.LGcs.AIcs.DC
收藏

S-LoRA:服务数千个并发LoRA适配器

S-LoRA: Serving Thousands of Concurrent LoRA Adapters

UC Berkeley(加州大学伯克利分校);Stanford University(斯坦福大学);Shanghai Jiao Tong University(上海交通大学)

Ying Sheng, Shiyi Cao, Dacheng Li, Coleman Hooper, Nicholas Lee, Shuo Yang, Christopher Chou, Banghua Zhu, Lianmin Zheng, Kurt Keutzer, Joseph E. Gonzalez, Ion Stoica

AI总结:

S-LoRA通过统一分页、张量并行和定制CUDA内核,在GPU上高效服务数千个LoRA适配器,吞吐量最高提升4倍,适配器数量提升数个数量级。

摘要:

“预训练-然后微调”范式在大语言模型部署中被普遍采用。低秩适配(LoRA)作为一种参数高效的微调方法,常被用于将基础模型适配到大量任务上,从而从一个基础模型衍生出数量庞大的LoRA适配器集合。我们观察到,这一范式在服务阶段为批量推理带来了显著机会。为利用这些机会,我们提出了S-LoRA,一个为大规模服务众多LoRA适配器而设计的系统。S-LoRA将所有适配器存储在主内存中,并将当前运行查询所使用的适配器取到GPU内存中。为高效利用GPU内存并减少碎片,S-LoRA提出了统一分页(Unified Paging)。统一分页使用一个统一内存池来管理具有不同秩的动态适配器权重以及具有不同序列长度的KV缓存张量。此外,S-LoRA采用了一种新颖的张量并行策略和高度优化的自定义CUDA内核,用于LoRA计算的异构批处理。这些特性共同使S-LoRA能够在单个GPU上或跨多个GPU服务数千个LoRA适配器,且开销很小。与HuggingFace PEFT和vLLM(仅原生支持LoRA服务)等最先进的库相比,S-LoRA可将吞吐量提升最多4倍,并将可服务的适配器数量提升数个数量级。因此,S-LoRA实现了众多任务特定微调模型的可扩展服务,并为大规模定制化微调服务提供了潜力。代码可在https://github.com/S-LoRA/S-LoRA获取。

英文摘要:

The "pretrain-then-finetune" paradigm is commonly adopted in the deployment of large language models. Low-Rank Adaptation (LoRA), a parameter-efficient fine-tuning method, is often employed to adapt a base model to a multitude of tasks, resulting in a substantial collection of LoRA adapters derived from one base model. We observe that this paradigm presents significant opportunities for batched inference during serving. To capitalize on these opportunities, we present S-LoRA, a system designed for the scalable serving of many LoRA adapters. S-LoRA stores all adapters in the main memory and fetches the adapters used by the currently running queries to the GPU memory. To efficiently use the GPU memory and reduce fragmentation, S-LoRA proposes Unified Paging. Unified Paging uses a unified memory pool to manage dynamic adapter weights with different ranks and KV cache tensors with varying sequence lengths. Additionally, S-LoRA employs a novel tensor parallelism strategy and highly optimized custom CUDA kernels for heterogeneous batching of LoRA computation. Collectively, these features enable S-LoRA to serve thousands of LoRA adapters on a single GPU or across multiple GPUs with a small overhead. Compared to state-of-the-art libraries such as HuggingFace PEFT and vLLM (with naive support of LoRA serving), S-LoRA can improve the throughput by up to 4 times and increase the number of served adapters by several orders of magnitude. As a result, S-LoRA enables scalable serving of many task-specific fine-tuned models and offers the potential for large-scale customized fine-tuning services. The code is available at https://github.com/S-LoRA/S-LoRA

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

↑