# Is the Local Model Good Enough? Evals as a Routing Gate

> The hybrid router from my EKS series sends a request to the local model when the prompt is short, which is a cost decision made with no quality signal. This post replaces that guess with measurement: a golden set built from real Langfuse traces, pairwise LLM-as-judge grading with position-bias control, a token-threshold sweep per workload, and a CI job that blocks a model or router change when quality drops.

Author: Kevin Cearns · Published: 2026-11-14 · Source: https://kcearns.tech/writing/hybrid-router-evals-quality-gate
The [hybrid router](/writing/eks-hybrid-llm-platform-router) from my EKS series makes one decision on every `"model": "auto"` request: local or cloud. It makes that decision on two numbers. If the prompt is under about 1,500 estimated tokens and the requested output is at most 1,024 tokens, the request goes to Qwen2.5-7B on vLLM. Otherwise it goes to Claude.

In Part 6 I called those thresholds "starting points, not absolutes". [Part 7](/writing/eks-hybrid-llm-platform-observability) made the routing split visible in Langfuse, and [Part 8](/writing/eks-hybrid-llm-platform-testing) proved every route works. None of that says whether the local model's answers are any good. The router is making a cost decision with no quality signal, and the threshold is a guess I wrote down once.

This post replaces the guess with a measurement. I build a small eval harness alongside the Part 8 test suite and use it to answer three questions:

1. On the traffic this platform actually sees, how often is the local answer as good as the cloud answer?
2. Where does local quality fall off as prompts get longer, and is that point the same for every workload?
3. How do I stop a model swap, a quantization change or a threshold tweak from quietly making things worse?

The output is a recommended `LOCAL_TOKEN_THRESHOLD` for each workload and a CI job that fails when quality drops.

## What "good enough" means here

The router's job is not to pick the best model. Claude will usually write a better summary than a 7B model. The question is whether the local answer is **acceptable**: not worse than the cloud answer in a way a user would notice. So the metric I track for each workload is the **acceptable rate**:

```
acceptable rate = (local wins + ties) / judged cases
```

A case is a win for local when the judge prefers the local answer, a tie when it can't separate them, and a loss when it prefers the cloud answer. A workload where local loses 5% of the time is a good candidate to stay local. One where it loses 40% of the time is costing quality to save money, and the router should know.

Classification is different. A sentiment label is right or wrong, so the classify workload is graded by exact match against a hand-checked label, with no judge involved. Use the cheapest grader that can actually tell answers apart, and only reach for an LLM judge when string comparison can't.

## Directory layout

The eval harness sits next to the Part 8 suite and reuses its `package.json` and the OpenAI SDK client.

```
tests/
├── integration/          # Part 8
├── load/                 # Part 8
├── workloads/            # Part 8
└── evals/
    ├── lib.ts            # router client, types, token estimate
    ├── build-golden.ts   # pull candidates from Langfuse
    ├── golden.jsonl      # the reviewed golden set (committed)
    ├── judge.ts          # pairwise judge with swap
    ├── run.ts            # run every case, write results
    ├── sweep.ts          # acceptable rate by token bucket
    ├── gate.ts           # CI pass/fail against a baseline
    └── baseline.json     # last accepted results (committed)
```

Two dependencies join the existing ones:

```bash
cd tests && npm install @anthropic-ai/sdk && npm install -D tsx
```

## Shared pieces

`lib.ts` holds the router client, the golden-case type and the same token estimate the router uses. Keeping the estimate identical to the router's matters: the sweep later recommends a threshold in the router's own units.

```ts
// tests/evals/lib.ts
import OpenAI from "openai";

export const ROUTER_URL = process.env.ROUTER_URL ?? "http://localhost:8080";

export const router = new OpenAI({
  baseURL: `${ROUTER_URL}/v1`,
  apiKey: "unused",
});

export type Workload = "classify" | "summarize" | "plan";
export type Message = OpenAI.ChatCompletionMessageParam;

export interface GoldenCase {
  id: string;
  workload: Workload;
  messages: Message[];
  max_tokens: number;
  /** Exact-match label for classify cases. */
  expected?: string;
}

/** Same heuristic as the router: characters ÷ 4. */
export function estimateTokens(messages: Message[]): number {
  return (
    messages.reduce(
      (sum, m) => sum + (typeof m.content === "string" ? m.content.length : 0),
      0,
    ) / 4
  );
}

export interface Completion {
  text: string;
  backend: string | null;
}

export async function complete(
  c: GoldenCase,
  model: "local" | "cloud" | "auto",
): Promise<Completion> {
  const { data, response } = await router.chat.completions
    .create({ model, messages: c.messages, max_tokens: c.max_tokens, temperature: 0 })
    .withResponse();

  return {
    text: data.choices[0]?.message?.content ?? "",
    backend: response.headers.get("x-router-backend"),
  };
}

export async function readJsonl<T>(path: string): Promise<T[]> {
  const { readFile } = await import("node:fs/promises");
  return (await readFile(path, "utf8"))
    .split("\n")
    .filter(Boolean)
    .map((line) => JSON.parse(line) as T);
}
```

