Benchmarks with BetterBench, launch80-style reports and publishing, GPU support

- Benchmarks: BetterBench 0.6.1 (pinned by checksum) runs against a running
  deployment, one at a time; quick/full/custom passes, phase selection, live
  step and output, cancel, run again, compare runs side by side.
- Report page after launch80's bench.betterbench.v1: headline tiles,
  "Read these first" caveats (quick, sample gate, max_tokens truncation,
  batched streams, failures, skipped depths, prefix-cache hits), charts, full
  tables with daggered under-sampled cells, method text. All figures come from
  BetterBench's own report functions.
- Publish to launch80 as a double opt-in: L80 dry run builds the exact payload
  for inspection, an explicit confirmation publishes that file (L80 CLI 0.4.0
  pinned by checksum, L80_TOKEN worker-only). Endpoint and host never leave.
- GPUs: runtime accelerator (CPU, NVIDIA, /dev/dri, ROCm) with presets for the
  official CUDA/Vulkan/Intel/ROCm builds; NVIDIA GPUs probed via nvidia-smi in
  a short-lived container; per-deployment GPU picking, -ngl, split mode,
  tensor split, MoE offload, vLLM tensor parallel and GPU memory share.
- llama.cpp --cache-ram option (1 GiB for new deployments) and a memory
  estimate that counts it and the KV cache: the 8 GiB default made containers
  thrash at their memory limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pascal LinxweilerandClaude Opus 5.5 committed 2026-10-10 20:54:38 +02:00
1 parent f0b4adda63
commit 9e167a44f6
61 files changed
+9898 -194

No files matched your search

