Model Router is a pattern that directs queries to different LLMs based on task complexity, cost constraints, or capability requirements. Simple queries go to smaller, cheaper models while complex queries route to more capable ones, optimizing the cost-quality balance.
At a Glance
- Problem: Sending every request to one frontier model means simple lookups cost as much per token as complex analysis and run slower than a small model would answer them. At production volume, this overspend decides whether the product is sustainable.
- Forces: Lower cost and latency versus the risk of a complex query reaching a cheap model; routing overhead versus the savings it buys; per-query savings versus consistent style and quality across a session.
- Solution: Place a classifier between users and a pool of model tiers. Rules, a trained classifier, or a cheap LLM rates each request's complexity, and the router sends it to the fast, standard, or premium tier.
- Consequences: Gains: lower average cost per query and faster answers for simple requests. Costs: another component to build and maintain, confident wrong answers on misrouted queries, and routing logic that goes stale as models and prices change.
What problem does Model Router solve?
Most LLM applications send every request to the same model. If you are using a frontier model, that means simple questions like "what is the capital of France" cost the same per token as complex questions like "analyze the trade-offs between microservices and monoliths for a fintech startup handling 10,000 transactions per second." You are paying frontier prices for tasks that a much smaller, cheaper model could handle.
The economics add up fast. In production systems handling thousands of requests per day, the difference between routing 70% of traffic to a cheap model versus sending everything to an expensive one can be the difference between a sustainable product and one that bleeds money. Smaller models are also faster. A simple query answered by a lightweight model in 200 milliseconds delivers a better user experience than the same query answered by a large model in 2 seconds.
The hard part is telling simple queries from complex ones. Message length is a poor proxy: a short question can demand careful reasoning, and a long one can be straightforward.
How does Model Router work?
A model router sits between your users and your model pool. It examines each incoming request, classifies it by complexity or difficulty, and sends it to the appropriate model tier. Simple requests go to fast, inexpensive models. Complex requests go to more capable, expensive models. Everything in between goes to a mid-tier option.
There are several ways to build the classifier.
Rule-based routing uses simple heuristics. If the query contains certain keywords (like "summarize" or "translate"), route to the cheap model. If the token count exceeds a threshold, route to the expensive model. If the query references code or asks for multi-step reasoning, route to the strongest model. Rules are easy to implement and debug, but they are brittle. Users will phrase things in ways your rules do not anticipate.
ML-based routing trains a lightweight classifier on labeled examples. You take a dataset of queries, label each one with the model tier that should handle it, and train a small model (logistic regression, random forest, or a small neural network) to predict the right tier. This holds up better than rules but requires labeled training data, so you need a period of sending everything to the best model and checking which queries needed it.
LLM-based routing uses a cheap, fast model to assess the complexity of the incoming query before routing it. You send the query to a small model with a prompt like "Rate the complexity of this question on a scale of 1 to 5." Based on the score, you route to the appropriate tier. It works better than you might expect and needs no training data. The overhead of one extra cheap LLM call is usually small compared to the savings from avoiding unnecessary expensive calls.
The model tiers themselves can be organized however makes sense for your application. A common setup is three tiers. The fast tier handles factual lookups, simple formatting, and straightforward instructions. The standard tier handles moderate reasoning, summarization, and most conversational tasks. The premium tier handles complex analysis, creative tasks that require subtlety, and multi-step reasoning.
When should you use Model Router?
Model routing makes sense when you have meaningful cost or latency differences between available models and enough request volume for the savings to matter.
Good conditions for this pattern:
- Your traffic mix includes a wide range of query complexity
- You are spending significantly on LLM API costs and need to optimize
- Latency is important and you want simpler queries to resolve faster
- You have access to multiple models at different price points
- Your error tolerance allows occasional misrouting (a complex query hitting a simple model and getting a subpar answer)
Less compelling conditions:
- All your queries are roughly the same complexity
- You only have access to one model
- Cost is not a concern relative to the value each request generates
- You need guaranteed quality on every request and cannot tolerate any degradation
When not to use it: If a query's difficulty only shows up once an answer exists, an upfront classifier will keep sending hard queries that look simple to the cheap tier; use Cascading so a quality gate judges real output. If the decision you need is which handler, tool, or pipeline to run rather than which model, use Semantic Router. And when the routing call costs about as much as it saves on very cheap queries, a rule-based fast path or Prompt Caching for repeated queries is the simpler fix.
Worked Example: Cost and Latency
A help-desk app handles 10,000 requests a day, each with about 1,000 input tokens and a 300-token answer, and a small-model classifier sends 70% of them to the small tier.
| Setup | Calls per request | Tokens per request (in / out) | Cost per 1,000 requests | Latency per request |
|---|---|---|---|---|
| Large model for everything | 1 | 1,000 / 300 | $7.50 | 5.5 s |
| LLM-based router, 70% small / 30% large | 2 | 300 / 5 router, plus 1,000 / 300 answer | $2.53 | 3.0 s small path, 6.0 s large path, 3.9 s average |
The router call costs 300 × $0.15 per million + 5 × $0.60 per million ≈ $0.00005, or $0.05 per 1,000. A small-model answer costs 1,000 × $0.15 per million + 300 × $0.60 per million = $0.00033; a large-model answer costs $0.0075. So 0.7 × $0.33 + 0.3 × $7.50 + $0.05 = $2.53 per 1,000, a 66% saving, and the router itself is under 2% of the bill. The router adds about 0.5 s to every request, but the small path still finishes in 3.0 s against 5.5 s, because the small model writes 300 tokens in 2 s instead of 5 s.
The numbers favor routing when a large share of traffic can safely go to the small tier; when only a small share qualifies, the saving shrinks while every request still pays the router's 0.5 s, and the table does not show the cost of a hard query misrouted to the small model and answered badly.
What are the common pitfalls?
Misrouting complex queries to cheap models. This is the primary failure mode. A query that looks simple on the surface might require deep reasoning. The cheap model produces a confident but wrong answer, and the user never knows a better model would have gotten it right. Build in feedback mechanisms so you can detect and correct misrouting over time.
Overhead exceeding savings. If your router itself is expensive (perhaps it uses an LLM call for classification), the cost of routing must be less than the cost savings from model selection. For very cheap queries, the routing overhead might increase total cost. Consider caching routing decisions for similar queries or using a rule-based fast path for obviously simple requests.
Model tier boundaries that do not match your traffic. If you set up three tiers but 95% of your traffic falls into one tier, the router does little useful work. Analyze your actual query distribution before designing your tiers.
Stale routing logic. As models improve and pricing changes, your routing rules need to be updated. A model that was too weak for complex queries six months ago might handle them fine now. Review your routing logic regularly.
User experience inconsistency. Different models produce different writing styles and quality levels. Users who send a mix of simple and complex queries in the same session might notice jarring quality shifts between responses. Consider whether consistent experience matters more than cost savings for your use case.
What are the trade-offs?
You gain lower average cost per query, faster response times for simple requests, and the ability to scale more efficiently by reserving expensive compute for queries that need it.
You pay with system complexity (another component to build and maintain), the risk of quality degradation on misrouted queries, and the need for ongoing monitoring and tuning of the routing logic.
Accuracy of routing determines the value. A router that correctly identifies 90% of simple queries saves significantly more than one that only catches 60%. Invest in the quality of your classifier. Good labeled data makes a large difference here.
The pattern compounds well with caching. If you cache responses for common queries, the router only needs to handle cache misses. So the router mostly sees novel or unusual queries, which are often the harder ones. Keep this in mind when evaluating router accuracy: your test distribution might not match your production distribution after caching.
Goes Well With
Cascading provides a different approach to the same cost-optimization goal. While a model router makes a single upfront decision about which model to use, cascading tries the cheapest model first and escalates only if the result is not good enough. You can combine them. Use a router to skip the cheapest tier entirely for obviously complex queries, and use cascading for the ambiguous middle ground.
Semantic Router handles a related but different routing decision. While a model router chooses which model to use, a semantic router chooses which handler, tool, or pipeline to invoke. In practice, you might use a semantic router to determine intent and a model router to determine which model serves that intent.
Small Language Models are the premise of this pattern, since routing only pays when capable small models exist at a fraction of the cost. As small models improve, the range of queries they can handle cheaply grows, and routing saves more.
References
- Ong, I., et al. (2024). RouteLLM: Learning to Route LLMs with Preference Data. arXiv preprint. arXiv