Knowledge Base · Learning paths
How to Serve 100 Fine-Tuned Models on a Single GPU
This article explains how to efficiently serve 100 LoRA fine-tuned models on just one GPU. By sharing base weights, separating adapters, smart request routing, and using vLLM batching, memory usage drops dramatically from 1.5TB to just 19.3GB while reducing cold starts and the number of worker nodes.
Translated from Chinese by AI. Spotted an issue? Use the feedback button.
🔗 Original source: How to Serve 100 Fine-Tuned Models on One GPU, clearly explained
Avi Chawla · X · @_avichawla · 2026-09-15 16:10
📌 This article is a repost. All copyright belongs to the original author. Please refer to the original link for the authoritative version.
Everything you need to know about how multi-LoRA serving shares base weights across 100 fine-tuned variants. Covers adapter memory, request routing, batching, cold starts, worker scaling, and the deployment choices that determine GPU utilization.
With merged weights, 100 fine-tuned variants of a 7B model can take up 1.5 TB, compared with just about 19.3 GB when sharing a single base model.
The difference comes down to what the serving stack loads into GPU memory. A rank-8 LoRA adapter contains about 40 MB of task-specific weights. Merging it produces another 15.2 GB copy of the model.
A one-endpoint-per-variant setup also creates 100 separate scaling pools. Each pool has its own workers, cold starts, and idle capacity.
Keeping adapters separate changes the setup. One 15.2 GB base model plus roughly 4 GB of adapters leaves about 60 GB on an 80 GB GPU for the KV cache.
Each request still reaches its fine-tuned variant. vLLM applies the requested adapter, while every variant reuses the same base weights.
Memory savings are the obvious benefit, but worker reuse matters more in production. A shared endpoint routes every request to the same pool, whereas separate endpoints may keep one model warm while a request for another waits for a new worker.
In this article, we will test both setups under the same traffic. We will train adapters on a Pod, serve them through vLLM on Runpod Serverless, and compare one shared endpoint with separate per-model endpoints.
Runpod Serverless is well suited to this test because its flex workers can scale to zero and are billed by the second. Its worker states and request timings let us distinguish GPU startup time from time spent waiting for capacity.
There are four deployment options:
-
Merged, one endpoint per variant → The adapter becomes part of a full copy of the base model.
-
Unmerged, registered at startup → A single base model is shared, and each adapter is loaded when the worker starts.
-
Unmerged, resolved on request → The engine fetches an adapter the first time a request needs it.
-
Managed per tenant → The provider manages the base model and adapters behind an API.
We will compare all four approaches, build the shared-base setup on Runpod, and benchmark it against a one-endpoint-per-model setup. To follow along, create a Runpod account and work through the build below.
A quick note on terminology:
-
An adapter is a small set of trained matrices that stores the fine-tuning updates.
-
An endpoint defines the API and scaling configuration. A worker is a running process attached to a GPU. A single endpoint can therefore launch multiple workers, each loading the configured model weights.
Let's get started!
1) Merged, one endpoint per variant
Merging adds the adapter's changes to the base model, so the serving engine no longer needs to load or apply the adapter separately.
That simplicity comes at a memory cost: every fine-tuned variant becomes another 15.2 GB copy of the model. Three variants require 45.6 GB, even though each started as just a 40 MB adapter.
In this setup, each variant also has its own endpoint and workers. When no worker is ready, the request must wait for Runpod to start a GPU worker and load the model.
In one test, RunPod measured this startup delay at 324 seconds when running a 32B model on two H200 GPUs. Four configuration changes reduced it to about 91 seconds without changing the model's speed once it was running.
Separate endpoints also prevent workers from helping one another. An idle worker hosting the extraction model cannot handle a request for the SQL model. The SQL request launches another worker while the first GPU remains unused.
Merging still makes sense when variants need different base models, different GPUs, or complete isolation. When all adapters share one base model, separate copies mostly duplicate memory usage and workers.
2) Unmerged, registered at startup
The base model is loaded only once. Rather than merging each fine-tuned variant into a full model, workers load smaller adapters alongside it.
Each request invokes the adapter it needs. vLLM applies that adapter to the shared base model and generates a response. This allows extraction, SQL, and routing requests to use the same GPU without loading three full models.
Each worker loads the same base model and set of adapters, so any worker can handle any variant. The worker pool grows with traffic, not with the number of fine-tuned variants.
Adding another variant now requires only about 40 MB of adapter memory, rather than another 15.2 GB copy of the model.
There are two practical constraints.
All adapters must come from the same base model. They also consume GPU memory, leaving less room for active requests.
3) Unmerged, resolved at request time
Registering adapters at startup (approach 2) works well when the catalog is small and changes infrequently.
A larger catalog might contain hundreds of customer adapters, with only a handful receiving requests at any given time.
Request-time loading keeps these adapters in storage rather than loading them all when a worker starts.
When a request needs an adapter that is not loaded, vLLM fetches it and adds it to the running worker.
Subsequent requests can reuse that adapter without restarting the endpoint. New adapters can also be added without another deployment.
This supports a larger catalog, but the first request for an unloaded adapter takes longer. It must wait for the adapter to be fetched and copied into GPU memory.
Use request-time loading when adapters change frequently or the entire catalog cannot fit into GPU memory. For a small, stable catalog, loading everything at startup is simpler and avoids first-request latency.
4) Hosted per-tenant
The provider stores the adapters and serves them through an API, typically charging per token rather than per GPU-hour. The provider controls the deployment layout and limits what you can measure or tune.
You do not need to deploy anything yourself. The rest of this installment assumes you want control over the GPUs.
Here is a summary of all four options we have discussed:
This chart shows how the number of workers required changes as the catalog grows:
The merged setup requires more workers for each new variant, while both unmerged setups reuse the same worker pool, adding workers only as request volume increases.
Building option two on RunPod (Implementing option two on RunPod)
This experiment measures whether a shared endpoint starts fewer workers and results in fewer cold starts than three separate endpoints.
To test this, we first train three adapters: one for extraction, one for SQL generation, and one for request routing. We then deploy them in two configurations:
-
One endpoint loading the base model and all three adapters
-
Three endpoints, each loading the base model and one adapter
Both configurations will receive the same requests. We will then compare how long those requests wait, the number of workers started, and the GPU time used by each configuration.
We will run training on a Runpod Pod, then move the adapters to Runpod Serverless for deployment testing.
Serverless reports whether workers are running, starting, throttled, or waiting for GPU capacity. This helps us separate cold-start time from model execution time.
Runpod’s vLLM workers also accept adapter settings through environment variables, so we can test both configurations without building a custom container.
The experiment uses a 1.5B Qwen model to keep costs low. The previous example used a 7B model, but the shared-base mechanism remains the same.
Step 1: Keys:
Create a Runpod API key (here). Create a Hugging Face token with write permissions. Export both in your local terminal:
export RUNPOD_API_KEY=”your-key-here”
export HF_TOKEN=”your-huggingface-token”
The first key creates and manages Runpod resources. The second is passed into the training Pod so it can upload the trained adapters.
Step 2: Configure the Pod:
We use Runpod’s command-line client instead of creating a machine in the dashboard. Install it and connect it to your account:
wget -qO- cli.runpod.net | sudo bash # Install on Linux
brew install runpod/runpodctl/runpodctl # Install on macos
bash <(curl -sL cli.runpod.io)
runpodctl config --apiKey “$RUNPOD_API_KEY”
Now create a Pod from Runpod’s PyTorch template:
runpodctl pod create \
--name lora-training \
--template-id runpod-torch-v21 \
--gpu-id “NVIDIA GeForce RTX 4090” \
--volume-in-gb 30 \
--env “{\”HF_TOKEN\”:\”$HF_TOKEN\”}”
This call provisions an RTX 4090, mounts a 30 GB working volume, and makes the Hugging Face token available inside the Pod. The 1.5B model does not require a larger GPU for training.
The command returns a Pod ID. Once the Pod is running, retrieve its SSH command and connect to it:
runpodctl ssh info YOUR_POD_ID
Run steps 3 through 6 in this SSH session. The working volume persists after the Pod is stopped, but Runpod deletes it when the Pod is terminated. We upload the adapters before terminating the machine.
Step 3: Install the training packages
The PyTorch template already includes a CUDA-compatible installation of PyTorch. Keep it. We only need the fine-tuning and dataset libraries:
pip install -U trl peft datasets accelerate huggingface_hub
That is the entire software setup. trl runs supervised fine-tuning, peft creates LoRA adapters, and datasets reads the training files.
Step 4: Create three small datasets
We want routing errors to be obvious.
So the extraction adapter returns JSON, the SQL adapter returns a query, and the routing adapter returns a support queue. The implementation is as follows:
import json
from pathlib import Path
def extract(i):
note = f"Order ORD-{40000+i} has {i % 5 + 1} items. Ship to Lisbon by DHL."
answer = json.dumps({”order_id”: f”ORD-{40000+i}”, “city”: “Lisbon”,
“quantity”: i % 5 + 1, “carrier”: “DHL”})
return “Extract the order details. Reply with JSON only.”, note, answer
def sql(i):
question = f”How many shipped orders have amount over {100+i}?”
answer = f”SELECT COUNT(*) FROM orders WHERE status = ‘shipped’ AND amount > {100+i};”
return “Answer with one SQLite query only.”, question, answer
def route(i):
messages = ["My card was charged twice.", "Tracking has not moved.", "I cannot sign in."]
queues = [”billing”, “shipping”, “account”]
choice = i % 3
ticket = f”Ticket {1000+i}: {messages[choice]}”
return “Return the support queue only.”, ticket, queues[choice]
Next, we generate the data:
Path(”data”).mkdir(exist_ok=True)
for task, make_example in {”extract”: extract, “sql”: sql, “route”: route}.items():
with open(f”data/{task}.jsonl”, “w”) as file:
for i in range(600):
system, user, answer = make_example(i)
row = {
“prompt”: [{”role”: “system”, “content”: system},
{”role”: “user”, “content”: user}],
“completion”: [{”role”: “assistant”, “content”: answer}],
}
file.write(json.dumps(row) + “\n”)
Once this is done, you should see 600 lines in each file. TRL recognizes this prompt-completion format and trains on the answers, without requiring you to manually assemble chat histories.
Step 5: Train an Adapter for Each Task
Next is the training script. Its first half defines the shared base model and the LoRA adapter:
import argparse
import torch
from datasets import load_dataset
from peft import LoraConfig
from trl import SFTConfig, SFTTrainer
parser = argparse.ArgumentParser()
parser.add_argument(”task”, choices=[”extract”, “sql”, “route”])
task = parser.parse_args().task
base = “Qwen/Qwen2.5-1.5B-Instruct”
adapter = LoraConfig(
r=16,
lora_alpha=32,
lora_dropout=0.05,
target_modules=[”q_proj”, “k_proj”, “v_proj”, “o_proj”,
“gate_proj”, “up_proj”, “down_proj”],
task_type=”CAUSAL_LM”,
)
The rank r=16 controls the adapter's size. The target list tells PEFT which parts of the transformer can receive these small updates. The base weights remain frozen.
Next, configure the trainer:
training = SFTConfig(
output_dir=f”adapters/{task}”,
num_train_epochs=3,
per_device_train_batch_size=8,
gradient_accumulation_steps=2,
learning_rate=2e-4,
max_length=512,
save_strategy=”no”,
report_to=”none”,
model_init_kwargs={”dtype”: torch.bfloat16},
)
trainer = SFTTrainer(
model=base,
args=training,
train_dataset=load_dataset(”json”, data_files=f”data/{task}.jsonl”, split=”train”),
peft_config=adapter,
)
trainer.train()
trainer.save_model(f”adapters/{task}”)
Train the three adapters one after another:
python train.py extract
python train.py sql
python train.py route
Each output directory should contain adapter_config.json and adapter_model.safetensors. With a rank of 16 across all seven projection modules, each adapter_model.safetensors file is approximately 70 MB.
It does not contain another multi-GB copy of Qwen. This is the first checkpoint to confirm that the adapters remain separate.
Step 6: Upload the Adapters
The Hugging Face CLI creates each repository if it does not already exist and uploads the corresponding folder. Replace YOUR_USERNAME before running these commands:
hf upload YOUR_USERNAME/qwen15-lora-extract adapters/extract .
hf upload YOUR_USERNAME/qwen15-lora-sql adapters/sql .
hf upload YOUR_USERNAME/qwen15-lora-route adapters/route .
Open each repository and confirm that both adapter files are present. You can then stop or terminate the training Pod.
Step 7: Deploy the Shared Serverless Endpoint
Return to the local terminal from Step 1. Search Runpod Hub for the current vLLM worker:
runpodctl hub search vllm
Copy the ID of Runpod's vLLM listing. Save it along with your Hugging Face username and adapter list:
export VLLM_HUB_ID=”id-from-the-search-result”
export HF_USER=”your-hugging-face-username”
export LORA_MODULES=”[
{\”name\”:\”extract\”,\”path\”:\”$HF_USER/qwen15-lora-extract\”},
{\”name\”:\”sql\”,\”path\”:\”$HF_USER/qwen15-lora-sql\”},
{\”name\”:\”route\”,\”path\”:\”$HF_USER/qwen15-lora-route\”}
]”
Now create the endpoint:
runpodctl serverless create \
--hub-id “$VLLM_HUB_ID” \
--name qwen-lora-shared \
--gpu-id “NVIDIA GeForce RTX 4090” \
--workers-min 0 \
--workers-max 3 \
--idle-timeout 5 \
--env MODEL_NAME=Qwen/Qwen2.5-1.5B-Instruct \
--env ENABLE_LORA=true \
--env MAX_LORAS=3 \
--env MAX_LORA_RANK=16 \
--env “LORA_MODULES=$LORA_MODULES”
When you deploy from a Hub ID, the GPU type and container disk settings come from the Hub release.
-
The --gpu-id flag overrides that default.
-
ENABLE_LORA enables adapter support.
-
MAX_LORAS=3 allows requests for all three adapters to share a batch.
-
LORA_MODULES registers the names that will later appear in the model field of each request.
The endpoint starts with no workers and can scale up to three. This allows it to scale back down to zero after five seconds of inactivity, which we will use in the cold-start test in Step 10.
The command returns the new endpoint ID. Save it and check the deployment:
export ENDPOINT_ID=”id-from-the-create-result”
Step 8: Confirm That the Adapters Are Loaded
curl -s "https://api.runpod.ai/v2/${ENDPOINT_ID}/openai/v1/models" \
-H "Authorization: Bearer ${RUNPOD_API_KEY}" |
python -m json.tool
This request starts a worker if none is running, so the first request may take a while. The response should list the base model along with extract, sql, and route. If you see only the base model, stop here. The endpoint has not loaded the adapters, so every subsequent measurement would test the wrong thing.
Step 9: Send One Request to Each Adapter
The URL stays the same. Only the model field changes:
curl -s "https://api.runpod.ai/v2/${ENDPOINT_ID}/openai/v1/chat/completions" \
-H "Authorization: Bearer ${RUNPOD_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"model":"sql","messages":[{"role":"user","content":"How many shipped orders have amount over 500?"}],"max_tokens":48}'
Run the same request with extract and route, using an appropriate prompt for each task. If the outputs have the expected format, a single endpoint is switching among the three fine-tuned models.
You can automate the warm-request latency check with a small Python script. If openai is not already installed in your local shell environment, install it first. This measures the full request, which is sufficient to catch substantial switching overhead:
import os, statistics, time
from openai import OpenAI
client = OpenAI(
api_key=os.environ[”RUNPOD_API_KEY”],
base_url=f”https://api.runpod.ai/v2/{os.environ[’ENDPOINT_ID’]}/openai/v1”,
)
prompts = {
“extract”: “Extract: Order ORD-40100 has 2 items. Ship to Lisbon by DHL.”,
“sql”: “How many shipped orders have amount over 500?”,
“route”: “Tracking has not moved.”,
}
for model, prompt in prompts.items():
times = []
for _ in range(5):
started = time.perf_counter()
client.chat.completions.create(
model=model,
messages=[{”role”: “user”, “content”: prompt}],
max_tokens=48,
temperature=0,
)
times.append(time.perf_counter() - started)
print(model, f”{statistics.median(times):.2f}s median”)
In our warm-start tests, the adapters stayed within the base model’s normal range of variation. This serving setup saved memory without adding noticeable request latency.
The script prints one timing result for each adapter. Each number is the median time across five requests:
It does not print the generated answers. Run the script against your endpoint and replace these placeholders with the three values from your terminal. These numbers will be compared with the results of the separate-endpoint tests in Step 11.
Step 10: Measure Cold Starts
Step 9 measured requests while a worker was already running. This test starts after the endpoint has scaled back down to zero workers.
Check the endpoint from your local terminal:
curl -s "https://api.runpod.ai/v2/${ENDPOINT_ID}/health" \
-H "Authorization: Bearer ${RUNPOD_API_KEY}" |
python -m json.tool
The workers section should show zero workers in every state, including throttled:
“workers”: {”idle”: 0, “initializing”: 0, “ready”: 0,
“running”: 0, “throttled”: 0, “unhealthy”: 0}
Next, we run this script to measure cold-start statistics:
import os, time, requests
base = f”https://api.runpod.ai/v2/{os.environ[’ENDPOINT_ID’]}”
headers = {”Authorization”: f”Bearer {os.environ[’RUNPOD_API_KEY’]}”}
payload = {”input”: {
“openai_route”: “/v1/chat/completions”,
“openai_input”:{
“model”: “sql”,
“messages”: [{”role”: “user”, “content”: “Count shipped orders over 500.”}],
“max_tokens”: 48,
“temperature”: 0,
},
}}
response = requests.post(f”{base}/run”, headers=headers, json=payload, timeout=30)
response.raise_for_status()
job = response.json()
while True:
response = requests.get(f”{base}/status/{job[’id’]}”, headers=headers, timeout=30)
response.raise_for_status()
result = response.json()
if result[”status”] in {”COMPLETED”, “FAILED”, “CANCELLED”, “TIMED_OUT”}:
break
time.sleep(2)
if result[”status”] != “COMPLETED”:
raise RuntimeError(result)
print(”status:”, result[”status”])
print(”delayTime:”, f”{result[’delayTime’] / 1000:.2f}s”)
print(”executionTime:”, f”{result[’executionTime’] / 1000:.2f}s”)
The terminal will print the following:
status: COMPLETED
delayTime: 171.89s
executionTime: 0.56s
-
delayTime covers everything before a worker picks up the job, including worker startup and time spent waiting for GPU capacity.
-
executionTime covers request processing after pickup.
In this run, 99.7% of the measured time occurred before inference. The pickup delay was roughly 307 times the execution time. So a model that responds in half a second may take nearly three minutes to deliver a response to the user after the endpoint scales to zero.
Because this test starts with zero workers and one queued request, startup dominates unless Runpod marks the worker as throttled.
Repeat the health check and script three times. Let the endpoint return to zero workers before each run, then record both values.
Our three clean trials waited 409, 245, and 214 seconds, respectively, before pickup. The median cold start was 245 seconds. Execution time stayed around half a second.
This variability is unsettling, but useful. Most of the uncertainty comes from starting the worker, not running the model.
These numbers also far exceed the time a 1.5B model should need on a 24 GB GPU, and the configuration explains why. Nothing is cached: every cold start pulls the vLLM worker image, then downloads the base model and all three adapters from Hugging Face before warming up the engine.
Runpod’s own article on related configuration changes reduced startup time for a much larger model from 324 seconds to 91 seconds without any code changes. Baking the model into the image or caching it on a network volume, while keeping FlashBoot enabled, would eliminate most of the delay we measured here. We kept the default configuration to make the two layouts comparable, but treat 245 seconds as an unoptimized baseline, not an inherent property of the platform.
If Runpod reports a throttled worker, discard that trial. The request is waiting for GPU capacity, so delayTime no longer represents worker startup time alone.
Step 11: Compare One Endpoint with Three Endpoints
The shared endpoint loads all three adapters. Now we will create three separate endpoints, each loading one adapter.
Return to the local terminal where VLLM_HUB_ID and HF_USER are already set. Define a small shell function to keep the common settings consistent:
create_single_adapter_endpoint() {
adapter="$1"
runpodctl serverless create \
--hub-id "${VLLM_HUB_ID}" \
--name "qwen-lora-${adapter}" \
--gpu-id "NVIDIA GeForce RTX 4090" \
--workers-min 0 \
--workers-max 3 \
--idle-timeout 5 \
--env MODEL_NAME=Qwen/Qwen2.5-1.5B-Instruct \
--env ENABLE_LORA=true \
--env MAX_LORAS=1 \
--env MAX_LORA_RANK=16 \
--env "LORA_MODULES=[{\"name\":\"${adapter}\",\"path\":\"${HF_USER}/qwen15-lora-${adapter}\"}]"
}
Run the function once for each adapter:
create_single_adapter_endpoint extract
create_single_adapter_endpoint sql
create_single_adapter_endpoint route
Each command prints the endpoint it creates. Copy the three endpoint IDs into environment variables:
export EXTRACT_ENDPOINT_ID="id-from-extract-create-result"
export SQL_ENDPOINT_ID="id-from-sql-create-result"
export ROUTE_ENDPOINT_ID="id-from-route-create-result"
Verify that each endpoint has registered its adapter, as in Step 8:
for id in \
"${EXTRACT_ENDPOINT_ID}" \
"${SQL_ENDPOINT_ID}" \
"${ROUTE_ENDPOINT_ID}"
do
curl -s "https://api.runpod.ai/v2/${id}/openai/v1/models" \
-H "Authorization: Bearer ${RUNPOD_API_KEY}" |
python -m json.tool
done
Each endpoint uses the same base model, GPU, worker limits, and five-second idle timeout. Only LORA_MODULES changes. MAX_LORAS is now 1 because each endpoint serves one adapter.
We now have two layouts:
-
Shared layout: one endpoint, three adapters.
-
Separate layout: three endpoints, one adapter each.
Send the same five-minute traffic stream to both layouts at one request per second. Alternate between extraction, SQL, and routing. Save the delayTime for each job. Also record the peak worker count shown by Runpod and the billed worker time for the run.
Keep the rate low enough for a warm worker to keep up. If requests queue behind other requests, a long delayTime can look like a cold start even when no workers are starting up.
Here is what happened in our run:
Notice that the separate layout used fewer billed worker-seconds, but not because its workers hit their idle timeout. With one request every three seconds per endpoint, a warm worker never reaches the five-second idle timeout. The separate endpoints spent most of the five-minute run cold-starting, so requests queued behind startup and far fewer requests completed.
The separate layout was cheaper in this short run because it completed fewer requests and left most requests waiting for more than two minutes.
The shared worker stayed active because the combined traffic kept arriving at the same pool. This is an operational advantage that memory calculations overlook.
Step 12: Turn Measurements into a Cost Estimate
Use your current Runpod GPU rate rather than copying the prices in this article. Rates depend on the GPU type and worker mode.
For flex workers, estimate the monthly cost as:
GPU rate × (request execution hours + startup hours + idle hours)
Request execution time should be similar across both layouts because the model generates the same tokens. Startup and idle time are billed separately for each endpoint. Three separate endpoints may therefore incur this overhead three times during the same traffic cycle.
For active workers, multiply the monthly price of an always-on worker by the number of endpoints. One shared endpoint needs one warm worker as a baseline. Three separate endpoints need three if every variant must respond immediately.
Use the 245-second cold start from Step 10 only as an example. Replace it with your median, then calculate busy and quiet periods separately. When traffic is sporadic, startup accounts for a larger share of the bill.
Wrapping up (Summary)
LoRA fine-tunes are small before merging. Merging creates a full copy of the model for each variant, and separate endpoints give each copy its own worker pool.
That trade-off makes sense when models need different hardware or complete isolation. When every adapter comes from the same base model, it wastes memory and workers.
For a family of adapters built on the same base model, my default is to keep them separate. Load one base model, attach the adapters, and let every request use the same worker pool.
The adapter catalog still consumes GPU memory, and all adapters must match the base model. But adding a variant no longer means adding another full model and endpoint.
The experiment also gave us a better way to discuss serverless latency: record queue time and execution time separately. A model that runs in half a second can still feel slow if the endpoint has to pull an image and download weights every time it wakes up. That is why cold-start configuration deserves as much attention as the serving architecture.
Runpod made that distinction visible in this test. Pods handled training, Serverless exposed worker behavior, and the ready-made vLLM worker let us compare architectures without maintaining four container images.
Thanks for reading, and thanks to Runpod for working with me to tackle this problem.