Skip to main content

Module routing_eval

Module routing_eval 

Source
Expand description

Routing off-vs-on savings proof (enterprise#21).

Answers “does the active router (enterprise#13) produce real, auditable savings?” the same way the context A/B answers the quality question — deterministically, at real list prices, over real queries:

  • off-arm: every task is served by the model the client requested.
  • on-arm: the task’s last user query runs through the production classifier (classifyroute_intent) and the configured RoutingRules — exactly the logic the proxy applies in-flight — and is priced at the model the router selects.

The savings claim is a pure rate-card delta: input_rate(requested) − input_rate(serving) per routed task, priced from the shared ModelPricing table (real provider list prices; enterprise#14). No token counts are invented — absolute USD amounts come from the usage ledger (enterprise#19), which applies the same formula to measured usage_events rows (routed_from × real input tokens). This eval proves the mechanism and the classification distribution; the ledger supplies the volumes.

Everything here is a deterministic function of (suite, rules, pricing table): the classifier is lexical, the price table is embedded, and the report digest is byte-stable (#498) — so the artifact is reproducible evidence, not a demo.

Structs§

RoutingEvalConfig
Configuration for one routing off-vs-on run.
RoutingEvalReport
Deterministic off-vs-on routing report — the savings_ledger’s attribution witness for the ROUTE mechanism.
RoutingTaskRecord
One task’s routing decision + rate delta.

Functions§

routing_saving_usd
The ROUTE-mechanism attribution formula shared with the savings ledger (enterprise#19): USD saved on input_tokens by serving serving instead of requested, at list input rates. Negative deltas (an upgrade) count as negative savings — the ledger must not hide regressions.
run_routing_eval
Runs the routing off-vs-on comparison over a suite’s real task prompts.
run_routing_experiment
Production OCLA callsite for the routing A/B experiment.