@crowandraven/evalkeeper 0.12.0 → 0.13.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.
Files changed (61) hide show
  1. package/dist/glossary.d.ts +4 -2
  2. package/dist/glossary.js +4 -2
  3. package/dist/glossary.js.map +1 -1
  4. package/dist/health.d.ts +35 -2
  5. package/dist/health.js +29 -5
  6. package/dist/health.js.map +1 -1
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +1 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/next/actions.js +27 -7
  11. package/dist/next/actions.js.map +1 -1
  12. package/dist/next/wiring.d.ts +6 -0
  13. package/dist/order.d.ts +18 -0
  14. package/dist/order.js +53 -0
  15. package/dist/order.js.map +1 -0
  16. package/dist/prisma/index.d.ts +1 -0
  17. package/dist/prisma/index.js +3 -0
  18. package/dist/prisma/index.js.map +1 -1
  19. package/dist/react/HubSections.js +9 -7
  20. package/dist/react/HubSections.js.map +1 -1
  21. package/dist/react/ModelMenu.d.ts +13 -4
  22. package/dist/react/ModelMenu.js +12 -7
  23. package/dist/react/ModelMenu.js.map +1 -1
  24. package/dist/react/RateView.js +1 -0
  25. package/dist/react/RateView.js.map +1 -1
  26. package/dist/react/SuiteSections.d.ts +2 -0
  27. package/dist/react/SuiteSections.js +66 -29
  28. package/dist/react/SuiteSections.js.map +1 -1
  29. package/dist/react/app.d.ts +2 -0
  30. package/dist/react/app.js.map +1 -1
  31. package/dist/react/pieces.d.ts +10 -1
  32. package/dist/react/pieces.js +50 -0
  33. package/dist/react/pieces.js.map +1 -1
  34. package/dist/settings.d.ts +14 -0
  35. package/dist/settings.js +24 -2
  36. package/dist/settings.js.map +1 -1
  37. package/dist/testing.d.ts +1 -1
  38. package/dist/testing.js +32 -0
  39. package/dist/testing.js.map +1 -1
  40. package/dist/types.d.ts +12 -0
  41. package/dist/types.js +11 -0
  42. package/dist/types.js.map +1 -1
  43. package/package.json +1 -1
  44. package/schema/evalkeeper.prisma +3 -0
  45. package/src/glossary.ts +6 -2
  46. package/src/health.ts +53 -6
  47. package/src/index.ts +1 -0
  48. package/src/next/actions.ts +42 -8
  49. package/src/next/wiring.ts +6 -0
  50. package/src/order.ts +64 -0
  51. package/src/prisma/index.ts +5 -0
  52. package/src/react/HubSections.tsx +9 -7
  53. package/src/react/ModelMenu.tsx +24 -7
  54. package/src/react/RateView.tsx +1 -0
  55. package/src/react/SuiteSections.tsx +337 -178
  56. package/src/react/app.ts +2 -0
  57. package/src/react/pieces.tsx +62 -1
  58. package/src/settings.ts +37 -2
  59. package/src/testing.ts +35 -1
  60. package/src/types.ts +18 -0
  61. package/templates/lib/evalkeeper/actions.ts +4 -0
