"use client" // Force recompile import { useAudienceMode } from "@/components/audience-mode-provider" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" import { Separator } from "@/components/ui/separator" import { Progress } from "@/components/ui/progress" import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible" import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog" import { Input } from "@/components/ui/input" import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table" import { ExternalLink, TrendingUp, Info, Database, Settings, FileCode, Building, Calendar, User, Server, ChevronDown, ChevronUp, BarChart3, Award, AlertTriangle, Cpu, Tag, Globe, Network, Activity, MessageSquare, Clock, Hash, Layers, Search, FlaskConical, Scale, BadgeCheck, BookOpenText } from "lucide-react" import type { BenchmarkEvaluation, CategoryType, EvaluationResult } from "@/lib/benchmark-schema" import { inferCategoryFromBenchmark } from "@/lib/benchmark-schema" import { formatScore, getBenchmarkDisplayName } from "@/lib/eval-processing" import type { ModelSummaryCore } from "@/lib/benchmark-schema" import { Fragment, useState, useEffect, useMemo, type CSSProperties } from "react" interface BenchmarkDetailProps { summary: ModelSummaryCore } interface BenchmarkVariant { evaluation: BenchmarkEvaluation result: EvaluationResult label: string variantType: "setup" | "subtask" | "setup+subtask" | "default" setupLabel: string | null subtaskLabel: string | null displayScore: string normalizedScore: number } interface BenchmarkGroup { key: string title: string description: string scoreType: EvaluationResult["metric_config"]["score_type"] | "mixed" avgNormalizedScore: number avgDisplayScore: string variants: BenchmarkVariant[] } interface VariantRowData { rowKey: string variant: BenchmarkVariant configMap: Record configEntries: Array<[string, string]> sampleCount: number | null } const GENERIC_RESULT_NAMES = new Set([ "score", "accuracy", "mean win rate", "exact match", "f1", "pass@1", ]) function getResultBenchmarkName( evaluation: BenchmarkEvaluation, result: EvaluationResult ) { if (result.source_data && !Array.isArray(result.source_data) && result.source_data.dataset_name) { return result.source_data.dataset_name } if (evaluation.benchmark) { return evaluation.benchmark } if (!Array.isArray(evaluation.source_data) && evaluation.source_data.dataset_name) { return evaluation.source_data.dataset_name } return result.evaluation_name } function getResultDisplayName( evaluation: BenchmarkEvaluation, result: EvaluationResult ) { const benchmarkName = getBenchmarkDisplayName(getResultBenchmarkName(evaluation, result)) const metricName = result.evaluation_name if (GENERIC_RESULT_NAMES.has(metricName.toLowerCase())) { return `${benchmarkName} - ${metricName}` } return metricName } function getVariantDescriptor( evaluation: BenchmarkEvaluation, result: EvaluationResult ): Pick { const evaluationVariant = getEvaluationVariantLabel(evaluation) const metricName = result.evaluation_name const isGenericMetric = GENERIC_RESULT_NAMES.has(metricName.toLowerCase()) const subtaskLabel = isGenericMetric ? null : metricName const setupLabel = evaluationVariant if (setupLabel && subtaskLabel) { return { label: `${setupLabel} · ${subtaskLabel}`, variantType: "setup+subtask", setupLabel, subtaskLabel, } } if (setupLabel) { return { label: `Setup: ${setupLabel}`, variantType: "setup", setupLabel, subtaskLabel: null, } } if (subtaskLabel) { return { label: subtaskLabel, variantType: "subtask", setupLabel: null, subtaskLabel, } } return { label: "Default run", variantType: "default", setupLabel: null, subtaskLabel: null, } } function formatMetadataValue(value: unknown) { if (value == null) { return null } if (typeof value === "string") { return value } if ( typeof value === "number" || typeof value === "boolean" || typeof value === "bigint" ) { return String(value) } try { return JSON.stringify(value, null, 2) } catch { return String(value) } } function isPlainObject(value: unknown): value is Record { return typeof value === "object" && value !== null && !Array.isArray(value) } function collectConfigEntries( source: Record, prefix = "", depth = 0 ): Array<[string, string]> { const entries: Array<[string, string]> = [] for (const [key, value] of Object.entries(source)) { const nextKey = prefix ? `${prefix}.${key}` : key if (isPlainObject(value) && depth < 1) { entries.push(...collectConfigEntries(value, nextKey, depth + 1)) continue } const formattedValue = formatMetadataValue(value) if (formattedValue) { entries.push([nextKey, formattedValue]) } } return entries } function getConfigDisplayValue(value: string) { return value.length > 36 ? `${value.slice(0, 33)}...` : value } function getTableConfigLabel(row: VariantRowData) { if (row.variant.setupLabel) { return row.variant.setupLabel } if (row.variant.variantType === "subtask") { return "Default setup" } return "Default config" } function formatCompactDate(timestamp: string) { try { const ts = parseFloat(timestamp) const date = Number.isFinite(ts) ? new Date(ts > 10000000000 ? ts : ts * 1000) : new Date(timestamp) return date.toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric", }) } catch { return timestamp } } function formatParamsBillions(value: unknown) { const numericValue = typeof value === "number" ? value : typeof value === "string" ? Number.parseFloat(value) : Number.NaN if (!Number.isFinite(numericValue)) { return null } if (numericValue >= 100) { return `${Math.round(numericValue)}B` } if (numericValue >= 10) { return `${numericValue.toFixed(1)}B` } return `${numericValue.toFixed(1)}B` } function getModelScaleDescription(value: unknown) { const numericValue = typeof value === "number" ? value : typeof value === "string" ? Number.parseFloat(value) : Number.NaN if (!Number.isFinite(numericValue)) { return null } const rounded = numericValue >= 100 ? Math.round(numericValue) : Number.parseFloat(numericValue.toFixed(1)) const scaleLabel = numericValue < 10 ? "Small model" : numericValue < 70 ? "Mid-size model" : "Large model" return `${scaleLabel} (${rounded} billion parameters)` } function getPolicyBenchmarkNarrative(name: string) { const value = name.toLowerCase() if (value.includes("ifeval")) { return { label: "Following instructions", description: "Can the model follow detailed formatting and content rules?", } } if (value.includes("bbh")) { return { label: "Reasoning and logic", description: "Multi-step reasoning across diverse tasks.", } } if (value.includes("math")) { return { label: "Advanced math", description: "Hard competition-level mathematics.", } } if (value.includes("gpqa")) { return { label: "Expert knowledge", description: "Graduate-level science questions across biology, physics, and chemistry.", } } if (value.includes("musr")) { return { label: "Complex narrative reasoning", description: "Reasoning over stories and real-world scenarios.", } } if (value.includes("mmlu")) { return { label: "Broad knowledge", description: "Professional and academic knowledge across many subject areas.", } } if (value.includes("tau-bench")) { return { label: "Agentic task completion", description: "Multi-step task execution in realistic workflow settings.", } } if (value.includes("swe-bench")) { return { label: "Software engineering", description: "Issue resolution and code-change performance on real repositories.", } } if (value.includes("rewardbench")) { return { label: "Preference alignment", description: "How well the model matches preference-style judgments.", } } return { label: name, description: "Reported benchmark evidence for this model.", } } function getPolicySignalLevel(score: number) { if (score >= 0.7) { return { label: "Good", tone: "bg-emerald-100 text-emerald-800 dark:bg-emerald-950/50 dark:text-emerald-300", } } if (score >= 0.4) { return { label: "Moderate", tone: "bg-amber-100 text-amber-800 dark:bg-amber-950/50 dark:text-amber-300", } } return { label: "Low", tone: "bg-rose-100 text-rose-800 dark:bg-rose-950/50 dark:text-rose-300", } } function getSignalTone(score: number) { if (score >= 0.7) { return "bg-emerald-100 text-emerald-800 dark:bg-emerald-950/50 dark:text-emerald-300" } if (score >= 0.4) { return "bg-amber-100 text-amber-800 dark:bg-amber-950/50 dark:text-amber-300" } return "bg-rose-100 text-rose-800 dark:bg-rose-950/50 dark:text-rose-300" } function getBenchmarkSpread(group: BenchmarkGroup) { if (group.variants.length <= 1) { return 0 } return group.variants[0].normalizedScore - group.variants[group.variants.length - 1].normalizedScore } function getVariantTypeTone(variantType: BenchmarkVariant["variantType"]) { switch (variantType) { case "setup": return "bg-sky-100 text-sky-800 dark:bg-sky-950/50 dark:text-sky-300" case "subtask": return "bg-violet-100 text-violet-800 dark:bg-violet-950/50 dark:text-violet-300" case "setup+subtask": return "bg-amber-100 text-amber-800 dark:bg-amber-950/50 dark:text-amber-300" default: return "bg-muted text-muted-foreground" } } function getVariantTypeLabel(variantType: BenchmarkVariant["variantType"]) { switch (variantType) { case "setup": return "Setup change" case "subtask": return "Benchmark subtask" case "setup+subtask": return "Setup + subtask" default: return "Single run" } } function buildVariantStructuredSections(variant: BenchmarkVariant) { const detailEntries = variant.result.score_details.details ? Object.entries(variant.result.score_details.details) : [] return { numericBreakdown: detailEntries.filter(([, value]) => typeof value === "number"), structuredBreakdown: detailEntries.filter(([, value]) => typeof value !== "number"), } } function formatConfigLabel(key: string) { return key .split(".") .slice(-2) .join(" ") .replace(/_/g, " ") .replace(/\b\w/g, (letter) => letter.toUpperCase()) } function getVariantConfigMap(variant: BenchmarkVariant) { const configMap: Record = {} const setup = getEvaluationVariantLabel(variant.evaluation) if (setup) { configMap.setup = setup } const generationArgs = variant.result.generation_config?.generation_args if (generationArgs) { for (const [key, value] of collectConfigEntries(generationArgs)) { configMap[key] = value } } return configMap } function normalizeScoreForDisplay(result: EvaluationResult) { const minScore = result.metric_config.min_score ?? 0 const maxScore = result.metric_config.max_score ?? 1 const range = maxScore - minScore if (range <= 0) { return 0 } const rawNormalized = (result.score_details.score - minScore) / range const normalized = result.metric_config.lower_is_better ? 1 - rawNormalized : rawNormalized return Math.max(0, Math.min(1, normalized)) } function formatResultDisplayScore(result: EvaluationResult) { return formatScore( result.score_details.score, result.metric_config.score_type, result.metric_config.max_score ) } function toComparableTimestamp(timestamp: string) { const numericTimestamp = Number.parseFloat(timestamp) if (Number.isFinite(numericTimestamp)) { return numericTimestamp } const parsedTimestamp = new Date(timestamp).getTime() return Number.isFinite(parsedTimestamp) ? parsedTimestamp : Number.NEGATIVE_INFINITY } function getVariantDedupKey(variant: BenchmarkVariant) { const configEntries = Object.entries(getVariantConfigMap(variant)).sort(([a], [b]) => a.localeCompare(b)) const sourceDataName = !Array.isArray(variant.result.source_data) && variant.result.source_data?.dataset_name ? variant.result.source_data.dataset_name : !Array.isArray(variant.evaluation.source_data) && variant.evaluation.source_data?.dataset_name ? variant.evaluation.source_data.dataset_name : "" return JSON.stringify({ label: variant.label, variantType: variant.variantType, setupLabel: variant.setupLabel, subtaskLabel: variant.subtaskLabel, displayScore: variant.displayScore, sourceOrganization: variant.evaluation.source_metadata.source_organization_name, sourceName: variant.evaluation.source_metadata.source_name ?? "", sourceType: variant.evaluation.source_metadata.source_type, sourceDataName, configEntries, }) } function buildBenchmarkGroups( entries: Array<{ evaluation: BenchmarkEvaluation; result: EvaluationResult }> ): BenchmarkGroup[] { const groups = new Map() for (const entry of entries) { const title = getBenchmarkDisplayName(getResultBenchmarkName(entry.evaluation, entry.result)) const normalizedScore = normalizeScoreForDisplay(entry.result) const displayScore = formatResultDisplayScore(entry.result) const descriptor = getVariantDescriptor(entry.evaluation, entry.result) const variant: BenchmarkVariant = { evaluation: entry.evaluation, result: entry.result, label: descriptor.label, variantType: descriptor.variantType, setupLabel: descriptor.setupLabel, subtaskLabel: descriptor.subtaskLabel, displayScore, normalizedScore, } const existing = groups.get(title) if (!existing) { groups.set(title, { key: title, title, description: entry.result.metric_config.evaluation_description, scoreType: entry.result.metric_config.score_type, avgNormalizedScore: normalizedScore, avgDisplayScore: `${(normalizedScore * 100).toFixed(1)}%`, variants: [variant], }) continue } existing.variants.push(variant) if (existing.description.length < entry.result.metric_config.evaluation_description.length) { existing.description = entry.result.metric_config.evaluation_description } if (existing.scoreType !== entry.result.metric_config.score_type) { existing.scoreType = "mixed" } } return Array.from(groups.values()) .map((group) => { const dedupedVariants = new Map() for (const variant of group.variants) { const variantKey = getVariantDedupKey(variant) const existingVariant = dedupedVariants.get(variantKey) if (!existingVariant) { dedupedVariants.set(variantKey, variant) continue } if ( toComparableTimestamp(variant.evaluation.retrieved_timestamp) >= toComparableTimestamp(existingVariant.evaluation.retrieved_timestamp) ) { dedupedVariants.set(variantKey, variant) } } group.variants = Array.from(dedupedVariants.values()) group.variants.sort((a, b) => b.normalizedScore - a.normalizedScore) group.avgNormalizedScore = group.variants.reduce((sum, variant) => sum + variant.normalizedScore, 0) / group.variants.length group.avgDisplayScore = `${(group.avgNormalizedScore * 100).toFixed(1)}%` return group }) .sort((a, b) => b.avgNormalizedScore - a.avgNormalizedScore) } function getEvaluationVariantLabel(evaluation: BenchmarkEvaluation) { const evaluationIdWithoutTimestamp = evaluation.evaluation_id.replace(/\/[^/]+$/, "") const modelSlug = evaluation.model_info.id.replace(/\//g, "_") let evaluationPrefix = evaluationIdWithoutTimestamp if (evaluationPrefix.endsWith(`__${modelSlug}`)) { evaluationPrefix = evaluationPrefix.slice(0, -(`__${modelSlug}`.length)) } else if (evaluationPrefix.endsWith(`/${modelSlug}`)) { evaluationPrefix = evaluationPrefix.slice(0, -(`/${modelSlug}`.length)) } const benchmarkName = evaluation.benchmark if (benchmarkName && evaluationPrefix.startsWith(`${benchmarkName}/`)) { const variant = evaluationPrefix.slice(benchmarkName.length + 1) return variant.split("/").filter(Boolean).pop() || null } if (benchmarkName && evaluationPrefix === benchmarkName) { return null } return evaluationPrefix.split("/").filter(Boolean).pop() || null } export function BenchmarkDetail({ summary }: BenchmarkDetailProps) { const { mode } = useAudienceMode() const isResearchView = mode === "research" const [benchmarkSearch, setBenchmarkSearch] = useState("") const [benchmarkSort, setBenchmarkSort] = useState<"score" | "name" | "variants" | "spread">("score") const [expandedBenchmarkKey, setExpandedBenchmarkKey] = useState(null) const allEvaluations = useMemo( () => Object.values(summary.evaluations_by_category).flat(), [summary.evaluations_by_category] ) const reportingStats = useMemo(() => { const organizations = new Set() const sourceTypes = new Set() const libraries = new Set() let missingGenerationConfigs = 0 let thirdPartyEvaluations = 0 allEvaluations.forEach((evaluation) => { organizations.add(evaluation.source_metadata.source_organization_name) sourceTypes.add(evaluation.source_metadata.source_type) if (evaluation.eval_library?.name) { libraries.add(`${evaluation.eval_library.name}${evaluation.eval_library.version ? ` ${evaluation.eval_library.version}` : ""}`) } if (evaluation.source_metadata.evaluator_relationship === "third_party") { thirdPartyEvaluations += 1 } missingGenerationConfigs += evaluation.evaluation_results.filter((result) => !result.generation_config).length }) return { organizationNames: Array.from(organizations).sort((a, b) => a.localeCompare(b)), organizationCount: organizations.size, sourceTypeCount: sourceTypes.size, libraryCount: libraries.size, libraryList: Array.from(libraries).sort((a, b) => a.localeCompare(b)), missingGenerationConfigs, thirdPartyEvaluations, } }, [allEvaluations]) const allCategoryResults = useMemo( () => Object.entries(summary.evaluations_by_category).flatMap(([category, evals]) => evals.flatMap((evaluation) => evaluation.evaluation_results.flatMap((result) => { let resultCategory: CategoryType | undefined if (result.factsheet?.functional_props) { const props = result.factsheet.functional_props.split(";").map((prop) => prop.trim()) if (props.includes(category)) { resultCategory = category as CategoryType } } if (!resultCategory) { const inferred = inferCategoryFromBenchmark(result.evaluation_name) if (inferred === category) { resultCategory = inferred } } return resultCategory === category ? [{ evaluation, result }] : [] }) ) ), [summary.evaluations_by_category] ) const policyHighlights = useMemo(() => { const groups = buildBenchmarkGroups(allCategoryResults) const seenLabels = new Set() return groups .filter((group) => { const narrative = getPolicyBenchmarkNarrative(group.title) if (seenLabels.has(narrative.label)) { return false } seenLabels.add(narrative.label) return true }) .slice(0, 6) .map((group) => { const narrative = getPolicyBenchmarkNarrative(group.title) const level = getPolicySignalLevel(group.avgNormalizedScore) return { key: group.key, title: group.title, label: narrative.label, description: narrative.description, scoreText: `${(group.avgNormalizedScore * 100).toFixed(0)}%`, level, } }) }, [allCategoryResults]) const policySummary = useMemo(() => { const benchmarkCount = new Set( allCategoryResults.map((entry) => getBenchmarkDisplayName(getResultBenchmarkName(entry.evaluation, entry.result))) ).size const allThirdParty = allEvaluations.length > 0 && reportingStats.thirdPartyEvaluations === allEvaluations.length const leadOrganization = reportingStats.organizationNames[0] const modelScaleDescription = getModelScaleDescription(summary.model_info.additional_details?.params_billions) const compactParamCount = formatParamsBillions(summary.model_info.additional_details?.params_billions) const compactModelName = compactParamCount ? `${summary.model_info.name} · ${compactParamCount}` : summary.model_info.name let testedByCopy = `Reported across ${benchmarkCount} standardized benchmark${benchmarkCount === 1 ? "" : "s"}.` if (leadOrganization && reportingStats.organizationCount === 1) { testedByCopy = allThirdParty ? `Tested by ${leadOrganization} — an independent third party, not the model's developer — using ${benchmarkCount} standardized benchmark${benchmarkCount === 1 ? "" : "s"}.` : `Reported by ${leadOrganization} using ${benchmarkCount} standardized benchmark${benchmarkCount === 1 ? "" : "s"}.` } else if (leadOrganization) { testedByCopy = allThirdParty ? `Tested by ${leadOrganization} and ${reportingStats.organizationCount - 1} other reporting organization${reportingStats.organizationCount - 1 === 1 ? "" : "s"} using ${benchmarkCount} standardized benchmark${benchmarkCount === 1 ? "" : "s"}.` : `Reported by ${reportingStats.organizationCount} organizations using ${benchmarkCount} benchmark views.` } const reproducibilityCopy = reportingStats.missingGenerationConfigs === 0 ? null : reportingStats.missingGenerationConfigs === summary.total_evaluations ? "How this model was prompted during testing is not documented. Scores cannot be independently confirmed." : "How this model was prompted during testing is missing for some reported results. Score differences may not be fully attributable to model capability alone." const comparabilityCopy = reportingStats.missingGenerationConfigs > 0 ? `${benchmarkCount > 0 ? `These results cover ${benchmarkCount} benchmark${benchmarkCount === 1 ? "" : "s"},` : "These results"} but missing prompting details mean apparent score gaps may partly reflect setup differences, not just capability.` : "Shared benchmark coverage helps, but evaluator choices, benchmark mix, and model size can still limit direct apples-to-apples comparison." const sizeCaveat = modelScaleDescription ? `${modelScaleDescription}. Comparisons against much smaller or larger systems should be interpreted with care.` : null return { compactModelName, modelScaleDescription, testedByCopy, reproducibilityCopy, comparabilityCopy, sizeCaveat, independentlyVerified: allThirdParty || reportingStats.thirdPartyEvaluations > 0, benchmarkCount, } }, [ allCategoryResults, allEvaluations.length, reportingStats, summary.model_info.additional_details?.params_billions, summary.model_info.name, summary.total_evaluations, ]) const benchmarkGroups = useMemo(() => buildBenchmarkGroups(allCategoryResults), [allCategoryResults]) const bestBenchmark = benchmarkGroups[0] const weakestBenchmark = benchmarkGroups[benchmarkGroups.length - 1] const widestBenchmark = [...benchmarkGroups].sort((a, b) => getBenchmarkSpread(b) - getBenchmarkSpread(a))[0] const repeatedBenchmarkCount = benchmarkGroups.filter((group) => group.variants.length > 1).length const setupDrivenBenchmarkCount = benchmarkGroups.filter((group) => group.variants.some((variant) => variant.variantType === "setup" || variant.variantType === "setup+subtask") ).length const subtaskDrivenBenchmarkCount = benchmarkGroups.filter((group) => group.variants.some((variant) => variant.variantType === "subtask" || variant.variantType === "setup+subtask") ).length const filteredBenchmarkGroups = useMemo(() => { const query = benchmarkSearch.trim().toLowerCase() const filtered = benchmarkGroups.filter((group) => { if (!query) { return true } return ( group.title.toLowerCase().includes(query) || group.description.toLowerCase().includes(query) || group.variants.some((variant) => variant.label.toLowerCase().includes(query)) ) }) const sorted = [...filtered] switch (benchmarkSort) { case "name": sorted.sort((a, b) => a.title.localeCompare(b.title)) break case "variants": sorted.sort((a, b) => b.variants.length - a.variants.length || b.avgNormalizedScore - a.avgNormalizedScore) break case "spread": sorted.sort((a, b) => getBenchmarkSpread(b) - getBenchmarkSpread(a) || b.avgNormalizedScore - a.avgNormalizedScore) break case "score": default: sorted.sort((a, b) => b.avgNormalizedScore - a.avgNormalizedScore) break } return sorted }, [benchmarkGroups, benchmarkSearch, benchmarkSort]) useEffect(() => { if (!expandedBenchmarkKey) { return } const stillVisible = filteredBenchmarkGroups.some((group) => group.key === expandedBenchmarkKey) if (!stillVisible) { setExpandedBenchmarkKey(null) } }, [expandedBenchmarkKey, filteredBenchmarkGroups]) const formatDate = (isoString: string) => { try { return new Date(isoString).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit' }) } catch { return isoString } } return (
Model Metadata {policySummary.independentlyVerified && ( Independent reporting )} {formatParamsBillions(summary.model_info.additional_details?.params_billions) && ( {formatParamsBillions(summary.model_info.additional_details?.params_billions)} )} {summary.model_info.architecture || summary.model_info.inference_engine || "Model"}
{summary.model_info.name}
{summary.model_info.developer} {policySummary.modelScaleDescription ? ` · ${policySummary.modelScaleDescription}` : ""}
{!isResearchView && (

{policySummary.testedByCopy}

)}
Benchmarks
{benchmarkGroups.length}
Results
{summary.total_evaluations}
Reporting orgs
{reportingStats.organizationCount}
Source types
{reportingStats.sourceTypeCount}
System and evidence context
System ID
{summary.model_info.id}
Version
{summary.model_info.model_version || "N/A"}
Deployment
{summary.model_info.additional_details?.deployment_context || "General Purpose"}
Release
{summary.model_info.release_date ? formatDate(summary.model_info.release_date).split(",")[0] : "Unknown"}
Modalities
{(summary.model_info.modalities?.input?.join(", ") || "Text")}/{(summary.model_info.modalities?.output?.join(", ") || "Text")}
Updated
{formatDate(summary.last_updated).split(",")[0]}
{summary.model_info.model_url && ( )}
{isResearchView ? (
Research lens

{reportingStats.missingGenerationConfigs > 0 ? `${reportingStats.missingGenerationConfigs} result entries are missing generation configuration, so some score differences may reflect setup choices rather than model capability alone.` : "Generation configuration is present across the current result set, which makes cross-slice comparison more trustworthy."}

Eval libraries {reportingStats.libraryList.length > 0 ? reportingStats.libraryList.join(", ") : "Not recorded"}
Evidence sources {reportingStats.organizationCount} orgs / {reportingStats.sourceTypeCount} types
Reported decomposition {setupDrivenBenchmarkCount} setup-aware · {subtaskDrivenBenchmarkCount} subtask-aware
) : (
Public reading
{policySummary.reproducibilityCopy && (
Reproducibility gap. {policySummary.reproducibilityCopy}
)}

{policySummary.comparabilityCopy}

{policySummary.sizeCaveat &&

{policySummary.sizeCaveat}

}
{policyHighlights.length > 0 && (
What was tested
{policyHighlights.slice(0, 3).map((item) => (
{item.label}
{item.description}
{item.scoreText}
))}
)}
)}

