YOLO Vision 2026:
Back to Ultralytics Glossary

Model Routing

Learn how model routing selects the right AI model for each request to balance accuracy, cost, latency, and resource use in multi-model systems.

Model routing is the process of selecting which AI model should handle each incoming request. Instead of sending every input to one model, a routing layer evaluates signals such as the requested task, input type, complexity, latency target, cost limit, hardware availability, or confidence requirements. It then forwards the request to the most suitable candidate. In this context, a “router” is an inference decision component, not a physical network router. Routing helps multi-model machine learning systems balance prediction quality, resource use, and inference latency.

How Model Routing Works#

A routing system generally contains a pool of deployed models, decision logic, and a common application interface. The application submits one request, the router selects an eligible model, and the model-serving layer returns that model’s output.

Routing decisions can be:

  • Rule-based: Select a model using explicit metadata, such as routing images requesting masks to a segmentation model.
  • Score-based: Estimate each candidate’s expected quality, cost, or response time and choose the highest-scoring option.
  • Learned: Use a lightweight classifier or routing model to infer which candidate best matches the input.
  • Cascaded: Run a fast model first, then escalate uncertain or high-risk results to a more capable model.

For example, Amazon Bedrock intelligent prompt routing predicts response quality before choosing between language models, while Microsoft’s model-routing strategy guidance describes cost-, quality-, and balanced routing. Similar principles apply to computer vision: requests can be routed by task, camera location, image resolution, or required prediction detail.

Model routing is closely connected to other multi-model techniques, but the terms are not interchangeable.

  • AI gateways: An AI gateway provides a broader control layer for authentication, quotas, logging, and traffic management. Model selection may be one gateway capability. The Kubernetes Gateway API Inference Extension also distinguishes model-aware routing from endpoint selection and load balancing.
  • Model ensembles: An ensemble normally runs multiple models and combines their predictions. A router typically chooses one model, reducing computation. NVIDIA Triton ensemble models instead define fixed dataflows through several models.
  • Mixture of experts: An MoE architecture routes internal representations to components inside one neural network. Model routing selects among separately deployable models or endpoints.
  • Agent routing: An agent router chooses a specialized agent, workflow, or tool. Model routing chooses the underlying model that performs an inference step. In an agentic system, both forms of routing may be present.

Load balancing is another important distinction. It distributes requests among replicas of the same service to improve availability or throughput. Model routing chooses between models with different capabilities, costs, or outputs.

Real-World Applications#

Visual inspection: A manufacturing system may use object detection for routine part counting but route suspected surface defects to instance segmentation for precise boundaries. Ultralytics YOLO26 supports both object detection and instance segmentation, making task-based routing possible within a consistent API. This avoids paying the segmentation cost when boxes are sufficient.

AI assistants: A support assistant can send simple classification and lookup requests to a small, fast language model while reserving a stronger model for complex reasoning or tool use. Google Cloud’s agentic architecture guidance describes this pattern as a way to balance quality, latency, and cost. Unlike a fixed cascade, dynamic routing can select the stronger model before generating an initial answer.

Implementing and Evaluating a Router#

This minimal Ultralytics example routes an image to detection or segmentation according to the output requested by an application:

from ultralytics import YOLO

models = {
    "detect": YOLO("yolo26n.pt"),
    "segment": YOLO("yolo26n-seg.pt"),
}

requested_task = "segment"
source = "https://ultralytics.com/images/bus.jpg"

model = models.get(requested_task)
if model is None:
    raise ValueError(f"Unsupported task: {requested_task}")

results = model(source)
result = results[0]
result.save(filename=f"{requested_task}_result.jpg")

The rule is intentionally simple: requests needing object masks go to segmentation, while requests needing only boxes can use detection. Production routers can also consider measured accuracy, queue depth, device type, privacy constraints, or service health.

Evaluate routing on representative traffic rather than model averages alone. Track route distribution, end-to-end latency, cost, failures, and task-level quality for each selected model. OpenTelemetry observability guidance explains how traces, metrics, and logs can follow individual requests through distributed services. Ultralytics Platform deployment monitoring similarly supports inspecting endpoint latency, errors, health, and request activity.

Misrouting can increase costs, miss latency targets, or send difficult inputs to an inadequate model. Teams should therefore define fallback behavior, restrict eligible models for sensitive workloads, log the selected route, and periodically retest the policy. These controls align routing decisions with broader practices in the NIST AI Risk Management Framework.

Explore solutions

Let's build the future of AI together!

Begin your journey with the future of machine learning