llmsql-benchmark icon indicating copy to clipboard operation
llmsql-benchmark copied to clipboard

[Evaluation] Accuracy is computed over the predictions file, not the benchmark (missing/duplicate/unknown ids)

Open DzmitryPihulski opened this issue 1 month ago • 1 comments

Problem

evaluate() computes accuracy as matches / len(outputs), i.e. over whatever predictions are in the file, not over the benchmark:

  • A file with 1,000 answers out of 80,330 (crashed run, --limit, a filtered file) gets a full-looking accuracy and no warning, so partial runs are easy to report as full results.
  • Duplicate question_ids are counted twice.
  • An unknown question_id crashes the whole evaluation with a bare KeyError (questions[qid] in evaluate_sample).
  • String ids (e.g. "123", which other tools commonly produce) fail an assert isinstance(qid, int); asserts also disappear under python -O.

Proposal

  • Report coverage in the summary and JSON report: answered, expected (number of benchmark questions), missing, duplicates; warn clearly when coverage < 100%.
  • Keep the first prediction per question_id (warn on duplicates).
  • Accept ids that are int-like strings; raise a clear ValueError naming the unknown id instead of KeyError; replace asserts with explicit errors.
  • Optionally an accuracy_over_benchmark field (missing = wrong) next to the current accuracy.
  • Tests for partial, duplicated, unknown and string-id inputs.

DzmitryPihulski avatar Oct 05 '26 16:10 DzmitryPihulski

Taking this one — working on it now.

ddaihao2022 avatar Oct 09 '26 15:10 ddaihao2022