Multi-LoRA Serving in Production: Comparing S-LoRA, Punica, LoRAX, and vLLM Multi-LoRA Architecture, Batched SGMV Kernels, Paged Adapter Memory, and Co-Location Economics

Fine-tuning large language models on domain-specific corpora, proprietary workflows, and per-tenant datasets has become a standard enterprise practice. Deploying hundreds or thousands of distinct task-specific models as full weight replicas creates unsustainable infrastructure costs. A 70-billion-parameter base model in 16-bit precision requires approximately 140 GB of high-bandwidth memory (HBM) across two to four high-end GPUs. Serving 500 specialized models as isolated instances would require

8 min
Multi-LoRA Serving in Production: Comparing S-LoRA, Punica, LoRAX, and vLLM Multi-LoRA Architecture, Batched SGMV Kernels, Paged Adapter Memory, and Co-Location Economics

Fine-tuning large language models on domain-specific corpora, proprietary workflows, and per-tenant datasets has become a standard enterprise practice. Deploying hundreds or thousands of distinct task-specific models as full weight replicas creates unsustainable infrastructure costs. A 70-billion-parameter base model in 16-bit precision requires approximately 140 GB of high-bandwidth memory (HBM) across two to four high-end GPUs. Serving 500 specialized models as isolated instances would require over 70 terabytes of GPU memory, leading to severe hardware fragmentation, low GPU utilization, and prohibitive compute spend.

Low-Rank Adaptation (LoRA) isolates task-specific parameter deltas into low-rank matrix pairs added to the base model weights. Because the underlying frozen backbone model remains identical across tasks, serving engines can co-locate thousands of adapters on a single cluster. Achieving high serving throughput requires custom kernel designs, dynamic memory management, and specialized request schedulers.

Multi-LoRA Serving Architecture

Mathematical Formulation and the Batching Challenge

LoRA decomposes the weight update ΔW\Delta W of a dense layer W0Rdin×doutW_0 \in \mathbb{R}^{d_{in} \times d_{out}} into two low-rank matrices ARdin×rA \in \mathbb{R}^{d_{in} \times r} and BRr×doutB \in \mathbb{R}^{r \times d_{out}}, where the adapter rank rmin(din,dout)r \ll \min(d_{in}, d_{out}). During inference, the layer computation executes as:

y=xW0+αr(xA)By = x W_0 + \frac{\alpha}{r} (x A) B

Here, α\alpha is a constant scaling hyperparameter. In standard single-model serving, the base matrix and adapter can be statically merged (W=W0+αrABW = W_0 + \frac{\alpha}{r} A B) prior to execution, avoiding additional runtime overhead. In a multi-tenant serving environment where concurrent requests within the same batch require different adapters, static weight merging cannot be used without duplicating the base model weights for every active adapter.

Naive multi-adapter serving strategies encounter fundamental performance bottlenecks:

  • Adapter-specific request grouping: Forcing requests with identical adapters into dedicated sub-batches fragments batch size, disables continuous batching benefits, and leaves GPU Tensor Cores starved for compute.
  • Sequential adapter kernel launches: Executing the base model projection once and then launching separate GEMM kernels sequentially for each distinct adapter in the batch introduces massive CUDA launch overhead (25μs2-5\mu\text{s} per kernel launch across tens of Transformer layers), stalling execution pipelines during memory-bound decode phases.
  • Heterogeneous rank divergence: Adapters deployed within an enterprise frequently utilize different ranks (r{8,16,32,64}r \in \{8, 16, 32, 64\}) depending on task complexity. Standard batched matrix multiplication (BMM) libraries in cuBLAS require uniform tensor dimensions, forcing systems to pad lower-rank adapters with zeros and waste memory bandwidth.

Kernel Architectures: SGMV, MBGMV, and Grouped GEMMs

Solving the multi-adapter batching bottleneck requires specialized GPU kernels capable of executing batched linear projections over ragged, non-contiguous memory layouts.

Punica and Segmented Gather Matrix-Vector Multiplication (SGMV)