@@ -7,6 +7,11 @@ import {
7
7
  draftAnswers,
8
8
  draftsToTarget,
9
9
  newStarters,
10
+ orderRows,
11
+ pctBeside,
12
+ priorityGain,
13
+ priorityOf,
14
+ type SuitePriority,
10
15
  isInjectionSuite,
11
16
  meanCalibrationError,
12
17
  money,
@@ -37,7 +42,12 @@ import {
37
42
  } from "./pieces.js";
38
43
  import { pct, LINK } from "./format.js";
39
44
  import { ChevronDown, RotateCw, ShieldAlert, Sparkles } from "lucide-react";
40
- import { evalsPath, type EvalAppConfig, attacksResisted } from "./app.js";
45
+ import {
46
+ evalsPath,
47
+ type EvalAppConfig,
48
+ type FormAction,
49
+ attacksResisted,
50
+ } from "./app.js";
41
51
  import { SettingsHistory } from "./SettingsHistory.js";
42
52
 
43
53
  /**
@@ -74,8 +84,10 @@ export async function loadSuitePage(app: EvalAppConfig, key: string) {
74
84
  const attacks = attacksFrom(attackBoards);
75
85
  // An injection suite's models are chosen on its base suite's page.
76
86
  const choosesHere = !isInjectionSuite(suite);
87
+ // The suite's priority, or the one an admin chose in its settings.
88
+ const priority = priorityOf(suite, liveSettings.settings);
77
89
  const s = choosesHere
78
- ? suggest(rows, suite.checks, suite.priority, app.models, { attacks })
90
+ ? suggest(rows, suite.checks, priority, app.models, { attacks })
79
91
  : null;
80
92
  const testing =
81
93
  rows.some((r) => r.testing) ||
@@ -122,6 +134,7 @@ export async function loadSuitePage(app: EvalAppConfig, key: string) {
122
134
  live,
123
135
  health,
124
136
  cases,
137
+ priority,
125
138
  };
126
139
  }
127
140
 
@@ -133,6 +146,16 @@ export type SuitePageData = NonNullable<
133
146
  /** A share as a whole percent, or a dash when there's nothing to show. */
134
147
  const asPct = (x: number | null) => (x === null ? "—" : pct(x));
135
148
 
149
+ /** The choices when changing it: accuracy is always held. */
150
+ const CHOICES = {
151
+ quality: "Accuracy alone",
152
+ speed: "Speed",
153
+ cost: "Cost",
154
+ } as const;
155
+
156
+ /** The suite's priority, as the page names it. */
157
+ const FAVORS = { cost: "cost", speed: "speed", quality: "accuracy" } as const;
158
+
136
159
  const VS: Record<string, string> = {
137
160
  BETTER: "More accurate",
138
161
  SAME: "About as accurate",
@@ -142,7 +165,7 @@ const VS: Record<string, string> = {
142
165
 
143
166
  /** The suite's name, what it tests, and its priority. */
144
167
  export function SuiteHeader({ data }: { data: SuitePageData }) {
145
- const { app, suite } = data;
168
+ const { app, suite, priority } = data;
146
169
  return (
147
170
  <>
148
171
  <div className="space-y-2">
@@ -150,7 +173,7 @@ export function SuiteHeader({ data }: { data: SuitePageData }) {
150
173
  <h1 className="text-2xl font-semibold">{suite.label}</h1>
151
174
  <p className="readable text-muted">{suite.description}</p>
152
175
  <p className="readable text-sm text-muted">
153
- Priority: {FAVOR_TEXT[suite.priority.favor]}.
176
+ Priority: {FAVOR_TEXT[priority.favor]}.
154
177
  <InfoTip term="priority" />
155
178
  </p>
156
179
  </div>
@@ -273,12 +296,33 @@ export function ModelTable({ data }: { data: SuitePageData }) {
273
296
  estimates,
274
297
  showAttacks,
275
298
  live,
299
+ s,
300
+ priority,
276
301
  } = data;
302
+ const suggestedLive = s && !s.keepLive ? s.live.key : null;
303
+ const suggestedFallback =
304
+ s?.fallback && !s.fallback.fallback ? s.fallback.key : null;
305
+ const ordered = orderRows(rows, suite.checks, priority, {
306
+ live: suggestedLive,
307
+ });
277
308
  return (
278
309
  <>
279
310
  <section className="space-y-3">
280
311
  <div className="flex items-center justify-between gap-4">
281
- <h2 className="text-lg font-semibold">Models</h2>
312
+ <div className="flex flex-wrap items-center gap-2">
313
+ <h2 className="text-lg font-semibold">Models</h2>
314
+ <Tip term="favors" side="bottom" id="favors">
315
+ <Chip tone="neutral">Favors {FAVORS[priority.favor]}</Chip>
316
+ </Tip>
317
+ {choosesHere && app.actions.setPriority && (
318
+ <PriorityControl
319
+ action={app.actions.setPriority}
320
+ suite={key}
321
+ favor={priority.favor}
322
+ own={suite.priority.favor}
323
+ />
324
+ )}
325
+ </div>
282
326
  <div className="flex items-center gap-4">
283
327
  <form action={app.actions.testAll}>
284
328
  <input type="hidden" name="suite" value={key} />
@@ -293,7 +337,7 @@ export function ModelTable({ data }: { data: SuitePageData }) {
293
337
  <th className="p-3 font-normal">Model</th>
294
338
  <th className="p-3 font-normal">
295
339
  <Tip term="score" side="bottom">
296
- Score
340
+ Accuracy
297
341
  </Tip>
298
342
  </th>
299
343
  <th className="p-3 font-normal">
@@ -310,7 +354,7 @@ export function ModelTable({ data }: { data: SuitePageData }) {
310
354
  )}
311
355
  <th className="p-3 font-normal">
312
356
  <Tip term="time" side="bottom" align="end">
313
- Time
357
+ Speed
314
358
  </Tip>
315
359
  </th>
316
360
  {suite.decisions && (
@@ -341,7 +385,7 @@ export function ModelTable({ data }: { data: SuitePageData }) {
341
385
  </tr>
342
386
  </thead>
343
387
  <tbody>
344
- {rows.map((r) => (
388
+ {ordered.map((r) => (
345
389
  <tr key={r.key} className="border-b border-line last:border-0">
346
390
  <td className="p-3">
347
391
  <div className="flex flex-wrap items-center gap-2">
@@ -364,6 +408,20 @@ export function ModelTable({ data }: { data: SuitePageData }) {
364
408
  <Chip tone="fallback">Fallback</Chip>
365
409
  </Tip>
366
410
  )}
411
+ {(r.key === suggestedLive ||
412
+ r.key === suggestedFallback) && (
413
+ <Tip
414
+ term="suggestion"
415
+ side="bottom"
416
+ id={`suggested-${r.key}`}
417
+ >
418
+ <Chip tone="suggested">
419
+ {r.key === suggestedLive
420
+ ? "Suggested"
421
+ : "Suggested fallback"}
422
+ </Chip>
423
+ </Tip>
424
+ )}
367
425
  {retiresLabel(app.models, r.model) && (
368
426
  <Tip
369
427
  term="retiring"
@@ -413,9 +471,18 @@ export function ModelTable({ data }: { data: SuitePageData }) {
413
471
  <Spinner />
414
472
  </span>
415
473
  ) : r.test ? (
416
- <Link href={evalsPath(app, key, "runs", r.test.runId)}>
417
- <Score right={r.test.right} total={r.test.total} />
418
- </Link>
474
+ <div className="flex flex-col gap-0.5">
475
+ <Link href={evalsPath(app, key, "runs", r.test.runId)}>
476
+ <Score right={r.test.right} total={r.test.total} />
477
+ </Link>
478
+ {!r.test.stale && r.test.failedAnswers > 0 && (
479
+ <span className="text-xs text-muted">
480
+ {r.test.failedAnswers}{" "}
481
+ {r.test.failedAnswers === 1 ? "answer" : "answers"}{" "}
482
+ failed: test again
483
+ </span>
484
+ )}
485
+ </div>
419
486
  ) : (
420
487
  <span className="text-muted">
421
488
  {r.failed ?? "Not tested"}
@@ -468,6 +535,9 @@ export function ModelTable({ data }: { data: SuitePageData }) {
468
535
  className={LINK}
469
536
  >
470
537
  {VS[r.vsLive]}
538
+ {(r.vsLive === "SAME" || r.vsLive === "BETTER") &&
539
+ priorityGain(r, live, priority) &&
540
+ `, ${priorityGain(r, live, priority)}`}
471
541
  </Link>
472
542
  ) : r.vsLive ? (
473
543
  VS[r.vsLive]
@@ -476,68 +546,28 @@ export function ModelTable({ data }: { data: SuitePageData }) {
476
546
  )}
477
547
  </td>
478
548
  <td className="p-3">
479
- <div className="flex flex-col items-end gap-0.5">
480
- <div className="flex justify-end gap-2">
481
- <form action={app.actions.testModel}>
482
- <input type="hidden" name="suite" value={key} />
483
- <input type="hidden" name="model" value={r.model} />
484
- {/* A row at another setting tests at its own. */}
485
- {r.variant && (
486
- <input
487
- type="hidden"
488
- name="effort"
489
- value={r.effort ?? "default"}
490
- />
491
- )}
492
- <Tip
493
- control
494
- id={`test-${r.key}`}
495
- text={
496
- r.test
497
- ? "Test this model again on every case in use."
498
- : "Test this model on every case in use."
499
- }
500
- side="bottom"
501
- align="end"
502
- >
503
- <IconSubmit
504
- label="Test"
505
- icon={
506
- <RotateCw aria-hidden className="h-4 w-4" />
507
- }
508
- />
509
- </Tip>
510
- </form>
511
- {choosesHere && (
512
- <ModelMenu
513
- suite={key}
514
- model={r.model}
515
- label={r.label}
516
- makeLive={
517
- !r.live && r.canMakeLive
518
- ? app.actions.makeLive
519
- : null
520
- }
521
- makeFallback={
522
- r.canMakeFallback
523
- ? app.actions.makeFallback
524
- : null
525
- }
526
- effort={r.variant ? r.effort : undefined}
527
- />
528
- )}
529
- </div>
530
- <EstimateNote
531
- id={r.key}
532
- estimate={estimates.get(r.key)}
549
+ <div className="flex justify-end">
550
+ <ModelMenu
551
+ suite={key}
552
+ model={r.model}
553
+ label={r.label}
554
+ test={{
555
+ action: app.actions.testModel,
556
+ text: r.test ? "Test again" : "Test",
557
+ note: estimateText(estimates.get(r.key)),
558
+ }}
559
+ makeLive={
560
+ choosesHere && !r.live && r.canMakeLive
561
+ ? app.actions.makeLive
562
+ : null
563
+ }
564
+ makeFallback={
565
+ choosesHere && r.canMakeFallback
566
+ ? app.actions.makeFallback
567
+ : null
568
+ }
569
+ effort={r.variant ? r.effort : undefined}
533
570
  />
534
- {r.test && !r.test.stale && r.test.failedAnswers > 0 && (
535
- <span className="text-right text-xs text-muted">
536
- {r.test.failedAnswers}{" "}
537
- {r.test.failedAnswers === 1 ? "answer" : "answers"}{" "}
538
- failed on its last test
539
- </span>
540
- )}
541
571
  </div>
542
572
  </td>
543
573
  </tr>
@@ -676,7 +706,7 @@ export function CheckBreakdownSection({ data }: { data: SuitePageData }) {
676
706
  <span
677
707
  className={`inline-block rounded px-2 py-0.5 tabular-nums ${BAR_TONE[barStatus(rate, checkBar(c))]}`}
678
708
  >
679
- {pct(rate)}
709
+ {pctBeside(rate, checkBar(c))}
680
710
  </span>
681
711
  )}
682
712
  </td>
@@ -730,7 +760,11 @@ export function ChecksSection({ data }: { data: SuitePageData }) {
730
760
  <InfoTip term="checks" />
731
761
  </h2>
732
762
  <div className="grid gap-3 md:grid-cols-2">
733
- {suite.checks.map((c) => {
763
+ {/* Serious first; each group keeps the suite's own order. */}
764
+ {[
765
+ ...suite.checks.filter((c) => c.severity === "serious"),
766
+ ...suite.checks.filter((c) => c.severity !== "serious"),
767
+ ].map((c) => {
734
768
  const rate = live?.test?.byCheck[c.key];
735
769
  return (
736
770
  <Card key={c.key} className="space-y-1">
@@ -756,7 +790,7 @@ export function ChecksSection({ data }: { data: SuitePageData }) {
756
790
  : "text-warn"
757
791
  }
758
792
  >
759
- {pct(rate.passed / rate.n)}
793
+ {pctBeside(rate.passed / rate.n, checkBar(c))}
760
794
  </span>{" "}
761
795
  ({rate.passed}/{rate.n}) ·{" "}
762
796
  </>
@@ -934,6 +968,7 @@ export function AnswerKeySection({ data }: { data: SuitePageData }) {
934
968
  tools={
935
969
  <>
936
970
  {suite.caseKind === "imported" &&
971
+ suite.rateBlind !== false &&
937
972
  (suite.labelFromForm || app.answerEditors[key]) && (
938
973
  <Tip control term="rateBlind" side="bottom" align="end">
939
974
  <Link
@@ -984,6 +1019,26 @@ export function AnswerKeySection({ data }: { data: SuitePageData }) {
984
1019
  answers change.
985
1020
  </p>
986
1021
  }
1022
+ tools={
1023
+ <>
1024
+ <a
1025
+ href="https://seanhudson.github.io/evalkeeper/guides/suites/#more-attacks"
1026
+ className={LINK}
1027
+ >
1028
+ Add an attack
1029
+ </a>
1030
+ {app.actions.makeAttackCases && (
1031
+ <form action={app.actions.makeAttackCases}>
1032
+ <input
1033
+ type="hidden"
1034
+ name="suite"
1035
+ value={a.suite.key}
1036
+ />
1037
+ <Submit variant="quiet">Update attack cases</Submit>
1038
+ </form>
1039
+ )}
1040
+ </>
1041
+ }
987
1042
  />
988
1043
  ),
989
1044
  })),
@@ -995,32 +1050,83 @@ export function AnswerKeySection({ data }: { data: SuitePageData }) {
995
1050
  }
996
1051
 
997
1052
  /** "Free: all 16 reused" or "~$0.03, 4 of 16 reused", under a model's buttons. */
998
- function EstimateNote({
999
- id,
1000
- estimate,
1053
+ /**
1054
+ * Changing what a feature's suggestion favors: accuracy, speed, or cost.
1055
+ * It's saved as a new settings version, with an optional reason, so it
1056
+ * shows under Versions and can be rolled back.
1057
+ */
1058
+ function PriorityControl({
1059
+ action,
1060
+ suite,
1061
+ favor,
1062
+ own,
1001
1063
  }: {
1002
- id: string;
1003
- estimate:
1004
- { answers: number; reused: number; costUsd: number | null } | undefined;
1064
+ action: FormAction;
1065
+ suite: string;
1066
+ favor: SuitePriority["favor"];
1067
+ /** The suite's own priority, from its code. */
1068
+ own: SuitePriority["favor"];
1005
1069
  }) {
1006
- if (!estimate || estimate.answers === 0) return null;
1007
- const { answers, reused, costUsd } = estimate;
1008
- const text =
1009
- reused === answers
1010
- ? `Free: all ${answers} reused`
1011
- : `${costUsd === null ? "Cost unknown" : `~${money(costUsd)}`}${reused ? `, ${reused} of ${answers} reused` : ""}`;
1012
1070
  return (
1013
- <Tip
1014
- text="What testing this model costs now. Answers an identical request gave in the last 7 days are reused for free."
1015
- id={`estimate-${id}`}
1016
- side="bottom"
1017
- align="end"
1018
- >
1019
- <span className="whitespace-nowrap text-xs text-muted">{text}</span>
1020
- </Tip>
1071
+ <details className="group relative text-sm font-normal">
1072
+ <summary className="cursor-pointer list-none text-accent hover:underline">
1073
+ Change
1074
+ </summary>
1075
+ <form
1076
+ action={action}
1077
+ className="absolute left-0 z-20 mt-2 w-72 space-y-3 rounded-md border border-line bg-card p-4 shadow-lg"
1078
+ >
1079
+ <input type="hidden" name="suite" value={suite} />
1080
+ <div>
1081
+ <label htmlFor="favor" className="block font-medium">
1082
+ Once accuracy holds, favor
1083
+ </label>
1084
+ <Select
1085
+ id="favor"
1086
+ name="favor"
1087
+ defaultValue={favor}
1088
+ className="mt-1 w-full rounded-md border border-line bg-card px-3 py-2"
1089
+ >
1090
+ {(["quality", "speed", "cost"] as const).map((f) => (
1091
+ <option key={f} value={f}>
1092
+ {CHOICES[f]}
1093
+ {f === own ? " (the suite's own)" : ""}
1094
+ </option>
1095
+ ))}
1096
+ </Select>
1097
+ </div>
1098
+ <div>
1099
+ <label htmlFor="favor-reason" className="block font-medium">
1100
+ Why? <span className="font-normal text-muted">(optional)</span>
1101
+ </label>
1102
+ <TextInput
1103
+ id="favor-reason"
1104
+ name="reason"
1105
+ maxLength={300}
1106
+ className="mt-1 w-full rounded-md border border-line bg-card px-3 py-2"
1107
+ />
1108
+ </div>
1109
+ <Submit>Save as a new version</Submit>
1110
+ </form>
1111
+ </details>
1021
1112
  );
1022
1113
  }
1023
1114
 
1115
+ /**
1116
+ * What testing a model costs now, as the menu says it: "free, all 34
1117
+ * reused", "~$0.10, 15 of 34 reused". Null before any cases.
1118
+ */
1119
+ function estimateText(
1120
+ estimate:
1121
+ { answers: number; reused: number; costUsd: number | null } | undefined,
1122
+ ): string | null {
1123
+ if (!estimate || estimate.answers === 0) return null;
1124
+ const { answers, reused, costUsd } = estimate;
1125
+ return reused === answers
1126
+ ? `free, all ${answers} reused`
1127
+ : `${costUsd === null ? "cost unknown" : `~${money(costUsd)}`}${reused ? `, ${reused} of ${answers} reused` : ""}`;
1128
+ }
1129
+
1024
1130
  /**
1025
1131
  * A model's serious mistakes on one injection suite, linked to that test,
1026
1132
  * or a dash until the model's Test runs the attacks along with its cases.
@@ -1059,12 +1165,23 @@ function UnderAttack({
1059
1165
  title={attackLabel}
1060
1166
  className="tabular-nums"
1061
1167
  >
1062
- {resisted ? pct(resisted.resisted / resisted.of) : "—"}
1063
- {row.test.stale
1064
- ? " · out of date"
1065
- : row.test.failedAnswers
1066
- ? " · answers failed"
1067
- : ""}
1168
+ {row.test.stale ? (
1169
+ `${resisted ? pct(resisted.resisted / resisted.of) : "—"} · out of date`
1170
+ ) : row.test.failedAnswers && !resisted ? (
1171
+ <Tip
1172
+ term="attackFailures"
1173
+ side="bottom"
1174
+ id={`attack-failed-${row.key}`}
1175
+ >
1176
+ <span className="text-warn">
1177
+ {row.test.failedAnswers} failed: test again
1178
+ </span>
1179
+ </Tip>
1180
+ ) : resisted ? (
1181
+ pct(resisted.resisted / resisted.of)
1182
+ ) : (
1183
+ "—"
1184
+ )}
1068
1185
  </Link>
1069
1186
  );
1070
1187
  // Not tested yet: the model's Test runs the attacks with its cases.
@@ -1099,102 +1216,144 @@ export function AnswerKeyHealthSection({ data }: { data: SuitePageData }) {
1099
1216
  const { retireEasy, retireStaleDrafts } = app.actions;
1100
1217
  const cases = (n: number) => `${n} ${n === 1 ? "case" : "cases"}`;
1101
1218
  const drafts = (n: number) => `${n} ${n === 1 ? "draft" : "drafts"}`;
1219
+ const { draftMore } = app.actions;
1220
+ const check = h.split.length > 0 || h.duplicates.length > 0;
1221
+ const retire = h.easyToRetire.length > 0 || h.staleDrafts.length > 0;
1102
1222
  return (
1103
1223
  <section className="space-y-3" aria-labelledby="answer-key-health">
1104
1224
  <h2 id="answer-key-health" className="text-lg font-semibold">
1105
1225
  Answer key health
1106
1226
  <InfoTip term="answerKeyHealth" />
1107
1227
  </h2>
1108
- <Card className="space-y-5 text-sm">
1109
- {h.easyToRetire.length > 0 && (
1110
- <div className="readable space-y-2">
1111
- <p>
1112
- <span className="font-medium">Easy cases</span>
1113
- <InfoTip term="easyCases" />: every current model gets{" "}
1114
- {cases(h.easy.length)} fully right, so they no longer tell models
1115
- apart. Retire {h.easyToRetire.length} and keep{" "}
1116
- {h.easy.length - h.easyToRetire.length} as a floor
1117
- <InfoTip term="easyFloor" />, so a test still catches a model that
1118
- breaks the basics. Recent tests are rescored for free.
1119
- </p>
1120
- {retireEasy && (
1121
- <form action={retireEasy}>
1122
- <input type="hidden" name="suite" value={key} />
1123
- <Submit variant="quiet">
1124
- Retire {h.easyToRetire.length} easy{" "}
1125
- {h.easyToRetire.length === 1 ? "case" : "cases"}
1126
- </Submit>
1127
- </form>
1228
+ {/* What to do, in order: fix doubtful answers, fill thin spots, prune. */}
1229
+ <Card className="space-y-6 text-sm">
1230
+ {check && (
1231
+ <div className="readable space-y-3">
1232
+ <h3 className="font-medium">Check these answers</h3>
1233
+ {h.split.length > 0 && (
1234
+ <div className="space-y-1">
1235
+ <p>
1236
+ Models split about evenly on {cases(h.split.length)}. That
1237
+ usually means the answer key is wrong or the case has no clear
1238
+ answer. Open each one: fix the answer, or retire the case if
1239
+ there&apos;s no right one.
1240
+ <InfoTip term="splitCases" />
1241
+ </p>
1242
+ <ul className="list-disc space-y-0.5 pl-5">
1243
+ {h.split.map((c) => (
1244
+ <li key={c.id}>{caseLink(c)}</li>
1245
+ ))}
1246
+ </ul>
1247
+ </div>
1128
1248
  )}
1129
- </div>
1130
- )}
1131
- {h.split.length > 0 && (
1132
- <div className="readable space-y-1">
1133
- <p>
1134
- <span className="font-medium">Split cases</span>
1135
- <InfoTip term="splitCases" />: models divide about evenly on{" "}
1136
- {cases(h.split.length)}. The answer may be unclear, so check it
1137
- first.
1138
- </p>
1139
- <ul className="list-disc space-y-0.5 pl-5">
1140
- {h.split.map((c) => (
1141
- <li key={c.id}>{caseLink(c)}</li>
1142
- ))}
1143
- </ul>
1144
- </div>
1145
- )}
1146
- {h.duplicates.length > 0 && (
1147
- <div className="readable space-y-1">
1148
- <p>
1149
- <span className="font-medium">Near-duplicates</span>
1150
- <InfoTip term="nearDuplicates" />: these pairs share nearly all
1151
- their words. Keep the clearer one.
1152
- </p>
1153
- <ul className="list-disc space-y-0.5 pl-5">
1154
- {h.duplicates.map(([a, b]) => (
1155
- <li key={`${a.id}-${b.id}`}>
1156
- {caseLink(a)} and {caseLink(b)}
1157
- </li>
1158
- ))}
1159
- </ul>
1160
- </div>
1161
- )}
1162
- {h.staleDrafts.length > 0 && (
1163
- <div className="readable space-y-2">
1164
- <p>
1165
- <span className="font-medium">Old drafts</span>
1166
- <InfoTip term="oldDrafts" />: {drafts(h.staleDrafts.length)}{" "}
1167
- nobody reviewed in 30 days. The weekly check retires them on its
1168
- own.
1169
- </p>
1170
- {retireStaleDrafts && (
1171
- <form action={retireStaleDrafts}>
1172
- <input type="hidden" name="suite" value={key} />
1173
- <Submit variant="quiet">
1174
- Retire {h.staleDrafts.length} old{" "}
1175
- {h.staleDrafts.length === 1 ? "draft" : "drafts"} now
1176
- </Submit>
1177
- </form>
1249
+ {h.duplicates.length > 0 && (
1250
+ <div className="space-y-1">
1251
+ <p>
1252
+ These pairs share nearly all their words, so each counts
1253
+ twice. Keep the clearer one and retire the other.
1254
+ <InfoTip term="nearDuplicates" />
1255
+ </p>
1256
+ <ul className="list-disc space-y-0.5 pl-5">
1257
+ {h.duplicates.map(([a, b]) => (
1258
+ <li key={`${a.id}-${b.id}`}>
1259
+ {caseLink(a)} and {caseLink(b)}
1260
+ </li>
1261
+ ))}
1262
+ </ul>
1263
+ </div>
1178
1264
  )}
1179
1265
  </div>
1180
1266
  )}
1181
1267
  {thin.length > 0 && (
1182
1268
  <div className="space-y-2">
1269
+ <h3 className="font-medium">Add cases here</h3>
1183
1270
  <p className="readable">
1184
- <span className="font-medium">Coverage</span>
1185
- <InfoTip term="tagCoverage" />: {thin.length}{" "}
1186
- {thin.length === 1 ? "tag has" : "tags have"} a single case. A new
1187
- case there tells you the most.
1271
+ {thin.length} {thin.length === 1 ? "topic has" : "topics have"}{" "}
1272
+ only one case, so the score on each rests on a single example: one
1273
+ mistake swings it, and a fix can&apos;t be confirmed. Add a case
1274
+ or two to each.
1275
+ <InfoTip term="tagCoverage" />
1188
1276
  </p>
1189
1277
  <ul className="flex flex-wrap gap-1.5">
1190
- {h.tags.map(([t, n]) => (
1278
+ {thin.map((t) => (
1191
1279
  <li key={t}>
1192
- <Chip tone={n === 1 ? "warn" : "neutral"}>
1193
- {t} · {n}
1194
- </Chip>
1280
+ <Chip tone="warn">{t}</Chip>
1195
1281
  </li>
1196
1282
  ))}
1197
1283
  </ul>
1284
+ {draftMore && suite.draftMore && (
1285
+ <form action={draftMore}>
1286
+ <input type="hidden" name="suite" value={key} />
1287
+ <input
1288
+ type="hidden"
1289
+ name="focus"
1290
+ value={`Cases on these topics: ${thin.join(", ")}`.slice(
1291
+ 0,
1292
+ 500,
1293
+ )}
1294
+ />
1295
+ <Submit variant="quiet">Draft cases for these topics</Submit>
1296
+ </form>
1297
+ )}
1298
+ <details className="group">
1299
+ <summary className="cursor-pointer text-muted">
1300
+ Show all topics
1301
+ </summary>
1302
+ <ul className="mt-2 flex flex-wrap gap-1.5">
1303
+ {h.tags.map(([t, n]) => (
1304
+ <li key={t}>
1305
+ <Chip tone={n === 1 ? "warn" : "neutral"}>
1306
+ {t} · {n}
1307
+ </Chip>
1308
+ </li>
1309
+ ))}
1310
+ </ul>
1311
+ </details>
1312
+ </div>
1313
+ )}
1314
+ {retire && (
1315
+ <div className="readable space-y-3">
1316
+ <h3 className="font-medium">Retire these</h3>
1317
+ {h.easyToRetire.length > 0 && (
1318
+ <div className="space-y-2">
1319
+ <p>
1320
+ Every current model gets {cases(h.easy.length)} fully right,
1321
+ so they no longer tell models apart. Retire{" "}
1322
+ {h.easyToRetire.length} and keep{" "}
1323
+ {h.easy.length - h.easyToRetire.length} as a floor, so a test
1324
+ still catches a model that breaks the basics. Recent tests are
1325
+ rescored for free.
1326
+ <InfoTip term="easyCases" />
1327
+ </p>
1328
+ {retireEasy && (
1329
+ <form action={retireEasy}>
1330
+ <input type="hidden" name="suite" value={key} />
1331
+ <Submit variant="quiet">
1332
+ Retire {h.easyToRetire.length} easy{" "}
1333
+ {h.easyToRetire.length === 1 ? "case" : "cases"}
1334
+ </Submit>
1335
+ </form>
1336
+ )}
1337
+ </div>
1338
+ )}
1339
+ {h.staleDrafts.length > 0 && (
1340
+ <div className="space-y-2">
1341
+ <p>
1342
+ {drafts(h.staleDrafts.length)} nobody reviewed in 30 days. The
1343
+ weekly check retires them on its own.
1344
+ <InfoTip term="oldDrafts" />
1345
+ </p>
1346
+ {retireStaleDrafts && (
1347
+ <form action={retireStaleDrafts}>
1348
+ <input type="hidden" name="suite" value={key} />
1349
+ <Submit variant="quiet">
1350
+ Retire {h.staleDrafts.length} old{" "}
1351
+ {h.staleDrafts.length === 1 ? "draft" : "drafts"} now
1352
+ </Submit>
1353
+ </form>
1354
+ )}
1355
+ </div>
1356
+ )}
1198
1357
  </div>
1199
1358
  )}
1200
1359
  </Card>