Complexity-Based Cheap/Strong Model Router

Route easy requests to a cheap model and hard ones to a strong model using a lightweight classifier plus escalation.

routingcostclassifier
Setup time1-2 hours (estimate)
Estimated costOne tiny classifier call per request; savings depend on your share of simple traffic.
ToolsPython
VerificationNot yet independently verified

Strategy

  1. Heuristic pre-filter (length, presence of code, math, multi-step words).
  2. Cheap classifier call returns simple or complex.
  3. simple → cheap model; complex → strong model.
  4. Escalate: if the cheap model's answer fails validation (schema error, low self-reported confidence, tests fail), retry on the strong model.

Router

def route(prompt: str) -> str:
    if len(prompt) > 6000 or "```" in prompt:
        return "strong"
    label = classify(prompt)        # cheap model, max_tokens=1, temperature=0
    return "strong" if label == "complex" else "cheap"

CLASSIFIER_PROMPT = """Label the task as 'simple' (lookup, rewrite, short answer)
or 'complex' (multi-step reasoning, code, math, analysis). Reply with one word.
Task: {prompt}"""

Config

models: {cheap: small-fast-model, strong: frontier-model}
escalate_on: [json_parse_error, validator_fail]
log: [route, model, tokens_in, tokens_out, latency_ms, escalated]

Measure on your own traffic: compare quality on a sample before trusting the savings.

Failure modes

Markdown version: /blueprints/complexity-based-routing.md

Want a deeper build of this?

Vote for an extended, fully tested version (more tools, a full workflow file). Votes decide what we build next.

– votes

Get one fully built blueprint a week

A weekly email: one blueprint with config, cost, setup time and failure modes, plus a vote on what we build next.

Related blueprints