The Punica multi-tenant serving system introduced the Segmented Gather Matrix-Vector (SGMV) CUDA operator. SGMV enables concurrent execution of different LoRA adapters in a single batch during the autoregressive token generation (decode) phase.

SGMV partitions the input batch into contiguous segments where tokens in each segment reference the same adapter ID. Execution splits into two fused stages:

  1. Shrink Stage: Multiplies the input activations xRB×dinx \in \mathbb{R}^{B \times d_{in}} by the corresponding adapter down-projection matrices AiRdin×riA_i \in \mathbb{R}^{d_{in} \times r_i} via pointer array lookups, producing intermediate low-rank representations hRB×rh \in \mathbb{R}^{B \times r}.
  2. Expand Stage: Multiplies the low-rank states hh by the corresponding up-projection matrices BiRri×doutB_i \in \mathbb{R}^{r_i \times d_{out}}, scaling and accumulating the result directly into the base model output tensor.

By loading adapter weight matrices into GPU Shared Memory (SRAM) and registers once per segment, SGMV amortizes memory access costs and avoids redundant DRAM roundtrips. Punica demonstrated up to 12x higher throughput than dedicated multi-model deployments while adding approximately 2ms of latency per token.

S-LoRA: MBGMV and MBGMM Kernels

While early implementations assumed uniform adapter ranks, S-LoRA introduced Multi-size Batched Gather Matrix-Vector (MBGMV) and Multi-size Batched Gather Matrix-Matrix (MBGMM) kernels to handle heterogeneous ranks without zero-padding overhead.

S-LoRA divides execution by request phase:

  • Prefill Phase (MBGMM): The prompt phase processes variable-length sequences, requiring batched general matrix-matrix multiplications with different inner dimensions (rir_i). MBGMM uses warp-specialized tiling to tile both token sequence length and projection dimensions dynamically.
  • Decode Phase (MBGMV): Autoregressive decoding processes single-token vectors (1×din1 \times d_{in}) per sequence. MBGMV maps thread blocks directly across batch segments to maximize Tensor Core operational intensity.

Ragged Batching and FlashInfer Grouped GEMM

Modern serving frameworks increasingly integrate high-performance grouped GEMM routines from libraries such as FlashInfer. FlashInfer optimizes multi-head and multi-adapter ragged tensors by compiling specialized CUTLASS-backed grouped GEMM kernels. This eliminates kernel launch overhead by processing all active adapters across all attention projections (Q,K,V,OQ, K, V, O) and feed-forward projections (gate, up, down) in a single fused GPU invocation.

Memory Management: Paged Adapter Allocation and Tiered Caching

GPU High-Bandwidth Memory must be carefully shared between three distinct consumers: frozen base model weights, the dynamic Key-Value (KV) cache, and active LoRA adapter weights.

Unified Paged Memory

Traditional memory allocators require contiguous physical allocations for adapter tensors. When serving hundreds of adapters with dynamic rank sizes and lifecycles, memory fragmentation degrades HBM utilization.

S-LoRA introduced Unified Paging, which structures adapter storage identically to paged KV caches. Adapter matrices are sliced into small, fixed-size memory pages (for example, 16 KB or 64 KB blocks). The engine maintains a software page table that maps logical adapter layers to non-contiguous physical page frames in GPU HBM.

This unified approach brings key architectural benefits:

  • Dynamic allocation without fragmentation: Memory can be allocated and deallocated on demand as adapters are requested, matching the elasticity of PagedAttention.
  • Shared memory pool balancing: During bursts of high concurrency, the engine dynamically contracts the adapter pool to grant more memory to the KV cache, avoiding request preemption.

Tiered Storage Hierarchy and Asynchronous Streaming

Production systems like Predibase LoRAX and vLLM implement a tiered storage hierarchy:

  1. GPU HBM: Holds the base model, active KV cache, and hot LoRA adapters required for the current execution step.
  2. Host System DRAM: Holds hundreds of warm LoRA adapters in pinned CPU memory, accessible over high-speed PCIe Gen 5 (64 GB/s) or NVLink-C2C interconnects.
  3. Remote Object Storage (S3 / MinIO / GCS): Stores the persistent library of cold adapters.

