Skip to content

Commit a7951c0

Browse files
committed
fix(evals): default leaderboard to measured task families
1 parent 22a4ebe commit a7951c0

4 files changed

Lines changed: 40 additions & 46 deletions

File tree

apps/evals/src/components/eval-ui.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState, type CSSProperties, type ReactNode } from "react";
22
import { ArrowUpRight, FlaskConical, X } from "lucide-react";
3-
import { dataset, families, type EvalModel, type FamilyFilter, type PageId } from "../data";
3+
import { dataset, type EvalModel, type FamilyFilter, type PageId } from "../data";
44
import { Button } from "./ui/button";
55
import { DialogRoot, DialogContent, DialogTitle, DialogDescription } from "./ui/dialog";
66

@@ -154,16 +154,15 @@ export function Panel({
154154
);
155155
}
156156

157-
export function FamilyTabs({
157+
export function FamilyTabs<T extends FamilyFilter>({
158158
value,
159159
onChange,
160-
includeAll = true,
160+
options,
161161
}: {
162-
value: FamilyFilter;
163-
onChange: (value: FamilyFilter) => void;
164-
includeAll?: boolean;
162+
value: T;
163+
onChange: (value: T) => void;
164+
options: readonly T[];
165165
}) {
166-
const options: readonly FamilyFilter[] = includeAll ? ["All tasks", ...families] : families;
167166
return (
168167
<div className="eval-family-tabs" role="group" aria-label="Task family">
169168
{options.map((family) => (

apps/evals/src/pages/leaderboard.stories.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,15 @@ type Story = StoryObj<typeof meta>;
1919

2020
export const Default: Story = {};
2121

22-
export const Portfolio: Story = {
22+
export const Perps: Story = {
2323
args: {
24-
initialFamily: "Portfolio",
24+
initialFamily: "Perps",
25+
},
26+
};
27+
28+
export const Predictions: Story = {
29+
args: {
30+
initialFamily: "Predictions",
2531
},
2632
};
2733

apps/evals/src/pages/leaderboard.tsx

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import { Button } from "../components/ui/button";
1212
import { Input } from "../components/ui/input";
1313
import "./leaderboard.css";
1414

15+
const leaderboardFamilies = ["Spot", "Perps", "Predictions"] as const;
16+
type LeaderboardFamily = (typeof leaderboardFamilies)[number];
17+
1518
type SortMetric = "passRate" | "accuracy" | "latency" | "cost";
1619
type SortDirection = "asc" | "desc";
1720
type ScatterMetric = "latency" | "cost";
@@ -257,13 +260,13 @@ function SortButton({
257260
}
258261

259262
export function LeaderboardPage({
260-
initialFamily = "All tasks",
263+
initialFamily = "Spot",
261264
initialSearch = "",
262265
}: {
263-
initialFamily?: FamilyFilter;
266+
initialFamily?: LeaderboardFamily;
264267
initialSearch?: string;
265268
}) {
266-
const [family, setFamily] = useState<FamilyFilter>(initialFamily);
269+
const [family, setFamily] = useState<LeaderboardFamily>(initialFamily);
267270
const [search, setSearch] = useState(initialSearch);
268271
const [sortMetric, setSortMetric] = useState<SortMetric>("passRate");
269272
const [sortDirection, setSortDirection] = useState<SortDirection>("desc");
@@ -285,21 +288,18 @@ export function LeaderboardPage({
285288
accuracy: metrics.accuracy,
286289
};
287290
});
288-
const measuredRows: LeaderboardRow[] =
289-
family === "All tasks"
290-
? []
291-
: measuredModels
292-
.filter(
293-
(model) =>
294-
model.families[family] !== undefined &&
295-
(query.length === 0 ||
296-
`${model.name} ${model.provider}`.toLocaleLowerCase().includes(query)),
297-
)
298-
.map((model) => ({
299-
kind: "measured",
300-
model,
301-
result: model.families[family]!,
302-
}));
291+
const measuredRows: LeaderboardRow[] = measuredModels
292+
.filter(
293+
(model) =>
294+
model.families[family] !== undefined &&
295+
(query.length === 0 ||
296+
`${model.name} ${model.provider}`.toLocaleLowerCase().includes(query)),
297+
)
298+
.map((model) => ({
299+
kind: "measured",
300+
model,
301+
result: model.families[family]!,
302+
}));
303303
const visible = [...illustrativeRows, ...measuredRows];
304304

305305
return visible.sort((left, right) => {
@@ -345,19 +345,13 @@ export function LeaderboardPage({
345345
};
346346

347347
const resetFilters = () => {
348-
setFamily("All tasks");
348+
setFamily("Spot");
349349
setSearch("");
350350
};
351351

352-
const tableCaption =
353-
family === "All tasks"
354-
? `Model results across all ${numberFormatter.format(dataset.tasks)} illustrative tasks.`
355-
: `Model results for the ${family} family, one of four ${numberFormatter.format(dataset.tasksPerFamily)}-task families.`;
352+
const tableCaption = `Model results for the ${family} family, one of four ${numberFormatter.format(dataset.tasksPerFamily)}-task families.`;
356353
const displayedUniverse =
357-
models.length +
358-
(family === "All tasks"
359-
? 0
360-
: measuredModels.filter((model) => model.families[family] !== undefined).length);
354+
models.length + measuredModels.filter((model) => model.families[family] !== undefined).length;
361355

362356
return (
363357
<PageShell active="leaderboard">
@@ -422,7 +416,7 @@ export function LeaderboardPage({
422416
</div>
423417

424418
<div className="lb-toolbar">
425-
<FamilyTabs value={family} onChange={setFamily} />
419+
<FamilyTabs value={family} onChange={setFamily} options={leaderboardFamilies} />
426420
<label className="lb-search-field">
427421
<span className="lb-visually-hidden">Search models</span>
428422
<Search size={15} aria-hidden="true" />
@@ -614,11 +608,7 @@ export function LeaderboardPage({
614608
</td>
615609
<td>
616610
{numberFormatter.format(
617-
row.kind === "measured"
618-
? row.result.total
619-
: family === "All tasks"
620-
? dataset.tasks
621-
: dataset.tasksPerFamily,
611+
row.kind === "measured" ? row.result.total : dataset.tasksPerFamily,
622612
)}
623613
</td>
624614
</tr>

apps/evals/src/pages/task-explorer.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useId, useState } from "react";
22
import { BookOpen, Clock, ListTree, Search, Shield } from "lucide-react";
3-
import { getModel, type FamilyFilter, type TaskFamily } from "../data";
3+
import { families, getModel, type TaskFamily } from "../data";
44
import { measuredModels, type MeasuredCase } from "../measured";
55
import { FamilyTabs, Modal, ModelAvatar, PageShell } from "../components/eval-ui";
66
import { Badge } from "../components/ui/badge";
@@ -171,8 +171,7 @@ export function TaskExplorerPage({
171171
const task = samples[sampleIndex] ?? sampleAt(family, 1);
172172
const trace = openTrace ? task.traces[openTrace] : null;
173173

174-
function changeFamily(next: FamilyFilter) {
175-
if (next === "All tasks") return;
174+
function changeFamily(next: TaskFamily) {
176175
setFamily(next);
177176
setSampleIndex(0);
178177
}
@@ -188,7 +187,7 @@ export function TaskExplorerPage({
188187
<EditorialColumn />
189188
<section className="task-main" aria-labelledby="task-main-heading">
190189
<div className="task-toolbar">
191-
<FamilyTabs value={family} onChange={changeFamily} includeAll={false} />
190+
<FamilyTabs value={family} onChange={changeFamily} options={families} />
192191
<div className="task-sample">
193192
<Label id={sampleLabelId} htmlFor="task-sample-trigger">
194193
Sample

0 commit comments

Comments
 (0)