LoRA on Llama: What Adapter Serving Does to Cost-Per-Request

Llama LoRA serving: when a shared base with multi-adapter batching beats merged per-variant deployments on cost per request, and how to benchmark it.

LoRA on Llama: What Adapter Serving Does to Cost-Per-Request
Written by TechnoLynx Published on 11 Jul 2026

As a Llama LoRA deployment adds fine-tuned variants, serving them on one shared base with multi-adapter batching kept cost per token flat in Hugging Face TGI’s measurement, while one full deployment per variant grows cost with every variant. The reason is that the base-model computation gets batched across variants instead of being copied once per variant. In a 2026 study of compliance-grade serving, vLLM multi-adapter batching with prompt-length buckets gave 3.90 times the throughput of PEFT-style adapter loading on a mixed request spread across four adapters. Skewed traffic is the exception. The dLoRA authors found that skipping the merge does not always pay off, especially when most requests go to a few adapters, because a merged model cuts computation further.

No single serving and batching architecture is right for every deployment. Prefix caching and quantisation, for instance, pay off differently depending on request volume, hardware and latency needs. So the combination has to be measured at the p95 or p99 target the product promises, and ranked by cost per request at that target. If that target is not written down yet, fixing a p95 target before comparing comes first.

Llama LoRA Serving: Merged per Variant or One Shared Base

The original LoRA paper removed adapter inference latency by merging the adapter into the model weights. To switch between adapters it added and subtracted LoRA weights from the base. That works for one adapter at a time, but the S-LoRA authors show it cuts throughput and raises total latency when several adapters are served at once. Merging also means a full copy of the base model for every variant, which uses a lot of GPU memory. NVIDIA’s NIM documentation adds the batching cost: a merged model is “bespoke”, serves only the task it was tuned for, and makes it hard to batch inputs for different tasks together.

With a shared base, all adapters sit in main memory and only the ones the current batch needs are fetched to the GPU. The adapters themselves are small. Hugging Face’s TGI team reports that loading 30 adapters adds 3% to VRAM. A public vLLM benchmark loaded 1,000 rank-16 adapters on Llama-3.1-8B and recorded about 13 GB of extra process memory but only about 25 MB of extra GPU memory after startup. Across Llama-7B to 70B, S-LoRA reached up to 4 times the throughput of vLLM with naive LoRA support and up to 30 times that of Hugging Face PEFT. Its throughput dipped slightly as adapters were added, then stopped falling at around 100 adapters, because the number of adapters active in any one batch stays the same. The mechanics are covered in more depth in our explainer on how S-LoRA serves many LoRA adapters at scale.

That shows up directly in cost. TGI’s vendor measurement shows cost per token staying flat as more models are added under multi-LoRA serving, while the cost of dedicated deployments grows because every fine-tuned model needs its own deployment. Consolidating also smooths out the usage pattern. Separate deployments pile up “rounding” errors every time one more GPU has to be added for a bursty, low-traffic model.

The shared base has a price too. NVIDIA reports that dynamic LoRAs add cost in both latency and throughput compared with a merged model, and that the cost rises from one adapter, to several of the same rank, to several of mixed ranks. In dLoRA’s setup, computing the unmerged adapter term took 38.9% of the time of the base-model computation. We would profile the merged path and the shared-base path side by side before optimising either. Best-practice rules only make sense in context, and that context comes from profiling.

When Merging the Hot Adapters Wins

Merging wins when traffic piles up on a few adapters. dLoRA switches each replica between merged and unmerged inference depending on the request pattern, and counts switching overhead and queueing delay in the decision. In production traces studied by the LoRAServe authors (2025), the top 5 of more than a thousand adapters carried over 70% of traffic. Those few could be merged and served on dedicated servers, while each of the rest received well under 1% of traffic. Giving those long-tail adapters their own servers would leave GPUs idle, so in that deployment each server hosts a subset of them.