+230
View File
@@ -362,9 +362,17 @@ export type DockerHostInfo = {
network: string | null;
/** Where the models come from on the Docker host (bind path or volume name), mounted read-only. */
modelsSource: { type: "bind" | "volume"; source: string } | null;
/** Docker has the NVIDIA runtime / CDI devices, so GPUs can be requested. */
nvidia?: boolean;
/** GPUs found by a probe container (nvidia-smi); empty when none or not probed. */
gpus?: HostGpu[];
gpuError?: string | null;
gpuCheckedAt?: string | null;
checkedAt: string;
};
export type HostGpu = { vendor: "nvidia"; index: number; uuid: string; name: string; memoryMb: number; driver: string };
// ---------------------------------------------------------------------------
// Runtimes: container images that serve models (llama.cpp, vLLM, forks, …)
// ---------------------------------------------------------------------------
@@ -373,6 +381,13 @@ export type DockerHostInfo = {
export const RUNTIME_ENGINES = ["llama.cpp", "vllm"] as const;
export type RuntimeEngine = (typeof RUNTIME_ENGINES)[number];
/**
* What the image computes on. nvidia: GPUs requested through Docker (NVIDIA Container Toolkit);
* dri: Intel/AMD GPUs via /dev/dri (Vulkan, SYCL, XPU); rocm: AMD via /dev/kfd + /dev/dri.
*/
export const RUNTIME_ACCELERATORS = ["cpu", "nvidia", "dri", "rocm"] as const;
export type RuntimeAccelerator = (typeof RUNTIME_ACCELERATORS)[number];
export const IMAGE_STATES = ["unknown", "missing", "pulling", "present", "failed"] as const;
export type ImageState = (typeof IMAGE_STATES)[number];
@@ -380,6 +395,7 @@ export const runtimes = sqliteTable("runtimes", {
id: id(),
name: text("name").notNull(),
engine: text("engine", { enum: RUNTIME_ENGINES }).notNull(),
accelerator: text("accelerator", { enum: RUNTIME_ACCELERATORS }).notNull().default("cpu"),
/** Full image reference, e.g. "ghcr.io/ggml-org/llama.cpp:server". */
image: text("image").notNull(),
description: text("description"),
@@ -451,6 +467,22 @@ export type DeploymentOptions = {
flashAttn?: "auto" | "on" | "off" | null;
/** llama.cpp: serve the built-in web UI at / (llama-server's default; false passes --no-webui). */
webui?: boolean | null;
/** llama.cpp -cram: prompt cache in RAM, MiB (llama-server default 8192; 0 off, -1 unlimited). */
cacheRamMb?: number | null;
/** NVIDIA: GPU UUIDs to use (null: all). */
gpus?: string[] | null;
/** llama.cpp -ngl: "auto" (default), "all" or a number of layers. */
gpuLayers?: string | null;
/** llama.cpp -sm across several GPUs. */
splitMode?: "none" | "layer" | "row" | "tensor" | null;
/** llama.cpp -ts, e.g. "3,1". */
tensorSplit?: string | null;
/** llama.cpp: keep all MoE expert weights in RAM (-cmoe) or those of the first N layers (-ncmoe). */
cpuMoe?: boolean | null;
nCpuMoe?: number | null;
/** vLLM --tensor-parallel-size and --gpu-memory-utilization. */
tensorParallel?: number | null;
gpuMemoryUtilization?: number | null;
/** Only accept requests with one of the API keys from Settings → API keys. */
requireApiKey?: boolean | null;
/** vLLM */
@@ -523,3 +555,201 @@ export const apiKeys = sqliteTable("api_keys", {
key: text("key").notNull().unique(),
createdAt: createdAt(),
});
// ---------------------------------------------------------------------------
// Benchmarks (BetterBench runs against a running deployment)
// ---------------------------------------------------------------------------
export const BENCHMARK_STATES = ["queued", "running", "completed", "failed", "cancelled"] as const;
export type BenchmarkState = (typeof BENCHMARK_STATES)[number];
export const BENCHMARK_PHASES = ["decode", "prefill", "concurrency"] as const;
export type BenchmarkPhase = (typeof BENCHMARK_PHASES)[number];
/** What a run measures. `passes`/`warmup` null: BetterBench's defaults (20 / 3), or 5 / 1 with quick. */
export type BenchmarkSettings = {
quick: boolean;
passes: number | null;
warmup: number | null;
phases: BenchmarkPhase[];
};
/** The deployment as it was when the run started, so results stay comparable after edits. */
export type BenchmarkSnapshot = {
deploymentName: string;
repoId: string;
runtimeName: string;
engine: RuntimeEngine;
accelerator?: RuntimeAccelerator;
/** Names of the GPUs used (NVIDIA), for comparisons. */
gpuNames?: string[];
/** The Docker host when the run started. */
host?: { cpuModel: string | null; threads: number | null; memoryBytes: number | null; os: string | null };
image: string;
imageId: string | null;
options: DeploymentOptions;
cpus: number | null;
memoryMb: number | null;
/** Rendered command (API keys masked). */
command: string;
};
/**
* BetterBench's own report rows for a run (betterbench.report: single_rows, prefill_rows,
* concurrency_rows, combined_score, sample_gate, …), copied as computed. Nothing in Kaname derives
* or fills in a number; `null` means BetterBench didn't report it. The endpoint and host are never
* stored. `v` 2; older summaries (no `v`) are recomputed by the worker from results.json.
*/
export type BenchmarkSummary = {
v?: number;
combined: { decode: number | null; ttft_p50: number | null; itl_low1: number | null; update_p50: number | null; update_p99: number | null } | null;
single: {
category: string;
runs: number;
tokens?: number;
ttft_n?: number;
gap_n?: number;
ttft_p99_ok?: boolean;
tail_ok?: boolean;
ttft_p50: number | null;
ttft_p99: number | null;
update_p50?: number | null;
update_p99?: number | null;
tok_per_update: number | null;
batched?: boolean;
batched_runs?: number;
decode_med: number | null;
decode_iqr?: number | null;
decode_cv: number | null;
itl_low1: number | null;
itl_med?: number | null;
itl_high99?: number | null;
}[];
prefill: {
target_depth: number;
skipped: boolean;
prompt_tokens_med?: number | null;
ttft_p50?: number | null;
pp_low1?: number | null;
pp_med?: number | null;
pp_p99?: number | null;
pp_n?: number;
pp_tail_ok?: boolean;
}[];
concurrency: {
level: number;
ok: number;
requests: number;
aggregate_tps: number;
ttft_p50: number | null;
ttft_p99: number | null;
decode_med: number | null;
ttft_n?: number;
ttft_p99_ok?: boolean;
}[];
/** Thinking models: share of reasoning tokens and time to first answer token, where detectable. */
reasoning?: { category: string; runs: number; known: number; answered: number; never_answered: number; reasoning_share: number | null; ttfa_p50: number | null }[];
/** Percentiles resting on fewer samples than n · tail ≥ 5 requires (BetterBench's sample gate). */
gate?: { section: string; key: string | number; metric: string; n: number; need: number }[];
/** [runs stopped at max_tokens, ok runs] in the single-stream set. */
truncated?: [number, number];
failedSingle?: number;
phases: string[];
cacheHits: number;
betterbenchVersion: string;
corpusVersion: string;
corpusHash?: string | null;
timestamp?: string | null;
maxModelLen?: number | null;
config?: {
warmup?: number | null;
runs_per_category?: number | null;
temperature?: number | null;
top_p?: number | null;
top_k?: number | null;
greedy?: boolean | null;
unique_nonce?: boolean | null;
weights?: Record<string, number> | null;
concurrency_levels?: number[] | null;
concurrency_requests?: number | null;
prefill_runs?: number | null;
prefill_warmup?: number | null;
prefill_max_tokens?: number | null;
};
passes: number | null;
quick: boolean;
};
export const benchmarkRuns = sqliteTable(
"benchmark_runs",
{
id: id(),
/** Null once the deployment is deleted; the snapshot keeps what was measured. */
deploymentId: text("deployment_id"),
modelId: text("model_id"),
tool: text("tool").notNull().default("betterbench"),
settings: text("settings", { mode: "json" }).$type<BenchmarkSettings>().notNull(),
snapshot: text("snapshot", { mode: "json" }).$type<BenchmarkSnapshot>().notNull(),
/** Free-form label, e.g. "q8 KV cache". */
label: text("label"),
state: text("state", { enum: BENCHMARK_STATES }).notNull().default("queued"),
phase: text("phase"),
cancelRequestedAt: ts("cancel_requested_at"),
startedAt: ts("started_at"),
finishedAt: ts("finished_at"),
error: text("error"),
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),
createdAt: createdAt(),
},
(t) => [index("benchmark_runs_created_idx").on(t.createdAt)],
);
export const benchmarkLogs = sqliteTable(
"benchmark_logs",
{
id: integer("id").primaryKey({ autoIncrement: true }),
runId: text("run_id").notNull(),
ts: integer("ts", { mode: "timestamp_ms" }).notNull(),
stream: text("stream", { enum: LOG_STREAMS }).notNull(),
line: text("line").notNull(),
},
(t) => [index("benchmark_logs_idx").on(t.runId, t.id)],
);
// ---------------------------------------------------------------------------
// launch80 publications (double opt-in: a dry-run preview, then an explicit confirmation)
// ---------------------------------------------------------------------------
/**
* preview: the worker runs `L80 betterbench --results … --dry-run --payload-out`; previewed: the
* exact payload is ready to inspect; publish: confirmed by a user, the worker publishes it;
* published / failed.
*/
export const PUBLICATION_STATES = ["preview", "previewed", "publish", "published", "failed"] as const;
export type PublicationState = (typeof PUBLICATION_STATES)[number];
export const benchmarkPublications = sqliteTable(
"benchmark_publications",
{
id: id(),
runId: text("run_id").notNull(),
state: text("state", { enum: PUBLICATION_STATES }).notNull().default("preview"),
template: text("template").notNull().default("bench.betterbench.v1"),
title: text("title"),
summary: text("summary"),
/** Size of the exact payload from the dry run; the payload itself is a file next to the run. */
payloadBytes: integer("payload_bytes"),
previewedAt: ts("previewed_at"),
/** Who confirmed publishing (the second opt-in), and when. */
confirmedBy: text("confirmed_by"),
confirmedAt: ts("confirmed_at"),
url: text("url"),
guid: text("guid"),
publishedAt: ts("published_at"),
error: text("error"),
createdAt: createdAt(),
},
(t) => [index("benchmark_publications_run_idx").on(t.runId)],
);