Topic 5 of 5 · 5 min read
Merging and serving adapters
Goal: Choose between merging an adapter and serving it separately for a stated multi-tenant workload, and justify the choice.
You can fold an adapter into the base weights to get one plain model, or keep adapters separate and load the one each request needs; pick by how many adapters you serve and how often they change.
Check yourself · 1 of 3
What does merging a LoRA adapter into the base model produce?
Why it matters
After tuning, an adapter is a small file that does nothing alone. How you ship it decides your serving cost, your upgrade path and what can go wrong in production.
Option 1: merge
Merging adds (alpha / r) * B x A into each adapted W and drops the adapter. The result is a normal model that any runtime can load, with no extra latency from the adapter. In PEFT it is merge_and_unload() followed by save_pretrained.
- Good for: one adapter, one product, or a runtime that has no adapter support.
- Cost: a full model file per variant, so ten adapters on a 7B model means ten large files and ten model copies in memory if you serve them all.
- Careful: merge into a 16-bit copy of the base. Merging into a 4-bit quantized base rounds the result, so reload the base in 16-bit first.
Option 2: serve adapters separately
Servers such as vLLM can load one base model and many LoRA adapters, and choose the adapter per request by name. One GPU holds the base once, and each adapter adds a small amount of memory.
vllm serve meta-llama/Llama-3.1-8B-Instruct \
--enable-lora --max-lora-rank 32 \
--lora-modules support=./out/support-v1 legal=./out/legal-v2
A request then asks for model: "support" or model: "legal". Set the maximum rank at or above your largest adapter, or loading fails.
- Good for: many tenants or tasks sharing one base, and frequent adapter updates that do not need a model rebuild.
- Cost: slightly more latency than a merged model and a runtime that supports adapters.
Keep versions matched
An adapter is trained against one exact base checkpoint. Loading it on a different base, even a later release of the same family, can produce quiet quality loss and not an error. Record the base model name and revision next to every adapter, and test the pair you deploy.
Before and after
Weak: "Merge everything, it is simpler." For a platform with 40 customer adapters that means 40 full models. Better: one base, 40 adapters hot-swapped by name, and merge only the one adapter that serves nearly all traffic.
What goes wrong
- Base drift. The base is upgraded and the adapters are not retrained.
- Rank limit. The server's max rank is below an adapter's rank.
- Merging a quantized base and losing quality in the merge.
Examples
A multi-tenant platform
A platform serves 40 customers, each with a LoRA adapter on the same 8B base, and updates a few adapters every week. Merged, that is 40 model copies and a redeploy per update. Served with vLLM, one base stays loaded, each customer's requests name their adapter, and an update is a new adapter directory. Serve separately.
A single product
A team ships one support model on a runtime that cannot load adapters. They load the base in 16-bit, call merge_and_unload(), save the result and run the held-out eval on the merged files before release. Merging is the right choice here.
Key points
- Merging folds the adapter into the weights and gives a plain model with no adapter latency.
- Serving adapters separately lets one base model and one GPU host many adapters, chosen per request.
- Merge for one product or a runtime without adapter support; serve separately for many tenants or fast-changing adapters.
- Merge into a 16-bit copy of the base, not into a 4-bit quantized one.
- Record the exact base model and revision with every adapter, because a mismatched base can degrade quality silently.
Common mistakes
- Merging every adapter into its own full model and then paying for dozens of copies.
- Merging into a quantized base and shipping the rounded result without re-running the eval.
- Upgrading the base model without retraining or re-testing the adapters built on the old one.
- Setting the server's maximum LoRA rank below the rank of an adapter, so it fails to load.
Check yourself · 2 of 3
A platform has 30 customers, each with a LoRA adapter on the same base. Which serving approach fits best?
Check yourself · 3 of 3
An adapter was trained on one release of a base model. A team loads it on a newer release of the same model family. What is the likely outcome?
Practice items, not counted towards your mastery.
Start here
- LoRA: Low-Rank Adaptation of Large Language Models (opens in a new tab)PaperFree
The original method: frozen weights, low-rank update matrices and why no inference latency is added.
- QLoRA: Efficient Finetuning of Quantized LLMs (Dettmers et al.) (opens in a new tab)PaperFree
Four-bit NF4 base weights, double quantization and paged optimizers, with the single-GPU memory results.
- PEFT documentation (Hugging Face) (opens in a new tab)DocsFree
LoraConfig fields, target modules, DoRA, merging and saving adapters.
More for this topic
- LoRA adapters in vLLM (opens in a new tab)DocsFree
Serving several adapters on one base model with per-request selection.