{isResearchView ? "Benchmark Explorer" : "Reported Benchmark Signals"}

{isResearchView ? "A benchmark-first view of this model's reported results, with setup spread and subtask-vs-setup differences surfaced up front." : "A benchmark-first view of the public evidence behind this model, with the strongest and most variable signals grouped in one place."}

setBenchmarkSearch(event.target.value)} placeholder="Search benchmarks or setups" className="pl-9" />
{bestBenchmark && (
Strongest Reported Benchmark
{bestBenchmark.title}
{bestBenchmark.description}
{bestBenchmark.avgDisplayScore}
)} {widestBenchmark && (
Widest score gap
{widestBenchmark.title}
{widestBenchmark.variants.length} reported slice{widestBenchmark.variants.length === 1 ? "" : "s"} with the biggest spread between highest and lowest scores
{(getBenchmarkSpread(widestBenchmark) * 100).toFixed(1)} pts
)}
Coverage Snapshot
{benchmarkGroups.length} benchmarks
{repeatedBenchmarkCount} benchmark{repeatedBenchmarkCount === 1 ? "" : "s"} include multiple comparison slices.
{filteredBenchmarkGroups.length} shown after filters
{filteredBenchmarkGroups.length === 0 ? (
No benchmarks match the current search.
) : (
{filteredBenchmarkGroups.map((group, index) => ( setExpandedBenchmarkKey((current) => { if (open) { return group.key } return current === group.key ? null : current }) } /> ))}
)}
) } function SampleDataDialog({ samples, evaluationName }: { samples: any[], evaluationName: string }) { const [open, setOpen] = useState(false) const [searchTerm, setSearchTerm] = useState("") const [currentPage, setCurrentPage] = useState(1) const itemsPerPage = 10 const filteredSamples = samples.filter(sample => sample.input.toLowerCase().includes(searchTerm.toLowerCase()) || sample.response.toLowerCase().includes(searchTerm.toLowerCase()) || sample.ground_truth.toLowerCase().includes(searchTerm.toLowerCase()) ) const totalPages = Math.ceil(filteredSamples.length / itemsPerPage) const startIndex = (currentPage - 1) * itemsPerPage const currentSamples = filteredSamples.slice(startIndex, startIndex + itemsPerPage) // Reset page when search changes useEffect(() => { setCurrentPage(1) }, [searchTerm]) return ( Sample Level Data Detailed results for {samples.length} samples from {evaluationName}
setSearchTerm(e.target.value)} className="pl-8" />
Showing {startIndex + 1}-{Math.min(startIndex + itemsPerPage, filteredSamples.length)} of {filteredSamples.length}
ID Input Model Response Ground Truth Score {currentSamples.length > 0 ? ( currentSamples.map((sample, idx) => ( {sample.sample_id || idx}
{sample.input}
{sample.response}
{sample.ground_truth}
{typeof sample.score === 'number' ? (sample.score * 100).toFixed(1) + '%' : sample.score || 'N/A'}
)) ) : ( No results found. )}
Page {currentPage} of {totalPages || 1}
) } function BenchmarkResultCard({ evaluation, result, titleOverride, showSetupBadge = true, }: { evaluation: BenchmarkEvaluation, result: EvaluationResult titleOverride?: string showSetupBadge?: boolean }) { const [isOpen, setIsOpen] = useState(false) const randomSample = useMemo(() => { const samples = evaluation.detailed_evaluation_results_per_samples; if (!samples || samples.length === 0) return null; // Use a simple hash of the evaluation ID to pick a consistent "random" sample for this session // or just Math.random() if we don't mind it changing on refresh const randomIndex = Math.floor(Math.random() * samples.length); return samples[randomIndex]; }, [evaluation.detailed_evaluation_results_per_samples]); const formatDate = (timestamp: string) => { try { // Handle unix timestamp (seconds or milliseconds) const ts = parseFloat(timestamp) const date = new Date(ts > 10000000000 ? ts : ts * 1000) return date.toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' }) } catch { return timestamp } } const { score } = result.score_details const { min_score = 0, max_score = 1, unit, lower_is_better } = result.metric_config const detailEntries = result.score_details.details ? Object.entries(result.score_details.details) : [] const numericBreakdown = detailEntries.filter(([, value]) => typeof value === "number") const structuredBreakdown = detailEntries.filter(([, value]) => typeof value !== "number") // Normalize to 0-1 for color coding let normalized = (score - min_score) / (max_score - min_score) if (lower_is_better) normalized = 1 - normalized const isHigh = normalized >= 0.8 const isMedium = normalized >= 0.6 let displayScore = score.toFixed(2) let displayUnit = unit || "Accuracy" const evaluationVariant = getEvaluationVariantLabel(evaluation) if (unit === 'accuracy' || !unit) { displayScore = (score * 100).toFixed(1) + "%" displayUnit = "Accuracy" } else if (unit === 'points') { displayScore = score.toFixed(1) displayUnit = "/ 10" } else if (unit === 'pass@1') { displayScore = (score * 100).toFixed(1) + "%" displayUnit = "Pass@1" } else { displayUnit = unit.charAt(0).toUpperCase() + unit.slice(1) } return (

{titleOverride || getResultDisplayName(evaluation, result)}

{result.metric_config.score_type} {showSetupBadge && evaluationVariant && ( Setup: {evaluationVariant} )}

{result.metric_config.evaluation_description}

{displayScore}
{displayUnit}
{/* Source Provenance */}
Source Provenance
{/* Source Metadata */}

Evaluator Metadata

Organization: {evaluation.source_metadata.source_organization_name}
Relationship: {evaluation.source_metadata.evaluator_relationship}
Source Type: {evaluation.source_metadata.source_type.replace(/_/g, ' ')}
{evaluationVariant && (
Evaluation Setup: {evaluationVariant}
)} {evaluation.source_metadata.source_url && (
URL: Link
)}
Date: {formatDate(evaluation.retrieved_timestamp)}
{/* Source Data */}

Dataset Information

Name: {Array.isArray(evaluation.source_data) ? 'Multiple Sources' : evaluation.source_data.dataset_name}
{!Array.isArray(evaluation.source_data) && ( <> {evaluation.source_data.hf_repo && ( )} {evaluation.source_data.hf_split && (
Split: {evaluation.source_data.hf_split}
)}
Samples: {evaluation.source_data.samples_number?.toLocaleString()}
)}
{/* Evaluation Results */}
Evaluation Results
Overall Score
{result.metric_config.score_type} • {result.metric_config.min_score}-{result.metric_config.max_score} • {result.metric_config.lower_is_better ? 'Lower is better' : 'Higher is better'}
{displayScore}
{detailEntries.length > 0 && ( <>
Detailed Breakdown
Scores and structured metadata for individual subtasks or metrics
{numericBreakdown.length > 0 && (
{numericBreakdown.map(([key, value]) => { let valDisplay = typeof value === 'number' ? value.toFixed(2) : value; let normalized_subtask = 0; if (typeof value === 'number') { if (unit === 'accuracy' || !unit || unit === 'pass@1') { valDisplay = (value * 100).toFixed(1) + "%"; normalized_subtask = value; } else { valDisplay = value.toFixed(2); normalized_subtask = (value - min_score) / (max_score - min_score); } } // Format the key nicely const formattedKey = key.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase()); return (
{formattedKey}
{valDisplay}
{typeof value === 'number' && ( )}
)})}
)} {structuredBreakdown.length > 0 && (
Structured Detail Fields
Field Value {structuredBreakdown.map(([key, value]) => { const formattedKey = key.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase()); const formattedValue = formatMetadataValue(value) ?? "N/A" return ( {formattedKey}
                                        {formattedValue}
                                      
) })}
)} )}
{/* Factsheet Information */} {result.factsheet && (
Benchmark Factsheet
{/* General Info */}
{result.factsheet.purpose && (
Purpose

{result.factsheet.purpose}

)} {result.factsheet.principles_tested && (
Principles Tested

{result.factsheet.principles_tested}

)}
{/* Methodology */}

Methodology

{result.factsheet.judge && (
Judge {result.factsheet.judge}
)} {result.factsheet.protocol && (
Protocol {result.factsheet.protocol}
)} {result.factsheet.model_access && (
Model Access {result.factsheet.model_access}
)} {result.factsheet.input_modality && (
Input Modality {result.factsheet.input_modality}
)} {result.factsheet.output_modality && (
Output Modality {result.factsheet.output_modality}
)} {result.factsheet.design && (
Design {result.factsheet.design}
)}
{/* Data & Validation */}

Data & Validation

{result.factsheet.size && (
Size {result.factsheet.size}
)} {result.factsheet.splits && (
Splits {result.factsheet.splits}
)} {result.factsheet.has_heldout !== undefined && (
Held-out Set {result.factsheet.has_heldout ? "Yes" : "No"}
)} {result.factsheet.is_valid !== undefined && (
Valid {result.factsheet.is_valid ? "Yes" : "No"}
)}
{/* Limitations */} {result.factsheet.known_limitations && ( <>
Known Limitations

{result.factsheet.known_limitations}

)}
)} {/* Generation Configuration */} {result.generation_config && (
Generation Configuration
{result.generation_config.additional_details && (
Description
{formatMetadataValue(result.generation_config.additional_details)}
)} {result.generation_config.generation_args && (
{Object.entries(result.generation_config.generation_args).map(([key, value]) => (
{key}
{formatMetadataValue(value)}
))}
)}
)} {/* Sample Level Data */} {evaluation.detailed_evaluation_results_per_samples && evaluation.detailed_evaluation_results_per_samples.length > 0 && randomSample && (
Sample Level Data (Random Sample)
{evaluation.detailed_evaluation_results_per_samples.length} Samples
ID: {randomSample.sample_id}
Input
{randomSample.input}
Model Response
{randomSample.response}
Ground Truth
{randomSample.ground_truth}
)} {/* Footer Links */}
{result.detailed_evaluation_results_url && ( View detailed per-sample results )}
) } function AggregatedBenchmarkCard({ group, isOpen, onOpenChange, motionIndex = 0, }: { group: BenchmarkGroup isOpen: boolean onOpenChange: (open: boolean) => void motionIndex?: number }) { const { mode } = useAudienceMode() const isResearchView = mode === "research" const [expandedRows, setExpandedRows] = useState>({}) const [selectedFilters, setSelectedFilters] = useState>({}) const variantRows = useMemo( () => group.variants.map((variant, index) => { const configMap = getVariantConfigMap(variant) return { rowKey: `${variant.evaluation.evaluation_id}-${index}`, variant, configMap, configEntries: Object.entries(configMap), sampleCount: Array.isArray(variant.evaluation.source_data) ? null : variant.evaluation.source_data.samples_number ?? null, } }), [group.variants] ) const filterDefinitions = useMemo(() => { const valuesByKey = new Map>() for (const row of variantRows) { for (const [key, value] of row.configEntries) { if (!valuesByKey.has(key)) { valuesByKey.set(key, new Set()) } valuesByKey.get(key)?.add(value) } } return Array.from(valuesByKey.entries()) .filter(([, values]) => values.size > 1) .sort(([a], [b]) => { if (a === "setup") return -1 if (b === "setup") return 1 return a.localeCompare(b) }) .map(([key, values]) => ({ key, label: key === "setup" ? "Setup" : formatConfigLabel(key), values: Array.from(values).sort((a, b) => a.localeCompare(b)), })) }, [variantRows]) const filteredRows = useMemo( () => variantRows.filter((row) => filterDefinitions.every((definition) => { const selectedValue = selectedFilters[definition.key] if (!selectedValue || selectedValue === "all") { return true } return row.configMap[definition.key] === selectedValue }) ), [filterDefinitions, selectedFilters, variantRows] ) const activeFilterCount = Object.values(selectedFilters).filter((value) => value && value !== "all").length const leaderNormalizedScore = filteredRows[0]?.variant.normalizedScore ?? 0 const signalTone = getSignalTone(group.avgNormalizedScore) const spread = getBenchmarkSpread(group) const sourceOrganizations = new Set(group.variants.map((variant) => variant.evaluation.source_metadata.source_organization_name)) const latestTimestamp = group.variants.reduce((latest, variant) => { const value = Number.parseFloat(variant.evaluation.retrieved_timestamp) return Number.isFinite(value) ? Math.max(latest, value) : latest }, Number.NEGATIVE_INFINITY) const latestReportedLabel = Number.isFinite(latestTimestamp) ? formatCompactDate(String(latestTimestamp)) : formatCompactDate(group.variants[0]?.evaluation.retrieved_timestamp ?? "") const toggleRow = (rowKey: string) => { setExpandedRows((current) => ({ ...current, [rowKey]: !current[rowKey], })) } return (
{isResearchView ? "Reported signal" : "Public signal"} {group.scoreType} {group.variants.length > 1 ? `${group.variants.length} comparison slices` : "1 reported result"} {sourceOrganizations.size > 1 && ( {sourceOrganizations.size} reporting orgs )}

{group.title}

{group.description}

{group.variants.length > 1 ? isResearchView ? "Top comparison slice" : "Top reported slice" : "Reported result"}
{group.variants[0]?.label ?? "Default run"} {group.variants[0] && ( {getVariantTypeLabel(group.variants[0].variantType)} )}
{group.variants.length > 1 ? isResearchView ? "Cross-slice spread" : "Score spread" : "Comparison status"}
{group.variants.length > 1 ? `${(spread * 100).toFixed(1)} pts` : "No comparison set"}
Latest report
{latestReportedLabel}
{group.avgDisplayScore}
{isResearchView ? "Average normalized score" : "Average reported score"}
Comparison Slices
{isResearchView ? "Setup changes and benchmark subtasks are shown separately so you can tell methodological differences from benchmark decomposition." : "Different setups and benchmark subtasks are visually separated so policy review does not confuse reporting choices with task slices."}
{filterDefinitions.length > 0 && (
Comparison Filters
{isResearchView ? "Narrow to matching setup or generation config values for apples-to-apples comparison" : "Narrow to matching setup and reporting conditions for more comparable policy review"}
{filteredRows.length} of {variantRows.length} shown {activeFilterCount > 0 && ( )}
{filterDefinitions.map((definition) => (
{definition.label}
))}
)} {variantRows.length === 1 ? (
Reported Details
) : (
{filteredRows.map((row, index) => { const { rowKey, variant } = row const isRowOpen = expandedRows[rowKey] ?? false const hasSourceLink = Boolean(variant.evaluation.source_metadata.source_url) const gapToLeader = Math.max(0, leaderNormalizedScore - variant.normalizedScore) const evidenceStatus = hasSourceLink ? "Linked" : "Inline" return (
{index + 1}
{variant.label}
{getVariantTypeLabel(variant.variantType)}
{variant.setupLabel && Setup: {variant.setupLabel}} {variant.setupLabel && variant.subtaskLabel && } {variant.subtaskLabel && Subtask: {variant.subtaskLabel}} {!variant.setupLabel && !variant.subtaskLabel && {group.title}}
{getConfigDisplayValue(getTableConfigLabel(row))} {isResearchView ? (
{index === 0 ? "Leader" : `-${(gapToLeader * 100).toFixed(1)} pts`}
0 ? (variant.normalizedScore / leaderNormalizedScore) * 100 : 100} className="h-2 w-14 shrink-0" />
) : (
{variant.evaluation.source_metadata.evaluator_relationship.replace(/_/g, " ")}
)}
{variant.displayScore}
{variant.evaluation.source_metadata.source_organization_name} / {evidenceStatus}
{isRowOpen && (
)}
) })} {filteredRows.length === 0 && (
No comparison slices match the current filters.
)}
)}
) } function VariantExpandedDetail({ row, group, mode, }: { row: VariantRowData group: BenchmarkGroup mode: "research" | "policy" }) { const isResearchView = mode === "research" const { variant, configEntries, sampleCount } = row const { numericBreakdown, structuredBreakdown } = buildVariantStructuredSections(variant) const purpose = variant.result.factsheet?.purpose const principles = variant.result.factsheet?.principles_tested const sourceTypeLabel = variant.evaluation.source_metadata.source_type.replace(/_/g, " ") return (
{variant.label}
{getVariantTypeLabel(variant.variantType)} {group.title} {variant.displayScore}
{variant.result.metric_config.evaluation_description}
{formatCompactDate(variant.evaluation.retrieved_timestamp)} {variant.evaluation.source_metadata.evaluator_relationship.replace(/_/g, " ")} {sampleCount != null && {sampleCount.toLocaleString()} samples}
{isResearchView ? "Provenance & Dataset" : "Reporting Context"}
{variant.subtaskLabel && } {variant.setupLabel && }
{isResearchView ? "Config Snapshot" : "Evaluation Setup"}
{configEntries.length > 0 ? ( configEntries.map(([key, value]) => ( {formatConfigLabel(key)}: {getConfigDisplayValue(value)} )) ) : ( No explicit config recorded )}
{!isResearchView && (purpose || principles) && (
{purpose && } {principles && }
)}
{numericBreakdown.length > 0 && (
{isResearchView ? "Subtask Scores" : "Reported Metrics"}
{numericBreakdown.map(([key, value]) => { const numericValue = value as number const minScore = variant.result.metric_config.min_score ?? 0 const maxScore = variant.result.metric_config.max_score ?? 1 const range = maxScore - minScore const normalizedValue = range > 0 ? ((numericValue - minScore) / range) * 100 : numericValue * 100 return (
{formatConfigLabel(key)}
{formatMetadataValue(numericValue)}
) })}
)} {structuredBreakdown.length > 0 && (
{isResearchView ? "Structured Detail Fields" : "Supporting Detail"}
Field Value {structuredBreakdown.map(([key, value]) => ( {formatConfigLabel(key)}
                        {formatMetadataValue(value)}
                      
))}
)} {variant.evaluation.source_metadata.source_url && ( )}
) } function InlineMeta({ label, value }: { label: string; value: React.ReactNode }) { return (
{label}
{value}
) } function SummaryRailItem({ label, tone, children, }: { label: string tone: string children: React.ReactNode }) { return (
{label}
{children}
) } function AllEvaluationsView({ evaluations }: { evaluations: BenchmarkEvaluation[] }) { return (
{evaluations.map((eval_, idx) => (
{eval_.evaluation_results.map((result, ridx) => ( ))}
))}
) } function CategoryStatsView({ stats, summary }: { stats: { category: CategoryType; count: number; avg_score: number }[] summary: ModelSummaryCore }) { const getCategoryColor = (score: number) => { if (score >= 0.8) return 'text-green-600' if (score >= 0.6) return 'text-yellow-600' return 'text-red-600' } const getCategoryLabel = (category: CategoryType): string => { return category.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ') } return (
{stats.map((stat) => { const evals = summary.evaluations_by_category[stat.category] || [] return (
{getCategoryLabel(stat.category)}
{(stat.avg_score * 100).toFixed(1)}%
{stat.count} evaluation{stat.count !== 1 ? 's' : ''}
{evals.map((eval_: BenchmarkEvaluation, idx: number) => { // Filter results to only show those that match this category const relevantResults = eval_.evaluation_results.filter((result: any) => { const resultCategory = inferCategoryFromBenchmark(result.evaluation_name) return resultCategory === stat.category }) if (relevantResults.length === 0) return null return relevantResults.map((result: any, ridx: number) => (
{getResultDisplayName(eval_, result)}
{(getEvaluationVariantLabel(eval_) ? `Setup: ${getEvaluationVariantLabel(eval_)}` : null) || (Array.isArray(eval_.source_data) ? (eval_.source_metadata.source_name || 'Unknown') : eval_.source_data.dataset_name)}
{formatScore( result.score_details.score, result.metric_config.score_type, result.metric_config.max_score )}
)) })}
) })}
) }