llmsql-benchmark
llmsql-benchmark copied to clipboard
[Inference] Interrupted runs cannot be resumed — output file is overwritten on every start
Problem
All inference backends (inference_transformers, inference_vllm, inference_api, inference_function) call overwrite_jsonl(output_file) at start, even though results are appended to the file batch by batch. If a full run (~80k questions, hours on GPU or many API calls) crashes at 70%, there is no way to continue: rerunning wipes the partial file and starts from zero.
The download / limit / output-file setup code is also copy-pasted across the four backends, so any fix has to be made four times.
Proposal
- Add
resume: bool = False(CLI:--resume). When set andoutput_fileexists, load it, skipquestion_ids already present, and append only the missing ones. Without--resume, keep the current overwrite behaviour. - Move the shared setup (download questions/tables, apply
limit, prepare output, filter already-done ids) into one helper inllmsql/utils/inference_utils.pyused by all backends. - Tests: an interrupted run followed by
resume=Trueproduces exactly one line per question.
I'd like to take this one.
Plan, following the proposal in the issue:
- New helper
prepare_run()inllmsql/utils/inference_utils.pythat owns the shared setup: resolve workdir, download/cached questions+tables, applylimit, prepare the output file, and drop question ids that are already present when resuming. - All four backends (
inference_transformers,inference_vllm,inference_api,inference_function) call it, so the copy-pasted block disappears and the behaviour is fixed in one place. - New
resume: bool = Falseargument on each backend plus a--resumeCLI flag. Without--resumenothing changes: the output file is still overwritten. - Tests: an interrupted run followed by
resume=Trueproduces exactly one line per question, plus unit tests for the helper.
I'll open a PR against this issue within the day.