Benchmarks: paired A/B runs, sweeps, resource usage
- A/B with betterbench ab between two deployments of the same model, with verdict, confidence interval and caveats. - Sweeps vary one or two deployment settings, deploy, benchmark and remove each variant, and compare them in one table. - Every run records CPU, RAM, VRAM, GPU utilization and power. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9e167a44f6
commit
b623b16a6d
37 files changed
+4314
-214
No files matched your search
@@ -525,6 +525,8 @@ export const deployments = sqliteTable("deployments", {
|
||||
exitCode: integer("exit_code"),
|
||||
error: text("error"),
|
||||
stats: text("stats", { mode: "json" }).$type<DeploymentStats>(),
|
||||
/** Temporary deployment created by a benchmark sweep (removed when its variant is done). */
|
||||
sweepId: text("sweep_id"),
|
||||
createdAt: createdAt(),
|
||||
updatedAt: updatedAt(),
|
||||
});
|
||||
@@ -572,6 +574,61 @@ export type BenchmarkSettings = {
|
||||
passes: number | null;
|
||||
warmup: number | null;
|
||||
phases: BenchmarkPhase[];
|
||||
/** A/B: target minimum detectable effect in % (BetterBench --mde, default 1) and pair ceiling. */
|
||||
mdePct?: number | null;
|
||||
maxPairs?: number | null;
|
||||
};
|
||||
|
||||
export const BENCHMARK_KINDS = ["run", "ab"] as const;
|
||||
export type BenchmarkKind = (typeof BENCHMARK_KINDS)[number];
|
||||
|
||||
/** One side of a paired comparison, as BetterBench's paired_compare reports it. */
|
||||
export type PairedResult = {
|
||||
metric: string;
|
||||
n_pairs: number;
|
||||
mean_a: number;
|
||||
mean_b: number;
|
||||
mean_diff: number;
|
||||
pct_diff: number;
|
||||
ci_low_pct: number;
|
||||
ci_high_pct: number;
|
||||
conf: number;
|
||||
significant: boolean;
|
||||
verdict: string;
|
||||
higher_is_better: boolean;
|
||||
};
|
||||
|
||||
/** `betterbench ab` result without the endpoints (raw per-pair series kept for the chart). */
|
||||
export type AbSummary = {
|
||||
pairs: number;
|
||||
decode_tps: PairedResult;
|
||||
gap_median: PairedResult & { batched: boolean };
|
||||
paired_cv: number;
|
||||
pairs_needed_for_mde: number;
|
||||
target_mde_pct: number;
|
||||
conf: number;
|
||||
maxPairs: number | null;
|
||||
raw: { a_tps: number[]; b_tps: number[] };
|
||||
betterbenchVersion: string;
|
||||
corpusVersion: string;
|
||||
timestamp: string | null;
|
||||
config: { greedy?: boolean | null; temperature?: number | null; warmup?: number | null; unique_nonce?: boolean | null; ab_min_pairs?: number | null };
|
||||
};
|
||||
|
||||
/** Resource use sampled during a run (every ~2 s), per deployment and per GPU. */
|
||||
export type ResourceStats = {
|
||||
samples: number;
|
||||
seconds: number;
|
||||
containers: {
|
||||
side: "a" | "b";
|
||||
cpuAvg: number | null;
|
||||
cpuPeak: number | null;
|
||||
memAvgBytes: number | null;
|
||||
memPeakBytes: number | null;
|
||||
memLimitBytes: number | null;
|
||||
}[];
|
||||
/** Whole-GPU figures (nvidia-smi), not per process. */
|
||||
gpus: { index: number; name: string; vramTotalMb: number; vramPeakMb: number; vramAvgMb: number; utilAvg: number; utilPeak: number; powerAvgW: number | null; powerPeakW: number | null }[];
|
||||
};
|
||||
|
||||
/** The deployment as it was when the run started, so results stay comparable after edits. */
|
||||
@@ -701,6 +758,14 @@ export const benchmarkRuns = sqliteTable(
|
||||
summary: text("summary", { mode: "json" }).$type<BenchmarkSummary>(),
|
||||
/** Files under BENCHMARKS_DIR/<id>/: results.json and results.html. */
|
||||
hasReport: integer("has_report", { mode: "boolean" }).notNull().default(false),
|
||||
kind: text("kind", { enum: BENCHMARK_KINDS }).notNull().default("run"),
|
||||
/** A/B: the second deployment (B); `deploymentId` is A. */
|
||||
deploymentBId: text("deployment_b_id"),
|
||||
snapshotB: text("snapshot_b", { mode: "json" }).$type<BenchmarkSnapshot>(),
|
||||
ab: text("ab", { mode: "json" }).$type<AbSummary>(),
|
||||
resources: text("resources", { mode: "json" }).$type<ResourceStats>(),
|
||||
/** Run of a sweep variant. */
|
||||
sweepId: text("sweep_id"),
|
||||
createdAt: createdAt(),
|
||||
},
|
||||
(t) => [index("benchmark_runs_created_idx").on(t.createdAt)],
|
||||
@@ -753,3 +818,43 @@ export const benchmarkPublications = sqliteTable(
|
||||
},
|
||||
(t) => [index("benchmark_publications_run_idx").on(t.runId)],
|
||||
);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Benchmark sweeps: one base deployment, one or two settings varied, a run per variant
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export const SWEEP_STATES = ["queued", "running", "completed", "failed", "cancelled"] as const;
|
||||
export type SweepState = (typeof SWEEP_STATES)[number];
|
||||
|
||||
/** A setting a sweep varies; values are strings as entered (parsed per key). */
|
||||
export type SweepParam = { key: string; values: string[] };
|
||||
|
||||
export type SweepVariant = {
|
||||
index: number;
|
||||
/** Option overrides for this variant, e.g. { contextSize: 8192, cacheTypeK: "q8_0", cacheTypeV: "q8_0" }. */
|
||||
overrides: Record<string, unknown>;
|
||||
label: string;
|
||||
state: "pending" | "deploying" | "benchmarking" | "done" | "failed" | "skipped";
|
||||
deploymentId?: string | null;
|
||||
runId?: string | null;
|
||||
error?: string | null;
|
||||
};
|
||||
|
||||
export const benchmarkSweeps = sqliteTable("benchmark_sweeps", {
|
||||
id: id(),
|
||||
label: text("label"),
|
||||
/** The deployment the variants are copied from (may be deleted later; `base` keeps it). */
|
||||
baseDeploymentId: text("base_deployment_id"),
|
||||
base: text("base", { mode: "json" })
|
||||
.$type<{ name: string; runtimeId: string; modelId: string; options: DeploymentOptions; cpus: number | null; memoryMb: number | null }>()
|
||||
.notNull(),
|
||||
params: text("params", { mode: "json" }).$type<SweepParam[]>().notNull(),
|
||||
settings: text("settings", { mode: "json" }).$type<BenchmarkSettings>().notNull(),
|
||||
variants: text("variants", { mode: "json" }).$type<SweepVariant[]>().notNull(),
|
||||
state: text("state", { enum: SWEEP_STATES }).notNull().default("queued"),
|
||||
cancelRequestedAt: ts("cancel_requested_at"),
|
||||
startedAt: ts("started_at"),
|
||||
finishedAt: ts("finished_at"),
|
||||
error: text("error"),
|
||||
createdAt: createdAt(),
|
||||
});
|
||||
Reference in new issue
Block a user