codebaobab
Python workspace

FDE interview labData & Systems

Eval Runner

Build a small evaluation runner.

Python50 minutesData & Systems

Challenge brief

Read before you begin

Your mission · Model evaluation

Build an eval runner whose accuracy numbers mean what their labels say.

Wexford Legal cannot get its replacement model approved, because Legal Ops does not trust the accuracy sheet it was given. The sheet skipped some questions and a regression slipped past reviewers. The release review is December 3, and the current model is retired December 15.

  • Target · All public checks
  • Cases · 60 tagged
Skip to round setup

Your assignment

  1. Score answers with the rules in docs/spec.md.
  2. Aggregate accuracy, counting model errors as failures.
  3. List regressions against the previous run.
  4. Handle the new requirement when it arrives.
  5. Work the sample report by hand in NOTES.md.

The problem

Errors left out

Last week's sheet counted 1,203 questions, not 1,240, and claimed 91.2% accuracy.

Impact: Legal Ops refused to sign off on the replacement model.

Overall was a mean

The overall row averaged the per-area rows instead of counting each question once.

Impact: Reviewers could not trust the headline number.

Regressions checked by eye

Reviewers compared two sheets by hand and missed msa-117.

Impact: The release review missed a question that stopped passing.

Context

Graded questions
1,240
Release review
Dec 3
Current model retired
Dec 15

Requirements

  • Return exactly the shape in docs/spec.md.
  • Normalize with NFKC, casefolding and whitespace only.
  • Punctuation stays: "Net-45" does not match "net 45".
  • A model error is a failed attempt.
  • Each case counts once in overall accuracy.
  • Regressions: passed in baseline, fails now, by id.
  • An invalid case raises ValueError naming the field.
  • The inputs are never changed.

System overview

Edit the components marked “Your work”. The other components show where your changes fit.

Question libraryGraded questions
Last runLast run results
Eval runner(Your work)Scores answers, lists regressions
Model adapterScripted model replies
Eval reportAudit report per run
Release reviewDecides if model ships
Read the connections
  • Question library → Eval runner: cases
  • Last run → Eval runner: options.baseline
  • Eval runner → Model adapter: one call a try
  • Eval runner → Eval report: report
  • Eval report → Release review: weekly
  • Question library: 1,240 graded questions with scorer, expected answer and tags.
  • Last run: Pass or fail per question id from the current model's last run.
  • Eval runner: evaluate(cases, options) in evals/runner.py passes the scripted model to EvaluationRunner. The runner scores attempts, counts tags and lists regressions.
  • Model adapter: fake_model in evals/adapters/model.py: scripted replies and errors, no network.
  • Eval report: One JSON report per run, kept for audit.
  • Release review: Legal Ops and engineering decide whether the new model ships.

Details

Full requirements

Functional

  1. Return {total, passed, accuracy, by_tag, results, regressions}, exactly the shape in docs/spec.md. The release review and the audit archive both parse it.
  2. Score exact and contains_all answers after Unicode NFKC, casefolding and collapsed whitespace only (normalize in evals/services/scorers.py, a stub to fill in). Punctuation stays, so "Net-45" does not match "net 45": a lawyer would not accept every near miss.
  3. A model error is a failed attempt with null output, and it stays in the denominator. Dropping errors is how last week's sheet overstated accuracy.
  4. by_tag restricts the same rules to the cases carrying each tag. A case with two tags counts once overall, so overall accuracy is not the average of the tag rows.
  5. regressions lists, in id order, current cases whose baseline was true and which no longer pass every attempt. Baseline ids missing from this run are ignored.
  6. Reject an invalid case with ValueError naming the field. Sort results and regressions by id and by_tag by tag. Do not mutate the inputs.

Non-functional

  • Scale: the full library is 1,240 questions; with three repetitions (the follow-up) that is 3,720 model calls per run. Call the model once per attempt. Include each result in the report and sort case IDs and tags so reports can be compared.
  • Cost: a real run costs about $0.011 per call, roughly $41 at three repetitions, so the report must be right the first time; nobody reruns to check the arithmetic.
  • Precision: rates are rounded to six decimal places, so two runs of the same input compare equal byte for byte.
  • Determinism: the same cases and baseline always give the same report. Order never depends on input order or dictionary order.

Out of scope

  • Calling a real model. fake_model plays back scripted replies; no API key is used.
  • Model-graded or semantic scoring. Only exact and contains_all exist today.
  • Statistical significance between two models. That is a debrief question.
Data model

Case

FieldTypeNotes
idstringUnique and nonempty, such as msa-102.
scorer"exact" | "contains_all"
expectedstring | string[]One string for exact; a nonempty list of nonempty terms for contains_all.
replies(string | {error})[]What fake_model returns for attempt 0, 1, 2 (cycling).
tagsstring[]Distinct, nonempty. May be empty as a list.

