bugger.
All challenges/Pythonmediumai-evaluation-batches-v1
THE INVESTIGATION

The evaluation score that changes with batch size

The same recorded model responses receive different scores when batched differently, and failed calls disappear from the denominator.

Applied AIEvaluationsMetricsRecorded responses

What’s going wrong

Original Applied AI lab. Recorded model outputs are represented by constructed fixtures. There are no live model calls or subjective LLM judges.

An AI release dashboard reports a different exact-match score after the team changes evaluation batch size. The example IDs, expected labels and recorded outputs are unchanged. Some model errors also vanish from the quality denominator, making an unreliable model appear better. Repair summarize to measure the specified per-example contract rather than the shape of execution batches.

Read {"batches":[[{"id":"q1","expected":"yes","actual":"yes","status":"ok"}], ...]}. There are 0 to 64 batches, each containing 0 to 64 examples. IDs are unique nonempty strings across the entire input. expected is a string of at most 128 characters. status is "ok" or "error"; actual is a string of at most 128 characters when status is ok, and null when status is error. Inputs satisfy this contract. Empty strings are valid labels. Exact match is case-sensitive and whitespace-sensitive; do not trim, case-fold or parse labels.

Every listed example counts once in the denominator, including model errors. An example earns one point only if status is ok and actual equals expected exactly. An error earns zero points and increments failed. Print {"score":0.75,"examples":4,"failed":0}, where examples is the number of all listed examples, failed is the number of error examples, and score is correct examples divided by all examples using Python round(value, 6). With no examples return score=null, examples=0 and failed=0. Empty batches have no effect. Preserve the result under arbitrary repartitioning or reordering of the same examples. Use only the Python standard library.

Expected behavior

Compute a per-example exact-match score that counts failed calls as zero and stays unchanged when identical examples are regrouped into batches.

Reproduction

Execution evidence

Recorded response fixtures · replay

Constructed recorded-response fixtures for exact-match evaluation. The responses stay fixed while only batch boundaries change.

  1. 01Dataset
    Four fixed examples: q1, q2 and q3 match; q4 does not. No model is called during this replay.
  2. 02Partition A
    Batch sizes [3,1], batch scores [1.0,0.0]. Starter aggregate=0.5.
  3. 03Partition B
    Batch size [4], batch score [0.75]. Starter aggregate=0.75.
  4. 04Failure accounting
    An error response has no output label but remains an attempted evaluation example. Check whether it survives the scoring denominator.
Explain your repair before submitting

Which observation contradicts the intended behavior? Where does the code break that contract? Explain why your change fixes the cause and which new regression case would detect it.

This evidence describes the starter. Use Run to observe your current code; Submit checks additional regressions. No live model calls are made.

01 A short failing batch must not outweigh three matches
{"batches":[[{"id":"q1","expected":"yes","actual":"yes","status":"ok"},{"id":"q2","expected":"yes","actual":"yes","status":"ok"},{"id":"q3","expected":"yes","actual":"yes","status":"ok"}],[{"id":"q4","expected":"yes","actual":"no","status":"ok"}]]}
{"score":0.75,"examples":4,"failed":0}
02 The same observations in one batch have the same score
{"batches":[[{"id":"q1","expected":"yes","actual":"yes","status":"ok"},{"id":"q2","expected":"yes","actual":"yes","status":"ok"},{"id":"q3","expected":"yes","actual":"yes","status":"ok"},{"id":"q4","expected":"yes","actual":"no","status":"ok"}]]}
{"score":0.75,"examples":4,"failed":0}
03 A model error remains in the quality denominator
{"batches":[[{"id":"q1","expected":"yes","actual":"yes","status":"ok"},{"id":"q2","expected":"yes","actual":null,"status":"error"}]]}
{"score":0.5,"examples":2,"failed":1}

Before you begin

  • Python loops, dictionaries and exact string comparison
  • The difference between averaging examples and averaging batch means
  • Evaluation failures belong to an explicit scoring contract

Need a nudge?

Reveal one investigation hint at a time. Try each clue before opening the next.

    The bug is intentional. Run the starter code to see it fail, then work toward a fix. Difficulty is provisional.
    Read-only preview
    Ready when you are
    Every fix starts with a failing test.

    Read the report, then sign in to start your investigation.