Choosing a model: capability, cost, latency, open vs hosted
Eight axes, one eval, and the number that decides it: cost per task on your own traffic, not rank on someone else's leaderboard
Model A is ranked 12 places above model B on LMArena. You run both on your 50-item support-ticket classifier from the prompting chapter. What gap should you expect?
Every chapter until now used one model and asked how to prompt it. This chapter asks the question that comes before that: which model, and at what price. The answer has a shape. You list the axes that matter for your task, you use public evidence to shortlist candidates, and then you run your own eval and read it as cost per task. Everything else is detail about those three steps.
The axes
A model choice is a point in an eight-dimensional space. Most teams look at one or two axes. The ones they skip are where the surprises live.
| Axis | What to measure | How it goes wrong |
|---|---|---|
| Capability on your task | Accuracy, pass rate or rubric score on your eval set | Measured on a benchmark that is not your task |
| Cost per task | Input plus output tokens at list price, times calls per task, plus retries | Compared on price per million tokens instead |
| Latency | Time to first token and time to last token at p50 and p95 under your load | Measured once, warm, at midnight |
| Context length | Tokens your longest input needs, plus headroom for history and tool results | A 200K-token model meets a 230K-token document in production |
| Modality | Text, image, PDF, audio in; text, structured JSON, tool calls out | Picking a text-only model for a workflow that turns out to need receipts |
| Tool-use quality | Does it pick the right tool, with valid arguments, and stop when done | Fine on the demo, loops or hallucinates arguments at scale |
| Data handling and residency | Retention policy, training on your data, region of inference, zero-data-retention terms | Legal finds out after launch |
| Licence | Open weights under which terms; hosted under which terms of service | A community licence with a monthly-active-user cap, or a clause that forbids your use case |
Two of these need numbers you will not find on a pricing page. Capability on your task exists only after you have an eval, which is why the prompting chapter made you build one. Latency at p95 under your load exists only after you have generated your load.
Context length deserves a second look. The current Claude models all accept 1M tokens of input and produce up to 128K of output. That number is not the one that constrains you. Cost is: at $2 per million input tokens a 500K-token prompt costs $1 before the model writes a word, and on Claude Haiku 5.5 prompts over 100K tokens move to a higher rate card ($0.50 / $2.50 instead of $0.10 / $0.50 per million). Accuracy is: models lose recall in the middle of very long inputs, a result the long-context chapter in module three measures. The question is never “does it fit” but “what does it cost and what does the model miss at that length”.
Leaderboards: how to read them without being fooled
Two public sources dominate conversations about model choice. LMArena (formerly Chatbot Arena) collects pairwise human preferences: a volunteer types a prompt, sees two anonymous answers, and votes. The votes feed a Bradley-Terry model that produces a score and a rank. Artificial Analysis runs a fixed suite of academic benchmarks against each model and publishes an aggregate “Intelligence Index” alongside measured output speed and a blended price.
Both are useful. Neither is evidence about your task, for reasons that are structural rather than a matter of execution.
The distribution is not yours. Arena prompts are whatever volunteers type, which skews towards coding, creative writing and trivia. Artificial Analysis benchmarks are maths competitions, graduate-level science questions and coding tasks. A ticket classifier, a contract clause extractor or a support agent over a shop database shares almost nothing with either. A model can be excellent at competition maths and mediocre at following a 40-line system prompt about refund policy.
Preference is not correctness. An arena vote measures which answer the voter liked. Longer, more confident, better-formatted answers win votes independently of being right. The Chatbot Arena paper itself documents this and works to control for it; the control is partial.
The ranking is gameable, and has been gamed. “The Leaderboard Illusion” (Singh et al., 2025) showed that some providers tested many private variants on the arena and published only the best, and that proprietary models received far more arena battles (hence more feedback) than open ones. A rank is partly a measure of how much a vendor optimised for the arena.
Aggregates hide the variance you care about. An index averaging ten benchmarks tells you nothing about which of the ten a model failed. Your task is likely closest to one of them, or to none.
So how do you read them anyway? As a shortlist filter and a sanity check:
- Use the index to find the frontier: which models are in the top group right now, so you know the ceiling.
- Use the price and speed columns, which are measured and roughly transferable, to find the cheapest model in each capability band.
- Use the per-benchmark breakdown, not the aggregate, and look at the benchmark nearest your task.
- Pick three or four candidates spanning the price range and put them in your eval. The eval decides.
The brief for the lab below is exactly this procedure, with the shortlist already chosen for you.
Hosted or open weights
The second large decision is whether to call a hosted API or run weights yourself. The trade-off is not “free versus paid”. It is who carries which costs.
| Hosted API (Claude, and peers) | Open weights (Llama, Qwen, Gemma, Mistral and others) | |
|---|---|---|
| Capability ceiling | Frontier | Behind the frontier by months to a year at the top end; competitive in the small and mid range |
| Cost model | Per token, zero when idle | Per GPU-hour, whether busy or idle; cheap per token only near saturation |
| Latency control | Provider’s queue and region | Yours: hardware, batching, quantisation, co-location |
| Data handling | Governed by provider terms, retention policy, region options | Never leaves your network |
| Operational burden | API key and a retry policy | Serving stack (vLLM, TGI, Ollama), GPU capacity planning, model updates, security patches |
| Change control | Provider retires models on their schedule, with notice | You pin a checkpoint forever if you want |
| Licence | Terms of service | Model-specific: Apache 2.0 for some, community licences with restrictions for others |
The cost line is where intuition fails. A single H100 costs roughly $2 to $4 per hour from a cloud provider. An 8B-parameter model on it serves perhaps 1,000 to 3,000 output tokens per second under heavy batching. If you keep that GPU busy around the clock, the per-token cost is tiny. If your traffic is 50 requests a minute during business hours, the GPU is idle 95% of the time and the effective per-token cost is far above a hosted small model. Open weights win on cost at steady high volume with an ops team; hosted wins at low, bursty or unpredictable volume with no ops team. Most products start in the second regime.
The data line is the one that is sometimes non-negotiable. If your inputs are medical records, legal discovery or anything under a residency rule that the provider’s regions cannot satisfy, open weights are the only option regardless of cost. Check the provider’s retention and regional inference terms before assuming this applies; it often does not.
The capability line moves. In this course the local default is llama3.2:3b, a 2 GB download that runs on a laptop. It is good enough for labs that teach mechanics. For labs that need quality, the chapters say so and name the hosted model. A 14B local model (qwen2.5:14b, a 9 GB download) sits in between and needs about 16 GB of RAM to run acceptably. You will measure all three in the lab.
Tiers within a family, and the prices
Hosted providers sell their models in tiers. Anthropic’s current line-up at the time of writing (check the pricing page; these change):
| Model | Model id | Position | Input / output per 1M tokens | Cache read | Latency |
|---|---|---|---|---|---|
| Claude Haiku 5.5 | claude-haiku-5-5 |
High-volume, latency-sensitive: classification, extraction, routing | $0.10 / $0.50 (prompts up to 100K tokens; $0.50 / $2.50 above) | $0.01 | Fastest |
| Claude Sonnet 5.5 | claude-sonnet-5-5 |
Speed and capability for everyday coding, agents and enterprise work | $2 / $10 | $0.10 | Fast |
| Claude Opus 5.5 | claude-opus-5-5 |
Long-running agentic coding and knowledge work; the recommended default | $4 / $20 | $0.20 | Moderate |
| Claude Fable 5.1 | claude-fable-5-1 |
The most demanding reasoning and long-horizon agentic work | $10 / $50 | $0.25 | Slower |
All four accept 1M tokens of context and produce up to 128K output tokens. Batch API requests are 50% off on input and output. Cache reads are 10% of the input price on Haiku 5.5, 5% on Sonnet 5.5 and Opus 5.5, and 2.5% on Fable 5.1, which changes the economics of a large stable system prompt more on the expensive tiers than the cheap ones.
Read the price column as a ratio. Sonnet 5.5 costs 20 times Haiku 5.5 per token. Opus 5.5 costs 2 times Sonnet. Fable 5.1 costs 2.5 times Opus. So a tier step at the bottom is a 20× cost change and a tier step at the top is a 2× to 2.5× change. If a task works on Haiku, it is almost never worth paying 20× for Sonnet; if a task needs Opus, trying Fable costs you 2.5× and may finish in fewer turns. The ratios, not the absolute prices, tell you where the eval is worth running.
Two things about these models matter for the eval you are about to run. First, thinking is adaptive and on by default on every current model; on Opus 5.5 and Fable 5.1 it cannot be turned off. The tokens it spends are billed as output. For a one-word classification you want output_config={"effort": "low"}, which tells the model to spend little and lets it skip thinking on easy inputs. Second, the default effort differs by tier (medium on Haiku 5.5 and Opus 5.5, high on Sonnet 5.5 and Fable 5.1), so an unconfigured comparison across tiers is also a comparison across effort levels. Set it explicitly and the same on every model you compare.
Effort before tier
Anthropic’s own guidance, and the measured curves on the cost-optimisation page linked below, say to tune effort before switching models. The reasoning is simple. Effort changes how many tokens the model spends thinking and how many tool calls it makes, inside one model. Stepping down a tier changes the model’s ceiling. A stronger model at low effort often matches or beats a weaker model at high, for a similar price, and it keeps one prompt cache namespace, because caches are per model.
The published curves differ by workload. On research and knowledge work they are nearly flat: low gives up a few points for a third to a half off the cost. On long agentic coding each step down costs single-digit points of pass rate for a large cost saving. For classification, which is what you will run, the curve is usually flat and low is right.
The procedure, then: sweep effort on the current model against the eval; if low passes, step down one tier, reset to that tier’s default effort, and sweep again. Stop when the eval fails or there is no cheaper tier.
Routing between tiers
Once you have two tiers that both pass part of the eval, the question becomes whether to route: send easy inputs to the cheap model and hard ones to the expensive one. Three patterns exist and they are not equal.
Route by input class. A cheap classifier (or a rule) decides which model handles the request before any model runs. Ticket intents that are factual go to Haiku; refund disputes go to Sonnet. This is the pattern the support-agent project uses. It works when the class is cheap to predict and the cost difference is large. It costs one extra small call per request.
Escalate on failure. Run everything on the cheap model, validate the output (schema, a checker, a confidence field), and re-run failures on the expensive one. Anthropic’s coding runs found this held the pass rate of running everything at the higher setting for a little over half the cost. It needs a usable failure signal; for a classifier that means a confidence or a second opinion, not the label alone.
Advisor. A cheap executor runs the loop and consults a frontier model on hard decisions. This pays only when the capability gap is wide and the executor consults at the right rate, which is fragile: too eager and you pay for both, too shy and you score below the cheap model alone. Measure the executor alone at higher effort first; it often lands in the same place.
Two cautions. Route between conversations, not within one: a mid-conversation model switch cold-starts the prompt cache and, on the current models, drops thinking blocks the new model cannot read. And a router is a second model with a second eval; its errors compound with the main model’s.
Re-evaluating when models change
Models are not infrastructure you install once. Providers retire them. Anthropic’s deprecation page lists every model with a status (active, legacy, deprecated, retired) and commits to at least 60 days notice before retiring a publicly released model, with a recommended replacement. The current models carry “not sooner than” retirement dates roughly a year out.
Sixty days is enough only if re-evaluation is a script, not a project. The replacement model will differ in ways that matter: a new tokenizer that counts the same text as 30% more tokens (which changes your cost and your cache minimums), a different default effort, parameters that now return a 400, a different tendency to call tools in parallel. Each is a line in the migration guide and each is also a line your eval should notice before your users do.
The practical answer is the harness you build in this module: a file of inputs with expected outputs, a runner that records accuracy, latency and cost per model, and a comparison you can read in one table. When a notice arrives, you change one string, run it, and read the table. That is the whole re-evaluation. The lab builds that runner on top of the prompting chapter’s harness, and the support-agent project turns it into a budget gate.
Pin model ids. Anthropic’s dateless ids such as claude-haiku-5-5 are pinned snapshots, so a request today and a request in six months hit the same weights. Open-weight models have the same property if you pin the checkpoint hash; a tag like llama3.2:3b in Ollama can move. Pin, then move deliberately through the eval.
You will run the same classification eval on two Claude tiers and two local models, record accuracy, p50 latency and cost per 1,000 items, plot cost against accuracy, and choose for three scenarios. Work in labs/ai/model-bakeoff/.
1. Set up the project and check the eval set.
mkdir -p labs/ai/model-bakeoff && cd labs/ai/model-bakeoff # from the root of your checkout
uv add anthropic matplotlib
ollama pull llama3.2:3b
ollama pull qwen2.5:14b # skip on a machine under 16 GB; the script handles a missing model
wc -l ../evals/tickets.jsonl ../evals/classify.py50 ../evals/tickets.jsonl and the line count of classify.py. The eval set is the one you labelled in prompting-fundamentals: one JSON object per line with id, label and text, six labels (billing, shipping, returns, account, product, technical), and the ambiguous tickets whose labels follow the tie-break rule. Those ambiguous items are what separate models. If either file is missing, do that chapter’s lab steps 1 and 2 first; this lab reuses its harness rather than building a second one.2. Write the runner. It imports the prompting chapter’s harness, so every model gets the same prompt (the structured variant: definitions, the tie-break rule, six examples and a JSON schema), the same parser and the same prices. It adds what a model comparison needs and classify.py does not record: latency per item, and cost per 1,000 items including electricity for the local models.
# bakeoff.py
import csv, statistics, sys, time
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "evals"))
from classify import ITEMS, PRICES, build, call_claude, call_ollama, parse_label # prompting-fundamentals
VARIANT = "structured"
WATTS, KWH_PRICE = 30, 0.30 # a laptop under load and a typical tariff, for the local-model estimate
def evaluate(model, call):
call(model, *build(VARIANT, ITEMS[0]["text"], 0)) # warm-up: loads the local model, opens the connection
hits, lat, tin, tout = 0, [], 0, 0
for it in ITEMS:
user, structured = build(VARIANT, it["text"], 0)
t0 = time.perf_counter()
raw, i, o = call(model, user, structured)
lat.append((time.perf_counter() - t0) * 1000)
hits += parse_label(raw) == it["label"]; tin += i; tout += o
if model in PRICES: # list price from classify.py
pin, pout = PRICES[model]
cost = (tin * pin + tout * pout) / 1e6
else: # electricity only: ms -> h -> kWh -> $
cost = sum(lat) / 3.6e6 * WATTS / 1000 * KWH_PRICE
lat.sort()
return {"model": model, "accuracy": hits / len(ITEMS), "p50_ms": statistics.median(lat),
"p95_ms": lat[int(0.95 * len(lat)) - 1], "cost_per_1000": cost / len(ITEMS) * 1000,
"output_tokens": tout}
MODELS = [("claude-haiku-5-5", call_claude), ("claude-sonnet-5-5", call_claude),
("llama3.2:3b", call_ollama), ("qwen2.5:14b", call_ollama)]
rows = []
for name, call in MODELS:
try:
rows.append(evaluate(name, call)); print(rows[-1])
except Exception as e:
print(f"skip {name}: {e}", file=sys.stderr)
with open("results.csv", "w", newline="") as f:
w = csv.DictWriter(f, fieldnames=rows[0].keys()); w.writeheader(); w.writerows(rows)call_claude in classify.py already runs at effort: low, sends the server-side fallback on Sonnet (not on Haiku, which has none), and treats a refusal as an empty answer that scores as a miss.
uv run python bakeoff.pyresults.csv. Typical numbers on a 2024 laptop: Haiku 5.5 at 0.84 to 0.94 accuracy, p50 around 600 to 900 ms, about $0.10 to $0.15 per 1,000 items; Sonnet 5.5 at 0.88 to 0.96, p50 around 1 to 2 s, about $2 to $3 per 1,000; llama3.2:3b at 0.60 to 0.80, p50 around 400 to 1,200 ms, under a cent per 1,000 in electricity; qwen2.5:14b at 0.78 to 0.90, p50 3 to 6 s. If qwen is missing you get skip qwen2.5:14b and three rows. Note the shape: the 20x price gap between the two Claude tiers buys a few points, mostly on the ambiguous tickets, and the local 3B model has the largest gap. The output_tokens column on the Claude rows includes adaptive thinking; effort: low keeps it small.3. Plot cost against accuracy. One series, four labelled points, a log cost axis because the range spans three orders of magnitude.
# plot.py
import csv, matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
rows = list(csv.DictReader(open("results.csv")))
fig, ax = plt.subplots(figsize=(7, 4.2))
for r in rows:
x, y = float(r["cost_per_1000"]), float(r["accuracy"]) * 100
ax.scatter(x, y, s=70, color="#4a5568", zorder=3)
ax.annotate(f'{r["model"]}\np50 {float(r["p50_ms"]):.0f} ms', (x, y),
textcoords="offset points", xytext=(8, -4), fontsize=9)
ax.set_xscale("log"); ax.set_xlabel("cost per 1,000 items (USD, log scale; local = electricity only)")
ax.set_ylabel("accuracy (%)"); ax.set_ylim(40, 102)
ax.grid(True, which="both", alpha=0.25); ax.spines[["top", "right"]].set_visible(False)
ax.set_title("Ticket classification: cost vs accuracy, 50 items")
fig.tight_layout(); fig.savefig("cost-vs-accuracy.png", dpi=160)
print("wrote cost-vs-accuracy.png")uv run python plot.py && open cost-vs-accuracy.png # xdg-open on Linux4. Pick for three scenarios. Write your answers into decision.md with the numbers that justify them.
- Scenario A: 2 million tickets a day, routing only, labels checked by downstream humans for the two sensitive classes. Which model, and does the Batch API apply?
- Scenario B: a live chat widget where the classification gates the first reply and the product requirement is “the reply starts within 1 second at p95”. Which model, and what does your p95 column say?
- Scenario C: the same classifier for a healthcare client whose contract forbids sending message text to a third party. Which model, what does it cost, and what did you give up?
CLAUDE_EFFORT=high uv run python bakeoff.py (the harness reads the variable in call_claude), so both Claude models think at high instead of low. Accuracy barely moves; output_tokens on Sonnet rises several-fold because adaptive thinking now spends more per item, p50 latency roughly doubles, and the Sonnet cost column climbs. You have measured the effort lever directly: on a flat-curve task it buys nothing and costs real money, and an unconfigured cross-tier comparison was also an uncontrolled cross-effort comparison. Then change the Ollama model tag from llama3.2:3b to llama3.2:1b (a 1.3 GB pull) and watch accuracy fall again and the schema occasionally come back with a label outside the enum, which is the local stack’s version of a 400: the JSON is valid and the content is wrong, and your parser has to treat it as a miss, not a crash.Template
# Model selection memo: <task>, <date>
Owner: <name, role>. Approver: <name, role>. Decision needed by: <date>.
Scope: <the task, the traffic, any data-handling rule that limits the choice, what this memo does not cover>.
## 1. Decision needed
<Which model does <task> ship on, and who approves it?>
## 2. Candidates
| Model | Why it is on the list | Hosted or open | Pinned id |
## 3. Eval results
Eval set: <name, number of items, how labelled>. Same prompt, same effort setting on every model.
| Model | Accuracy | p50 latency | Cost per 1,000 items | Source (run or assumption) |
## 4. Cost and latency at our volume
Assumed volume: <items a day>. Cost a day and a month per candidate. Latency against the requirement.
## 5. The choice
<Model, effort setting, and the two reasons that decide it. Models ruled out, with why.>
## 6. How this could be wrong
<One way, and what would show it.>
## 7. Re-evaluation triggers
- <Provider retirement notice: the eval runs against the replacement within <n> days>
- <A measured threshold, for example accuracy below <x> on the monthly re-run>
- <A change in volume, price or data rules that moves the decision>
## 8. Rollback and out of scope
Rollback: <how to return to the previous model id, and how long it takes>. Out of scope: <what this memo leaves out>. WORKED EXAMPLE
An engineer on the support tooling team writes this memo; the head of engineering approves it. It is dated 20 November 2026 and covers the shop’s support-ticket classifier from the lab (50 items, six labels). Figures marked as ranges are the lab’s printed typical numbers; replace them with your own results.csv row.
Decision needed. Which model routes tickets from 1 December? The head of engineering decides by 27 November.
Candidates and results. Same structured prompt, effort low, every model.
| Model | Accuracy | p50 | Cost per 1,000 items |
|---|---|---|---|
| Claude Haiku 5.5 | 0.84 to 0.94 | 600 to 900 ms | $0.10 to $0.15 |
| Claude Sonnet 5.5 | 0.88 to 0.96 | 1 to 2 s | $2 to $3 |
| llama3.2:3b | 0.60 to 0.80 | 400 to 1,200 ms | under a cent, electricity only |
| qwen2.5:14b | 0.78 to 0.90 | 3 to 6 s | not comparable: GPU-hour needed |
Volume. Assumed: 20,000 tickets a day. Haiku is $2 to $3 a day; Sonnet is $40 to $60 a day.
Choice. Haiku 5.5 at low effort. Sonnet costs 20 times as much for a few points, mostly on ambiguous tickets, and agents see every label. The 3B model fails on accuracy.
Could be wrong. Fifty items is a small set. If a monthly re-run on 200 fresh tickets scores under 0.85, the gap to Sonnet is larger than here.
Triggers. A retirement notice (at least 60 days); accuracy under 0.85 and volume above 200,000 a day (both assumed thresholds).
Rollback. Change one model id string. Out of scope: refund-dispute tickets.
Now you
You are an engineer on the digital channels team at Northmere Bank, a tier-2 bank in Lagos with 9.2 million retail customers. Customer emails reach a shared inbox and a classifier sorts them into six queues (the lab’s labels stand in for yours); a customer care agent checks the queue before replying. Assume 3,000 emails a day. Northmere’s data-handling rule forbids sending message text to a third party, so no hosted model sees live traffic; assume the rule covers your eval too, so use the lab’s 50 tickets, not real emails. Run the lab’s four-model eval, reuse results.csv and cost-vs-accuracy.png, and answer scenario C from step 4 for all traffic. Write the memo for the head of customer care, who approves it. They need to know what you gave up against the hosted rows, what the local option costs (price the GPU-hour, not the electricity), and what would make you reopen the decision.
Self-check
You are building invoice extraction for an accounts-payable team: 40,000 PDFs a month, 12 fields each, results reviewed by a clerk before payment. Your eval has 200 labelled invoices. Haiku 5.5 scores 91% field accuracy, Sonnet 5.5 scores 97%, Opus 5.5 scores 97.5%. A clerk fix costs about 40 seconds. Which model do you ship?
- DOC Choosing the right model
Anthropic's own procedure: criteria, efficiency-first versus capability-first starting points, the tier matrix, and the instruction to tune effort before switching models. Short; read all of it.
- DOC Models overview
The comparison table: ids, context windows, default effort, latency class, retirement commitments. The source for the tier table in this chapter; bookmark it rather than memorising numbers.
- DOC Pricing
List prices, cache write and read multipliers, batch discounts, and the long-context rate card for Haiku 5.5. Every cost number in your harness should trace to a row here.
- DOC Optimizing for cost and intelligence
Measured effort curves by workload, cost per completed task rather than per token, the advice to price the hardest tenth, and the two multi-model shapes that pay. Skip the implementation details until the cost-engineering chapter.
- PAPER Chatbot Arena: An Open Platform for Evaluating LLMs by Human Preference Chiang et al., 2024
How the arena collects votes and turns them into a ranking, and the authors' own analysis of what the votes measure. Read it to understand what a rank is before you argue from one. Read: sections 1 to 3 and the discussion of prompt distribution and vote quality in section 5.
- PAPER The Leaderboard Illusion Singh et al., 2025
Evidence that private testing and unequal sampling distort arena rankings. The reason this chapter calls leaderboards a shortlist filter and not a result. Read: the abstract, section 3 on private testing, and the recommendations in section 6.
- DOC Artificial Analysis methodology
What the Intelligence Index averages, how speed is measured (output tokens per second after first token) and how the blended price assumes a 7:2:1 cache-hit, input, output mix. Read the price and speed definitions; they are the transferable part.
- DOC Llama 3.2 model card
A real open-weights model card: sizes, training data cutoff, evaluation tables, and the Llama 3.2 Community License, which is the licence axis made concrete. Read the licence section before you ship anything on it.
All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.