To prevent adapter loading from blocking model execution, modern engines use dedicated CUDA copy streams. When a request specifies an uncached adapter, the engine begins an asynchronous PCIe host-to-device memory transfer while the GPU executes compute-heavy prefill operations on preceding requests. For a typical rank-16 adapter on a 7B model (approximately 50-100 MB), loading over PCIe Gen 5 completes in 1-2 milliseconds, completely hidden behind base layer computation.

Eviction and Replacement Policies

When GPU HBM reaches capacity, adapter page allocators employ cache replacement algorithms:

  • Least Recently Used (LRU): Evicts pages belonging to adapters that have remained idle longest.
  • Frequency-Weighted LRU: Accounts for request distribution skew, preventing high-frequency base adapters from being evicted during transient spikes in long-tail adapter usage.
  • Pinning and Priority Tiers: High-SLA enterprise tenants can pin designated adapters in HBM, ensuring zero-overhead execution without cold-cache penalties.

Framework Implementations: S-LoRA, Punica, LoRAX, and vLLM

Different serving stacks make distinct architectural trade-offs across kernel design, memory layout, and deployment features:

Punica

  • Primary Focus: Cluster-level multi-tenant serving and SGMV kernel foundation.
  • Kernel Implementation: Segmented Gather Matrix-Vector (SGMV) with uniform rank support.
  • Memory Architecture: Pre-allocated device buffers for adapter staging.
  • Dynamic Adapter Loading: Static registration with runtime buffer swapping.
  • Target Workload: High-density multi-tenant API serving with homogeneous adapter ranks.

S-LoRA

  • Primary Focus: High-scale concurrent adapter serving with heterogeneous ranks and tensor parallelism.
  • Kernel Implementation: Custom MBGMV (decode) and MBGMM (prefill) operators supporting arbitrary ranks (r[1,256]r \in [1, 256]).
  • Memory Architecture: Unified PagedLoRA memory pool co-located with KV cache.
  • Dynamic Adapter Loading: Host-to-GPU dynamic paging via custom page table.
  • Target Workload: Large clusters serving thousands of active adapters across multi-GPU nodes.

LoRAX (Predibase)

  • Primary Focus: Enterprise multi-adapter microservices with cloud storage integration.
  • Kernel Implementation: Punica SGMV kernels with continuous batching.
  • Memory Architecture: Dynamic GPU memory cache with host RAM fallback.
  • Dynamic Adapter Loading: Dynamic runtime loading over HTTP and S3 endpoints via adapter identifiers.
  • Target Workload: Enterprise deployments needing dynamic adapter fetching from remote registries without server restarts.

vLLM Multi-LoRA

  • Primary Focus: High-throughput general-purpose inference engine integrating PagedAttention.
  • Kernel Implementation: Punica and FlashInfer grouped GEMM backend.
  • Memory Architecture: Dedicated LoRA memory buffer configured via max_loras and max_lora_rank parameters.
  • Dynamic Adapter Loading: Per-request dynamic selection via LoraRequest abstraction.
  • Target Workload: Production LLM serving combining multi-LoRA routing with speculative decoding and chunked prefill.

Distributed Multi-LoRA: Tensor and Pipeline Parallelism

Scaling multi-LoRA serving to large models (70B+) requires coordinating adapter projections across Tensor Parallel (TP) and Pipeline Parallel (PP) ranks.

Tensor Parallelism Partitioning

