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.

Mathematical Formulation and the Batching Challenge
LoRA decomposes the weight update of a dense layer into two low-rank matrices and , where the adapter rank . During inference, the layer computation executes as:
Here, is a constant scaling hyperparameter. In standard single-model serving, the base matrix and adapter can be statically merged () 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 ( 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 () 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:
- Shrink Stage: Multiplies the input activations by the corresponding adapter down-projection matrices via pointer array lookups, producing intermediate low-rank representations .
- Expand Stage: Multiplies the low-rank states by the corresponding up-projection matrices , 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 (). MBGMM uses warp-specialized tiling to tile both token sequence length and projection dimensions dynamically.
- Decode Phase (MBGMV): Autoregressive decoding processes single-token vectors () 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 () 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:
- GPU HBM: Holds the base model, active KV cache, and hot LoRA adapters required for the current execution step.
- 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.
- 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 ().
- 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
LoraRequestabstraction. - 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 projections and MLP Gate/Up projections): In column-parallel layers, base weight is split along output columns. For the LoRA path , the down-projection matrix is replicated across all TP ranks, while the up-projection matrix is partitioned along its column dimension (). Each rank computes locally.
- Row-Parallel Layers (Self-Attention Output projection and MLP Down projection): In row-parallel layers, base weight is split along input rows. For LoRA, the down-projection is partitioned row-wise (), while the up-projection is replicated. Each rank computes its slice, and a single collective
AllReducesum 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 is routed to a worker that already holds 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
- Punica: Multi-Tenant LoRA Serving (Chen et al., MLSys 2024)
- S-LoRA: Serving Thousands of Concurrent LoRA Adapters (Sheng et al., 2023)
- LoRAX: Multi-LoRA Inference Server (Predibase)
- vLLM Multi-LoRA Serving Documentation
- FlashInfer: High-Performance LLM Serving Kernels
- LoRA: Low-Rank Adaptation of Large Language Models (Hu et al., 2021)



