fix(benchmark): fair to reasoning models, fair to router degradation, real sub-cent costs
Three false signals in benchmark results, all seen on a live run:
- Reasoning models were scored ❌ because the per-test max_tokens cap cut
them mid-<think> before the actual answer. Every run now gets +256 tokens
of headroom; non-thinking models stop at EOS as before, thinking ones get
to finish (math-mult on nanbeige: false 0/1 → honest 1/1).
- When the router degraded (timeout → fallback chain) the table showed
"✗ degraded" and counted it against classification accuracy. There was no
classification to judge — such rows now show a muted "⚠ router degraded"
with an explanatory tooltip and are excluded from the accuracy KPI.
- Costs below $0.0001 (cheap flash models) collapsed to "$0.0000". money
formatting now grows precision until two significant digits survive
($0.000035 instead of $0.0000).
2 new strings in all 7 languages.
This commit is contained in:
Vendored
+16
-7
@@ -170,7 +170,9 @@ export async function renderBenchmark() {
|
||||
let text = "";
|
||||
try {
|
||||
const info = await testStream(
|
||||
{ model, messages: [{ role: "user", content: test.prompt }], temperature: 0, max_tokens: test.max || 128 },
|
||||
// +256: headroom for reasoning models — a tight cap cuts them
|
||||
// mid-<think> and turns a correct model into a false ❌
|
||||
{ model, messages: [{ role: "user", content: test.prompt }], temperature: 0, max_tokens: (test.max || 128) + 256 },
|
||||
(d) => (text += d)
|
||||
);
|
||||
const latency = performance.now() - started;
|
||||
@@ -183,12 +185,17 @@ export async function renderBenchmark() {
|
||||
if (info.ttft_ms != null) rec.ttft.push(info.ttft_ms);
|
||||
const row = { id: test.id, cat: test.cat, ...ev, latency: Math.round(latency), cost: info.cost_usd || 0, answer: stripThink(text).slice(0, 300) };
|
||||
if (mode === "routing") {
|
||||
// router timed out / fell back — there was no classification to
|
||||
// judge, so it must not count against accuracy
|
||||
row.degraded = !info.task_label
|
||||
|| info.task_label === "degraded"
|
||||
|| String(info.route_source || "").includes("degraded");
|
||||
row.task = info.task_label || "—";
|
||||
row.tier = info.tier || "—";
|
||||
row.chosen = info.selected_model || "—";
|
||||
row.source = info.route_source || "—";
|
||||
row.expected = test.label; // null = classification not judged
|
||||
row.taskOk = test.label ? test.label.includes(info.task_label) : null;
|
||||
row.taskOk = test.label && !row.degraded ? test.label.includes(info.task_label) : null;
|
||||
}
|
||||
rec.results.push(row);
|
||||
} catch (e) {
|
||||
@@ -311,11 +318,13 @@ export async function renderBenchmark() {
|
||||
h("tr", {},
|
||||
h("td", {}, h("div", {}, r.id), h("div", { class: "muted small" }, r.cat)),
|
||||
h("td", {},
|
||||
r.taskOk == null
|
||||
? h("span", { class: "muted" }, r.task || "—")
|
||||
: h("span", { class: r.taskOk ? "" : "err" },
|
||||
(r.taskOk ? "✓ " : "✗ ") + r.task,
|
||||
r.taskOk ? "" : h("div", { class: "muted small" }, t("bm.expectedLbl") + " " + (r.expected || []).join("/")))),
|
||||
r.degraded
|
||||
? h("span", { class: "muted", title: t("bm.routerDegraded") }, "⚠ " + t("bm.degraded"))
|
||||
: r.taskOk == null
|
||||
? h("span", { class: "muted" }, r.task || "—")
|
||||
: h("span", { class: r.taskOk ? "" : "err" },
|
||||
(r.taskOk ? "✓ " : "✗ ") + r.task,
|
||||
r.taskOk ? "" : h("div", { class: "muted small" }, t("bm.expectedLbl") + " " + (r.expected || []).join("/")))),
|
||||
h("td", {}, r.tier ? h("span", { class: "badge tier-" + r.tier }, r.tier) : "—"),
|
||||
h("td", {},
|
||||
h("span", { class: "mono small" }, r.chosen || "—"),
|
||||
|
||||
Reference in New Issue
Block a user