Covers: Definitions; The pipeline; Results; Design rules; Interview questions, with the follow-ups; Common mistakes; What the example does not do.
Definitions
Open weights and open models
Open weights: the trained parameters can be downloaded. Open model: weights and training data are public.
Inference service and model API
Inference service: the system that hosts a model and answers queries. Model API: its interface.
Utilisation
Utilisation: the share of a paid GPU's capacity that actually serves requests. Self-hosting cost per token is inversely proportional to it.
Break-even volume
Break-even volume: the monthly token count above which a fixed self-hosting cost is lower than the API's per-token bill.
Router
Router: a component that picks which model or tool handles a request, often a small intent classifier.
Cascade
Cascade: call a cheap model first and escalate to a stronger one when a confidence signal says the first answer is unreliable.
Statistical power
Power: the chance a test detects a real difference of a given size. Paired test: compares two models on the same items using only the items where they disagree.
The pipeline
What fits, how fast, and what it costs (assumed hardware and prices).
Results
Model
16-bit
8-bit
4-bit
Batch-1 decode bound at 1 TB/s, 4-bit (the 70B row does not fit that GPU)
3B
6 GB
3 GB
1.5 GB
667 tokens/s
7B
14 GB
7 GB
3.5 GB
286 tokens/s
13B
26 GB
13 GB
6.5 GB
154 tokens/s
34B
68 GB
34 GB
17 GB
59 tokens/s
70B
140 GB
70 GB
35 GB
29 tokens/s
Where it fits (20% headroom)
16-bit
8-bit
4-bit
7B
laptop, 24 GB GPU, 80 GB GPU
laptop, 24 GB GPU, 80 GB GPU
also the 8 GB phone
13B
80 GB GPU only
laptop, 24 GB GPU, 80 GB GPU
laptop, 24 GB GPU, 80 GB GPU
70B
none
none
80 GB GPU only
8B model, sequence 2,048
Tokens/s
$ per M tokens at 10%
at 30%
at 60%
at 100%
Batch 1
117
59.28
19.76
9.88
5.93
Batch 8
651
10.67
3.56
1.78
1.07
Batch 32
1,271
5.46
1.82
0.91
0.55
Engineering cost per month
Fixed cost per month
Break-even tokens per month
Utilisation needed (batch 32)
$0
$1,825
304 M
9%
$7,500
$9,325
1,554 M
47%
$15,000
$16,825
2,804 M
84%
Routing frontier and the number of evaluation items a model switch needs.
Strategy (small cost 1, large cost 20)
Accuracy
Cost
Always small
37.3%
1
Always large
84.3%
20
Random, 25% large
48.9%
5.74
Random, 50% large
60.9%
10.5
Random, 75% large
72.4%
15.2
Cost to come within 2 points of the large model
Cost
Saving vs always large
Cascade, no confidence signal
20.2
none (worse)
Cascade, signal strength 1
18.8
6%
Cascade, signal strength 2
16.0
20%
Cascade, signal strength 4
13.1
34%
Difficulty router, noise 0.05 / 0.2 / 0.5
17.0 / 18.2 / 18.9
15% / 9% / 6%
Small model skill (accuracy)
Cascade (signal 2) cost
Router (noise 0.05) cost
0.40 (37%)
16.0
17.0
0.55 (57%)
11.3
14.6
0.70 (74%)
4.7
9.1
Large model price ratio
Always large
Cascade (signal 2)
5x
5
4.8
20x
20
16.0
50x
50
38.6
Items
Power, paired test
Power, independent test on the same items
300
13%
4%
1,000
31%
13%
3,000
72%
48%
3,651
79%
59%
6,187
95%
86%
Memory sets what runs where; quantisation moves a model down a device class.
Self-host cost is mostly utilisation: the same GPU cost $0.55 or $59 per million tokens depending on batching and load.
Break-even is a volume and staffing question, and may exceed what one GPU can serve.
A cascade is only as good as its confidence signal, and a useless one costs more than not routing.
Routing pays most when the small model is already decent and the price gap is large.
Small accuracy gaps need thousands of items to detect.
Design rules
Write down the seven axes and which ones are hard constraints (privacy, region, on-device) before comparing models.
Read each licence for commercial use, user-count limits and output-use restrictions.
Size memory as weights plus cache, then check decode speed with a bandwidth bound before renting hardware.
Compute cost at realistic utilisation, not full load, and include engineering and on-call time.
Measure the small model on your own traffic before designing a router; the gain depends on it.
Make routers and confidence checks cheap and measure their own accuracy.
Keep an escape hatch: log escalations and sample the cheap path for review.
Use a paired comparison on a fixed evaluation set and plan the item count for the gap you care about.
Pin versions of open weights and record them with every evaluation.
Interview questions, with the follow-ups
Would you self-host a model or use an API?
"I start from hard constraints: data that cannot leave, regional rules, on-device needs. If none apply it is cost, quality and effort. In my toy an 8B model cost $0.55 per million tokens at full load and batch 32 but $59 at 10 percent load at batch 1, against an assumed $6 API price, so utilisation decides. Adding engineering time moved break-even from 304 million to 1.5 billion tokens a month." Follow-up: "What would change your mind?" Needing the strongest model, function calling or structured outputs out of the box, or low traffic.
How would you route between a small and a large model?
"Measure the small model on real traffic first. Then either a cheap difficulty or intent classifier before the call, or a cascade that escalates on a confidence signal. In my simulation a cascade with a good signal came within 2 points of the large model at 16 against 20, a useless signal cost 20.2, and a stronger small model cut it to 4.7. Random mixing only moves along the straight line." Follow-up: "How do you know the router is not hurting?" Sample cheap-path answers for review and track accuracy by route.
Will a 13B model run on my 24 GB GPU, and how fast?
"In 16-bit the weights are 26 GB, so no; in 8-bit they are 13 GB and fit with room for the cache. Decode is bandwidth-bound: bandwidth divided by weight bytes gives an upper bound, about 77 tokens per second for 8-bit at an assumed 1 TB/s, before the cache and overhead." Follow-up: "What else limits you?" The KV cache and batch size (module 6).
How many evaluation items do you need to switch to a cheaper model?
"It depends on the gap I must detect. In my simulation a 2-point difference needed about 3,650 items with a paired test, and 300 items gave only 13 percent power. If the cheaper model is only worse by 10 points, a few hundred are enough; for 2 points I need thousands, or I accept a pre-agreed margin and test non-inferiority." Follow-up: "Why paired?" Both models see the same items, so only the disagreements carry information.
Common mistakes
Comparing price per token without utilisation and staffing.
Assuming a model fits because the weights do, ignoring the cache.
Routing before measuring the small model.
A confidence signal nobody has evaluated.
Ignoring licence terms on output use or user counts.
Switching models on 100 test items.
Not pinning the open-weight version or the API model version.
Quoting vendor benchmark gaps as if they applied to your task.
What the example does not do
No real model: correctness is a sigmoid of skill minus difficulty; real errors are structured and correlated with the confidence signal in messier ways.
Assumed prices and hardware: only the 2 TB/s A100 bandwidth is a published figure; GPU rental, API price, device bandwidths and engineering cost are mine.
Throughput is a bytes-over-bandwidth model with a multi-head cache layout; it ignores compute, scheduling, prefill and network time.
Router and confidence signal are simulated, not trained on text.
The power calculation uses a normal approximation and one family of models; it does not cover multiple metrics or multiple comparisons.
No safety, privacy-compliance or licensing analysis beyond the three licence questions in the exercises.
Optional real experiment (I did not run this): take 500 real requests from your agent, run them through a small open model (for example with llama.cpp or vLLM) and a hosted model, score both with the same judge and compute the paired differences and the share of requests where a cheap confidence check agrees with the judge.
Check yourself
Why can an idle self-hosted GPU cost more than the API? (You pay for the hour whether tokens flow or not. In my model batch 32 at full load cost $0.55 per million tokens but $5.46 at 10 percent utilisation, against an assumed $6 API price.)
For the curious Router quality is everything
A cascade with an informative confidence signal came within 2 points of the large model at cost 16.0, against 20 for always using the large model. With no signal it cost 20.2, worse than always using the large model, because the small call was wasted. The saving shrinks as the price ratio shrinks (about 5 percent at 5x, 20 percent at 20x). A few hundred test items cannot show a 2-point difference: the paired test needed about 3,651. Prices, hardware and the correctness model are assumed; no real model was served.
What you will use daily at work
Practice
What it looks like
Size memory before you choose
Weights = parameters x bytes, plus the KV cache.
Compute cost per token at real utilisation
Include engineering time.
Route only after measuring the small model
On your own traffic and your own eval.
Read the licence for each model
Commercial use, restrictions, output use.
Draft: confirm current licence terms, GPU rental prices and the serving stack you would use before relying on any figure here.
What you must be able to say (one page)
"Open" is a spectrum. A common distinction separates open weights (you can download the model) from open models (the training data is public too). "Open source" is often used loosely for any public-weight model, though most are open-weight only. Licences differ model by model; ask: does it allow commercial use, are there restrictions (the Llama licences require a special licence above 700 million monthly active users), and may you use its outputs to train other models (Llama 2 forbade it; later Llama versions relaxed this with conditions, which shows why you must read the current text). I did not check any current licence text.
Seven axes for self-host versus API: data privacy, data lineage, performance, functionality, cost, control, on-device. In short: self-hosting keeps data in-house, gives logprobs and the ability to fine-tune and freeze a version; APIs give the strongest models, scaling, function calling and structured outputs out of the box. Providers tend to keep their best models behind APIs, so open models often lag the frontier, while for many uses they suffice.
Will it fit, and how fast? Weights = parameters x bytes (16-bit 2, 8-bit 1, 4-bit 0.5). With 20 percent headroom: a 7B model needs 14 GB in 16-bit (fits a 32 GB laptop or a 24 GB GPU, not an 8 GB phone) and 3.5 GB in 4-bit (fits the phone); 13B in 16-bit (26 GB) fits only the 80 GB GPU; 70B in 4-bit (35 GB) fits the 80 GB GPU, in 16-bit (140 GB) fits none of my four devices. Decode speed is bounded by bandwidth / weight bytes: on a 1 TB/s GPU (assumed) a 7B model gives at most 71 tokens/s in 16-bit and 286 in 4-bit at batch 1; 13B 4-bit gives 154. These are upper bounds that ignore the KV cache and overhead (module 6).
Self-host economics are about utilisation. My model (8B 16-bit, $2.50 per GPU-hour assumed, about 2 TB/s for an A100-80GB): batch 1 gives 117 tokens/s, batch 8 651, batch 32 1,271. Cost per million tokens at batch 32: $0.55 at full load, $0.91 at 60 percent, $1.82 at 30 percent, $5.46 at 10 percent; at batch 1 it is $5.93 at full load and $59 at 10 percent. Against an assumed $6 per million API price, an idle GPU loses; a busy, batched one wins by a wide margin. API cost per token barely changes with scale, while self-hosted cost falls as you fill a fixed cluster.
Break-even needs volume and engineering time. Monthly fixed cost = GPU hours + the people. GPU only ($1,825): break-even at 304 M tokens a month (9 percent of one GPU's 3,340 M capacity at batch 32). Add $7,500 of engineering (assumed): 1,554 M tokens, 47 percent utilisation. Add $15,000: 2,804 M, 84 percent. Engineering time can cost more than the API bill it saves.
Routing and cascades (routers and cascades are common ways to mix models). My simulation: small model cost 1, large cost 20 (assumed), correctness = sigmoid(10 x (skill - difficulty)); small skill 0.4 gets 37.3 percent, large (0.8) gets 84.3 percent. A random mix only moves along the straight line between them (25 percent large: 48.9 percent at cost 5.74). A cascade (ask small, escalate when a confidence signal is low) with an informative signal beats the line: the cost to come within 2 points of the large model is 16.0 with a signal of strength 2 and 13.1 with strength 4, but 20.2 (worse than always using the large model) with no signal, because you paid for the small call too.
The savings depend on how good the small model is. Cost to match the large model within 2 points with a cascade of signal strength 2: 16.0 when the small model scores 37 percent, 11.3 at 57 percent, 4.7 at 74 percent. A difficulty-predicting router with noise 0.05 got 17.0, 14.6 and 9.1; with noise 0.2 it got 18.2 (small skill 0.4); with noise 0.5, 18.9. Router quality is everything. A verifier that costs 1 or 3 per call raised the cascade cost from 16.0 to 17.0 and 19.0.
The price ratio sets the prize. With the large model at 5x, 20x and 50x the small one, the cascade cost to match it was 4.8, 16.0 and 38.6: a saving of about 5, 20 and 23 percent. Routers should be small and cheap, for example an intent classifier built on a small language model or an even smaller classifier.
Switching models is a statistical decision. To detect a 2-point accuracy gain between two models on the same items, my paired test needed about 3,651 items for 80 percent power; an independent-samples test would need 6,187 per model. In simulation power at 3,000 items was 72 percent (paired) and 48 percent (independent test applied to the shared items, which is conservative). A gap from 70 to 80 percent needs about 295 per model; from 70 to 73 percent 3,555. A few hundred items cannot show a small difference, either way.
Why teams pick open models (an a16z enterprise survey, from memory): control and customisability; and you can freeze a version, whereas commercial models change, sometimes silently.
What to say in an interview: "I decide on seven axes: privacy, lineage, quality, features, cost, control and where it runs. I size by weights = parameters x bytes plus the KV cache, estimate decode speed from bandwidth, and compute cost per token at the utilisation I will actually achieve, including engineering time. I route or cascade only after measuring the small model on my own traffic, and I decide a switch with enough items to see the gap."
Honest limits: every price, GPU rental rate, bandwidth other than the published A100 figure, and the correctness model are assumptions; no real small model was served or evaluated; the router and confidence signal are simulated, not trained.