Deployment Fits when How cost per request behaves What to watch
Merged model per variant A single task per deployment Each new variant adds a full model’s GPU footprint No batching across tasks
Shared base, multi-adapter batching Many LoRAs over the same base model Cost per token stayed flat as models were added in TGI’s measurement Adapter overhead, rank mix, cold starts
Hybrid: merge the hot few, share the long tail Popularity is heavily skewed Hot adapters skip adapter compute; the tail shares GPUs Re-checking the split as popularity shifts
Dynamic merge/unmerge switching Skew changes over time Switching overhead is spread over later iterations Scheduler complexity and switching thresholds

Static, Dynamic and Continuous Batching Once Adapters Share the Batch

Static batching runs a fixed group of requests together, and the next group cannot start until the slowest one finishes. Dynamic batching holds requests for a short window to fill a batch before running it. Continuous batching, which S-LoRA takes from Orca’s iteration-level scheduling, adds a new request to the running batch as soon as there is room and removes each request the moment it hits its stop condition. For throughput, the difference is about waiting. PEFT has no continuous batching, so short requests wait for long ones, and with no KV-cache support its largest batch on an A10G was 6 against S-LoRA’s 30.

Adapters add a second variable. PEFT’s own documentation says that mixing adapters in one batch shrinks the effective batch size to the number of samples per adapter, and it recommends buffering requests so batches stay close to single-adapter. S-LoRA calls the same idea “adapter clustering”: fewer active adapters leave more memory for the KV cache and allow larger batches, at some cost to average latency and fairness between adapters. The compliance study grouped first by adapter and then by prompt length, because a 400-token classification prompt in the same prefill batch as a 3,000-token extraction prompt is slowed by padding and scheduling. For variable-length generation on Llama, we treat continuous batching as the baseline and judge the adapter and length grouping on top of it.

Which Serving Stack Handles Prefix and KV-Cache Reuse for Repetitive Prompts?

For a 13B Llama-class model under IDE-style traffic, where many prompts share long prefixes, we would pick a stack with automatic prefix caching built in over a plain static-batch setup. The two usual candidates are vLLM’s Automatic Prefix Caching, built on PagedAttention, and SGLang’s RadixAttention. The choice between them should come from a head-to-head run on the real traffic, not from reputation.

TechnoLynx runs that head-to-head through the Inference Cost-Cut Pack. TechnoLynx starts by measuring the traffic itself: how much of each prompt is shared prefix, how many requests run concurrently, and what share of prompts share nothing. TechnoLynx then tunes each candidate stack on the target GPUs and compares throughput, p99 latency and latency for the non-shared prompts.

A prefix cache is the KV cache for a run of input tokens starting from the first token. Like PagedAttention’s KV cache it is stored in fixed-size blocks, but unlike it, the blocks can outlive the request that created them. SGLang keeps its prefix cache in a radix tree, which suits traffic where prefixes branch. TensorRT-LLM is worth adding to the shortlist mainly when a team already runs NVIDIA-specific deployment tooling and wants its performance profile.

Fairness is a real concern. In one prefix-caching study on vLLM, a scheduler that always ran requests matching GPU-resident prefixes first gave maximum throughput but could starve other requests at high utilisation.

The tuning effort, memory use and on-call burden of each stack have to be measured on the infrastructure that will run it. Framework features change quickly; check any parity claim against the current release.

Measuring Prefix Caching Against a Static-Batch Baseline on Replayed Traffic

To know how much continuous batching with prefix caching saves over static batching, in p99 latency and GPU-hours, we would replay real request logs through both setups at the target concurrency and measure. The benefit depends on request volume and cache capacity.

TechnoLynx builds the replay harness for this comparison as part of the Inference Cost-Cut Pack. TechnoLynx captures the autocomplete traffic’s prefix-overlap and concurrency profile, runs the real log through both setups on the target hardware, and reports p99 latency, GPU-hours, and cache memory and eviction under load.

