feat: Rangliste und Matrix für Batches

ranking.rs: Gesamtscore je Modell (gewichtet nach weight aus task.toml),
Median-Dauer und Completion-Tokens als Tie-Breaker, Matrix Modell × Aufgabe
mit Erfolgen und mittlerem Score. Befehl batch_ranking, Anzeige nach dem
Batch. 5 Unit-Tests grün, 47 insgesamt. Wilson-Intervalle folgen mit F-12.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-07 11:54:28 +01:00
parent bf3d8d8459
commit 668e690cda
4 changed files with 321 additions and 3 deletions

View File

@ -44,6 +44,18 @@
let progress = $state<{ done: number; total: number } | null>(null);
let batchId = $state<number | null>(null);
let rows = $state<RunRow[]>([]);
type ModelRank = {
rank: number;
model: string;
total_score: number;
runs: number;
successes: number;
median_duration_ms: number;
mean_completion_tokens: number;
};
type MatrixCell = { model: string; task_id: string; runs: number; successes: number; mean_score: number };
type Ranking = { batch_id: number; models: ModelRank[]; cells: MatrixCell[]; tasks: string[] };
let ranking = $state<Ranking | null>(null);
let batchError = $state("");
let unlisten: UnlistenFn | null = null;
@ -98,6 +110,7 @@
async function start() {
batchError = "";
rows = [];
ranking = null;
log = [];
progress = null;
batchId = null;
@ -111,6 +124,7 @@
});
batchId = summary.batch_id;
rows = await invoke<RunRow[]>("batch_results", { batchId: summary.batch_id });
ranking = await invoke<Ranking>("batch_ranking", { batchId: summary.batch_id });
if (summary.cancelled) log = [...log, "Batch abgebrochen."];
} catch (e) {
batchError = String(e);
@ -211,6 +225,65 @@
{/if}
</section>
{#if ranking && ranking.models.length > 0}
<section>
<h2>Rangliste, Batch {ranking.batch_id}</h2>
<table>
<thead>
<tr>
<th>Rang</th>
<th>Modell</th>
<th>Score</th>
<th>Erfolge</th>
<th>Median-Dauer</th>
<th>Ø Completion-Tokens</th>
</tr>
</thead>
<tbody>
{#each ranking.models as m (m.model)}
<tr>
<td>{m.rank}</td>
<td>{m.model}</td>
<td>{m.total_score.toFixed(2)}</td>
<td>{m.successes} / {m.runs}</td>
<td>{(m.median_duration_ms / 1000).toFixed(1)} s</td>
<td>{m.mean_completion_tokens.toFixed(0)}</td>
</tr>
{/each}
</tbody>
</table>
<h3>Matrix: Erfolge je Aufgabe</h3>
<table class="matrix">
<thead>
<tr>
<th>Modell</th>
{#each ranking.tasks as t (t)}
<th>{t}</th>
{/each}
</tr>
</thead>
<tbody>
{#each ranking.models as m (m.model)}
<tr>
<td>{m.model}</td>
{#each ranking.tasks as t (t)}
{@const cell = ranking.cells.find((c) => c.model === m.model && c.task_id === t)}
<td
class="zelle"
style={cell ? `background: color-mix(in srgb, #2e7d32 ${Math.round(cell.mean_score * 100)}%, transparent)` : ""}
title={cell ? `Score ${cell.mean_score.toFixed(2)}` : "keine Läufe"}
>
{cell ? `${cell.successes}/${cell.runs}` : "–"}
</td>
{/each}
</tr>
{/each}
</tbody>
</table>
</section>
{/if}
{#if batchId !== null && rows.length > 0}
<section>
<h2>Ergebnisse, Batch {batchId}</h2>
@ -326,4 +399,9 @@
.fehler {
color: #c62828;
}
.matrix .zelle {
text-align: center;
font-variant-numeric: tabular-nums;
}
</style>