CoverageCheck / web /src /components /evals /Headline.tsx
TBM99's picture
Deploy coverage-check 3559250
23d418f verified
Raw History Blame Contribute Delete
2.34 kB
import { SERIES, ORDER } from '@/lib/chart'
import { percent, seconds } from '@/lib/format'
import type { EvalsFile } from '@/lib/types'
/** The verdict first: one stat tile per system (accuracy with its 95% interval, median
* time, tokens per question), then the primary paired result in one sentence. A few
* headline numbers are tiles, not a chart (dataviz: "is it even a chart?"). */
export function Headline({ data }: { data: EvalsFile }) {
const cb = data.pairs.find((p) => p.new === 'c' && p.base === 'b')
return (
<div className="space-y-4">
<div className="grid gap-3 sm:grid-cols-3">
{ORDER.map((s) => {
const x = data.systems[s]
return (
<div key={s} className="rounded-2xl border p-4">
<div className="flex items-center gap-2 text-sm text-muted-foreground">
<span className="size-2.5 rounded-sm" style={{ background: SERIES[s] }} aria-hidden />
System {s.toUpperCase()} · {x.name}
</div>
<div className="mt-2 text-4xl font-semibold tracking-tight">{percent(x.accuracy)}</div>
<div className="text-xs text-muted-foreground">
correct · 95% interval {percent(x.accuracy_ci[0] ?? 0)} to {percent(x.accuracy_ci[1] ?? 0)}
</div>
<div className="mt-3 flex gap-4 text-xs tabular-nums">
<span>
<span className="font-medium">{seconds(x.latency_p50_ms)}</span>{' '}
<span className="text-muted-foreground">median time</span>
</span>
<span>
<span className="font-medium">{(x.tokens_mean / 1000).toFixed(1)}k</span>{' '}
<span className="text-muted-foreground">tokens / question</span>
</span>
</div>
</div>
)
})}
</div>
{cb && (
<p className="text-sm">
On the same {cb.n} questions, <span className="font-medium">C fixed {cb.fixed} answers B got wrong and broke {cb.broken}</span>
: +{Math.round(cb.diff * 100)} points (95% interval +{Math.round((cb.ci[0] ?? 0) * 100)} to +
{Math.round((cb.ci[1] ?? 0) * 100)}), McNemar p {cb.p < 0.001 ? '< 0.001' : `= ${cb.p.toFixed(3)}`}.
</p>
)}
</div>
)
}