In Megatron-style Tensor Parallelism, base linear layers are partitioned across GPUs:

  • Column-Parallel Layers (Self-Attention Q,K,VQ, K, V projections and MLP Gate/Up projections): In column-parallel layers, base weight W0W_0 is split along output columns. For the LoRA path xABx A B, the down-projection matrix ARdin×rA \in \mathbb{R}^{d_{in} \times r} is replicated across all TP ranks, while the up-projection matrix BRr×doutB \in \mathbb{R}^{r \times d_{out}} is partitioned along its column dimension (B=[B1,B2,,Bk]B = [B_1, B_2, \dots, B_k]). Each rank computes xABkx A B_k locally.
  • Row-Parallel Layers (Self-Attention Output projection and MLP Down projection): In row-parallel layers, base weight W0W_0 is split along input rows. For LoRA, the down-projection AA is partitioned row-wise (A=[A1T,A2T,,AkT]TA = [A_1^T, A_2^T, \dots, A_k^T]^T), while the up-projection BB is replicated. Each rank computes its slice, and a single collective AllReduce sum operation synchronizes the combined base and LoRA outputs across ranks.

By aligning LoRA partitioning with base model tensor parallelism, systems avoid extra cross-GPU communication steps, keeping inter-GPU bandwidth usage identical to base model execution.

Adapter-Aware Cluster Scheduling

At the cluster layer, request routers must balance two competing objectives: token load balancing across GPU workers and adapter cache hit maximization.

If an incoming request for adapter KK is routed to a worker that already holds KK in GPU HBM, the request avoids host-to-device transfer latency and can immediately join the active batch. Modern multi-LoRA routers implement consistent hashing or weighted affinity routing. When a specific adapter experiences high burst traffic, the scheduler replicates the adapter across multiple worker nodes to prevent hot-spotting.

Production Economics and Performance Trade-Offs

Deploying multi-LoRA architecture delivers significant operational advantages over isolated model deployments:

  • Infrastructure Cost Reduction: Serving 1,000 fine-tuned LoRA adapters on top of a single Llama-3-70B base deployment running across 4x NVIDIA H100 (80GB) GPUs reduces total GPU requirements by more than 95% compared to dedicated instances.
  • Throughput Preservation: Microbenchmarks from S-LoRA and vLLM indicate that executing heterogeneous batches with 100+ distinct adapters introduces less than 5% throughput degradation compared to running the pure base model without adapters.
  • Decoding Latency Impact: Batched SGMV and MBGMV kernel execution typically adds 1.5ms to 3.5ms of latency per decode step. This represents an acceptable overhead for real-time interactive generation while maintaining high tenant consolidation.

Organizations operating multi-LoRA architectures must monitor adapter churn rates, host-to-device transfer bandwidth, and rank distribution skew to prevent memory thrashing and ensure consistent time-to-first-token (TTFT) performance.

Sources

Written by

More to read

  • Prompt Compression in Production: Comparing Selective Context, LLMLingua, LongLLMLingua, and LLMLingua-2 Architecture, Token-Level Information Density, and Serving Economics

    In high-throughput production LLM deployments, prompt length dominates both serving latency and inference costs. For multi-turn conversational agents, long-document retrieval-augmented generation (RAG), and multi-step agentic workflows, input contexts routinely scale from 8,000 to over 64,000 tokens. Because the prefill phase scales quadratically in raw attention FLOPs and linearly in key-value (KV) cache allocation, long prompts drive up Time To First Token (TTFT) and consume disproportionate G

    1 min
  • Sentante Begins Commercial Rollout of Endovascular Surgical Robot with Physical AI Telemetry

    Lithuanian medical robotics company Sentante has initiated commercial deployment of its CE-marked endovascular robotic platform, launching revenue clinical operations across European vascular surgery and interventional radiology departments. The platform is designed to perform catheter-and-guidewire vascular interventions while capturing synchronized procedural telemetry to train downstream physical AI navigation models. Teleoperated Architecture and Standard Tool Interoperability Sentante's

    1 min
  • Scalable Capital Integrates ChatGPT and Claude for Brokerage Trades and Portfolio Analysis

    European digital wealth manager Scalable Capital has introduced direct integration allowing account holders to link their brokerage accounts to conversational artificial intelligence platforms, including OpenAI's ChatGPT and Anthropic's Claude. The feature enables retail investors to analyze portfolio performance, query asset allocation breakdowns, and initiate trade execution directly from conversational chat environments. Scalable Capital represents the first European brokerage to establish n

    1 min