Published results show both the gain and its conditions. In the vLLM prefix-caching study, text-analysis workloads showed a strong increase in throughput, a small increase in latency, and fewer cache misses as more storage tiers were added. Swapping prefixes to disk helped only when request volume was high enough to overlap the swaps with computation, and at low request counts the system stalled waiting for them. Before the authors added a prefetcher, more swapping made performance worse, which led them to conclude that the prefetcher matters more than the eviction policy. Memory is shared with adapters as well: CaraServe measured a rank-64 adapter on Llama2-7B at about 100 MiB, the same as the KV cache for 200 tokens. That is how hot prefixes can get evicted once concurrency grows.

Replay Benchmark, in Order

  1. Record a production window of requests with timestamps, prompt and output lengths, adapter id and the shared-prefix structure. The compliance study recommends matching prompt-length and output-length histograms, prefix-sharing ratios and adapter mix to production as closely as possible.
  2. Fix the latency target (p95 or p99) and the hardware before running any configuration.
  3. Run the static-batch baseline, then continuous batching alone, then continuous batching with prefix caching, all with the same weights and the same replay.
  4. Record tail latency, sustained throughput, GPU-hours, cache hit rate and evictions at the target concurrency, not only at low load.
  5. Keep prefix caching only if the p99 and GPU-hour gains hold with acceptable cache memory and few evictions of hot prefixes. Otherwise static batching may be simpler and good enough.

Results do not transfer across GPUs or vLLM versions without re-running.

Ranking Continuous Batching, KV-Cache Management and Quantisation for vLLM on A100 and H100

On vLLM with A100 or H100 GPUs, we would rank the techniques by measured cost-per-token payoff against how hard each is to undo. Continuous batching and PagedAttention KV-cache management come first because vLLM ships both by default, so there is little to adopt or undo. Quantisation comes next, and only where its measured gain justifies committing to one precision and serving path.

TechnoLynx produces that ranked shortlist in the Inference Cost-Cut Pack. TechnoLynx first records the model, the target GPU and the traffic mix (request-length distribution, QPS, latency target). TechnoLynx then benchmarks cost per token, throughput and latency on that mix and checks output quality after any quantisation.

Technique How easy to adopt or reverse What decides the payoff
Continuous batching Default behaviour in vLLM; nothing to undo Variance in request length and concurrency
PagedAttention KV-cache management Built into vLLM; S-LoRA extends it to adapter weights KV-cache headroom left after base weights and adapters
Weight-only INT4 (W4A16, GPTQ or AWQ) Needs calibration data; random-token calibration degrades accuracy Most cost-efficient for synchronous serving
W8A8 (INT8 or FP8) Plain INT8 needs SmoothQuant at 70B to hold accuracy Leads throughput under asynchronous continuous batching

Quantisation holds up better than previously thought, but the right format is still task and algorithm specific. A 2024 study of the Llama-3.1 family on vLLM 0.6.4.post1 found FP8 effectively lossless, well-tuned INT8 within 1-3% accuracy, and INT4 weight-only competitive with 8-bit. For 8B and 70B models, W4A16 cut cost per query by 2-3 times against BF16 in synchronous deployment. The mechanism explains why the right scheme depends on the ratio of prefill to decode tokens. Prefill is compute-bound and decode is memory-bound, so quantising weights mainly speeds up decode, while quantising weights and activations speeds up prefill.

When the open question is which GPU to buy, LynxBenchAI measures throughput, latency, memory and cost per unit of work across accelerators on one scale. Its published results show how each device runs the public PyTorch stack your own models also run on, so they are broadly indicative for custom PyTorch models too. They do not run or measure your workload or your adapter mix.

Who Can Benchmark Our Llama Adapter Mix Before We Commit?

TechnoLynx benchmarks your own Llama model, adapter set and replayed traffic against the candidate serving setups before you commit: merged versus shared base, batching mode, KV-cache settings and quantisation, each costed per request at your latency target. The Inference Cost-Cut Pack starts by measuring the current serving path, then compares the options on your hardware and gives you a before-and-after cost per request together with the harness that produced it. The scope and first steps are described on its page.

