Design a multi-tenant fine-tuning and LoRA serving platform
I was asked this
No reports yet. Sign in to say where you were asked it.
An AI system design interview question asked in Mistral AI's system design round. It tests fine-tuning, lora and llm serving.
A model provider lets customers fine-tune its open-weight models on their own data through an API, then call the fine-tuned models through the same chat endpoint as the base models. Most customers use LoRA adapters. Design the platform: dataset validation, scheduling training jobs on shared GPUs, evaluating the result before it is deployed, and serving thousands of fine-tuned variants on shared base-model replicas with latency close to the base model.
Requirements
- Functional: upload and validate training data; start, monitor and cancel fine-tuning jobs; evaluate each result; deploy it under its own model name; call it through the standard chat API; delete it and its data on request.
- Non-functional: thousands of adapters, most rarely used and a few very busy; first-token latency within a small margin of the base model; training jobs from many customers share GPUs fairly; one customer's data and adapters never reachable by another.
Clarifying questions
- Which base model sizes, and which LoRA ranks and target layers do we allow?
- How much training data per job, and how long should a typical job take?
- How are adapters used: steady traffic, bursts, or rarely?
- Do customers ever need full fine-tuning instead of LoRA?
- What evaluation does a customer expect before deployment?
What a strong answer covers
- Data validation: format and schema checks, token counts, duplicates, a safety and policy scan, and a train/validation split; problems reported before any GPU time is spent.
- Training scheduling: a queue with per-customer quotas and priorities, packing small LoRA jobs onto shared GPUs, preemption with checkpoints, and estimated time from tokens and model size.
- Adapter size: per adapted weight matrix
r x (d_in + d_out)parameters; for example rank 16 on every attention and MLP matrix of a 7B model is about 40 million parameters, about 80 MB in 16-bit, against about 14 GB for the base weights, so a GPU can hold dozens next to the base model and host memory hundreds more. - Serving: base model replicas that load many adapters, batching requests for different adapters together with batched LoRA kernels (as in multi-adapter serving systems), adapters cached in GPU memory with LRU eviction, then CPU memory, then object storage; load time from each tier and its effect on first-token latency.
- Routing: requests for an adapter go to replicas that already hold it; popular adapters on several replicas; cold adapters loaded on demand.
- Evaluation before deployment: the validation loss, customer-supplied test prompts, standard capability and safety checks to catch regressions, with results shown to the customer.
- Isolation: per-customer storage encryption, adapters and data access-controlled by account, and deletion that covers backups.
Follow-ups
- One customer's adapter gets 1,000 requests a second. How do you serve it?
- A new base model version ships. What happens to the adapters trained on the old one?
- Offer full fine-tuning for large customers. What changes in training and serving?
- How do you detect a fine-tune that removed the base model's safety behaviour?
Where it's asked
- Mistral AI · System design60 min · Architecture discussion
What it tests
fine-tuning · lora · llm serving · gpu scheduling
Sign in to see the worked answer
The full answer, chapter by chapter, with what interviewers expect at each level. New accounts get 5 credits: each one unlocks a question for good.
What the labs asked this week
A weekly email of what OpenAI, Anthropic and the other top AI labs asked engineers, round by round.
