Choosing a Model

How to compare models on quality, speed, cost, context size and privacy, and how to pick the cheapest one that passes your own tests.

12 minLesson 6 of 7
On this page
  1. The factors that separate models
  2. Testing candidates on your own examples
  3. Pitfalls
  4. What this changes in practice
  5. Check yourself
  6. What to practise next

Choosing a model means picking, from the models available to you, the one that meets your quality, speed, cost, context and privacy requirements for a specific task. Larger models are usually more accurate but slower and more expensive, so the most capable model is rarely the right default. The practical method is to define what good enough means, test candidates on your own examples, and use the cheapest one that passes.

Without that method, teams pick by reputation. A support-ticket classifier built on the largest model may work well and still be rejected because each ticket takes five seconds and the monthly bill is ten times what a smaller model would have cost. The opposite failure also happens: a small, fast model used to review contracts can miss unusual clauses that a larger model would catch.

The factors that separate models

Six properties decide most model choices. Each one matters for different kinds of tasks.

Quality

Quality is how often the output is right for your task. Larger models follow long instructions more reliably, handle subtle cases better and cope with harder reasoning. Smaller models are often good enough for narrow, well-defined work such as sorting text into a fixed set of categories. Quality matters most when mistakes are costly or hard to notice, and it can only be measured on your own task, as the next section explains.

Speed

Speed is how long a reply takes to start and how long it takes to finish. For a chat interface the time until the first words appear matters most, because the reply can be streamed while it is still being written. For a feature that needs the whole reply before it can continue, such as a form that submits on click, the total time matters. For a nightly batch job nobody is waiting, so speed barely matters. Smaller models are usually faster, and a long reply takes longer than a short one with any model.

Cost

Models are priced per token, so the cost of a feature is the price per token, times the tokens in each request and reply, times the number of requests. A model that costs five times as much makes no visible difference at ten requests a day, but at tens of thousands of requests a month it becomes a line in the budget. Output tokens are usually priced higher than input tokens, so a feature that writes long replies costs more than one that reads long inputs and returns a short label. Long prompts add to the cost of every request, so a large pasted document is paid for every time.

Context size

Context size is how much text fits in one request, including your prompt, any documents and the reply (see The Context Window). It matters when a task needs a whole long document or codebase at once. If the input does not fit, you either choose a model with a larger window or split the input and retrieve only the relevant parts (see Chunking and Retrieval). Even when a document fits, quality can drop as the context fills up, so test with realistic input lengths.

Privacy and hosting

Where the model runs and what happens to your data can rule out options before any quality testing. Regulated or confidential data may have to stay on your own infrastructure, or may only be sent to providers with specific contract terms. A self-hosted model gives you control over the data, and you then pay for the hardware and operations yourself. Privacy and Security lists the questions to ask a provider.

Supported features

Models differ in what they can do beyond writing text. Some accept images or audio, some are better at calling tools (see Tool Use), and some follow a required output format more reliably (see Structured Output). If the feature needs one of these, check it first, because a model that lacks it cannot be rescued by a better prompt.

Thinking modes

Some models can spend extra time reasoning before they answer (see Give the Model Room to Think). This improves answers on hard problems such as multi-step maths or tricky debugging, and it costs more tokens and more waiting time. On simple tasks like classification it usually adds cost without improving the result, so turn it on only when your tests show a difference.

FactorMatters most when
QualityMistakes are costly or hard to spot
SpeedA person is waiting for the reply
CostRequest volume is high or each request is long
Context sizeA whole long document or codebase must fit in one request
Supported featuresThe task needs images, tool calls or a strict output format
Privacy and hostingThe data is sensitive, regulated or must stay on your machines

Testing candidates on your own examples

Public rankings measure models on other people's tasks, so they say little about yours. The reliable method is to collect a small set of real examples with known correct answers, run each candidate on them and compare the results. Fifty labelled examples is a reasonable start for a simple task (see Evals).

Before you run the tests, write down the bar a model must clear. For a ticket classifier it might be at least 90% of tickets labelled correctly and a reply in at most 2 seconds. The function below applies that rule: it goes through the candidates from cheapest to most expensive and returns the first one that clears every bar.

Pick the cheapest model that clears the bar
// Results from running each candidate on your own 50 test tickets.
const candidates = [
  { name: "large", accuracy: 0.96, seconds: 4.8, cost: 20 },
  { name: "small", accuracy: 0.84, seconds: 0.6, cost: 1 },
  { name: "medium", accuracy: 0.92, seconds: 1.4, cost: 4 },
];
 
function chooseModel(candidates, minAccuracy, maxSeconds) {
  const byCost = [...candidates].sort((a, b) => a.cost - b.cost);
  for (const model of byCost) {
    if (model.accuracy >= minAccuracy && model.seconds <= maxSeconds) {
      return model.name; // cheapest one that clears every bar
    }
  }
  return null; // nothing is good enough: rethink the task or the bar
}
 
