On Monday morning I ran two models in sequence: the cheap one for ticket classification, the expensive one for drafting refund emails. I did this because the two tasks differ enormously in how they’re validated, not out of preference. If a classification is wrong, the rules catch it on the spot; if an email is badly written, someone has to read it word by word to know what’s off, and rework costs an order of magnitude more.
When switching between multiple models, one plain question is unavoidable: for this mistake, who will catch it, and how soon.
Decide how to validate first, then pick the model
My order is now fixed: write the acceptance criteria first, then choose the model. You can list a screenful of candidate models, but there’s usually only one way to validate.
For extracting fields from invoices, I first pin down the JSON structure and field types, validate values and dates item by item, and constrain the decimal places on amounts. The model only guesses; the rules judge. I usually hand this kind of work to a cheap, fast model, wrapped in a parsing layer and one retry. Its mistakes are obvious and cheap to fix.
Code refactoring is different. Validation relies on compilation and tests, and the model must see the call chain and surrounding files. I’ll provide a larger context and would rather use an expensive model to get it right in one pass—the cost of back-and-forth trial and error far exceeds the unit price, especially when someone still has to review it.
Long-document summarization is different again. Validation can only be me reading it once; there’s no automatic check. Here I limit output length, require subheadings and numbers to be preserved, and prioritize stability over cheapness.
The validation method also determines how the prompt is written. For classification tasks, I hard-code the category definitions and attach three examples—that’s enough; for email drafting, the prompt must specify tone, policy boundaries, and what must not be promised. The former paves the way for rules; the latter saves a person time. Mixing the two structures into one template means neither is written well.
This explains a counterintuitive phenomenon: the same model is cost-effective on task A but not on task B. This is mostly unrelated to capability fluctuations—it’s more about differing validation costs. I roughly divide validation cost into three tiers: automatically judgeable, semi-automatically judgeable, and human-read only. For automatically judgeable tasks, prioritize cheap and fast; for human-read-only tasks, prioritize stability and explainability—I’ll accept slower.
There’s also an easily overlooked middle tier. Structured extraction often has one or two free-text fields where rules can only judge “non-empty,” not correctness. I tend to split these tasks: the judgeable part goes to a cheap model for volume, and the unjudgeable part gets a separate expensive call, or simply goes to manual spot-checking. Running them mixed together means pricing the entire pipeline by its most expensive link.
My four switching lines
Output constraints are the first filter for models. If I need JSON, fixed fields, or schema compliance, I first check whether the model supports structured output or function calling; if not, I wrap it in a parser and retry rather than gambling on hard prompts. Hard prompts sometimes work, but when they fail, they tend to fail uniformly—an entire batch is ruined.
The context-length line depends on how you feed it—stuffing the whole document in isn’t the answer. I usually split material into must-read blocks and retrieval blocks: must-read goes first, retrieval is assembled on demand. If it exceeds the window, switch to a long-context model; if the task is just finding one sentence in a document, I do the reverse—use retrieval plus a small model, and don’t make a large model read the whole thing. The cost of stuffing everything in isn’t just money; attention gets diluted, and the longer the material, the more likely the model misses the middle section.
The failure-mode line is the most easily overlooked. Some models fail loudly; some fail quietly. In classification tasks, quiet errors are the most expensive; when drafting, loud errors are actually easier to handle. I record a failure mode for each model, not just accuracy. Two models with similar accuracy can have completely different failure modes: one tends to drop fields, the other to invent them—the former can be saved with added validation, the latter can only be replaced.
For latency and billing, I don’t chase absolute values; I set budgets per task: interactive completion needs to be second-level, background batch processing can be minute-level with no problem. The cost-effectiveness conclusion for the same model in these two places can be completely opposite. If over budget, downgrade or split the task. Splitting tasks is sometimes more effective than switching models: extract entities first, then have the model write the reply—this is more stable than having one model do everything end to end, and it’s easier to locate which step went wrong.
These four aren’t a scoring sheet; they’re more like a process of elimination. Most of the time, what gets eliminated first is “unsuitable,” not “not smart enough.”
A small routing table and its fallback
My routing table doesn’t have dozens of models—just four or five slots: fast classification, general conversation, long-document processing, code modification, offline fallback. Each slot specifies the primary choice, the backup, and the escalation conditions.
1 | ROUTES = { |
When actually running, I only look at three signals: parse failure, low confidence, manual rejection. The first two trigger automatically; the third requires recording the reason. Escalation isn’t blindly switching to the biggest model—it’s switching to the one whose constraints match better: if JSON parsing fails, first switch to one with strong structured output; if tests fail, first switch to a code model, not casually to a general large model—that usually just spends money faster.
Fallback also needs design. If the expensive model times out, fall back to a medium model; if the medium model also fails, stop and enter the manual queue—don’t let it retry indefinitely. Retries inflate the bill, and worse, they mask errors as latency: what the user sees is “slow,” when actually it “failed three times.”
What remains after switching
For each switch I record four things: task type, trigger reason, model slot, and whether manual rework was needed. Recording only tokens and latency is useless—those numbers can’t explain why the switch happened.
I also maintain a small set of about twenty samples covering common inputs and two edge cases. I run them before switching models—not for statistical significance, just to avoid stepping back into pits I’ve already fixed. This approach is crude, but more reliable than looking at leaderboards: leaderboards measure average capability; what I want is for these twenty not to regress. The routing table itself should also be version-controlled: changing one escalate_if condition can have a bigger impact than switching models, yet few people write change logs for it.
One thing I haven’t settled: whether to fix one model long-term for the same task. Fixing it makes prompt tuning easier but also breeds path dependency—the model iterates while you’re still using the old approach; frequent switching can cut costs, but evaluation becomes so complex no one wants to maintain it. My current compromise is fixed slots with swappable model names, and any swap must pass that small sample set first.
If you’re currently running all tasks through the same model, I suggest first finding one thing whose errors are automatically detectable, switch it to a cheap model, and track the rework rate for a week. Don’t change the entire workflow at once. Get one slot working first, then talk about multi-model.
Comments