`complete` returns the `X-Router-Backend` header along with the text. That header is how the harness catches the router's cold-start fallback. If vLLM has scaled to zero, a request for `model: "local"` is quietly served by Claude, and an eval that doesn't check would score the cloud model twice and report that local is perfect.

## Building the golden set from real traffic

Made-up prompts make a poor eval. They are cleaner, shorter and more evenly spread than real traffic. Part 7 already stores every request in Langfuse, so the golden set comes from there.

`build-golden.ts` pages through the `chat-completion` generations the router logs, labels each one by workload using its system prompt, removes duplicates, and then takes a sample **spread across prompt length**. A random sample would mostly hold short prompts, because most traffic is short. The threshold question is about the long end, so the sample needs cases there too.

```ts
// tests/evals/build-golden.ts
import { createHash } from "node:crypto";
import { writeFile } from "node:fs/promises";
import { estimateTokens, type GoldenCase, type Message, type Workload } from "./lib.ts";

const HOST = process.env.LANGFUSE_HOST ?? "http://localhost:3000";
const AUTH =
  "Basic " +
  Buffer.from(
    `${process.env.LANGFUSE_PUBLIC_KEY}:${process.env.LANGFUSE_SECRET_KEY}`,
  ).toString("base64");

const PER_WORKLOAD = 50;
const MAX_TOKENS: Record<Workload, number> = { classify: 5, summarize: 150, plan: 800 };

interface Observation {
  id: string;
  input: Message[] | null;
}

async function* generations(): AsyncGenerator<Observation> {
  for (let page = 1; ; page++) {
    const url = `${HOST}/api/public/observations?type=GENERATION&name=chat-completion&limit=100&page=${page}`;
    const res = await fetch(url, { headers: { Authorization: AUTH } });
    if (!res.ok) throw new Error(`Langfuse ${res.status}: ${await res.text()}`);
    const body = (await res.json()) as { data: Observation[]; meta: { totalPages: number } };
    yield* body.data;
    if (page >= body.meta.totalPages) return;
  }
}

function workloadOf(messages: Message[]): Workload | null {
  const system = messages.find((m) => m.role === "system")?.content;
  if (typeof system !== "string") return null;
  if (system.startsWith("Classify the sentiment")) return "classify";
  if (system.startsWith("Summarise the article")) return "summarize";
  if (system.startsWith("You are a senior engineering manager")) return "plan";
  return null;
}

/** Take n items spread evenly across the list after sorting by prompt length. */
function spread<T>(items: T[], n: number, size: (t: T) => number): T[] {
  const sorted = [...items].sort((a, b) => size(a) - size(b));
  if (sorted.length <= n) return sorted;
  return Array.from({ length: n }, (_, i) =>
    sorted[Math.round((i * (sorted.length - 1)) / (n - 1))],
  );
}

const seen = new Set<string>();
const pools: Record<Workload, GoldenCase[]> = { classify: [], summarize: [], plan: [] };

for await (const obs of generations()) {
  if (!Array.isArray(obs.input)) continue;
  const workload = workloadOf(obs.input);
  if (!workload) continue;

  const hash = createHash("sha256").update(JSON.stringify(obs.input)).digest("hex");
  if (seen.has(hash)) continue;
  seen.add(hash);

  pools[workload].push({
    id: `${workload}-${hash.slice(0, 10)}`,
    workload,
    messages: obs.input,
    max_tokens: MAX_TOKENS[workload],
  });
}

const candidates = (Object.keys(pools) as Workload[]).flatMap((w) =>
  spread(pools[w], PER_WORKLOAD, (c) => estimateTokens(c.messages)),
);

await writeFile(
  "evals/candidates.jsonl",
  candidates.map((c) => JSON.stringify(c)).join("\n") + "\n",
);
console.log(
  Object.fromEntries((Object.keys(pools) as Workload[]).map((w) => [w, pools[w].length])),
  `→ ${candidates.length} candidates`,
);
```

The plan workload in Part 8 sends `model: "cloud"` explicitly, so it never reaches the local model today. It's still in the golden set. Whether those requests *could* go local is exactly the kind of question the eval should answer, rather than me assuming they can't.

### Reviewing by hand

`candidates.jsonl` is not the golden set yet. I read all 150 cases before promoting them:

- **Remove anything sensitive.** Production prompts can contain customer text. Anything I wouldn't commit to the repo gets dropped or rewritten.
- **Label the classify cases.** I fill in `expected` by hand. It is quick for 50 one-line reviews, and it is the only ground truth in the set that doesn't come from a model.
- **Drop broken inputs.** Empty articles, truncated pastes, test requests from Part 8's integration suite.

What survives goes into `golden.jsonl` and gets committed. From then on the golden set only changes in a reviewed pull request, the same as code. An eval set that changes silently can't tell you whether the model changed or the questions did.

## The judge

For summarize and plan there is no single right answer, so a stronger model compares the local and cloud answers. Three choices keep the judge honest.

**Pairwise, not absolute scores.** Asking a model to "rate this summary 1–10" gives numbers that drift between runs and bunch up around 7. Asking "which of these two is better, or are they equivalent?" is a much easier question, and it's the question the router actually needs answered.

**Run every comparison twice with the order swapped.** LLM judges tend to prefer whichever answer they see first. Each pair is judged as (local, cloud) and again as (cloud, local). If the two verdicts disagree, the judge was reacting to the order rather than the content, and the case counts as a tie.

**Ask for a verdict in a fixed schema.** Structured outputs constrain the response to `A`, `B` or `tie` plus a one-sentence reason, so there is no parsing of free text.

