Reducing LLM Inference Costs with Multi-Model Tiered Routing
This article explains how to cut LLM inference costs by routing each task to a model that matches its difficulty and risk. It covers cost breakdown, task tiering, three routing approaches, fallback chains, layered validation, token reduction, key metrics, and a step-by-step rollout plan.
Background: Multiple Models Are Now the Norm
The number of LLM services available keeps growing. Models differ noticeably in reasoning ability, context length, response speed, and unit price. For businesses and developers, the key question has shifted from “Which model should we choose?” to “Which model should handle each type of task?” If every request defaults to the most capable and most expensive model, cost grows linearly with call volume. A considerable share of those requests do not need that level of capability.
Breaking Down Cost Sources
Call cost usually consists of two parts:
- Input token count multiplied by the input price;
- Output token count multiplied by the output price.
The formula is: cost per call = input tokens × input price + output tokens × output price.
In practice, three more overheads add up: retries after failures, round-trip context from tool calls, and historical messages repeatedly sent in long conversations. Optimization should therefore target three areas: reducing wasted tokens, lowering the unit price, and avoiding complex-task prices for simple tasks.
Task Tiering
The first step is to classify tasks by difficulty and risk. Common dimensions include:
- Task type: classification, information extraction, rewriting, and summarization are relatively deterministic, while multi-step reasoning, complex code changes, and solution design are harder.
- Output constraints: structured output and results in a fixed format are easier for smaller models to produce, and they can be checked by programmatic validators.
- Risk level: tasks involving funds, compliance, or production changes should keep a high-quality model and add human review, even though this costs more.
After tiering, each tier maps to a default model and a set of quality requirements. Tiering rules are not a one-time task. They should be adjusted continuously based on production data.
Routing Strategies
Routing is the set of rules that maps requests to models. There are three common approaches.
(1) Rule-based routing: route requests using deterministic conditions such as task labels, input length, or keywords. It is simple to implement and behaves predictably, which makes it a good starting point.
(2) Classifier-based routing: a lightweight model or small classification logic first judges request difficulty, then selects which model to call. It adds one extra decision step, but it handles borderline requests better.
(3) Dynamic routing based on evaluation results: accumulate quality and cost data for historical requests across different models, then select models by cost-effectiveness. This approach often works best, but it depends on a mature evaluation system.
Example code:
def route(task):if task.risk_level == "high":return MODEL_FLAGSHIPif task.type in SIMPLE_TYPES and task.input_tokens < 2000:return MODEL_LIGHTif task.requires_long_context:return MODEL_LONG_CONTEXTreturn MODEL_STANDARD
This logic reflects a priority order: the risk check runs before the cost check. If the order were reversed, high-risk tasks could be wrongly downgraded, which is a common source of production incidents.
Fallback and Degradation
Lightweight models fail on some samples, so the system needs a clearly defined fallback chain:
- If output format validation fails, retry once or switch to a higher-tier model;
- If a request times out or the service is unavailable, switch to a peer backup model;
- If consecutive failures exceed a threshold, log an alert and hand the task to human processing.
The fallback rate is an important metric in itself. If the fallback rate for a task type stays high, that type should not be assigned to a lightweight model.
Quality Validation
Reducing cost only works if output quality holds. Validation has three layers:
- Format validation: JSON parsing, field completeness checks, and enum range checks. This layer adds almost no cost and should run on every request.
- Rule validation: checks business constraints, such as amounts that cannot be negative or end dates that must be later than start dates.
- Semantic validation: uses a stronger model or human sampling to score outputs. This layer is costly, so it should run on a sampled basis.
Reducing Wasted Tokens
Much overhead comes from unnecessary context. It can be reduced in the following ways:
- Keep only the parts of the conversation history relevant to the current question, and summarize earlier turns;
- Place fixed instructions at the beginning of the prompt so the server can reuse cached repeated content;
- Deduplicate and rank retrieval results, injecting only the most relevant few snippets;
- Limit output length and ask for concise, structured answers in the prompt.
These methods do not change model selection, yet they often produce substantial savings.
Establishing Evaluation Metrics
Looking only at per-call price leads to wrong conclusions. Focus on these metrics:
- Cost per task: total spend to complete one business task, including the overhead of retries and validation;
- First-pass rate: the share of outputs that pass all validation without fallback;
- Human correction rate: the share of outputs that people modify;
- End-to-end latency: a key factor that directly affects user experience.
Evaluation sets should come from real business samples and be updated regularly. Do not draw conclusions from a small set of examples.
Rollout Steps
- Inventory existing call scenarios, and measure call volume, average token count, and current output quality.
- Select high-frequency, relatively simple tasks as the first pilot. Ideally, the pilot should account for more than half of total call volume.
- Build an evaluation set for the pilot tasks and compare candidate models offline.
- Roll out the routing rules to a small share of traffic, and observe changes in quality and cost.
- Adjust tiering rules based on data, and move the rules into configuration instead of scattering them through business code.
Common Pitfalls
- Looking only at model unit price and ignoring the extra cost of retries and fallbacks;
- Leaving routing rules unmaintained after they are written, so they stop working as model capabilities change;
- Sending all tasks to lightweight models, so quality problems only surface downstream;
- Keeping incomplete logs, which makes it impossible to tell whether a failure came from a routing error or a prompt problem.
Summary
The core of multi-model scheduling is matching the capability a task requires with the capability a model provides. Through task tiering, dynamic routing, layered validation, and ongoing evaluation, teams can keep result quality intact while directing inference spending to where it is truly needed.
