Skip to content

Let ResponseBatchScorer grade batches of responses in one call - #573

Open
alok-108 wants to merge 2 commits into
allenai:mainfrom
alok-108:feat/response-batch-scorer
Open

alok-108 wants to merge 2 commits into
allenai:mainfrom
alok-108:feat/response-batch-scorer

Conversation

@alok-108

Copy link
Copy Markdown

Fixes #392.

Description

Adds ResponseBatchScorer so scorers whose reference protocol grades multiple responses per call (such as charxiv_descriptive, which groups responses by question template id qid and grades 5 triplets per GPT-4o call) are fed deterministic batches of responses by both Task.score_responses and the async runner (runners/asynq/results.py), leaving the existing per-response Scorer path untouched.

What changed

  • ResponseBatchScorer contract (src/olmo_eval/common/scorers/execution.py, src/olmo_eval/common/scorers/__init__.py):
    • Added ResponseBatchScorer(Scorer) with requires_async = True, configurable batch_size: int | None = None (None grades an entire bucket together), optional batch_key(response) -> Hashable for grouping responses before batching, and abstract ascore_batch(responses, context).
  • Task scoring integration (src/olmo_eval/evals/tasks/common/base.py):
    • Updated Task._has_async_scorers, added Task._get_response_batch_scorers, and updated Task.score_responses / Task._apply_scorers_async to group responses by scorer.batch_key(response), chunk by scorer.batch_size, run scorer.ascore_batch bounded by ScoringContext.scoring_concurrency, support both single-output and multi-output score sequences, and record structured per-output scoring_errors on failure without aborting other batches or losing sync scorer results.
  • Runner batch streaming (src/olmo_eval/runners/asynq/results.py):
    • Updated process_results to buffer incoming responses for tasks with ResponseBatchScorer using an instance-order watermark cursor (skipping restored and hard-failed instances without stalling), dispatching score_batch_and_store as soon as a bucket reaches batch_size and flushing partial remainder batches when all instances for the task have arrived, while keeping the existing per-response score_and_store path unchanged for all other tasks.
  • CharXiv migration (src/olmo_eval/evals/vision/scoring/judges.py, src/olmo_eval/evals/vision/benchmarks/charxiv.py):
    • Migrated CharxivJudgeScorer to ResponseBatchScorer (batch_size=5 grouped by qid for charxiv_descriptive, batch_size=1 for charxiv_reasoning), honoring cache_dir, cache_only, and recompute while removing the bespoke score_responses overrides from CharxivDescriptiveTask and CharxivReasoningTask. Under the async runner, charxiv_descriptive now batches up to 5 same-template questions per GPT call (~800 calls on the 4,000-instance split instead of 4,000).
  • Tests (tests/core/test_response_batch_scorer.py, tests/evals/vision/test_charxiv.py):
    • Added unit tests for ResponseBatchScorer chunking, batch_key grouping, batch_size=None, multi-output scores, batch error isolation, deterministic instance-order runner batching across out-of-order worker arrivals, hard-failure/restored-instance skipping, and CharxivDescriptiveTask / CharxivReasoningTask batch grading.

Affected results

  • charxiv_descriptive: When run via the async runner (process_results), descriptive grading now batches up to 5 responses sharing the same template qid per GPT-4o call in instance order (matching the official CharXiv evaluation protocol and direct Task.score_responses(all_responses) calls), rather than issuing 1 question per GPT call. Task hashes (3aba511be7d9025f and b362f8d52bd06cee) are unchanged.

Type of Change

  • Bug fix
  • New feature
  • Refactoring (no functional changes)

Validation

Executed on Windows (win32, Python 3.13.1, commit 928ae66f9d28391afb9fb9c53f302f59b181e556) using uv run --frozen --no-sync --no-group vllm --extra clients --extra litellm --extra agents:

  • uv run --frozen --no-sync --no-group vllm --extra clients --extra litellm --extra agents ruff check src/ tests/ and ruff format --check src/ tests/ — passed (All checks passed!, 757 files already formatted)
  • uv run --frozen --no-sync --no-group vllm --extra clients --extra litellm --extra agents ty check --python-platform linux src/ — passed (All checks passed!)
  • ./scripts/check_file_sizes.sh — passed (All 1164 tracked files are within 1.00 MB.)
  • uv build — built source distribution and wheel cleanly
  • Focused suite (tests/core/test_response_batch_scorer.py, tests/evals/vision/, tests/evals/tasks/test_base.py, tests/evals/tasks/test_task_hashes.py, tests/runners/, tests/common/test_scoring_time.py, --ignore=tests/runners/test_resume.py) — 568 passed, 4 skipped
  • Cross-platform test sweep (tests/common, tests/core, tests/evals, tests/harness, tests/inference, tests/providers, tests/runners, tests/cli/test_{arg_round_trip,dotlist_overrides,harness_overrides,output_dir_default,utils}.py, tests/cli/beaker/test_{example_configs,sglang_install}.py, tests/test_package.py, tests/test_readme.py, tests/test_runner.py, excluding the Windows-incompatible POSIX/pexpect.spawn/os.O_DIRECTORY/Unix-PATH files listed under Remaining work) — 4336 passed, 23 skipped
  • New tests added for new behavior (tests/core/test_response_batch_scorer.py, tests/evals/vision/test_charxiv.py)

Remaining work

  • Full Linux CI (uv run pytest tests/ --ignore=tests/integration -v) and Docker integration tests (tests/integration/) need to run on GitHub Actions Linux runners; on Windows, POSIX/Linux-specific test modules (test_http_command.py, test_http_session.py, test_owned_docker_deployment.py, test_sandbox_executor.py, test_terminal_bench_external.py, test_livecodebench.py, test_ruler_plus.py, test_vllm_server_startup.py, test_resume.py, test_results_upload.py[sigterm], tests/data/, tests/upload/, tests/scripts/, tests/cli/beaker/test_{build_image_script,launch,resume_access,upload_wiring}.py) were excluded or skipped.

@alok-108
alok-108 requested a review from a team as a code owner November 17, 2026 16:43

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ResponseBatchScorer: let a scorer grade a batch of responses in one call

1 participant