The engagement is less useful for a team serving a single merged model with steady traffic, where there is little to choose between. It is also the wrong fit for anyone who mainly wants extra engineering hours on a fixed build. Whoever runs it, ask three things: does the benchmark use your traffic replay or a synthetic peak, are results reported as cost per request at a fixed tail-latency target, and do you get the harness so you can re-run it after the next model update.

Batching Across Tenants Without Breaking the Latency SLA

A hidden cost of mixing tenants is rank interference. In the LoRAServe study, serving a rank-8 and a rank-128 adapter from the same Llama 7B server raised the P95 time-to-first-token of the rank-8 requests by 84%, compared with a server handling only rank-8 requests. The same authors measured a rank-128 adapter taking 2.7 times the prefill time of a rank-8 adapter on a 2,000-token prompt, and degradation from rank heterogeneity reached 45% on Llama 70B. The cause is in the kernels. Punica’s BGMV pads every request to the largest rank in the batch, and, according to the LoRAServe authors, S-LoRA’s MBGMV removes the padding but still lays out work around the highest rank present. CaraServe’s profiling found decode latency tracking batch size times maximum rank under BGMV, and the sum of ranks under MBGMV. For cost, this means the same hardware processes fewer tokens per second on higher ranks, so higher-rank adapters cost more per token to serve within an SLO.

vLLM exposes the settings that control this. --max-lora-rank should be set to the largest rank actually in use, because a value well above that wastes memory and can hurt performance. max_loras sets how many adapters can run in one batch alongside base-model requests. In the public Llama-3.1-8B benchmark at concurrency 32 with max_loras=32, uniform traffic fell from 1,935 tokens/sec with one adapter to 884 tokens/sec with 1,000. Skewed traffic at 1,000 adapters reached 2,167 tokens/sec, about 2.45 times the uniform result. In that run, max_loras=16 gave the best throughput from 10 to 500 adapters under skewed traffic. Smaller values caused tail-latency spikes and larger ones reduced throughput. The author describes multi-LoRA serving as a working-set problem: what matters is the hot set of adapters, not the total count. Treat those figures as one run with synthetic random-weight adapters on a single 80 GB GPU. NVIDIA notes that system operators may want to enforce one adapter rank for this reason, since uniform ranks batch better.

No batching or occupancy technique wins on every workload mix. Continuous batching suits variable-length generation, because short requests no longer wait for long ones. Rank them by cost per request saved after subtracting p99 risk on the actual mix, raise occupancy step by step, and stop where SLA risk starts rising faster than the savings. The partitioning side of this is covered in our piece on GPU partitioning and multi-tenant scheduling.

Adapter-swap latency under S-LoRA-style multi-tenant batching depends on the deployment. Published figures range from a 7.21 ms difference in total request time for 100 users switching between 25 adapters on one A100 in LoRA Land to adapter loading taking up to 35% of end-to-end latency under high concurrency in the Predictive-LoRA study. That is why TechnoLynx measures the p99 swap distribution on your own adapter set at increasing numbers of concurrent adapters, under continuous batching, and hands over the harness.

Requests from different customers can share a batch when they use the same base model and each request keeps its own adapter weights. Tail latency suffers when ranks are mixed or short requests queue behind long ones. Any precision or kernel change made to fit larger batches needs its own quality check before it ships.

Cold starts are the other tenant cost. When a requested adapter is not on the GPU, a single cold start can take tens of milliseconds. Under continuous batching it delays the other requests already decoding as well as the new one, and CaraServe measured an average latency increase of 25%. On average, cold starts took 10%, 16% and 20% of total request time at 3, 6 and 9 requests per second. Loading a rank-64 adapter for Llama2-7B takes about 28-45 ms depending on PCIe bandwidth, and prefetching brought the load time from 45 ms in vLLM down to 8 ms in the Predictive-LoRA system. The Chameleon authors keep adapters cached in otherwise idle GPU memory and resize the cache as load changes. Against an S-LoRA baseline, this cut tail latency by 14.7%, 24.6% and 80.7% at low, medium and high load. A partial fix is to preload adapters into CPU memory. Another study found CPU loading added 7-16% latency for short requests and under 2% for long ones, with disk loading about 70% slower than CPU loading.

