A design exercise. Read the brief, sketch your answer, then read on. The platform building blocks are taught in Module 21; this lesson puts them together under real constraints.
Before you start: words you need#
| Word | Plain meaning |
|---|---|
| Tenant | A customer of the platform: an internal team, a business unit or an external company. Each has its own data, quotas and bill. |
| Variant | A tenant’s version of a model: usually a base model plus a LoRA adapter, sometimes a fully fine-tuned copy. |
| LoRA adapter | A small set of extra weights that customises a base model. Many adapters can share one copy of the base model on the same GPUs (18.g). |
| Isolation tier | How strongly a tenant is separated from others: shared GPUs, dedicated GPUs, or dedicated GPUs in a specific region or network. |
| Noisy neighbour | A tenant whose burst of traffic hurts other tenants on the same hardware. |
| Priority class | A label (interactive, standard, batch) that decides who is served first when capacity is short (20.k). |
| Long tail | The many variants that each get very little traffic. Individually tiny; together, often most of the deployments. |
| Chargeback | Billing each tenant for what it used (31.e). |
1. What is it? The brief#
REQUIREMENTS
Who: a large company's AI platform: ~300 internal teams plus ~50 external enterprise
customers who use it through the company's product
Models: 4 open base models (small, medium, large MoE, a vision-language model);
~120 tenant variants (LoRA adapters; a few full fine-tunes);
a premium closed API proxied for tasks the open models cannot do
Traffic: long-tailed: the 10 busiest variants carry ~60% of requests
Classes: interactive (SLO), standard (best effort), batch (24 h)
Isolation: most tenants shared; 5 regulated customers need dedicated GPUs in the EU
Money: every tenant sees and pays its share; the platform runs at cost
Today: every team deployed its own model; ~314 replicas at 32% average utilization
QUESTION: design the platform. How many replicas? How do tenants stay isolated and fairly served?Facts checked on 13 November 2026.
2. Why does it matter?#
This is the most common principal-level design problem in 2026: not one heroic service, but a few hundred ordinary ones that together waste a fortune.
- Dedicated deployments waste most of their GPUs. A variant with a few requests per minute still needs two replicas for availability. Across a long tail, average utilization falls to a third (section 6).
- Sharing creates new problems: noisy neighbours, data isolation, fair queueing, attribution, and rollout coordination between teams who never had to talk to each other.
- The organisation is the hard part. Teams that own their own GPUs give them up only if the platform is clearly better: faster to launch on, reliable, and cheaper on their own budget.
3. Simple analogy#
An office building versus every company building its own office. Shared reception, lifts, heating and security cost far less per desk. But tenants need locked floors, fair use of the meeting rooms, a separate electricity meter each, and a building manager who stops one tenant’s party from flooding the lifts. A few tenants (a bank, a hospital) need their own secure floor with its own entrance. Everyone else is happy on a shared floor, as long as it is clean and the lifts work.
4. Tiny example#
120 variants on 4 base models, with traffic needing 100 fully busy replicas at peak:
dedicated: each variant max(2, ceil(load / 0.7)) → 314 replicas, 32% utilization
shared: one pool per base model, adapters batched
together, +10% LoRA overhead, +1 spare → 163 replicas, 61% utilizationHalf the fleet is released by sharing, before any kernel or hardware change. Eighty-eight of the 120 variants need less than half a replica each, yet each held two in the dedicated design.
5. Technical explanation: the design#
Architecture#
flowchart LR T["Tenants<br/><small>apps, agents, batch jobs</small>"] --> GW["Gateway<br/><small>auth, quotas, metering</small>"] GW --> POL["Policy<br/><small>tier, region, data rules, priority</small>"] POL --> RT["Router<br/><small>adapter- and prefix-aware</small>"] RT --> SH["Shared pools<br/><small>one per base model, multi-LoRA</small>"] RT --> DED["Dedicated pools<br/><small>big or regulated tenants, EU</small>"] POL --> BQ["Batch queue<br/><small>fills troughs</small>"] BQ --> SH GW -.-> EXT["Premium API proxy"] REG["Model and tenant registry"] -.-> POL REG -.-> SH SH --> MET["Metering<br/><small>tokens, KV-seconds per tenant</small>"] DED --> MET class T,GW,POL,RT io class SH,DED compute class BQ,MET memory class EXT,REG warn
Control plane#
- Registry (21.b): base models, adapters, versions, owners, eval results, and which tenants may use what. A variant cannot be served until it passes the platform’s quality gate (Module 28).
- Policy: per tenant, the isolation tier, allowed regions, data-retention rules, priority class defaults, and quotas. Policy is data, not code: changing a tenant’s quota must not need a deploy.
- Placement (21.e): which base models run in which pools, how many replicas, which adapters are preloaded where. Re-evaluated as traffic shifts.
Data plane#
- Gateway (21.i): one OpenAI-compatible API for every model, provider and tier. Authenticates,
enforces quotas and rate limits (21.f, 23.j), meters usage, and is where tenants’ requests get
their priority class and their
cache_salt. - Router (21.g, 21.h): sends a request to a replica that has the right base model, preferably with the adapter already loaded and the prompt prefix already cached.
- Shared pools: one per base model, serving many adapters in the same batch (multi-LoRA, 18.g). Adapters load on demand into a cache of adapter slots; the busy ones stay resident.
- Dedicated pools: for the largest tenants (who fill a pool on their own and want their own SLOs) and the regulated EU customers. Same software, same registry, different placement.
- Batch queue (Module 27): batch-class work runs on the shared pools when interactive load is low, and is paused when it rises.
Fairness and noisy neighbours#
Layered defences, cheapest first:
- Quotas in tokens per minute and concurrent requests, per tenant and per variant (21.f).
- Priority classes in the engine’s scheduler: interactive before standard before batch (17.c, 20.k). Under pressure, batch pauses first, then standard is shed, then interactive (31.g).
- Weighted fair queueing within a class, so one tenant’s burst waits behind its own requests, not everyone’s.
- Admission control at the gateway when the pool is saturated (20.c): reject with a retry-after rather than queue without limit.
- Charge for what costs: long-context requests hold KV that others need; meter KV block-seconds (23.c).
Isolation#
| Concern | Shared tier | Dedicated tier |
|---|---|---|
| Data in transit and at rest | encrypted; per-tenant keys for logs and stored prompts | same, plus customer-managed keys |
| Prefix cache | cache_salt per tenant so cached prefixes are never shared across tenants (17.f) | not shared by construction |
| Adapters | access control in the registry; adapter IDs checked at the gateway | same |
| GPUs | shared processes; no tenant code runs on them | dedicated nodes |
| Region | any allowed region | pinned, e.g. EU only |
| Logs and debugging | tenant-scoped access; redaction | customer-approved access only |
Sharing a prefix cache across tenants can leak information through timing: a fast response reveals that someone else sent the same prefix. Per-tenant salts close that channel at the cost of fewer cache hits for common system prompts (23.i, 17.f).
Money#
- Meter per request: tenant, variant, input, cached input, output, KV block-seconds, priority class (23.c).
- Price per class: batch cheaper than standard, interactive dearer; dedicated pools billed per replica-hour.
- Showback first, then chargeback, with a monthly statement every team can read (31.e).
- The platform runs at cost, including its own team and spares. If it is not cheaper than each team running alone, teams will leave, and they should.
Migration#
The organisational plan is half the design:
- Launch the gateway first, in front of the existing deployments: metering and quotas with no change to serving.
- Move the long tail onto shared pools: the most waste, the least risk, owners who are happy to stop running GPUs.
- Offer dedicated pools on the platform for the big tenants, so they keep their isolation and SLOs while dropping their own operations.
- Publish the utilization and cost per team, before and after.
6. Under the hood: dedicated vs shared#
The program spreads 120 variants across 4 base models with Zipf-distributed (long-tailed) traffic, then counts replicas for three designs: a dedicated deployment per variant, a shared pool per base model with multi-LoRA batching, and a mixed design where the five busiest variants keep dedicated pools. The traffic shape and the 10% multi-LoRA slowdown are assumptions.
// tenants.go — dedicated deployments per tenant model vs shared base models with LoRA adapters.
package main
import (
"fmt"
"math"
)
func main() {
const (
bases = 4 // base models offered by the platform
perBase = 30 // fine-tuned variants (LoRA adapters) per base, one per tenant use case
busyTotal = 100.0 // replicas kept 100% busy at peak, summed over all variants
zipfS = 1.1 // traffic is long-tailed: a few variants carry most of it
targetUtil = 0.70
minReplicas = 2 // dedicated: at least two replicas each, for availability
loraPenalty = 0.10 // multi-LoRA batches run ~10% slower than the bare base model: ASSUMED
)
n := bases * perBase
weights := make([]float64, n)
sum := 0.0
for i := range weights {
weights[i] = 1 / math.Pow(float64(i+1), zipfS)
sum += weights[i]
}
// A: every variant gets its own deployment (merged weights, own replicas).
dedicated, tiny := 0.0, 0
for _, w := range weights {
load := busyTotal * w / sum
r := math.Max(minReplicas, math.Ceil(load/targetUtil))
if load < 0.5 {
tiny++
}
dedicated += r
}
fmt.Printf("variants: %d; top 10 carry %.0f%% of traffic; %d need under half a replica\n",
n, top(weights, 10)/sum*100, tiny)
fmt.Printf("A dedicated per variant: %4.0f replicas, average utilization %3.0f%%\n",
dedicated, busyTotal/dedicated*100)
// B: one shared pool per base model; adapters are batched together on it (18.g).
shared := 0.0
for b := 0; b < bases; b++ {
load := 0.0
for i := b; i < n; i += bases { // spread variants across bases round-robin
load += busyTotal * weights[i] / sum
}
shared += math.Max(minReplicas, math.Ceil(load*(1+loraPenalty)/targetUtil)) + 1 // +1 spare per pool
}
fmt.Printf("B shared base + LoRA: %4.0f replicas, average utilization %3.0f%%\n",
shared, busyTotal/shared*100)
// C: B, but the 5 biggest variants get dedicated pools (isolation, own SLOs, their own budget).
big, rest := 0.0, make([]float64, bases)
for i, w := range weights {
load := busyTotal * w / sum
if i < 5 {
big += math.Max(minReplicas, math.Ceil(load/targetUtil))
} else {
rest[i%bases] += load
}
}
for _, l := range rest {
big += math.Max(minReplicas, math.Ceil(l*(1+loraPenalty)/targetUtil)) + 1
}
fmt.Printf("C top 5 dedicated + rest shared: %4.0f replicas, average utilization %3.0f%%\n",
big, busyTotal/big*100)
}
func top(w []float64, k int) float64 {
s := 0.0
for i := 0; i < k; i++ {
s += w[i]
}
return s
}Output:
variants: 120; top 10 carry 61% of traffic; 88 need under half a replica
A dedicated per variant: 314 replicas, average utilization 32%
B shared base + LoRA: 163 replicas, average utilization 61%
C top 5 dedicated + rest shared: 160 replicas, average utilization 62%How to read it:
- The long tail is the waste. 88 of 120 variants need under half a replica, and the dedicated design gives each of them two. Sharing halves the fleet: 314 to 163 replicas, utilization from 32% to 61%.
- Giving the five largest tenants their own pools costs nothing (160 vs 163), because they fill their pools on their own. Large tenants can have isolation for free; small ones cannot.
- The multi-LoRA overhead is worth paying. A 10% slowdown on shared pools is tiny next to a 2x utilization gain. Measure it on your adapters and ranks (18.g).
- What is missing: troughs. Filling nights and weekends with batch-class work (Module 27) raises utilization further; the shared design makes that possible, because any pool can take any batch job for its base model.
7. Performance implications#
- Adapter swapping costs latency. Keep busy adapters resident; route to replicas that already hold the adapter; measure the cold-adapter TTFT penalty (18.g).
- Mixed tenants mean mixed shapes: one tenant’s 100k-token RAG prompts beside another’s chat. Chunked prefill caps (12.k, 17.b) and KV quotas protect interactive latency.
- Per-tenant salts reduce cache hits on common prefixes. Measure the cost; it is usually worth it.
- Priority classes need engine support (17.c). Shedding at the gateway alone reacts too slowly.
8. Production implications#
- Every tenant gets an SLO per class and a dashboard of its own traffic, errors, latency and cost (23.h).
- Rollouts of base models and engines affect everyone. Canary per pool and per tenant group, with tenants’ own evals in the gate where they have them (23.g, 31.g).
- Tenants own their adapters’ quality; the platform owns the base model, the engine and the serving quality checks (Module 28).
- Capacity planning is per base model and region, from the sum of tenants’ forecasts plus the platform’s own growth view (23.b, 31.d).
- Deprecation policy: base models are retired on a published schedule, with migration help.
9. Common mistakes#
- One deployment per team “for isolation” when the team needs a tenth of a replica.
- Sharing without quotas or priorities. The first noisy neighbour ends the platform’s credibility.
- A shared prefix cache across tenants without salts: a data-isolation incident waiting to happen.
- Billing per request. Long-context tenants are subsidised (23.c).
- Forcing big tenants onto shared pools. Give them dedicated pools on the same platform.
- Migrating the biggest, most critical service first. Start with the long tail.
- Policy hard-coded in services. Every quota change becomes a deploy.
10. Hands-on exercise#
- Run
tenants.go. ChangezipfSto 0.6 (traffic spread more evenly). How much does sharing save now? Why? - Raise
loraPenaltyto 0.30. Is sharing still worth it? - Add the regulated EU tier: 5 of the mid-sized variants must run on dedicated EU replicas. How many replicas does that add?
- Design the priority and quota policy for three tenants: a customer-facing chat (interactive), an internal analytics job (batch) and a data-science team’s notebooks (standard). What happens to each at 90% load and at 110%?
- Write the migration plan for the first quarter: which variants move first, and what you show each team before and after.
11. Interview questions#
- Why does a long tail of variants waste so many GPUs when each has its own deployment?
- How do you stop one tenant’s burst from hurting everyone else?
- What can leak between tenants on a shared inference server, and how do you prevent it?
- When should a tenant get dedicated GPUs?
- How do you bill tenants fairly for long-context requests?
- Teams refuse to give up their own GPUs. What do you do?
12. Further reading#
Checked on 13 November 2026.
- vLLM: LoRA adapters — serving many adapters on one base model.
- S-LoRA: serving thousands of concurrent LoRA adapters (arXiv 2311.03285)
- Kubernetes Gateway API Inference Extension — model-aware routing, criticality and LoRA-aware scheduling at the gateway.
- 21.a–21.m (the platform building blocks), 18.g (LoRA in vLLM), 17.f (
cache_salt), 23.c (attribution and KV block-seconds), 23.i (security and isolation), 20.k (priorities).