HTML 77.2%
TypeScript 10.5%
Python 9.6%
JavaScript 2.5%
1import type { Metadata } from 'next';2import Link from 'next/link';3import { redirect } from 'next/navigation';4import { BenchmarksFilterRail } from '@/components/benchmarks/filter-rails';5import { TerminalLayout } from '@/components/layout/terminal';6import { ScrollX } from '@/components/models/scroll-x';7import { TrustBadge } from '@/components/models/badges';8import { fmtScoreUnit } from '@/components/models/shared';9import { ComparabilityLegend } from '@/components/entity/model-blocks';10import { EntityLink } from '@/components/ui/entity';11import { Hint } from '@/components/ui/hint';12import { Container, Note } from '@/components/ui/section';13import { EmptyState, Unavailable } from '@/components/ui/unavailable';14import { apiD1, safe } from '@/lib/api';15import { cn } from '@/lib/cn';16import { fmtAgo, fmtInt, num } from '@/lib/format';17import { routes, SITE_NAME, SITE_URL } from '@/lib/site';18import type { BenchmarkListItem } from '@/lib/types';1920export const metadata: Metadata = {21 title: 'AI benchmarks — leaderboards, comparability groups & current leaders',22 description: 'Every benchmark in the atlas grouped by family and variant: metric and direction, current results, distinct models, the current recorded leader with its trust level — one row per canonical model, never compared across configurations.',23 alternates: { canonical: '/benchmarks' },24 openGraph: { title: `AI benchmarks — leaderboards, comparability groups & current leaders | ${SITE_NAME}`, url: `${SITE_URL}/benchmarks`, type: 'website' },25};26export const revalidate = 300;2728type SP = { category?: string; view?: string; q?: string; with_results?: string };2930function familyOf(b: BenchmarkListItem): string {31 return b.family ?? b.slug;32}3334export default async function BenchmarksPage({ searchParams }: { searchParams: Promise<SP> }) {35 const sp = await searchParams;36 if (sp.view === 'matrix') redirect('/benchmarks/matrix');37 const category = sp.category?.trim() || undefined;38 const q = sp.q?.trim().toLowerCase() || undefined;39 const withResults = sp.with_results === '1';40 const [res, meth] = await Promise.all([safe(apiD1.benchmarks()), safe(apiD1.methodology())]);41 const all = res?.items ?? [];42 const cats = new Map<string, number>();43 for (const b of all) if (b.category) cats.set(b.category, (cats.get(b.category) ?? 0) + 1);44 const catList = [...cats.entries()].sort((x, y) => y[1] - x[1] || x[0].localeCompare(y[0]));45 let items = category ? all.filter((b) => b.category === category) : all;46 if (q) items = items.filter((b) => `${b.name} ${b.family ?? ''} ${b.variant ?? ''}`.toLowerCase().includes(q));47 if (withResults) items = items.filter((b) => (num(b.result_count) ?? 0) > 0);48 const empty = all.filter((b) => (num(b.result_count) ?? 0) === 0).length;49 const totalResults = all.reduce((n, b) => n + (num(b.result_count) ?? 0), 0);50 // Family grouping: families by total results, head first, then variants by results.51 const fams = new Map<string, BenchmarkListItem[]>();52 for (const b of items) fams.set(familyOf(b), [...(fams.get(familyOf(b)) ?? []), b]);53 const famList = [...fams.entries()]54 .map(([f, list]) => ({ f, list: list.sort((a, b) => Number(!!b.attributes?.family_head) - Number(!!a.attributes?.family_head) || (num(b.result_count) ?? 0) - (num(a.result_count) ?? 0) || a.name.localeCompare(b.name)), total: list.reduce((n, b) => n + (num(b.result_count) ?? 0), 0) }))55 .sort((a, b) => b.total - a.total || a.f.localeCompare(b.f));56 const href = (patch: Record<string, string | undefined>) => {57 const p = new URLSearchParams();58 const cur = { category, q: sp.q, with_results: withResults ? '1' : undefined, ...patch };59 for (const [k, v] of Object.entries(cur)) if (v) p.set(k, v);60 const s = p.toString();61 return s ? `/benchmarks?${s}` : '/benchmarks';62 };63 const trustLevels = meth?.trust_levels ?? [];64 const filterCount = [category, q, withResults ? '1' : undefined].filter(Boolean).length;65 const ld = { '@context': 'https://schema.org', '@type': 'CollectionPage', name: 'AI benchmarks', url: `${SITE_URL}/benchmarks`, description: metadata.description, mainEntity: { '@type': 'ItemList', numberOfItems: all.length, itemListElement: all.slice(0, 12).map((b, i) => ({ '@type': 'ListItem', position: i + 1, name: b.name, url: `${SITE_URL}${routes.benchmark(b.slug)}` })) } };6667 const filters = <BenchmarksFilterRail q={sp.q} category={category} withResults={withResults} total={all.length} categories={catList.map(([c, n]) => ({ c, n }))} hrefAll={href({ category: undefined })} categoryHrefs={Object.fromEntries(catList.map(([c]) => [c, href({ category: category === c ? undefined : c })]))} />;68 const inspector = (69 <div className="space-y-5 text-sm" data-benchmark-inspector>70 <dl className="kv [&>div]:grid-cols-[8rem_minmax(0,1fr)] [&>div]:py-1">71 <div>72 <dt>Benchmarks</dt>73 <dd className="tnum text-ink">{fmtInt(all.length)}</dd>74 </div>75 <div>76 <dt>Current results</dt>77 <dd className="tnum text-ink">{fmtInt(totalResults)}</dd>78 </div>79 <div>80 <dt>Without results</dt>81 <dd className="tnum text-ink">{fmtInt(empty)}</dd>82 </div>83 </dl>84 <div>85 <p className="eyebrow mb-1">Trust levels</p>86 <ul className="space-y-1">87 {(trustLevels.length ? trustLevels : Object.entries({ 'official-benchmark': 'Official benchmark leaderboard', 'independent-evaluator': 'Independent third-party evaluator', community: 'Community-run leaderboard or submission' }).map(([key, label]) => ({ key, label }))).map((t) => (88 <li key={t.key} className="flex items-start gap-2 text-xs text-ink-2">89 <TrustBadge level={t.key} /> <span>{t.label}</span>90 </li>91 ))}92 </ul>93 </div>94 <div>95 <p className="eyebrow mb-1">Comparability</p>96 <ComparabilityLegend />97 </div>98 <Note>{res?.note ?? 'Leaderboards show one row per canonical model: its best current row inside the comparability group (metric × task-defining configuration).'}</Note>99 </div>100 );101102 return (103 <>104 <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(ld) }} />105 <Container wide>106 <header className="flex flex-col gap-3 pb-4 pt-6 md:flex-row md:items-end md:justify-between md:pt-8">107 <div className="min-w-0">108 <p className="eyebrow">Benchmarks</p>109 <h1 className="display mt-1 text-[26px] md:text-[34px]">Benchmarks</h1>110 <p className="mt-2 max-w-2xl text-sm text-ink-2">Evaluation suites grouped by family and variant. Each leaderboard is one row per canonical model inside a comparability group; leaders are per group, never a composite.</p>111 </div>112 {res && (113 <p className="tnum text-sm text-ink-2">114 <span className="font-semibold text-ink">{fmtInt(items.length)}</span> {category ? `of ${fmtInt(all.length)} ` : ''}benchmarks · <span className="font-semibold text-ink">{fmtInt(totalResults)}</span> current results115 <Hint text="Current results = one row per model × benchmark × metric × configuration run; closed (superseded) rows are kept in history." align="right" />116 </p>117 )}118 </header>119 </Container>120 <TerminalLayout filters={filters} filterCount={filterCount} inspector={inspector} inspectorTitle="Legend" storageKey="aia-benchmarks-inspector">121 {!res ? (122 <Unavailable what="Benchmarks" />123 ) : items.length === 0 ? (124 <EmptyState title={category ? `No benchmark in “${category}”` : 'No benchmark matches'}>125 <Link href="/benchmarks" className="link">126 Show all benchmarks127 </Link>128 </EmptyState>129 ) : (130 <>131 {empty > 0 && !withResults && (132 <p className="mb-2 border-l-2 border-warning bg-warning-soft/40 px-3 py-2 text-xs text-ink-2" data-honesty>133 {fmtInt(empty)} benchmark{empty === 1 ? '' : 's'} ha{empty === 1 ? 's' : 've'} no results yet — sources being connected. They are listed so their definitions and aliases resolve; nothing is fabricated.134 </p>135 )}136 <ScrollX>137 <table className="data-table stack compact" data-benchmarks-table>138 <caption className="sr-only">Benchmarks by family</caption>139 <thead>140 <tr>141 <th scope="col">Family · variant</th>142 <th scope="col">Metric</th>143 <th scope="col" className="num">144 Results145 </th>146 <th scope="col" className="num">147 Models148 </th>149 <th scope="col">Current leader</th>150 <th scope="col">Updated</th>151 </tr>152 </thead>153 <tbody>154 {famList.map((fam) => (155 <FamilyRows key={fam.f} fam={fam.f} list={fam.list} />156 ))}157 </tbody>158 </table>159 </ScrollX>160 <Note className="mt-3">Leader = best current row of the benchmark's primary comparability group (most-populated task configuration of the canonical metric), with the trust level of that row. Open a benchmark for the group picker, trust filter, frontier over time and per-model history.</Note>161 </>162 )}163 </TerminalLayout>164 </>165 );166}167168function FamilyRows({ fam, list }: { fam: string; list: BenchmarkListItem[] }) {169 const grouped = list.length > 1;170 const head = list.find((b) => b.attributes?.family_head) ?? null;171 return (172 <>173 {grouped && (174 <tr className="bg-surface-2/40">175 <td colSpan={6} className="!py-1.5 text-[11px] font-semibold uppercase tracking-[0.08em] text-ink-3">176 {head?.family ?? fam} <span className="tnum font-normal normal-case tracking-normal">· {list.length} variants · {fmtInt(list.reduce((n, b) => n + (num(b.result_count) ?? 0), 0))} results</span>177 </td>178 </tr>179 )}180 {list.map((b) => {181 const empty = (num(b.result_count) ?? 0) === 0;182 const leader = b.leader;183 return (184 <tr key={b.id} className={cn(empty && 'text-ink-3')}>185 <td className={cn('primary', grouped && 'md:pl-5')}>186 <Link href={routes.benchmark(b.slug)} className="text-ink hover:text-accent hover:underline">187 {b.name}188 </Link>189 <span className="block text-[11px] text-ink-3">190 {grouped && b.variant ? `variant ${b.variant}` : b.category ?? ''}191 {grouped && b.variant && b.category ? ` · ${b.category}` : ''}192 {b.attributes?.family_head ? ' · family head' : ''}193 </span>194 </td>195 <td data-label="Metric" className="text-ink-2">196 {b.metric ?? '—'}197 <span className="text-ink-3"> {b.direction === 'lower' ? '↓ lower is better' : '↑'}</span>198 {b.groups.length > 1 && <span className="block text-[11px] text-ink-3">{fmtInt(b.groups.length)} comparability groups</span>}199 </td>200 <td data-label="Results" className="num tnum">201 {empty ? <span className="text-ink-3">0</span> : fmtInt(b.result_count)}202 </td>203 <td data-label="Models" className="num tnum text-ink-2">204 {fmtInt(b.model_count)}205 </td>206 <td data-label="Current leader">207 {leader ? (208 <span className="flex flex-wrap items-center gap-x-2 gap-y-0.5">209 <EntityLink e={{ ...leader.model, entity_type: 'model' }} className="font-medium" />210 <span className="tnum text-ink-2">{fmtScoreUnit(leader.score, leader.unit)}</span>211 <TrustBadge level={leader.trust_level} label={leader.trust_label} />212 {leader.model.organization && <span className="block w-full text-[11px] text-ink-3">{leader.model.organization.name}</span>}213 </span>214 ) : (215 <span className="text-xs text-ink-3">{empty ? 'no results yet' : '—'}</span>216 )}217 </td>218 <td data-label="Updated" className="text-xs text-ink-2" title={leader?.observed_at}>219 {leader ? fmtAgo(leader.observed_at) : '—'}220 </td>221 </tr>222 );223 })}224 </>225 );226}227