Browse documentation
Evals
View Markdown
On this page

Your first eval

Who this page is for: everyone. You type commands and read what they print; there is no Python to write.

This page runs the eval of the support desk that comes with gvn, from the first command to a comparison of two versions, and opens the web page on the result.

  • You will be able to: see what an eval offers, check it on three cases, run it in full against two versions, read and compare the two reports, and open them in the web page.
  • Read first: Evals, for the words used here.
  • Time: about 20 minutes.

What you will run

The support desk is a harness from gvn's examples: it triages a customer's question, then either answers it from eight help articles or escalates it by opening a ticket for a person. The eval lives in examples/support_evals/:

support.cases.csv      20 customers: who asks what, where it should go, what the reply must say
support.eval.toml      the eval: which cases, 2 trials each, 5 criteria
project.py             what the developers offer: the versions, the shop, the criteria that need code
.gvn/                  every run and every report, created on first use
flowchart LR
    cases[("support.cases.csv<br/>20 customers")]
    evalfile[("support.eval.toml<br/>2 trials, 5 criteria")]
    baseline["baseline<br/>the desk as it ships"]
    plain["plain_spoken<br/>clearer instructions"]
    r1["Report<br/>support.baseline"]
    r2["Report<br/>support.plain_spoken"]
    verdict["Comparison"]
    cases --> baseline --> r1
    evalfile --> baseline
    cases --> plain --> r2
    evalfile --> plain
    r1 --> verdict
    r2 --> verdict

Two versions are offered. baseline is the desk as it ships. plain_spoken is the same desk whose triage is told exactly what goes to a person, and whose answers are told to stay short and to the articles. The question the eval answers: is plain_spoken better?

Each trial gets a fresh shop: the eight articles and an empty ticket system. The stand-in approves the ticket a person would approve. When the run ends, the shop reports the tickets opened and the searches made, and five criteria judge the trial:

  • three must pass: the case is closed (by an answer or a ticket); a person is brought in exactly when needed; the reply states the key fact the case names;
  • two are measured: the reply sticks to the articles (a judge model decides), and the trial stays within 12,000 tokens.

The output on this page comes from the example's own tests, which run every command below offline: scripted models stand in for Claude there, and their baseline sends every customer to an answer, never to a person. A live run prints the same lines with other numbers.

Step 1: see what is offered

Run every command from the repository root. gvn eval first has to know which project to load: the Python object that lists the eval files, versions and criteria on offer. It reads that from the [tool.gvn] section of the repository's pyproject.toml:

[tool.gvn]
project = "examples.support_evals.project:project"

project names a module and, after the colon, the attribute in it that returns the project. The [tool.gvn] section lists everything the section accepts, and Writing the project shows how to write a project of your own.

$ gvn eval list
Eval files:
  support (support.eval.toml): cases from support.cases.csv, 2 trials per case, 5 criteria
Versions offered:
  baseline
  plain_spoken
Criteria offered (use = "KEY" in an eval file):
  closed: finishes in escalated or resolved
  key_fact: the reply states the key fact
  right_place: a person is brought in exactly when needed
Recorded eval runs:
  none yet: start one with gvn eval run FILE --version NAME

list answers "what can I run, and against what?": the eval files found under the project, the versions you may name with --version, the criteria you may name in an eval file with use = "KEY" (with the name each one has), and the eval runs recorded so far.

Step 2: a smoke run of three cases

Before a full run, check that everything is wired up on a few cases, once each. Three rows of the cases file carry the tag smoke:

$ gvn eval run examples/support_evals/support.eval.toml --version baseline --only smoke --trials 1
support on baseline: 2 of 3 trials passed, 67% (likely between 21% and 94%)
Cases: 2 solid (passed every time), 0 flaky (passed some of the time), 1 failing (never passed)
Criteria:
  must pass: a person is brought in exactly when needed: 67% (likely between 21% and 94%)
  must pass: the case is closed, by an answer or a ticket: 100% (likely between 44% and 100%)
  must pass: the reply states the key fact: 100% (likely between 44% and 100%)
  measured: stays within 12000 tokens: 100% (likely between 44% and 100%)
  measured: the reply sticks to the articles: 100% (likely between 44% and 100%)
Cost: 0.0009 USD
Recorded as 'support.baseline.only-smoke.1-trial': gvn eval show support.baseline.only-smoke.1-trial

The smoke run already finds something: one of the three customers needed a person and was not sent to one. Notice how wide the likely ranges are: with three trials, a 67% pass rate could really be anything from 21% to 94%. Three cases are enough to see that the eval runs, not to judge a version: gvn eval compare gives a verdict only once at least six cases were judged in both runs, and says not enough data to tell before that.

--only takes tags or case ids, separated by commas (--only delivery-abroad,tracking), and --trials the number of times each case runs. A run narrowed this way is recorded under a name that says so, support.baseline.only-smoke.1-trial, so it is never taken for the full run.

Step 3: the full run, for each version

$ gvn eval run examples/support_evals/support.eval.toml --version baseline --budget 2
support on baseline: 24 of 40 trials passed, 60% (likely between 40% and 80%)
Cases: 12 solid (passed every time), 0 flaky (passed some of the time), 8 failing (never passed)
Criteria:
  must pass: a person is brought in exactly when needed: 65% (likely between 45% and 85%); 65% of cases passed every time, 65% passed at least once
  must pass: the case is closed, by an answer or a ticket: 100% (likely between 84% and 100%); 100% of cases passed every time, 100% passed at least once
  must pass: the reply states the key fact: 95% (likely between 85% and 100%); 95% of cases passed every time, 95% passed at least once
  measured: stays within 12000 tokens: 100% (likely between 84% and 100%); 100% of cases passed every time, 100% passed at least once
  measured: the reply sticks to the articles: 100% (likely between 84% and 100%); 100% of cases passed every time, 100% passed at least once
