LearnQuestion bank

Write a small eval harness: load a JSONL dataset, call a model concurrently under a rate limit, apply code-based and judge-based graders, cache results and print a per-slice report.

Applied LLMCodingMedium

Theme reported publicly: Google DeepMind, Mistral AI

Answer it yourself first, out loud or on paper, then compare.

Answer

Model answer, written in a candidate's voice

In short

  • Define small interfaces: DatasetItem, ModelClient, Grader, ResultStore, and a RunConfig with model, prompt version, params, and slice
  • Run async with a semaphore for concurrency plus a token bucket for the rate limit, per-call timeouts, and exponential backoff with jitter on 429/5xx
  • Cache by sha256 of model, prompt version, parameters, and input hash; persist results and resume by skipping cache hits
  • Keep deterministic ordering by sorting items by stable id and emitting results sorted by slice and id
  • Use exact/regex/schema graders plus a judge grader that records judge model, prompt, and rationale
  • Aggregate per slice with n, pass rate, mean score, and confidence intervals such as Wilson for pass rates and bootstrap/t intervals for numeric scores

In full

I would start with narrow interfaces: a dataset loader yields DatasetItem(id, slice, input, expected, metadata), a ModelClient exposes async generate(prompt, params), a Grader exposes grade(item, output) returning score, pass, and reason, and a ResultStore persists and loads results keyed by a stable run identity. The runner sorts items by id, uses asyncio.Semaphore to cap concurrency and a small token-bucket limiter to enforce the requests-per-minute limit, wraps each call in a timeout, and retries 429/5xx with exponential backoff plus jitter and a max retry count, recording failures rather than silently dropping them. The cache key is a hash of model name, prompt version, decoding parameters, and the canonicalised input, and results are written atomically so a rerun can load prior entries and only execute misses; output is sorted by slice and id so reports are reproducible. Graders are code-based for exact match, regex, and JSON schema validation, plus a judge grader for open-ended outputs that uses a separate judge model with a fixed rubric and records judge model, prompt version, and rationale. The report groups by slice and prints n, pass rate, mean score, cache-hit rate, and confidence intervals, using Wilson intervals for pass rates and bootstrap or t-intervals for numeric scores, with enough detail to inspect failures. I would keep the harness small and explicit: no hidden retries, no unversioned prompts, and no aggregates without n and intervals.

Corrected by an independent AI reviewer.

What a strong answer covers

  • Clear interfaces for dataset, client, grader and result store
  • Async with a semaphore; exponential backoff with jitter on 429/5xx; timeouts
  • Cache keyed by model, prompt version, parameters and input hash; deterministic result ordering; resumable runs
  • Graders: exact/regex/schema checks and a judge grader; per-slice aggregates with confidence intervals

Common mistakes

  • No retry/rate-limit handling so the run dies midway
  • cache key without prompt version