The judge is Claude Opus 5.5, a stronger model than either side of the comparison (the router's cloud backend is Sonnet 4.6), so it isn't grading its own answers. I run it at `medium` effort and turn on the API's server-side refusal fallback so one declined request doesn't stop a CI run.

```ts
// tests/evals/judge.ts
import Anthropic from "@anthropic-ai/sdk";
import type { GoldenCase } from "./lib.ts";

const anthropic = new Anthropic();
const JUDGE_MODEL = process.env.JUDGE_MODEL ?? "claude-opus-5-5";

const RUBRICS: Record<"summarize" | "plan", string> = {
  summarize: `A good summary is faithful to the article (no invented facts),
covers its main point, and respects the two-to-three sentence limit.
Fluency matters less than faithfulness.`,
  plan: `A good plan has realistic phases with durations, concrete deliverables,
and risks that are specific to the stated goal rather than generic.
Penalise plans that ignore constraints stated in the goal.`,
};

const VERDICT_SCHEMA = {
  type: "object",
  properties: {
    reason: { type: "string" },
    verdict: { type: "string", enum: ["A", "B", "tie"] },
  },
  required: ["reason", "verdict"],
  additionalProperties: false,
} as const;

type Verdict = "A" | "B" | "tie";

async function judgeOnce(c: GoldenCase, a: string, b: string): Promise<Verdict> {
  const task = c.messages.map((m) => `[${m.role}]\n${m.content}`).join("\n\n");

  const response = await anthropic.beta.messages.create({
    model: JUDGE_MODEL,
    max_tokens: 4000,
    betas: ["server-side-fallback-2026-07-01"],
    fallbacks: "default",
    output_config: {
      effort: "medium",
      format: { type: "json_schema", schema: VERDICT_SCHEMA },
    },
    system: `You compare two responses to the same request and decide which is better.
${RUBRICS[c.workload as "summarize" | "plan"]}
Answer "tie" when a reader would not notice a meaningful difference in quality.
Do not prefer a response for being longer.`,
    messages: [
      {
        role: "user",
        content: `<request>\n${task}\n</request>\n\n<response_a>\n${a}\n</response_a>\n\n<response_b>\n${b}\n</response_b>`,
      },
    ],
  });

  if (response.stop_reason === "refusal") return "tie";
  const text = response.content.find((block) => block.type === "text");
  if (!text || text.type !== "text") throw new Error(`No verdict for ${c.id}`);
  return (JSON.parse(text.text) as { verdict: Verdict }).verdict;
}

export type Outcome = "win" | "tie" | "loss";

/** Judge local vs cloud in both orders. Disagreement between orders is a tie. */
export async function judgePair(c: GoldenCase, local: string, cloud: string): Promise<Outcome> {
  const [first, second] = await Promise.all([
    judgeOnce(c, local, cloud), // local is A
    judgeOnce(c, cloud, local), // local is B
  ]);
  const localFirst: Outcome = first === "A" ? "win" : first === "B" ? "loss" : "tie";
  const localSecond: Outcome = second === "B" ? "win" : second === "A" ? "loss" : "tie";
  return localFirst === localSecond ? localFirst : "tie";
}
```

The rubric tells the judge not to prefer longer answers. That isn't filler: verbosity bias is the second most common judge failure after position bias, and it works against the 7B model, which tends to write longer.

### Checking the judge against my own grading

A judge nobody has checked is just another model giving opinions. Before trusting it, grade 30 summarize and plan pairs yourself, without seeing the judge's verdicts, and compare the two.

```ts
// tests/evals/calibrate.ts — compare judge verdicts with hand labels
import { readJsonl } from "./lib.ts";
import type { Outcome } from "./judge.ts";

interface Row { id: string; human: Outcome; judge: Outcome }
const rows = await readJsonl<Row>("evals/calibration.jsonl");

const agree = rows.filter((r) => r.human === r.judge).length / rows.length;

// Cohen's kappa: agreement corrected for what two random graders would hit by chance.
const labels: Outcome[] = ["win", "tie", "loss"];
const share = (who: "human" | "judge", l: Outcome) =>
  rows.filter((r) => r[who] === l).length / rows.length;
const chance = labels.reduce((s, l) => s + share("human", l) * share("judge", l), 0);
const kappa = (agree - chance) / (1 - chance);

console.log(`agreement ${(agree * 100).toFixed(0)}%  kappa ${kappa.toFixed(2)}`);
```

Plain agreement looks better than it is when most cases are ties, so the script also reports Cohen's kappa. My bar is a kappa of 0.6 or above. Below that, change the rubric, not the model, and calibrate again. The disagreements are where the rubric is unclear.

## Running the eval

`run.ts` sends every golden case to the local backend and the cloud backend, grades it, and writes one result row per case. It runs a few cases at a time so it doesn't flood vLLM, and it stops immediately if a local request was served by the cloud.

```ts
// tests/evals/run.ts
import { writeFile } from "node:fs/promises";
import { complete, estimateTokens, readJsonl, type GoldenCase, type Workload } from "./lib.ts";
import { judgePair, type Outcome } from "./judge.ts";

export interface Result {
  id: string;
  workload: Workload;
  tokens: number;
  outcome: Outcome;
}

const CONCURRENCY = 4;
const cases = await readJsonl<GoldenCase>("evals/golden.jsonl");

async function evaluate(c: GoldenCase): Promise<Result> {
  const local = await complete(c, "local");
  if (local.backend !== "local") {
    throw new Error(`${c.id}: requested local, served by ${local.backend}. Is vLLM warm?`);
  }

  let outcome: Outcome;
  if (c.workload === "classify") {
    outcome = local.text.trim().toUpperCase() === c.expected ? "win" : "loss";
  } else {
    const cloud = await complete(c, "cloud");
    outcome = await judgePair(c, local.text, cloud.text);
  }

  return { id: c.id, workload: c.workload, tokens: estimateTokens(c.messages), outcome };
}

const results: Result[] = [];
for (let i = 0; i < cases.length; i += CONCURRENCY) {
  results.push(...(await Promise.all(cases.slice(i, i + CONCURRENCY).map(evaluate))));
  process.stdout.write(`\r${results.length}/${cases.length}`);
}

await writeFile("evals/results.json", JSON.stringify(results, null, 2));
console.log("\nwrote evals/results.json");
```

For classify, an exact-match pass counts as a "win" and a miss as a "loss", so all three workloads report the same acceptable rate.

## Finding the real threshold

`sweep.ts` groups each workload's results into prompt-length buckets and prints the acceptable rate per bucket, with a confidence interval. The recommended threshold is the top of the last bucket where the **lower bound** of the interval is still above the target, and every shorter bucket passes too.

Using the lower bound matters. A bucket with eight cases that all passed has an acceptable rate of 100% and almost no evidence behind it. The Wilson score interval accounts for small samples, and a 95% Wilson lower bound for 8 out of 8 is about 68%.

```ts
// tests/evals/sweep.ts
import { readFile } from "node:fs/promises";
import type { Result } from "./run.ts";
import type { Workload } from "./lib.ts";

const TARGET = Number(process.env.TARGET ?? 0.85);
const EDGES = [250, 500, 750, 1000, 1500, 2000, 3000, 4000, Infinity];

/** 95% Wilson score lower bound for k successes out of n. */
export function wilsonLower(k: number, n: number, z = 1.96): number {
  if (n === 0) return 0;
  const p = k / n;
  const denom = 1 + (z * z) / n;
  const centre = p + (z * z) / (2 * n);
  const margin = z * Math.sqrt((p * (1 - p)) / n + (z * z) / (4 * n * n));
  return (centre - margin) / denom;
}

const results = JSON.parse(await readFile("evals/results.json", "utf8")) as Result[];

for (const workload of ["classify", "summarize", "plan"] as Workload[]) {
  const rows = results.filter((r) => r.workload === workload);
  let threshold = 0;
  let passing = true;
  let lo = 0;

  console.log(`\n${workload}`);
  for (const hi of EDGES) {
    const bucket = rows.filter((r) => r.tokens >= lo && r.tokens < hi);
    if (bucket.length === 0) { lo = hi; continue; }
    const ok = bucket.filter((r) => r.outcome !== "loss").length;
    const lower = wilsonLower(ok, bucket.length);
    passing &&= lower >= TARGET;
    if (passing) threshold = hi;
    console.log(
      `  ${String(lo).padStart(5)}–${String(hi).padEnd(8)} n=${String(bucket.length).padEnd(3)}` +
        ` acceptable ${((ok / bucket.length) * 100).toFixed(0).padStart(3)}%` +
        `  lower ${(lower * 100).toFixed(0).padStart(3)}%${passing ? "" : "  ✗"}`,
    );
    lo = hi;
  }
  console.log(`  → LOCAL_TOKEN_THRESHOLD ≈ ${threshold === Infinity ? "no limit" : threshold}`);
}
```

The target of 85% is a product decision, not a technical one. It says that 15% of answers on this route being noticeably worse than the cloud model is an acceptable price for the savings. A customer-facing route might want 95%. An internal batch job might accept 70%.

### Per-workload thresholds in the router

If the sweep gives very different thresholds per workload (I expect classify to be fine at any length and plan to fail early), one global `LOCAL_TOKEN_THRESHOLD` can't represent them. The smallest change to the router is an optional `X-Workload` header that callers set, with a threshold per workload loaded from config:

```ts
// router src/index.ts — additions to Part 6
const WORKLOAD_THRESHOLDS: Record<string, number> = JSON.parse(
  process.env.WORKLOAD_THRESHOLDS ?? "{}",
); // e.g. {"classify":4000,"summarize":1000,"plan":0}

function routeToLocal(model: string, messages: Message[], maxTokens: number, workload?: string): boolean {
  if (LOCAL_MODELS.has(model)) return true;
  if (model in CLOUD_MODELS) return false;
  const threshold =
    workload !== undefined && workload in WORKLOAD_THRESHOLDS
      ? WORKLOAD_THRESHOLDS[workload]
      : LOCAL_TOKEN_THRESHOLD;
  return estimateTokens(messages) < threshold && maxTokens <= LOCAL_MAX_TOKENS_THRESHOLD;
}

// in the handler:
let useLocal = routeToLocal(model, messages, maxTokens, c.req.header("x-workload"));
```

A threshold of `0` means "never local" for that workload, which is how the eval can overrule Part 8's decision to hard-code plan to cloud, or confirm it. Requests without the header behave exactly as before.

## A CI gate

The eval is only useful if it runs whenever something that affects quality changes: the vLLM model or its flags, the router's thresholds, or the golden set itself. `gate.ts` compares a fresh run to the committed `baseline.json` and fails if any workload's acceptable rate drops by more than an allowed margin.

```ts
// tests/evals/gate.ts
import { readFile } from "node:fs/promises";
import type { Result } from "./run.ts";
import type { Workload } from "./lib.ts";

const MAX_DROP = Number(process.env.MAX_DROP ?? 0.05);

const rate = (rows: Result[], w: Workload) => {
  const r = rows.filter((x) => x.workload === w);
  return r.filter((x) => x.outcome !== "loss").length / r.length;
};

const current = JSON.parse(await readFile("evals/results.json", "utf8")) as Result[];
const baseline = JSON.parse(await readFile("evals/baseline.json", "utf8")) as Result[];

let failed = false;
for (const w of ["classify", "summarize", "plan"] as Workload[]) {
  const before = rate(baseline, w);
  const after = rate(current, w);
  const drop = before - after;
  const status = drop > MAX_DROP ? "FAIL" : "ok";
  if (status === "FAIL") failed = true;
  console.log(
    `${w.padEnd(10)} ${(before * 100).toFixed(1)}% → ${(after * 100).toFixed(1)}%  ${status}`,
  );
}
process.exit(failed ? 1 : 0);
```

The 5-point margin is not arbitrary. With 50 cases per workload and an acceptable rate around 85%, the 95% interval on a single run is roughly ±10 points, and two runs of an unchanged system can differ by several points from judge variation alone. A tighter gate would fail on noise and people would learn to rerun it until it passes, which is worse than having no gate. If I need to catch smaller regressions, the fix is more cases, not a tighter margin.

When a change is meant to move the numbers (a better model, a deliberate threshold change), the pull request updates `baseline.json` along with the change, and the diff shows the reviewer what moved.

The workflow runs against a staging deployment of the platform. It warms vLLM first, because a scaled-to-zero GPU node takes minutes to come back and the harness refuses to grade cloud answers as local.

```yaml
# .github/workflows/evals.yml
name: evals
on:
  pull_request:
    paths:
      - "router/**"
      - "lib/inference-stack.ts"
      - "tests/evals/**"

jobs:
  eval:
    runs-on: ubuntu-latest
    timeout-minutes: 40
    defaults:
      run:
        working-directory: tests
    env:
      ROUTER_URL: ${{ secrets.STAGING_ROUTER_URL }}
      ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
    steps:
      # Pin both actions to a commit SHA in a real repo.
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: npm
          cache-dependency-path: tests/package-lock.json
      - run: npm ci

      - name: Wait for vLLM to be warm
        run: |
          for i in $(seq 1 60); do
            backend=$(curl -s -o /dev/null -D - "$ROUTER_URL/v1/chat/completions" \
              -H 'content-type: application/json' \
              -d '{"model":"local","messages":[{"role":"user","content":"ping"}],"max_tokens":1}' \
              | grep -i '^x-router-backend' | tr -d '\r' | awk '{print $2}')
            [ "$backend" = "local" ] && exit 0
            sleep 10
          done
          echo "vLLM never became ready" && exit 1

      - run: npx tsx evals/run.ts
      - run: npx tsx evals/sweep.ts
      - run: npx tsx evals/gate.ts
```

`sweep.ts` runs in CI for its output, not as a gate. The threshold it recommends goes in the job log for the reviewer to act on, and only the regression check can fail the build.

## What the eval itself costs

An eval that costs more than the savings it protects won't keep running. Per run, with 150 cases (50 per workload):

- **Local generations:** 150 requests on a GPU node that is already up for staging. Effectively free.
- **Cloud generations:** 100 requests (summarize and plan) on Sonnet 4.6 at $3/$15 per million tokens. At about 800 input and 400 output tokens each, that's around **$0.85**.
- **Judge calls:** 200 calls (two orders × 100 pairs) on Opus 5.5 at $4/$20 per million tokens. At about 1,500 input and 400 output tokens each (output includes the judge's thinking), that's around **$2.80**.

So roughly **$4 per run**, run on pull requests that touch the model or router, not on every commit. These are estimates from average prompt sizes; log `usage` from both SDKs on your first run to get the real figure. Classification uses no judge at all, which is one reason to grade by exact match wherever the task allows it.

## What I'd keep from this

- **Measure on your own traffic.** Public benchmarks say little about whether a 7B model can summarise *your* articles. Fifty real prompts per workload, reviewed by hand, say more.
- **Ask the judge which answer is better, not for a score.** Comparisons are steadier than ratings. Swapping the order and counting disagreements as ties removes position bias for the cost of a second call.
- **Check the judge before trusting it.** Thirty hand-graded pairs and a kappa figure take an hour, and they are the difference between an eval and a guess.
- **Decide on the lower bound, not the average.** Small buckets look perfect. The Wilson interval makes the sweep cautious exactly where data is thin.
- **Set the gate wider than the noise.** A gate that fails on noise gets ignored. Size the margin to the sample, and add cases when you need more precision.

The routing decision is still a cost decision. It's just one made with a measured quality figure next to the price, instead of a number I wrote down in Part 6 and never checked.