Cutting Cost per Request on an A100 Pool Before Buying More Nodes

Llama-3-70B on A100: Batching, Quantisation and Tensor-Parallel Layout

The order is to sweep batch sizes with continuous batching on, test quantisation, compare tensor-parallel layouts, and only buy capacity once the best configuration still misses the latency target.

TechnoLynx runs this as an Inference Cost-Cut Pack engagement. TechnoLynx first states the goal as cost per request under an explicit latency SLO, then profiles occupancy, memory and throughput on the existing A100s for each candidate layout before recommending any change in node count.

Decode is memory-bound. A 2026 single-GPU Markaicode benchmark of a Q4_K_M-quantised Llama 3.3 70B on an A100 80 GB found VRAM the bottleneck well before compute: 68.1 GB peak at a 512-token context, and out-of-memory errors once --max-model-len went past 4,096. Quantisation therefore pays off partly by freeing room for more concurrent queries, not only by speeding up kernels. At 70B, the plain W8A8-INT scheme in the 2024 Llama-3.1 study caused noticeable accuracy drops until SmoothQuant was applied, which is why accuracy has to be checked at the model size actually deployed. For LoRA specifically, tensor parallelism adds little: S-LoRA’s scheduling made adapter communication negligible next to the base model’s, because the rank is far smaller than the hidden size. Rank heterogeneity, though, is worse at 70B than at 7B. Any change to the tensor-parallel layout needs its correctness re-checked, not just its throughput.

Packing Several Tenant Models Onto One Shared GPU

We would fit several tenant models onto one shared GPU, such as text-to-speech models where voice quality is the gate, with the same profile, optimise and validate method and a different pass condition. A quantised candidate that fails the agreed listening test is rejected whatever memory it saves. We would measure per-tenant memory with all tenants batching concurrently, including fragmentation under sustained load. The engine-level detail of quantising and compiling such models belongs to GPU-level optimisation work rather than to a batching decision.

We would judge SGLang’s speculative decoding under continuous batching only from an on/off run replaying real bursty, mixed-length traffic.

Does Continuous Batching Change Model Outputs?

Continuous batching changes how requests are scheduled, adding and removing them from the running batch at the token level. A faster batching policy should therefore ship only after an automated quality check has compared its outputs with a reference mode on the same prompts, inside the same load-test run.

TechnoLynx builds that paired-output check into the load-test pipeline you already use, so latency, throughput and quality-difference reports come from one run. The first step is to define correctness for your workload: exact match for greedy decoding, task accuracy or semantic similarity for sampled generation.

The 2026 compliance study made this a rule. Its harness kept serving measurements separate from quality-gating measurements, so a faster configuration was not promoted unless it stayed compliant and aligned with the judge and human reviewers. In its framing, the best candidate is the point on the serving-quality Pareto frontier that passes the quality checks, not simply the fastest configuration. We would build the check like this:

  • Reference mode: static batching or single-request decoding with identical weights, seeds and sampling parameters.
  • Stop and truncation: whether each output reaches the same stop condition as the reference.
  • Content divergence: exact match under greedy decoding; distribution-level or task-accuracy checks under sampling.
  • Attribution: continuous batching alone, prefix caching alone, then both together, so a regression is traced to the right feature.
  • Gate: if divergence or accuracy loss exceeds the agreed tolerance, the policy does not ship, whatever its latency gain.

Some divergence between batching modes is expected under temperature or top-p sampling even without a bug, so exact-match comparisons only make sense for greedy decoding. The check only catches what the chosen prompts and metrics can see, and it has to be re-run on every serving-stack upgrade, because a regression found in one engine version may be absent in the next. For a quality score that sits next to cost in the same report, see our piece on LLM quality benchmarks alongside cost per request.

A Cost-per-Request Model That Separates Base Compute from Adapter Overhead

A credible cost-per-request model for LoRA serving is built up from measured GPU-seconds, not from peak throughput. It keeps shared base-model compute separate from adapter overhead (swaps, cold starts, rank penalties), includes idle and autoscaling time, and states every price and utilisation assumption so finance can test it.

TechnoLynx builds and validates this model in the Inference Cost-Cut Pack. TechnoLynx starts by recording the real workload on the target hardware (traffic shape, retries, adapter usage, request sizes), measures GPU-second cost per request, per tenant and per adapter under realistic autoscaling, and then projects costs forward with sensitivity ranges.

Term What it captures Where the number comes from
Base compute Shared forward pass, batched across all tenants Measured GPU-seconds at the target p95
Adapter compute Extra computation and GPU transfers, roughly linear in adapter count Profiled per rank, since higher ranks cost more per token
Swap and cold start Loading adapters from host or disk on the critical path Measured p99 load time at real concurrency
Idle and scaling buffer GPU time paid for but not serving, plus model cold starts Traffic replay; model cold starts are dominated by loading and CUDA graph compilation
GPU price On-demand, reserved or spot rate per GPU-hour Stated as an assumption with a range

The arithmetic should be shown, not just the result. The Markaicode A100 run computed cost from effective throughput: a 768-token request finishing in 2.156 s gives about 356 tokens/sec, and at $0.60 per GPU-hour that is about $0.000167 per second. One million tokens at 356 tokens/sec takes about 2,809 seconds, which at $0.000167 per second comes to roughly $0.47. That matches the low end of the $0.45-$1.65 per million tokens range the source reports across $0.60-$2.21 GPU-hour prices for that workload shape. The source itself calls this a single run and says the measurement should be repeated on your own hardware before planning capacity.

Utilisation is the main lever. GPU cost per hour is fixed, so cost per request is that cost divided by the requests actually served in the hour, and a pool running at 20% of its capacity costs four times as much per request as the same pool at 80%. Packing adapters is the multi-tenant way to raise that figure. A 2026 adapter-placement study cut the GPUs needed for its workloads by 60% on average by packing adapters up to the point where KV-cache starvation begins, at the cost of higher latency from larger batches. For chargeback across business units or tenants, we would bill shared base compute per token and adapter overhead per adapter, because a per-adapter line is what a tenant disputing a bill can actually check. The general version of this model, without the adapter terms, is covered in our guide to a load-aware cost-per-request model. Agentic workloads where one request fans out into many calls need cost per task rather than per call.

What to Settle Before the Next Adapter Ships

The question to settle before the next variant ships is where your traffic sits on the skew curve. If a handful of adapters carry most requests, merging those few and sharing the long tail across servers is what one production deployment did. If popularity is flat, a shared base with tuned max_loras, a tight --max-lora-rank and adapters grouped by rank is where the savings are. Either way, the answer changes as adapters are added and popularity shifts, so the benchmark should be re-run when the variant count or rank mix changes. Our cost-per-request comparison method shows how to run that comparison at a fixed p95. Teams building AI infrastructure and production SaaS will find the wider serving and cost work collected there.

FAQ

What Is Rank and Alpha in LoRA?

Rank is the inner dimension of the two small matrices a LoRA adapter adds, and lora_alpha scales the adapter’s update. Hugging Face PEFT recommends setting lora_alpha equal to the rank, which gives a scaling factor of 1.

How Much Does LoRA Cost to Train?

Predibase found it cost about $8.00 to train each adapter, as reported by Hugging Face’s TGI team.

Can You Explain How LoRA Adapters Work?

A LoRA adapter keeps the base model frozen and represents the fine-tuning update as two small matrices, so the trainable parameters can be up to 10,000 times fewer than in full fine-tuning. At inference the adapter can be merged into the base weights or computed separately on top of a shared base.