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

[Inference] Interrupted runs cannot be resumed — output file is overwritten on every start

Open DzmitryPihulski opened this issue 1 month ago • 1 comments

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 and output_file exists, load it, skip question_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 in llmsql/utils/inference_utils.py used by all backends.
  • Tests: an interrupted run followed by resume=True produces exactly one line per question.

DzmitryPihulski avatar Oct 05 '26 16:10 DzmitryPihulski

I'd like to take this one.

Plan, following the proposal in the issue:

  • New helper prepare_run() in llmsql/utils/inference_utils.py that owns the shared setup: resolve workdir, download/cached questions+tables, apply limit, 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 = False argument on each backend plus a --resume CLI flag. Without --resume nothing changes: the output file is still overwritten.
  • Tests: an interrupted run followed by resume=True produces exactly one line per question, plus unit tests for the helper.

I'll open a PR against this issue within the day.

ddaihao2022 avatar Oct 13 '26 15:10 ddaihao2022