Result

FieldTypeNotes
idstring
pass_ratenumberPassing attempts / attempts, six decimals.
consistentbooleanAll attempts passed or all failed.
attempts{output, passed, error}[]A model error has null output and passed false.

Tag row

FieldTypeNotes
tagstring
totalintegerCases carrying the tag.
passedintegerOf those, cases whose every attempt passed.
accuracynumber | nullPassing attempts / attempts for those cases.
Files you are given · 5
  • samples/review-cases.json Six questions from the library: a casing difference, extra spaces and punctuation, a missing term, a model timeout, a hyphen, and a case with two tags.
    [
      {
        "id": "nda-014",
        "scorer": "exact",
        "expected": "Yes",
        "replies": [
          "yes"
        ],
        "tags": [
          "confidentiality",
          "smoke"
        ]
      },
      {
        "id": "msa-102",
        "scorer": "contains_all",
        "expected": [
          "30 days",
          "written notice"
        ],
        "replies": [
          "Either party may terminate on 30  days' Written Notice."
        ],
        "tags": [
          "termination"
        ]
      },
      {
        "id": "msa-117",
        "scorer": "contains_all",
        "expected": [
          "12 months",
          "fees paid"
        ],
        "replies": [
          "Liability is capped at the fees paid in the prior year."
        ],
        "tags": [
          "liability",
          "smoke"
        ]
      },
      {
        "id": "dpa-031",
        "scorer": "exact",
        "expected": "72 hours",
        "replies": [
          {
            "error": "upstream timeout"
          }
        ],
        "tags": [
          "privacy"
        ]
      },
      {
        "id": "sow-008",
        "scorer": "exact",
        "expected": "net 45",
        "replies": [
          "Net-45"
        ],
        "tags": [
          "payment"
        ]
      },
      {
        "id": "msa-121",
        "scorer": "exact",
        "expected": "Delaware",
        "replies": [
          "delaware"
        ],
        "tags": [
          "liability",
          "termination"
        ]
      }
    ]
  • samples/baseline-2026-11-17.json Last week's pass or fail per id, including msa-099, which is not in this run.
    {
      "nda-014": true,
      "msa-102": true,
      "msa-117": true,
      "dpa-031": true,
      "sow-008": false,
      "msa-099": true
    }
  • samples/review-report.json The report evaluate(cases, {"baseline": baseline}) must return for those two files.
    {
      "total": 6,
      "passed": 3,
      "accuracy": 0.5,
      "by_tag": [
        {
          "tag": "confidentiality",
          "total": 1,
          "passed": 1,
          "accuracy": 1
        },
        {
          "tag": "liability",
          "total": 2,
          "passed": 1,
          "accuracy": 0.5
        },
        {
          "tag": "payment",
          "total": 1,
          "passed": 0,
          "accuracy": 0
        },
        {
          "tag": "privacy",
          "total": 1,
          "passed": 0,
          "accuracy": 0
        },
        {
          "tag": "smoke",
          "total": 2,
          "passed": 1,
          "accuracy": 0.5
        },
        {
          "tag": "termination",
          "total": 2,
          "passed": 2,
          "accuracy": 1
        }
      ],
      "results": [
        {
          "id": "dpa-031",
          "pass_rate": 0,
          "consistent": true,
          "attempts": [
            {
              "output": null,
              "passed": false,
              "error": "upstream timeout"
            }
          ]
        },
        {
          "id": "msa-102",
          "pass_rate": 1,
          "consistent": true,
          "attempts": [
            {
              "output": "Either party may terminate on 30  days' Written Notice.",
              "passed": true,
              "error": null
            }
          ]
        },
        {
          "id": "msa-117",
          "pass_rate": 0,
          "consistent": true,
          "attempts": [
            {
              "output": "Liability is capped at the fees paid in the prior year.",
              "passed": false,
              "error": null
            }
          ]
        },
        {
          "id": "msa-121",
          "pass_rate": 1,
          "consistent": true,
          "attempts": [
            {
              "output": "delaware",
              "passed": true,
              "error": null
            }
          ]
        },
        {
          "id": "nda-014",
          "pass_rate": 1,
          "consistent": true,
          "attempts": [
            {
              "output": "yes",
              "passed": true,
              "error": null
            }
          ]
        },
        {
          "id": "sow-008",
          "pass_rate": 0,
          "consistent": true,
          "attempts": [
            {
              "output": "Net-45",
              "passed": false,
              "error": null
            }
          ]
        }
      ],
      "regressions": [
        "dpa-031",
        "msa-117"
      ]
    }
  • logs/eval-run-2026-11-20.log The candidate run behind last week's sheet: 1,240 calls, 37 model errors, 1,203 rows exported.
    2026-11-20T14:02:11Z eval run=ev-0412 model=candidate-2026-11 cases=1240 repetitions=1
    2026-11-20T14:09:37Z model error case=dpa-031 attempt=0 error="upstream timeout"
    2026-11-20T14:09:52Z model error case=dpa-044 attempt=0 error="upstream timeout"
    2026-11-20T14:21:05Z model error case=msa-388 attempt=0 error="rate limited"
    2026-11-20T14:31:40Z eval run=ev-0412 finished calls=1240 answered=1203 errors=37
    2026-11-20T14:32:02Z export sheet=candidate-vs-current.xlsx rows=1203
  • metrics/candidate-vs-current-2026-11-20.csv The sheet Legal Ops rejected: 1,203 of 1,240 questions, and an "ALL" row taken as the mean of the area rows.
    area,questions,correct,accuracy
    termination,214,201,0.939
    liability,256,226,0.883
    privacy,188,170,0.904
    payment,141,131,0.929
    confidentiality,233,218,0.936
    other,171,151,0.883
    ALL (mean of areas),1203,1097,0.912
