import { CartesianGrid, ErrorBar, LabelList, ResponsiveContainer, Scatter, ScatterChart, Tooltip, XAxis, YAxis } from 'recharts' import { INK, ORDER, SERIES } from '@/lib/chart' import { percent, seconds } from '@/lib/format' import type { EvalsFile } from '@/lib/types' /** What accuracy costs in time: each system as one dot at (median seconds, accuracy), * a whisker out to its 95th-percentile time, labelled directly (three dots: a legend * would only repeat the labels). */ export function TradeoffChart({ data }: { data: EvalsFile }) { const points = ORDER.map((s) => { const x = data.systems[s] return { s, label: `${s.toUpperCase()} · ${percent(x.accuracy)}`, seconds: x.latency_p50_ms / 1000, p95: x.latency_p95_ms / 1000, err: [0, (x.latency_p95_ms - x.latency_p50_ms) / 1000], accuracy: x.accuracy, tokens: x.tokens_mean, } }) return (
`${v} s`} tickLine={false} axisLine={{ stroke: INK.axis }} tick={{ fill: INK.muted, fontSize: 11 }} label={{ value: 'Median time per answer (whisker: 95th percentile)', position: 'insideBottom', offset: -10, fill: INK.muted, fontSize: 11 }} /> percent(v)} tickLine={false} axisLine={false} tick={{ fill: INK.muted, fontSize: 11 }} /> } /> {points.map((p) => ( ))}
) } type Props = { active?: boolean; payload?: { payload: { s: string; seconds: number; p95: number; accuracy: number; tokens: number } }[] } function TradeoffTooltip({ active, payload }: Props) { if (!active || !payload?.length) return null const p = payload[0].payload return (

System {p.s.toUpperCase()}

{percent(p.accuracy)} correct · {seconds(p.seconds * 1000)} median, {seconds(p.p95 * 1000)} at the 95th percentile

{(p.tokens / 1000).toFixed(1)}k tokens per question

) }