llmsql-benchmark
llmsql-benchmark copied to clipboard
[Evaluation] Accuracy is computed over the predictions file, not the benchmark (missing/duplicate/unknown ids)
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_idcrashes the whole evaluation with a bareKeyError(questions[qid]inevaluate_sample). - String ids (e.g.
"123", which other tools commonly produce) fail anassert isinstance(qid, int); asserts also disappear underpython -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
ValueErrornaming the unknown id instead ofKeyError; replace asserts with explicit errors. - Optionally an
accuracy_over_benchmarkfield (missing = wrong) next to the current accuracy. - Tests for partial, duplicated, unknown and string-id inputs.
Taking this one — working on it now.