@crowandraven/evalkeeper 0.17.1 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/glossary.d.ts +2 -2
- package/dist/glossary.js +2 -2
- package/dist/glossary.js.map +1 -1
- package/dist/prune.d.ts +38 -8
- package/dist/prune.js +37 -11
- package/dist/prune.js.map +1 -1
- package/dist/react/HubSections.d.ts +3 -12
- package/dist/react/SuiteSections.d.ts +3 -9
- package/dist/react/SuiteSections.js +20 -12
- package/dist/react/SuiteSections.js.map +1 -1
- package/dist/runner.d.ts +4 -8
- package/dist/runner.js +65 -5
- package/dist/runner.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/glossary.ts +2 -2
- package/src/prune.ts +65 -13
- package/src/react/SuiteSections.tsx +47 -8
- package/src/runner.ts +82 -6
- package/src/types.ts +6 -0
package/src/runner.ts
CHANGED
|
@@ -16,7 +16,13 @@ import {
|
|
|
16
16
|
import type { BoardRow } from "./board.js";
|
|
17
17
|
import { allPassed } from "./stats.js";
|
|
18
18
|
import { pickQuickSet } from "./quickSet.js";
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
EASY_FLOOR_CASES,
|
|
21
|
+
EASY_MIN_MODELS,
|
|
22
|
+
answerKeyHealth,
|
|
23
|
+
withRounds,
|
|
24
|
+
type CaseResult,
|
|
25
|
+
} from "./prune.js";
|
|
20
26
|
import { stableJson } from "./stableJson.js";
|
|
21
27
|
import { suiteMetrics, type ScoredOutput } from "./stats.js";
|
|
22
28
|
import type {
|
|
@@ -520,7 +526,10 @@ export function createRunner(opts: RunnerOptions) {
|
|
|
520
526
|
label: parsed?.success ? parsed.data : null,
|
|
521
527
|
};
|
|
522
528
|
});
|
|
523
|
-
|
|
529
|
+
// Marked, so the case is known to matter to others (never easy).
|
|
530
|
+
const extra = suite
|
|
531
|
+
.gradeTogether(answers)
|
|
532
|
+
.map((cs) => cs.map((c) => ({ ...c, together: true })));
|
|
524
533
|
await mapLimit(
|
|
525
534
|
group.map((o, i) => ({ o, add: extra[i] ?? [] })),
|
|
526
535
|
6,
|
|
@@ -796,7 +805,57 @@ export function createRunner(opts: RunnerOptions) {
|
|
|
796
805
|
board(suiteKey),
|
|
797
806
|
store.listCases(suiteKey),
|
|
798
807
|
]);
|
|
799
|
-
|
|
808
|
+
const rounds = await easyRounds(suiteKey, cases);
|
|
809
|
+
return answerKeyHealth(cases, withRounds(b.caseResults, rounds), today);
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Per case, the rounds of testing it passed (EASY_MIN_ROUNDS): days on
|
|
814
|
+
* which at least EASY_MIN_MODELS models were tested on it and every one
|
|
815
|
+
* got it fully right (all repeats), counted only after its answer last
|
|
816
|
+
* changed. Empty when the suite has EASY_FLOOR_CASES cases in use or
|
|
817
|
+
* fewer: nothing can be retired then, so the history isn't read.
|
|
818
|
+
*/
|
|
819
|
+
async function easyRounds(
|
|
820
|
+
suiteKey: string,
|
|
821
|
+
cases?: readonly CaseRecord[],
|
|
822
|
+
): Promise<Record<string, number>> {
|
|
823
|
+
const all = cases ?? (await store.listCases(suiteKey));
|
|
824
|
+
const inUse = all.filter(
|
|
825
|
+
(c) => c.status !== "RETIRED" && confirmedLabel(c.labels),
|
|
826
|
+
);
|
|
827
|
+
if (inUse.length <= EASY_FLOOR_CASES) return {};
|
|
828
|
+
const since = new Map(
|
|
829
|
+
inUse.map((c) => {
|
|
830
|
+
const l = confirmedLabel(c.labels);
|
|
831
|
+
return [c.id, Math.max(+c.updatedAt, l ? +l.updatedAt : 0)];
|
|
832
|
+
}),
|
|
833
|
+
);
|
|
834
|
+
const runs = (await store.listRuns(suiteKey, { status: "SUCCEEDED" })).map(
|
|
835
|
+
(r) => ({ ...r, day: r.startedAt.toISOString().slice(0, 10) }),
|
|
836
|
+
);
|
|
837
|
+
const outputs = await outputsByRun(runs.map((r) => r.id));
|
|
838
|
+
// case → day → model → right on every answer that day
|
|
839
|
+
const seen = new Map<string, Map<string, Map<string, boolean>>>();
|
|
840
|
+
for (const r of runs) {
|
|
841
|
+
for (const o of outputs.get(r.id) ?? []) {
|
|
842
|
+
const after = since.get(o.caseId);
|
|
843
|
+
if (after === undefined || +r.startedAt <= after) continue;
|
|
844
|
+
const days =
|
|
845
|
+
seen.get(o.caseId) ?? new Map<string, Map<string, boolean>>();
|
|
846
|
+
const models = days.get(r.day) ?? new Map<string, boolean>();
|
|
847
|
+
const right = !o.error && allPassed(o.scores ?? []);
|
|
848
|
+
models.set(r.model, (models.get(r.model) ?? true) && right);
|
|
849
|
+
days.set(r.day, models);
|
|
850
|
+
seen.set(o.caseId, days);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
const rounds: Record<string, number> = {};
|
|
854
|
+
for (const [caseId, days] of seen)
|
|
855
|
+
rounds[caseId] = [...days.values()].filter(
|
|
856
|
+
(m) => m.size >= EASY_MIN_MODELS && [...m.values()].every(Boolean),
|
|
857
|
+
).length;
|
|
858
|
+
return rounds;
|
|
800
859
|
}
|
|
801
860
|
|
|
802
861
|
/**
|
|
@@ -805,6 +864,9 @@ export function createRunner(opts: RunnerOptions) {
|
|
|
805
864
|
* Returns how many it retired.
|
|
806
865
|
*/
|
|
807
866
|
async function retireEasy(suiteKey: string): Promise<number> {
|
|
867
|
+
// Regraded first, so every compared case is marked as such (tests
|
|
868
|
+
// graded before the mark existed have none).
|
|
869
|
+
if (suiteOrThrow(suiteKey).gradeTogether) await rescoreRecent(suiteKey);
|
|
808
870
|
const { easyToRetire } = await answerKeyHealthOf(suiteKey);
|
|
809
871
|
for (const c of easyToRetire) await store.setCaseStatus(c.id, "RETIRED");
|
|
810
872
|
if (easyToRetire.length) await rescoreRecent(suiteKey);
|
|
@@ -1219,14 +1281,27 @@ export function createRunner(opts: RunnerOptions) {
|
|
|
1219
1281
|
a.label.localeCompare(b.label),
|
|
1220
1282
|
);
|
|
1221
1283
|
// How each case fared across current, complete tests: easy and split cases.
|
|
1222
|
-
const caseResults: Record<string,
|
|
1284
|
+
const caseResults: Record<string, CaseResult> = {};
|
|
1223
1285
|
for (const row of rows) {
|
|
1224
1286
|
if (row.variant || !row.test || row.test.stale || row.test.failedAnswers)
|
|
1225
1287
|
continue;
|
|
1288
|
+
// Each model once per case: right only if every repeat was right.
|
|
1289
|
+
const byCase = new Map<string, { right: boolean; ranked: boolean }>();
|
|
1226
1290
|
for (const x of outputsOf(row.test.runId)) {
|
|
1227
|
-
const
|
|
1291
|
+
const had = byCase.get(x.caseId) ?? { right: true, ranked: false };
|
|
1292
|
+
byCase.set(x.caseId, {
|
|
1293
|
+
right: had.right && allPassed(x.checks),
|
|
1294
|
+
// Compared with other cases (a ranking): others' results need it.
|
|
1295
|
+
ranked:
|
|
1296
|
+
had.ranked ||
|
|
1297
|
+
Boolean(x.checks?.some((k) => k.together && k.pass !== null)),
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
for (const [caseId, r] of byCase) {
|
|
1301
|
+
const c = (caseResults[caseId] ??= { passed: 0, models: 0 });
|
|
1228
1302
|
c.models++;
|
|
1229
|
-
if (
|
|
1303
|
+
if (r.right) c.passed++;
|
|
1304
|
+
if (r.ranked) c.ranked = true;
|
|
1230
1305
|
}
|
|
1231
1306
|
}
|
|
1232
1307
|
return {
|
|
@@ -1352,6 +1427,7 @@ export function createRunner(opts: RunnerOptions) {
|
|
|
1352
1427
|
rescoreRecent,
|
|
1353
1428
|
answerKeyHealth: answerKeyHealthOf,
|
|
1354
1429
|
retireEasy,
|
|
1430
|
+
easyRounds,
|
|
1355
1431
|
retireStaleDrafts,
|
|
1356
1432
|
stopStuckRuns,
|
|
1357
1433
|
compare,
|
package/src/types.ts
CHANGED
|
@@ -34,6 +34,12 @@ export type CheckResult = {
|
|
|
34
34
|
* `brier`, `logLoss`, `confidence`, and `correct` (see decisionCheck).
|
|
35
35
|
*/
|
|
36
36
|
measures?: Record<string, number> | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Set by Evalkeeper on checks from a suite's `gradeTogether`: they grade
|
|
39
|
+
* this answer against others (a ranking), so the case matters to other
|
|
40
|
+
* cases' results too, and is never retired as easy.
|
|
41
|
+
*/
|
|
42
|
+
together?: boolean | undefined;
|
|
37
43
|
};
|
|
38
44
|
|
|
39
45
|
/**
|