Ultralytics YOLO27: Join the waitlist.
License YOLO
Back to Ultralytics Glossary

Model Routing

Model routing sends each AI request to the best-suited model using rules, a learned router, or a cascade, balancing answer quality, cost, and latency.

Model routing is the practice of choosing, for each incoming request, which of several deployed AI models should handle it. A router inspects the request, and in some designs a cheap model's first answer, then forwards it to the candidate that meets the quality target at the lowest cost or inference latency. Easy requests go to a small, fast model, and only the inputs that need it reach a larger one. The savings can be large because model prices vary widely: in FrugalGPT, Lingjiao Chen, Matei Zaharia, and James Zou at Stanford found that the fees of popular large language model (LLM) APIs differed by about two orders of magnitude, and their learned cascade matched GPT-4 accuracy at up to 98% lower cost.

Routing Strategies#

Routers differ in what they know when they decide:

  • Rule-based routing: Explicit request fields pick the model, such as the task, input language, file type, or customer tier. Rules are predictable and easy to audit, and they cannot judge how hard a particular input is.
  • Learned routing: A small classifier predicts, before any large model runs, whether a weaker model's answer will be good enough. RouteLLM, from Isaac Ong and colleagues at LMSYS and UC Berkeley in 2024, trained such routers on human preference data from Chatbot Arena and cut costs by more than half in some settings without lowering answer quality.
  • Cascades: The cheapest model answers first, and the request escalates when that answer's confidence or a scoring model's verdict falls below a threshold. Cascades pay for a second call on hard inputs and decide with the first answer in hand.

Routing has moved into products. When OpenAI launched GPT-5 in ChatGPT in August 2025, a real-time router picked between a fast model and a deeper reasoning model for each message, using conversation type, complexity, tool needs, and explicit intent such as "think hard about this." Cloud platforms offer managed routers as well, such as Amazon Bedrock intelligent prompt routing, which predicts response quality for each prompt and picks between two models of the same family.

A Confidence Cascade for Vision#

The same idea applies to model deployment for object detection. YOLO26 comes in five sizes behind one API, from YOLO26n at 40.9 COCO mAP and 38.9 ms per image on a CPU with ONNX to YOLO26x at 57.5 mAP and 525.8 ms, so a cascade can run the nano model on every image and send only images with low-confidence detections to the extra-large one:

from ultralytics import YOLO

source = "https://ultralytics.com/images/bus.jpg"
small_model = YOLO("yolo26n.pt")
large_model = YOLO("yolo26x.pt")

# Every image goes to the small model first
results = small_model(source)
route = "yolo26n"

# Escalate when the small model finds nothing or is unsure about any detection
confidences = results[0].boxes.conf
if len(confidences) == 0 or confidences.min() < 0.5:
    results = large_model(source)
    route = "yolo26x"

print(f"answered by {route}: {len(results[0].boxes)} objects")

The printout names the model that produced the final answer. Raising the 0.5 threshold sends more images to YOLO26x, so it sets the trade-off between mean average precision and average cost per image, which is tuned on held-out images from the deployment.

Model routing is often mixed up with neighboring ideas:

  • Load balancing: Spreads requests across identical replicas of one model to share load. Every replica gives the same answer.
  • Mixture of experts: A gating network inside one model sends each token to a few expert layers, and the experts train jointly with the gate.
  • Model ensemble: Runs several models on the same input and combines their outputs, which costs more per request.
  • AI gateway: The infrastructure layer between applications and model providers, which often hosts the router next to authentication, rate limits, and logging.
  • AI agent orchestration: Chooses which agent or tool handles each step of a task, and each of those steps can make its own model routing decision.

Routers are evaluated on representative traffic against the baseline of always calling the strongest model. RouteLLM measures performance gap recovered, the share of the quality difference between the weak and strong model that a router retains, at each fraction of calls sent to the strong model. In production, model monitoring tracks the escalation rate, latency, and cost per request of each route, because a shift in incoming traffic moves all three.

Explore solutions

Computer vision in sports

Computer vision in sports

Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery

Computer vision for aerial imagery

Transform drone and aerial imagery into real-time insights for agriculture, aquaculture, environmental monitoring, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace

Computer vision in aerospace

Bring vision AI to aerial monitoring with Ultralytics YOLO models. Power drones, aerospace workflows, environmental conservation & geospatial industries with computer vision solutions.
Learn more
Computer vision in security

Computer vision in security

Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics

Computer vision in robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Computer vision in logistics

Computer vision in logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail

Computer vision in retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare

Computer vision in healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing

Computer vision in manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive

Computer vision in automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Computer vision in agriculture

Computer vision in agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more
Computer vision in sports

Computer vision in sports

Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery

Computer vision for aerial imagery

Transform drone and aerial imagery into real-time insights for agriculture, aquaculture, environmental monitoring, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace

Computer vision in aerospace

Bring vision AI to aerial monitoring with Ultralytics YOLO models. Power drones, aerospace workflows, environmental conservation & geospatial industries with computer vision solutions.
Learn more
Computer vision in security

Computer vision in security

Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics

Computer vision in robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Computer vision in logistics

Computer vision in logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail

Computer vision in retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare

Computer vision in healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing

Computer vision in manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive

Computer vision in automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Computer vision in agriculture

Computer vision in agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more
Computer vision in sports

Computer vision in sports

Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery

Computer vision for aerial imagery

Transform drone and aerial imagery into real-time insights for agriculture, aquaculture, environmental monitoring, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace

Computer vision in aerospace

Bring vision AI to aerial monitoring with Ultralytics YOLO models. Power drones, aerospace workflows, environmental conservation & geospatial industries with computer vision solutions.
Learn more
Computer vision in security

Computer vision in security

Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics

Computer vision in robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Computer vision in logistics

Computer vision in logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail

Computer vision in retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare

Computer vision in healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing

Computer vision in manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive

Computer vision in automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Computer vision in agriculture

Computer vision in agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more

Let's build the future of AI together!

Begin your journey with the future of machine learning