A deterministic quality eval as a run type next to BetterBench: tool calling (12 requests), coding (8 Python functions checked by unit tests in a locked-down sandbox container) and long-context retrieval (needle at 3 depths in 3 lengths up to the context). Versioned eval set in src/evals/v1, score stored per run, shown on the run page, in compare views, the benchmark list and sweep tables (optional eval per variant); API kind "eval", quality in run/sweep/compare answers; skill updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
716bd8f2f0
commit
6b67c653b5
33 files changed
+3822
-79
No files matched your search
+20
-10
@@ -5,7 +5,7 @@ import { z } from "zod";
|
||||
import { runDir } from "@/lib/benchmark-paths";
|
||||
import { deploymentSnapshot } from "@/lib/benchmark-snapshot";
|
||||
import { db } from "@/lib/db/client";
|
||||
import { BENCHMARK_PHASES, benchmarkLogs, benchmarkRuns } from "@/lib/db/schema";
|
||||
import { BENCHMARK_PHASES, benchmarkLogs, benchmarkRuns, QUALITY_SECTIONS } from "@/lib/db/schema";
|
||||
|
||||
export class BenchmarkError extends Error {
|
||||
constructor(
|
||||
@@ -35,6 +35,10 @@ export const BenchmarkBody = z.object({
|
||||
maxPairs: z.number().int().min(12).max(2000).nullable().optional(),
|
||||
/** Set by sweeps. */
|
||||
sweepId: z.string().nullable().optional(),
|
||||
/** "eval": the quality eval instead of BetterBench (default: run, or ab with deploymentBId). */
|
||||
kind: z.enum(["run", "ab", "eval"]).optional(),
|
||||
/** eval: which sections (empty: all). */
|
||||
evalSections: z.array(z.enum(QUALITY_SECTIONS)).max(3).optional(),
|
||||
});
|
||||
export type BenchmarkInput = z.infer<typeof BenchmarkBody>;
|
||||
|
||||
@@ -54,7 +58,9 @@ async function snapshotOf(deploymentId: string, role: string) {
|
||||
export type AgentRequest = { requestedBy: { tokenId: string; name: string }; pendingApproval: boolean; timeLimitS: number };
|
||||
|
||||
export async function createBenchmark(input: BenchmarkInput, agent?: AgentRequest) {
|
||||
const ab = !!input.deploymentBId;
|
||||
const kind = input.kind ?? (input.deploymentBId ? "ab" : "run");
|
||||
const ab = kind === "ab";
|
||||
if (ab && !input.deploymentBId) throw new BenchmarkError("invalid", "An A/B needs a second deployment.", 400);
|
||||
const a = await snapshotOf(input.deploymentId, ab ? "Deployment A" : "The deployment");
|
||||
const b = ab ? await snapshotOf(input.deploymentBId!, "Deployment B") : null;
|
||||
if (b) {
|
||||
@@ -66,19 +72,22 @@ export async function createBenchmark(input: BenchmarkInput, agent?: AgentReques
|
||||
const [row] = await db()
|
||||
.insert(benchmarkRuns)
|
||||
.values({
|
||||
kind: ab ? "ab" : "run",
|
||||
kind,
|
||||
deploymentId: a.id,
|
||||
deploymentBId: b?.id ?? null,
|
||||
modelId: a.modelId,
|
||||
label: input.label || null,
|
||||
description: input.description || null,
|
||||
settings: {
|
||||
quick: input.quick,
|
||||
passes: input.passes ?? null,
|
||||
warmup: input.warmup ?? null,
|
||||
phases: input.phases,
|
||||
...(ab ? { mdePct: input.mdePct ?? null, maxPairs: input.maxPairs ?? null } : {}),
|
||||
},
|
||||
settings:
|
||||
kind === "eval"
|
||||
? { quick: false, passes: null, warmup: null, phases: [], evalSections: input.evalSections ?? [] }
|
||||
: {
|
||||
quick: input.quick,
|
||||
passes: input.passes ?? null,
|
||||
warmup: input.warmup ?? null,
|
||||
phases: input.phases,
|
||||
...(ab ? { mdePct: input.mdePct ?? null, maxPairs: input.maxPairs ?? null } : {}),
|
||||
},
|
||||
snapshot: a.snapshot,
|
||||
snapshotB: b?.snapshot ?? null,
|
||||
sweepId: input.sweepId ?? null,
|
||||
@@ -116,6 +125,7 @@ const listColumns = {
|
||||
snapshotB: benchmarkRuns.snapshotB,
|
||||
ab: benchmarkRuns.ab,
|
||||
resources: benchmarkRuns.resources,
|
||||
quality: benchmarkRuns.quality,
|
||||
sweepId: benchmarkRuns.sweepId,
|
||||
requestedBy: benchmarkRuns.requestedBy,
|
||||
requestedByTokenId: benchmarkRuns.requestedByTokenId,
|
||||
|
||||
Reference in new issue
Block a user