Day 73: Draft-Then-Verify Routing

Day 73: Draft-Then-Verify Routing

Not every token deserves the expensive model. Draft-then-verify routes cheap drafts to an expensive gate for risky or low-confidence outputs — saving money without shipping unchecked diffs.

⚡ TL;DR: Cheap model drafts intents/plans; verifier model (or tests+critic) gates apply. Route by risk score and confidence. Tests still run regardless of model route.

Router

RISKY_PATHS = ("/terraform/", "/iam/", "/payments/")

def needs_expensive_gate(intent: dict, conf: float) -> bool:
    if any(p in intent["path"] for p in RISKY_PATHS):
        return True
    return conf < 0.7
export async function draftThenVerify(goal: string) {
  const draft = await cheap.complete(goal);
  if (!needsExpensiveGate(draft)) return draft;
  const verdict = await expensive.verify(draft);
  if (!verdict.ok) throw new Error("verify_reject");
  return draft;
}

✅ Tests still run regardless of model route — verify ≠ skip CI.

Closing checklist

  • [ ] Risk-based routing
  • [ ] Expensive verify on risky paths
  • [ ] Keep deterministic tests as ground truth
  • [ ] Log which model drafted vs verified
  • [ ] Eval both paths in the suite

Series navigation

Day 72: Prompt Caching Pitfalls · Day 74: Batch Inference Overnight

Last updated September 11, 2026


Discover more from CheatCoders

Subscribe to get the latest posts sent to your email.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply