Loading component…
Loading component…
How an LLM judge picks the best of several attempts, as a tournament – two answers at a time, the preferred one moves on, and every match opens both side by side with why
To reuse this local React demo, copy all files from the Code tab into the same folder, then import JudgeBracket from ./judge-bracket.
import { JudgeBracket, type Contender } from "@/components/ui/judge-bracket";
const contenders: Contender[] = [
{ id: "a", name: "Sonnet · warm", meta: "142 words", output: "Subject: Your 14 days start now…" },
{ id: "b", name: "GPT-5 · formal", meta: "168 words", output: "Subject: Welcome to your trial…" },
{ id: "c", name: "Gemini · bullets", meta: "104 words", output: "Subject: 3 steps to your first project…" },
{ id: "d", name: "Sonnet · short", meta: "96 words", output: "Subject: Start your first project…" },
];
export function BestEmail() {
return (
<JudgeBracket
contenders={contenders}
verdicts={{ "0:0": { winner: "a", scores: [8.1, 7.4], reason: "Warmer, and it names the trial length." } }}
judging="0:1"
judge="Claude Opus"
task="Welcome email for new trial users"
onPick={(winner) => send(winner.output)}
/>
);
}| Name | Type | Default | Description |
|---|---|---|---|
| contenders | Contender[] | Every attempt, in seed order – 2, 4, 8 or 16; neighbours meet in the first round | |
| Contender | { id, name, icon?, meta?, output? } | name – what makes this attempt different; icon – e.g. the model maker's logo; meta – a quiet line like "118 words · 2.1s"; output – what it produced | |
| verdicts | Record<string, { winner, reason?, scores? }> | What the judge decided, by match "round:match" from 0 – e.g. "0:2" is the third match of the first round; scores are for the upper and the lower contender | |
| judging | string | The match the judge works on right now, same key – both names shimmer | |
| judge | string | Who judges – e.g. "Claude Opus" | |
| task | string | What the attempts are for – shown muted next to the title | |
| onPick | (winner: Contender) => void | Use the winner – without it, the final has no button | |
| title | string | "Judge" | Heading of the bar |
| className | string | Extra class on the root |
Every slot has a fixed height, so nothing moves while the judge works; the rounds share the width
When the rounds don't fit side by side it becomes a list per round, two contenders a row, and the answers stack
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"