ChatPaper.aiChatPaper

S-LoRA: Servindo Milhares de Adaptadores LoRA Concorrentes

S-LoRA: Serving Thousands of Concurrent LoRA Adapters

November 6, 2023
Autores: 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
cs.AI

Resumo

O paradigma "pré-treinamento e depois ajuste fino" é comumente adotado na implantação de modelos de linguagem de grande escala. A Adaptação de Baixa Classificação (LoRA), um método de ajuste fino eficiente em parâmetros, é frequentemente empregada para adaptar um modelo base a uma multitude de tarefas, resultando em uma coleção substancial de adaptadores LoRA derivados de um único modelo base. Observamos que esse paradigma apresenta oportunidades significativas para inferência em lote durante o serviço. Para aproveitar essas oportunidades, apresentamos o S-LoRA, um sistema projetado para o serviço escalável de muitos adaptadores LoRA. O S-LoRA armazena todos os adaptadores na memória principal e busca os adaptadores usados pelas consultas atualmente em execução para a memória da GPU. Para usar eficientemente a memória da GPU e reduzir a fragmentação, o S-LoRA propõe a Paginação Unificada. A Paginação Unificada usa um pool de memória unificado para gerenciar pesos dinâmicos de adaptadores com diferentes classificações e tensores de cache KV com comprimentos de sequência variados. Além disso, o S-LoRA emprega uma nova estratégia de paralelismo de tensores e kernels CUDA altamente otimizados para o agrupamento heterogêneo de computação LoRA. Coletivamente, esses recursos permitem que o S-LoRA sirva milhares de adaptadores LoRA em uma única GPU ou em várias GPUs com uma pequena sobrecarga. Comparado a bibliotecas de ponta como HuggingFace PEFT e vLLM (com suporte ingênuo de serviço LoRA), o S-LoRA pode melhorar a taxa de transferência em até 4 vezes e aumentar o número de adaptadores servidos em várias ordens de magnitude. Como resultado, o S-LoRA permite o serviço escalável de muitos modelos ajustados para tarefas específicas e oferece o potencial para serviços de ajuste fino personalizados em grande escala.
English
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.
PDF312February 8, 2026