chooseModel(candidates, 0.9, 2); // "medium"
# Results from running each candidate on your own 50 test tickets.
candidates = [
    {"name": "large", "accuracy": 0.96, "seconds": 4.8, "cost": 20},
    {"name": "small", "accuracy": 0.84, "seconds": 0.6, "cost": 1},
    {"name": "medium", "accuracy": 0.92, "seconds": 1.4, "cost": 4},
]
 
def choose_model(candidates, min_accuracy, max_seconds):
    for model in sorted(candidates, key=lambda m: m["cost"]):
        if model["accuracy"] >= min_accuracy and model["seconds"] <= max_seconds:
            return model["name"]  # cheapest one that clears every bar
    return None  # nothing is good enough: rethink the task or the bar
 
choose_model(candidates, 0.9, 2)  # "medium"

The model names are placeholders, and cost is in relative units, so "small" costs 1 per ticket and "large" costs 20.

Choosing a model for ticket labellingUse the arrows or ← → keys
sort candidates by cost, cheapest firstfor each model:  if accuracy >= 0.90 and seconds <= 2:    return modelreturn none
  1. candidates
    accuracysecondscost
    small42/50 = 0.840.61
    medium46/50 = 0.921.44
    large48/50 = 0.964.820
    min accuracy
    0.9
    max seconds
    2

    1Three candidates were each run on the same 50 labelled tickets and are sorted cheapest first, so the first one that passes is the cheapest one that passes.

  2. candidates
    accuracysecondscost
    small42/50 = 0.840.61
    medium46/50 = 0.921.44
    large48/50 = 0.964.820
    min accuracy
    0.9
    max seconds
    2
    checking
    small

    2Small is fast and cheap, but its accuracy of 0.84 is below 0.90, which means 8 of 50 tickets were labelled wrong. It is rejected.

  3. candidates
    accuracysecondscost
    small42/50 = 0.840.61
    medium46/50 = 0.921.44
    large48/50 = 0.964.820
    min accuracy
    0.9
    max seconds
    2
    checking
    medium

    3Medium has an accuracy of 0.92, which is at least 0.90, and a time of 1.4 seconds, which is at most 2. It clears both bars.

  4. candidates
    accuracysecondscost
    small42/50 = 0.840.61
    medium46/50 = 0.921.44
    large48/50 = 0.964.820
    chosen
    medium

    4The function returns medium. Every cheaper model already failed, so the loop stops and never looks at large.

  5. candidates
    accuracysecondscost
    small42/50 = 0.840.61
    medium46/50 = 0.921.44
    large48/50 = 0.964.820
    chosen
    medium
    cost vs large
    1/5

    5Large gets 2 more of the 50 tickets right at 5 times the cost, and its 4.8 seconds fails the speed bar anyway, so the most capable model was the wrong choice here.

1 / 5

If no model passes, do not lower the bar straight away. First make the task easier for the model by writing clearer instructions, adding a few examples to the prompt, or splitting one hard request into two simple ones. A better prompt often lifts a cheaper model over the line.

Starting from the strongest model

If you are unsure whether a task is possible at all, try the most capable model first. If even that model fails, the problem is the task or the prompt, and a cheaper model will not help. Once the strongest model works, run the same tests on cheaper models and step down.

Using more than one model

One application can use several models. With routing, a small model answers the easy, high-volume requests and passes anything it is unsure about to a larger one. In another arrangement a capable model plans the work and a cheaper model carries out the simple steps. Each of these adds code, more places to fail and more to test, so use them only when cost or speed requires it.

Pitfalls

What this changes in practice

Before you pick a model, write down the requirements for the task: how often it must be right, how fast the reply must be, how much text goes in, and what data it touches. Then build a test set of real examples and let the results decide. Treat the model as a setting you can change, and keep the test set so that changing it later is cheap.

Try it: Name the trade-offs

For each feature, say which two factors matter most, what kind of model you would try first, and why.

  1. Suggested replies that appear while a user types in a chat app.
  2. A nightly job that summarises 2,000 long legal documents for a law firm's archive.
  3. A tool at a hospital that drafts discharge notes from patient records.
Show a sample answer
  1. Speed and cost. The user is waiting, and the feature runs every few keystrokes for every user. A slightly worse suggestion costs little because the user ignores it. Try a small, fast model first.
  2. Context size and quality. The documents are long, nobody is waiting, and errors in a legal archive are costly. Try a capable model that can take a whole document at once, or a cheaper one with a good chunking plan (see Chunking and Retrieval), and compare both on a sample with known good summaries.
  3. Privacy and quality. Patient data may have to stay inside the hospital's systems, which can rule out hosted options before any testing. Quality matters a great deal, and a clinician must review every draft. Start from the models the hospital is allowed to use, then test within that group.

In each case the task decided which factors mattered, and those factors narrowed the choice before any model was compared.

Check yourself

Quick check

What does chooseModel return if the accuracy bar is raised to 0.95 and the time limit stays at 2 seconds?

Why does the function sort the candidates by cost before checking them?

A feature works with the most capable model but is too slow. What should you try first?

What to practise next

Write the bar for one task you use AI for regularly, covering how often it must be right, how fast the reply must be and what data it touches. Then read Common Mistakes, which collects the habits from this whole module.