All notes

How to Design a Multi-Model Router

Designing model selection around capability, quality, latency, cost, and graceful fallback.

LLMRoutingEvaluation

Start with a route policy

A multi-model router should encode product priorities rather than chase a universal model ranking. The best model for a request depends on the job: structured extraction rewards consistency, coding rewards repository understanding, and interactive chat may prioritize latency.

Define a small policy with observable inputs before introducing a learned router.

TYPESCRIPT
type RoutePolicy = {
  requiredCapabilities: string[];
  maxLatencyMs: number;
  costTier: "low" | "balanced" | "high";
  fallbackModel: string;
};

Separate eligibility from ranking

First filter models that cannot satisfy hard requirements such as context length, tool calling, data residency, or structured output. Then rank the eligible set with softer signals such as predicted quality, cost, and recent latency.

This separation makes failures easier to explain. It also prevents a cheap but incapable model from winning a weighted score.

Build feedback into the route

A router improves only when decisions can be evaluated. Log the route inputs, chosen model, fallback path, latency, cost estimate, and task outcome. Avoid storing unnecessary user content; evaluation features should be deliberate and privacy-aware.

  • Maintain a small golden dataset by task type.
  • Run shadow evaluations before changing production policy.
  • Track fallback frequency and reasons.
  • Version routing rules alongside evaluation results.

Prefer graceful degradation

Routing is infrastructure, so failure behavior matters. A robust system can retry a transient error, fall back to a compatible model, reduce context safely, or ask for clarification. It should never silently send a request to a model that violates a hard requirement.

The first useful router is usually a readable policy table. Add learned routing only when real traffic and evaluation data show where static rules stop working.