Skip to content
mentoor

Topic 4 of 5 · 4 min read

Routing easy requests to smaller models

Goal: Pick the smallest model that passes an evaluation for each task type and estimate the cost difference.

Use the smallest model that passes your own evaluation for each task, and route every request to it, instead of sending everything to the biggest model.

Check yourself · 1 of 3

How should you decide whether a cheaper model is good enough for a task?

Choose one answer

Why it matters

Model families come in tiers. The largest model can cost many times more per token than the smallest, and Claude's pricing page shows that gap across its lineup. Most traffic in a real product is easy: classify a ticket, pull a date from an email, rewrite a sentence. A small model often handles those as well as the large one, at a fraction of the price. Only a minority of requests need the expensive model.

How to do it

  1. Split your traffic into task types: classification, extraction, short rewrite, long reasoning, code. Each type gets its own decision.
  2. Build a small evaluation set per task: 50 to 200 real inputs with the answer you accept. Real inputs beat invented ones.
  3. Run each candidate model on the set, smallest first, and score pass rate. Pick the cheapest model that meets your bar, for example 95 % correct.
  4. Compute the cost difference: tokens per request times each model's price, times requests per day.
  5. Route in code: a lookup from task type to model. Add a fallback, such as retrying on the bigger model when the small one returns low confidence or fails a format check.
  6. Re-run the evaluation when models change. New small models often beat old large ones.

Before and after

Weak: every request goes to the flagship model "to be safe". A tagging task that a small model handles at 97 % costs 10 times more than it should.

Fixed: tagging uses the small model, summaries use the mid-tier, and only multi-step contract analysis uses the flagship. The evaluation scores sit in a table next to the price.

What goes wrong

  • Choosing by leaderboard or reputation, not by your own data and your own prompts.
  • Evaluating on five hand-picked examples that happen to pass.
  • Measuring cost but not quality, so a saving hides a drop in accuracy.
  • Routing once and never re-testing as models and prices change.
  • Ignoring the cost of the fallback: if the small model fails often, you pay twice.

Examples

A routing decision table

Illustrative evaluation of 100 real inputs per task, prices per million input and output tokens.

Task Small model Mid model Large model Chosen
Ticket tagging 97 % 98 % 98 % Small
Email date extraction 94 % 99 % 99 % Mid
Contract risk review 61 % 78 % 91 % Large

With a 95 % bar, tagging goes small, extraction goes mid and only contract review pays for the large model.

Routing in code with a fallback

const MODEL_BY_TASK: Record<string, string> = {
  tag: SMALL,
  extract: MID,
  review: LARGE,
};

async function run(task: string, input: string) {
  const out = await call(MODEL_BY_TASK[task], input);
  return isValid(out) ? out : call(LARGE, input);
}

Log how often the fallback fires. If it is above a few percent, the small model is not good enough for that task.

Key points

  • Decide the model per task type, not once for the whole product.
  • Pick the cheapest model whose pass rate on your own evaluation set meets your bar.
  • Evaluation inputs should come from real traffic, with the answers you would accept.
  • Always put quality next to cost, so a saving that hurts accuracy is visible.
  • A fallback to a bigger model catches small-model failures but adds cost when failures are frequent.

Common mistakes

  • Using the flagship model for every request to be safe.
  • Choosing a model from a public leaderboard without testing on your own inputs.
  • Judging quality from a handful of cherry-picked examples.
  • Never re-running the evaluation after a new model or price change.

Check yourself · 2 of 3

A small model passes 97 % of a tagging evaluation and the large model passes 98 %. The large one costs 10 times more. What is the sensible choice if your bar is 95 %?

Choose one answer

Check yourself · 3 of 3

Your router falls back to the large model whenever the small model's output fails a format check. The fallback fires on 40 % of requests. What does that tell you?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic