S-LoRA: Serving Thousands of Concurrent LoRA Adapters

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Sheng, Ying, Cao, Shiyi, Li, Dacheng, Hooper, Coleman, Lee, Nicholas, Yang, Shuo, Chou, Christopher, Zhu, Banghua, Zheng, Lianmin, Keutzer, Kurt, Gonzalez, Joseph E., Stoica, Ion
Format: Preprint
Veröffentlicht: 2023
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866910472204189696
author Sheng, Ying
Cao, Shiyi
Li, Dacheng
Hooper, Coleman
Lee, Nicholas
Yang, Shuo
Chou, Christopher
Zhu, Banghua
Zheng, Lianmin
Keutzer, Kurt
Gonzalez, Joseph E.
Stoica, Ion
author_facet Sheng, Ying
Cao, Shiyi
Li, Dacheng
Hooper, Coleman
Lee, Nicholas
Yang, Shuo
Chou, Christopher
Zhu, Banghua
Zheng, Lianmin
Keutzer, Kurt
Gonzalez, Joseph E.
Stoica, Ion
contents 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
format Preprint
id arxiv_https___arxiv_org_abs_2311_03285
institution arXiv
publishDate 2023
record_format arxiv
spellingShingle S-LoRA: Serving Thousands of Concurrent LoRA Adapters
Sheng, Ying
Cao, Shiyi
Li, Dacheng
Hooper, Coleman
Lee, Nicholas
Yang, Shuo
Chou, Christopher
Zhu, Banghua
Zheng, Lianmin
Keutzer, Kurt
Gonzalez, Joseph E.
Stoica, Ion
Machine Learning
Artificial Intelligence
Distributed, Parallel, and Cluster Computing
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
title S-LoRA: Serving Thousands of Concurrent LoRA Adapters
topic Machine Learning
Artificial Intelligence
Distributed, Parallel, and Cluster Computing
url https://arxiv.org/abs/2311.03285