[Paper Review] S-LoRA: Serving Thousands of Concurrent LoRA Adapters
S-LoRA is a scalable system for serving thousands of concurrent LoRA adapters on a single GPU or across multiple GPUs by leveraging unified memory pooling, heterogeneous batching via optimized CUDA kernels, and a novel tensor parallelism strategy. It achieves up to 4x higher throughput and orders-of-magnitude more adapters than state-of-the-art systems like HuggingFace PEFT and vLLM.
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
Motivation & Objective
- To address the scalability challenge of serving thousands of LoRA adapters concurrently on limited GPU memory.
- To reduce memory fragmentation and I/O overhead from dynamic loading of adapters with varying ranks and sequence lengths.
- To enable efficient batching of LoRA computations across heterogeneous adapters with non-contiguous memory layouts.
- To design a low-overhead, scalable tensor parallelism strategy for multi-GPU deployment of LoRA adapters.
- To achieve high inference throughput while minimizing latency and memory footprint in large-scale, customized LLM serving.
Proposed method
- S-LoRA introduces Unified Paging, a unified memory pool that manages both adapter weights and KV cache tensors dynamically to reduce fragmentation and I/O overhead.
- It employs heterogeneous batching using custom CUDA kernels that operate directly on non-contiguous memory, enabling efficient batched inference across adapters of different ranks.
- S-LoRA TP is a novel tensor parallelism strategy that fuses LoRA computation with base model communications, minimizing communication cost across multiple GPUs.
- The system separates base model computation (batchable) from adapter computation (non-batchable), enabling optimal scheduling and memory access patterns.
- It uses a host memory-based adapter storage strategy, fetching only active adapters to GPU memory on-demand.
- The system integrates early abort scheduling and supports dynamic sequence length handling via the unified memory pool.
Experimental results
Research questions
- RQ1How can we efficiently manage memory for thousands of LoRA adapters with varying ranks and dynamic sequence lengths?
- RQ2What is the optimal way to batch LoRA computations across heterogeneous adapters with non-contiguous memory layouts?
- RQ3How can we minimize communication and memory overhead when scaling LoRA serving across multiple GPUs?
- RQ4Can unified memory pooling and optimized kernels significantly improve throughput and adapter capacity compared to existing systems?
- RQ5What is the performance impact of dynamic adapter loading and unloading on inference latency and GPU utilization?
Key findings
- S-LoRA improves inference throughput by up to 4x compared to state-of-the-art systems like HuggingFace PEFT and vLLM with naive LoRA support.
- It enables serving several orders of magnitude more LoRA adapters than existing systems, achieving high scalability on a single GPU.
- The unified memory pool reduces memory fragmentation and I/O overhead, allowing efficient dynamic loading of adapters with diverse ranks and sequence lengths.
- Heterogeneous batching with custom CUDA kernels enables efficient computation on non-contiguous memory, minimizing latency overhead across diverse adapter configurations.
- S-LoRA TP achieves minimal communication cost for LoRA computation by fusing it with base model communications, enabling effective multi-GPU scaling.
- The system demonstrates high efficiency on A10G-24G and A100-80G GPUs, with ablation studies confirming the effectiveness of early abort scheduling and memory management.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.