Tickets · 3
  • TASK-201 Define the result record and implement one scorer at a time Reported by Priya (Model Quality)

    Expected msa-102 passes (case and spaces differ, both terms present). sow-008 fails ("Net-45" keeps its hyphen). Each result has pass_rate, consistent and attempts.

    Actual evaluate raises NotImplementedError: the report is not implemented yet.

  • TASK-202 Keep errors as failed attempts and aggregate overall and tag metrics Reported by Marco (Legal Ops)

    Expected total 6, accuracy 0.5 with dpa-031's timeout counted as a failed attempt; liability shows total 2, accuracy 0.5; msa-121 counts in both of its tags but once overall.

    Actual The only numbers today are the sheet's: 37 errored questions missing from the denominator and an overall row computed as the mean of the area rows.

  • TASK-203 Compare current outcomes with the previous run Reported by Dana (product)

    Expected regressions is ["dpa-031", "msa-117"]. sow-008 failed before too, and msa-099 is not in this run, so neither is listed.

    Actual Nothing lists regressions. Reviewers compared two sheets by eye and missed msa-117.

What you hand in
  • EvaluationRunner in evals/services/evaluation.py passing every public check through evaluate in evals/runner.py, including the follow-up when it arrives.
  • NOTES.md: the review report worked out by hand for samples/review-cases.json, and one line on why overall accuracy is not the mean of the tag rows.
  • Your answers to the interviewer's follow-up and the debrief questions.
How the work is judged
Breaking down the work
Settles the attempt and result records first, then one scorer, then aggregation, then regressions, each checked before the next.
Directing the assistant
Gives the assistant the normalization rule (NFKC, casefold, whitespace only) and the denominator rule in words, instead of "build an eval runner".
Checking the work
Works out samples/review-cases.json by hand, including the timeout and the two-tag case, and compares with the report.
Judging the assistant
Rejects generated code that drops errors, strips punctuation, averages tag accuracies or sorts by input order.
Correct result
All checks pass, including three repetitions and quarantine, with the exact report shape and six-decimal rates.
Explaining the work
Explains to a Legal Ops reader why the sheet's 91.2% and this report's numbers differ.
Trade-offs to discuss
  • Exact matching with light normalization versus a looser scorer that accepts "Net-45": fewer false failures, more false passes.
  • Three repetitions triple the cost of a run; what that buys in detecting flaky answers.
  • Counting a model timeout as a failure versus retrying it: what each says about the model versus the vendor.
How you are graded
  • Decomposition 15%
  • Prompting the assistant 15%
  • Verification 20%
  • Judgment about AI output 15%
  • Correctness 25%
  • Communication 10%

Scores use evidence from your session. A short or incomplete session may not provide enough evidence for every skill. See a sample scorecard

Interview guidance

I will review whether your numbers mean what their labels say. Use the AI assistant to build the runner, then walk me through a small report by hand.

  • AI is allowed and expected: your own Claude, OpenAI or Gemini key, or the free in-browser model.
  • You are graded on how you drive and check the AI, not on how much you prompt.
  • Run the checks; read what fails.
  • A new requirement will arrive partway through.
  • Too little AI use is reported as “not enough to grade”, never as a fail.
Debrief · 7 questions
  • What did you delegate to the AI, and why?
  • Name one AI suggestion you rejected or changed, and why.
  • Choose one block the AI helped write. Explain what each line does and which test verifies it.
  • What is still risky, and what would you test or ship next?
  • Why is the overall accuracy not the average of the tag accuracies?
  • How does a model exception affect the report and its denominator?
  • Which part of the generated aggregation did you verify by hand?