Cost: 0.012 USD
Recorded as 'support.baseline': gvn eval show support.baseline

Twenty cases, two trials each: forty trials. Read it from the top:

  • 24 of 40 trials passed (60%): a trial passes when all three must-pass criteria pass. Likely between 40% and 80% is where the true pass rate most likely lies, given how many cases there are. More cases make the range narrower.
  • 12 solid, 8 failing: per case, solid means it passed every time it ran, failing that it never passed, flaky that it passed some of the time. Flaky cases are where a model's luck decides; the scripted model here is never flaky, a real one often is.
  • The criteria lines say which rule fails: only 65% of cases were sent to the right place. 65% of cases passed every time, 65% passed at least once is the same split by case: what a customer can count on, and what the desk can do at least sometimes.
  • Cost is what the trials and the judge's calls cost, in the project's currency.

Every one of the forty trials was judged here. When some could not run or are not judged yet, the headline says so: 20 of 36 judged trials passed, 56% (...); only 36 of 40 trials were judged (4 could not run). Reading reports says what to do then.

Now the other version:

$ gvn eval run examples/support_evals/support.eval.toml --version plain_spoken --budget 2
support on plain_spoken: 38 of 40 trials passed, 95% (likely between 85% and 100%)
Cases: 19 solid (passed every time), 0 flaky (passed some of the time), 1 failing (never passed)
Criteria:
  must pass: a person is brought in exactly when needed: 100% (likely between 84% and 100%); 100% of cases passed every time, 100% passed at least once
  must pass: the case is closed, by an answer or a ticket: 100% (likely between 84% and 100%); 100% of cases passed every time, 100% passed at least once
  must pass: the reply states the key fact: 95% (likely between 85% and 100%); 95% of cases passed every time, 95% passed at least once
  measured: stays within 12000 tokens: 100% (likely between 84% and 100%); 100% of cases passed every time, 100% passed at least once
  measured: the reply sticks to the articles: 100% (likely between 84% and 100%); 100% of cases passed every time, 100% passed at least once
Cost: 0.01158 USD
Recorded as 'support.plain_spoken': gvn eval show support.plain_spoken

--budget 2 stops the run from starting more trials once 2 USD are spent. A run stopped by its budget, by Ctrl-C or by a crash continues when the same command is given again: what was recorded is kept, and only the missing trials run.

Step 4: read a report again

show prints a recorded report, without running anything:

$ gvn eval show support.baseline
support on baseline: 24 of 40 trials passed, 60% (likely between 40% and 80%)
Cases: 12 solid (passed every time), 0 flaky (passed some of the time), 8 failing (never passed)
...
Cost: 0.012 USD

Step 5: compare the two versions

The new version comes first, the one to compare it with second:

$ gvn eval compare support.plain_spoken support.baseline
'support.plain_spoken' is better than 'support.baseline'.
'support.plain_spoken' is a run of the version plain_spoken and cost 0.01158 USD.
'support.baseline' is a run of the version baseline and cost 0.012 USD.
  passed overall: +35 percentage points (likely between +15 and +55) over 20 cases; 7 did better, 0 did worse
  a person is brought in exactly when needed: +35 percentage points (likely between +15 and +55) over 20 cases; 7 did better, 0 did worse
  the case is closed, by an answer or a ticket: 0 percentage points (likely between 0 and 0) over 20 cases; 0 did better, 0 did worse
  the reply states the key fact: 0 percentage points (likely between 0 and 0) over 20 cases; 0 did better, 0 did worse
  stays within 12000 tokens: 0 percentage points (likely between 0 and 0) over 20 cases; 0 did better, 0 did worse
  the reply sticks to the articles: 0 percentage points (likely between 0 and 0) over 20 cases; 0 did better, 0 did worse
What to do next: Adopt the newer version if its cost is acceptable. If any case did worse, read it first.

The first line is the verdict. It is better because every one of the twenty cases was judged in both runs and, case by case, the new version passed 35 percentage points more often, and even the low end of the likely range (+15) is a gain. The lines below say where the gain comes from: the seven customers who needed a person now reach one, and no case got worse. Both runs cost about the same. The last line says what to do next.

A comparison has four possible verdicts: better, about the same, worse and not enough data to tell. Reading reports says what each one means and what to do about it.

Step 6: open the web page

$ gvn eval serve --open
The eval page is at http://127.0.0.1:8000/ on this computer; press Ctrl-C to stop it.

The page lists both runs. Open one to see its criteria and every case with its trials; open a trial to read the conversation the desk had; tick both runs to compare them case by case. The web page describes each view.

Running it live

A live run calls Claude Haiku for the desk and for the judge. It needs ANTHROPIC_API_KEY set in the environment of the shell that runs gvn, and a --budget in USD on every gvn eval run, as above: the project prices every call, so the budget is checked as the run goes. The runs and reports are kept in examples/support_evals/.gvn/, so show, compare and serve read them later without calling any model.

Recap

  • gvn eval list shows the eval files, the versions, the criteria offered and the recorded runs.
  • gvn eval run FILE --version NAME runs every case against a version; --only smoke --trials 1 makes a quick check under its own name; running the same command again continues.
  • gvn eval show RUN prints a report again; gvn eval compare NEW OLD gives the verdict and the differences; gvn eval serve --open opens the web page.

Next: Writing cases, to add your own customers.