File size: 2,336 Bytes
23d418f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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>
  )
}