Sovereign inference: running LLMs where the internet isn't
What it actually takes to serve large language models inside a network with no way out: picking models against a GPU budget, batching, quantisation, routing, and upgrading a system you can't download anything into.
Most of the AI industry assumes one thing so completely that nobody writes it down: the model lives somewhere else. You send text to an API, a data centre you will never see does the arithmetic, and text comes back. Latency, scaling, upgrades and the electricity bill are someone else's problem.
For a growing share of enterprise and public-sector AI work, that assumption is simply false. Many regulated and government customers do not allow their documents to leave their network. Some of those networks have no route to the internet at all. If the assistant is going to answer a question about an internal circular, the model that reads the circular has to be in the same building as the circular.
That's what people mean by sovereign inference. It sounds like a policy word. In practice it is a long list of infrastructure decisions that cloud users never have to make, and this post is my attempt to write down the ones that mattered.
The budget is GPUs, not tokens
With a cloud API, cost is a smooth function: more tokens, more money. On-prem, cost is a step function. You buy or are allocated a fixed number of GPUs, and then you have exactly that much capacity until the next procurement cycle, which in government is measured in quarters, not days.
That flips how you choose models. The question is not "what's the best model" but "what's the best set of models that fits in this many cards, at this concurrency, with this latency target". A frontier-sized model that needs most of your cluster to serve a handful of users at a time is not an option, however good it is on benchmarks.
The constraints, roughly in the order they bite:
- Memory for weights. A model's parameters have to fit in GPU memory, across however many cards you shard it over. This sets the floor.
- Memory for the KV cache. Every active conversation holds a cache of attention keys and values that grows with context length. This, not the weights, is what limits how many users you can serve at once.
- Compute for prefill. Reading a long prompt — say, twenty retrieved document chunks — is compute-heavy and happens before the first token appears. This drives time-to-first-token.
- Bandwidth for decode. Generating tokens one at a time is mostly memory-bandwidth bound. This drives how fast the answer streams.
Retrieval-augmented assistants are prefill-heavy. A typical request carries a system prompt, a policy preamble, conversation history and a pile of retrieved chunks. The answer is often shorter than the context. That shapes almost every decision below.
Everything inside the dashed line runs in the customer's network. The only thing that crosses it is a signed bundle, and only inward.
A small set of models, not one model
The obvious first design is one general model for everything. It works, and it is wasteful. Most requests don't need the biggest model you have. Classifying intent, rewriting a query for search, summarising a single short document, extracting a date from a form — a smaller model does these as well and several times faster.
A better serving layer is a small pool with a router in front:
| Role | Size class | Typical work | Why it's separate |
|---|---|---|---|
| Router / utility | small | intent, query rewrite, safety checks | runs on every request, must be fast |
| General assistant | medium | most chat, drafting, summaries | the workhorse; best quality per GPU |
| Long-context | medium, long window | many-document synthesis, long files | needs a big KV budget, low concurrency |
| Embeddings | tiny | indexing and query embedding | different hardware profile entirely |
The router is deliberately boring. It is a small model plus a few deterministic rules, and its job is to send a request to the cheapest model that will do it well. When it's unsure, it sends the request up a tier, not down. A slightly slower good answer costs less trust than a fast wrong one.
def route(req: Request) -> str:
# deterministic rules first: cheap, predictable, auditable
if req.kind == "embed":
return "embed"
if req.context_tokens > 24_000:
return "long-context"
# then a small model labels the intent
label = utility.classify(req.last_user_message, labels=INTENTS)
if label.confidence < 0.7:
return "general" # unsure: go up a tier, never down
if label.name in {"rewrite", "extract", "classify", "short_summary"}:
return "utility"
return "general"A rough split of routing decisions over a week. Illustrative proportions, not a benchmark.
Serving: batching is the whole game
The single biggest lever on on-prem capacity is how well the server batches. A GPU generating tokens for one user is mostly idle; generating for forty at once costs only a little more per step. Modern servers in the vLLM family do continuous batching — new requests join the running batch between decode steps instead of waiting for it to finish — and page the KV cache so memory isn't reserved for the longest possible conversation.
In practice that means getting three things right.
Cap context, honestly. Every model advertises a maximum context. Serving every request at that maximum quietly eats your KV cache and your concurrency with it. Set per-route limits that match real usage and truncate retrieval to fit, rather than letting the cache decide.
Separate long prompts from short ones. One user pasting a two-hundred-page document can stall a batch full of quick questions while it prefills. Long-context work goes to its own replicas, where low concurrency is expected.
Prefix caching for the boring parts. The system prompt and the policy preamble are identical across thousands of requests in a tenant. Caching their KV state means prefill only pays for the part of the prompt that's actually new.
model: general-assistant
replicas: 4
tensor_parallel: 2 # each replica spans two GPUs
quantization: fp8 # see the trade-offs below
max_model_len: 16384 # per-route cap, not the model's max
scheduler:
max_num_seqs: 64 # concurrent sequences per replica
enable_prefix_caching: true
enable_chunked_prefill: true
max_num_batched_tokens: 8192
gpu_memory_utilization: 0.90
health:
ttft_p95_ms: 1500 # alert, don't just log
tokens_per_sec_p50: 25Quantisation, and when to stop
Quantisation — storing weights in fewer bits — is how you fit a better model into the same cards. It is also where I've seen teams lose quality without noticing, because the drop shows up in the long tail, not the demo.
What I'd recommend: quantise weights moderately for the general model, keep the router and the safety checks at higher precision because their mistakes compound, and never quantise without running the evaluation set first. A good eval set is a few hundred real, anonymised questions per tenant with known-good answers and source documents. If a quantised build loses citations or starts mixing up names across languages, it doesn't ship, however much memory it saves.
Bilingual is a requirement, not a feature
Many organisations work in more than one language, and questions arrive in either, or a mix of both in the same sentence. Many of the documents are the same. That shrinks the list of viable open models more than any benchmark does, and it changes what you test. Tokenizers that split non-English text into many small pieces make the same question cost more tokens, which means more KV cache and slower prefill for exactly the users you most need to serve well. So measure every candidate model on your own mixed-language eval set, for tokens per question as well as answer quality, before anyone looks at its leaderboard position.
Capacity planning for a large user base
Tens of thousands of users do not mean tens of thousands of concurrent requests. They mean a working-day curve: quiet before eight, a ramp through the morning, a lunchtime dip, a second smaller peak, and almost nothing at night. Institutional calendars add their own shape — the week before a reporting deadline looks nothing like the week after.
Demand follows the working day; capacity is a flat line until the next procurement. Illustrative curve.
The planning method can be deliberately simple:
- Measure, per tenant, peak concurrent generating sequences — not users, not sessions.
- Measure tokens per second per replica at the latency target, under realistic prompt lengths.
- Size replicas so the peak fits with roughly a third of headroom.
- Decide in advance what degrades first when it doesn't fit.
Step four is the one people skip. When demand exceeds capacity on-prem, you can't autoscale. You choose. A sensible order: shorten retrieved context, push non-interactive work (bulk summaries, re-indexing) to the night, route more to the smaller model, and only then queue interactive requests with an honest "busy, you're third in line" message. Nobody enjoys a queue. Everybody prefers it to a spinner that never ends.
Upgrading a system you can't download into
In the cloud, a new model version is a config change. Inside an air gap, it's a delivery.
Every artefact — model weights, server images, tokenizer files, evaluation sets, even the Python wheels — is built and tested outside, packaged into a bundle, signed, and carried in through the customer's own transfer process. On the inside, nothing is installed unless the signature checks out against a key the customer controls.
#!/usr/bin/env bash
set -euo pipefail
BUNDLE="$1"
cosign verify-blob --key /etc/assistant/import.pub \
--signature "$BUNDLE.sig" "$BUNDLE"
sha256sum -c "$BUNDLE.sha256"
tar -xf "$BUNDLE" -C /srv/import/staging
./staging/bin/run-evals --tenant-set local --min-score-from manifest.json
./staging/bin/promote --canary 10%Two habits make this bearable. First, every bundle includes the eval suite and the thresholds it must pass, and the promotion script refuses to proceed if the local run disagrees with the outside one. Second, the previous version stays on disk and warm. Rolling back is moving a pointer, not another delivery.
Seeing inside the boundary
You can't ship logs to a SaaS dashboard from a network with no internet, and you shouldn't want to: the logs contain the questions people asked about their own documents. So observability has to live inside, too.
Keep it small and specific. Per route: time to first token, tokens per second, queue depth, KV cache utilisation, and error rate. Per tenant: request volume and the share of answers with at least one citation. That last one is one of the most useful quality signals there is; when it drops, something upstream — usually retrieval or a connector — has broken, long before anyone files a complaint. The same numbers feed the feedback loop I wrote about in the air-gapped post: the on-site team sees them, and what's safe to share leaves in the same signed bundles, going the other way.
Is it worth it versus a cloud API?
People ask this as if it were a cost question. For customers with strict data residency, it mostly isn't — the documents can't leave, so the cloud API isn't on the menu. But it's still worth being honest about the comparison, because it decides how hard you push utilisation.
| Cloud API | On-prem | |
|---|---|---|
| Cost shape | per token, smooth | per GPU, stepped |
| Idle cost | none | full |
| Peak handling | someone else's problem | you plan it, you degrade it |
| Model choice | the frontier, today | what fits, tested, delivered |
| Upgrades | instant | a signed delivery and an eval run |
| Data leaves the network | yes | no |
On-prem gets cheaper per token the busier you keep it, which is why the night-time batch work matters: re-indexing and bulk summarisation run on capacity that would otherwise sit idle. It gets expensive fast if you size for a peak you never see. The honest answer is that the economics depend almost entirely on utilisation, and utilisation depends on how much of the day's work you can move off the peak.
What I'd tell a team starting today
- Plan capacity in concurrent sequences and tokens per second. Not users.
- Run a pool of models with a boring router. Escalate when unsure.
- Treat the KV cache as the scarce resource. Cap context per route and separate long work.
- Never quantise without an eval set made of the customer's own anonymised questions.
- Design the upgrade path before the first install. Signed bundles, local evals, warm rollback.
- Decide how you degrade before the first busy Monday decides for you.
None of this is novel to people who have run databases on fixed hardware. That's the part I find reassuring. Sovereign AI turns out to be mostly the old discipline of capacity planning, applied to a new and very hungry kind of workload.