import type { Metadata } from 'next'; import Link from 'next/link'; import { redirect } from 'next/navigation'; import { BenchmarksFilterRail } from '@/components/benchmarks/filter-rails'; import { TerminalLayout } from '@/components/layout/terminal'; import { ScrollX } from '@/components/models/scroll-x'; import { TrustBadge } from '@/components/models/badges'; import { fmtScoreUnit } from '@/components/models/shared'; import { ComparabilityLegend } from '@/components/entity/model-blocks'; import { EntityLink } from '@/components/ui/entity'; import { Hint } from '@/components/ui/hint'; import { Container, Note } from '@/components/ui/section'; import { EmptyState, Unavailable } from '@/components/ui/unavailable'; import { apiD1, safe } from '@/lib/api'; import { cn } from '@/lib/cn'; import { fmtAgo, fmtInt, num } from '@/lib/format'; import { routes, SITE_NAME, SITE_URL } from '@/lib/site'; import type { BenchmarkListItem } from '@/lib/types'; export const metadata: Metadata = { title: 'AI benchmarks — leaderboards, comparability groups & current leaders', 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.', alternates: { canonical: '/benchmarks' }, openGraph: { title: `AI benchmarks — leaderboards, comparability groups & current leaders | ${SITE_NAME}`, url: `${SITE_URL}/benchmarks`, type: 'website' }, }; export const revalidate = 300; type SP = { category?: string; view?: string; q?: string; with_results?: string }; function familyOf(b: BenchmarkListItem): string { return b.family ?? b.slug; } export default async function BenchmarksPage({ searchParams }: { searchParams: Promise }) { const sp = await searchParams; if (sp.view === 'matrix') redirect('/benchmarks/matrix'); const category = sp.category?.trim() || undefined; const q = sp.q?.trim().toLowerCase() || undefined; const withResults = sp.with_results === '1'; const [res, meth] = await Promise.all([safe(apiD1.benchmarks()), safe(apiD1.methodology())]); const all = res?.items ?? []; const cats = new Map(); for (const b of all) if (b.category) cats.set(b.category, (cats.get(b.category) ?? 0) + 1); const catList = [...cats.entries()].sort((x, y) => y[1] - x[1] || x[0].localeCompare(y[0])); let items = category ? all.filter((b) => b.category === category) : all; if (q) items = items.filter((b) => `${b.name} ${b.family ?? ''} ${b.variant ?? ''}`.toLowerCase().includes(q)); if (withResults) items = items.filter((b) => (num(b.result_count) ?? 0) > 0); const empty = all.filter((b) => (num(b.result_count) ?? 0) === 0).length; const totalResults = all.reduce((n, b) => n + (num(b.result_count) ?? 0), 0); // Family grouping: families by total results, head first, then variants by results. const fams = new Map(); for (const b of items) fams.set(familyOf(b), [...(fams.get(familyOf(b)) ?? []), b]); const famList = [...fams.entries()] .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) })) .sort((a, b) => b.total - a.total || a.f.localeCompare(b.f)); const href = (patch: Record) => { const p = new URLSearchParams(); const cur = { category, q: sp.q, with_results: withResults ? '1' : undefined, ...patch }; for (const [k, v] of Object.entries(cur)) if (v) p.set(k, v); const s = p.toString(); return s ? `/benchmarks?${s}` : '/benchmarks'; }; const trustLevels = meth?.trust_levels ?? []; const filterCount = [category, q, withResults ? '1' : undefined].filter(Boolean).length; 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)}` })) } }; const filters = ({ c, n }))} hrefAll={href({ category: undefined })} categoryHrefs={Object.fromEntries(catList.map(([c]) => [c, href({ category: category === c ? undefined : c })]))} />; const inspector = (
Benchmarks
{fmtInt(all.length)}
Current results
{fmtInt(totalResults)}
Without results
{fmtInt(empty)}

Trust levels

    {(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) => (
  • {t.label}
  • ))}

Comparability

{res?.note ?? 'Leaderboards show one row per canonical model: its best current row inside the comparability group (metric × task-defining configuration).'}
); return ( <>