Skip to content

feat: swe bench scorer#342

Open
tianmu-li wants to merge 33 commits into
mlcommons:mainfrom
tianmu-li:feat/swe_bench_scorer
Open

feat: swe bench scorer#342
tianmu-li wants to merge 33 commits into
mlcommons:mainfrom
tianmu-li:feat/swe_bench_scorer

Conversation

@tianmu-li

@tianmu-li tianmu-li commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds SWE-bench accuracy evaluation to the agentic inference workflow (per #310). A new SWEBench dataset loads SWE-bench_Verified/_Lite, and SWEBenchScorer drives the eval by shelling out to mini-swe-agent and the swebench harness in an isolated uv subproject, bypassing the built-in accuracy phase.

Agent-run parallelism (extras.workers) defaults to the load pattern's target_concurrency when unset. Includes example configs, an optional Qwen tool-call patch, and docs.

Type of change

  • New feature
  • Documentation update

Related issues

Closes #310

Testing

  • Tests added/updated
  • All tests pass locally
  • Manual testing completed

Checklist

  • Code follows project style
  • Pre-commit hooks pass
  • Documentation updated

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for SWE-bench accuracy evaluation by adding a new accuracy-only SWEBench dataset, a SWEBenchScorer that runs evaluations using mini-swe-agent in an isolated environment, and associated configuration templates, tests, and runbooks. Feedback on the changes focuses on improving the robustness of the SWEBenchScorer implementation, specifically by safely handling missing or null values when parsing configuration templates, benchmark configurations, and evaluation results, as well as gracefully handling cases where the Docker binary is missing from the system's PATH during preflight checks.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/inference_endpoint/evaluation/scoring.py Outdated
Comment thread src/inference_endpoint/evaluation/scoring.py Outdated
Comment thread src/inference_endpoint/evaluation/scoring.py Outdated
Comment thread src/inference_endpoint/evaluation/scoring.py Outdated
@tianmu-li
tianmu-li force-pushed the feat/swe_bench_scorer branch 2 times, most recently from aa7f559 to bb9b307 Compare June 15, 2026 05:16
@tianmu-li
tianmu-li marked this pull request as ready for review June 21, 2026 17:28
@tianmu-li
tianmu-li requested review from a team and Copilot June 21, 2026 17:28
@tianmu-li tianmu-li changed the title WIP feat: swe bench scorer feat: swe bench scorer Jun 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class SWE-bench accuracy support to the benchmarking system by introducing an external (subprocess-driven) scorer and a predefined SWE-bench dataset, plus wiring in config/schema handling and examples to run the workflow.

Changes:

  • Introduces SWEBenchScorer (external evaluation via uv run --project ... mini-extra + swebench harness) and integrates it into the scoring/benchmark lifecycle (preflight, phase skipping, reporting).
  • Adds predefined swe_bench dataset with caching + an ACCURACY_ONLY guard to prevent using it as a performance dataset.
  • Updates schema/templates/examples and adds unit tests for the scorer + dataset + benchmark wiring.

Reviewed changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
uv.lock Locks pyyaml as a direct dependency.
pyproject.toml Adds pyyaml==6.0.3 to runtime dependencies.
src/inference_endpoint/evaluation/scoring.py Adds scorer preflight hooks, shared subprocess logging helper, and new SWEBenchScorer implementation.
src/inference_endpoint/dataset_manager/predefined/swe_bench/init.py Adds SWE-bench predefined dataset with HF download + parquet cache and ACCURACY_ONLY=True.
src/inference_endpoint/dataset_manager/dataset.py Introduces Dataset.ACCURACY_ONLY class flag.
src/inference_endpoint/dataset_manager/init.py Exposes/imports SWEBench dataset.
src/inference_endpoint/config/schema.py Adds swe_bench_scorer to ScorerMethod and injects concurrency → SWE-bench workers default.
src/inference_endpoint/commands/benchmark/execute.py Runs scorer preflight(), prevents accuracy-only datasets as perf, skips endpoint phases for external scorers, and improves sample counting/reporting.
src/inference_endpoint/config/templates/online_template_full.yaml Documents swe_bench_scorer as an accuracy scorer option.
src/inference_endpoint/config/templates/offline_template_full.yaml Documents swe_bench_scorer as an accuracy scorer option.
src/inference_endpoint/config/templates/concurrency_template_full.yaml Documents swe_bench_scorer as an accuracy scorer option.
examples/10_Agentic_Inference/swebench_template.yaml Adds a SWE-bench/mini-swe-agent config template used by the external scorer.
examples/10_Agentic_Inference/swe_bench_accuracy.yaml Adds a runnable example config for SWE-bench external accuracy evaluation.
examples/10_Agentic_Inference/README.md Documents how to sync/run the SWE-bench accuracy subproject.
examples/10_Agentic_Inference/qwen_agentic_benchmark.yaml Adds SWE-bench accuracy dataset to an agentic benchmark example.
examples/10_Agentic_Inference/kimi_agentic_benchmark.yaml Adds SWE-bench accuracy dataset to an agentic benchmark example.
examples/10_Agentic_Inference/accuracy/RUNBOOK.md Adds an ops runbook for validating the SWE-bench accuracy pipeline.
examples/10_Agentic_Inference/accuracy/pyproject.toml Adds isolated uv subproject deps for SWE-bench evaluation tooling.
tests/unit/evaluation/test_swe_bench_scorer.py Adds unit coverage for scorer behavior, config patching, and preflight.
tests/unit/dataset_manager/test_swe_bench_dataset.py Adds unit coverage for dataset registration, caching, and subset mapping.
tests/unit/commands/test_benchmark.py Adds tests for concurrency→workers injection, ACCURACY_ONLY enforcement, preflight propagation, and phase skipping behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/inference_endpoint/evaluation/scoring.py Outdated
Comment thread src/inference_endpoint/evaluation/scoring.py Outdated
Comment thread src/inference_endpoint/dataset_manager/predefined/swe_bench/__init__.py Outdated
Copilot AI review requested due to automatic review settings June 21, 2026 23:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 20 out of 21 changed files in this pull request and generated 7 comments.

Comment thread src/inference_endpoint/evaluation/scoring.py Outdated
Comment thread src/inference_endpoint/evaluation/scoring.py Outdated
Comment thread src/inference_endpoint/evaluation/scoring.py Outdated
Comment thread src/inference_endpoint/evaluation/scoring.py Outdated
Comment thread examples/10_Agentic_Inference/swebench_template.yaml
Comment thread examples/10_Agentic_Inference/README.md Outdated
Comment thread examples/10_Agentic_Inference/swe_bench_accuracy.yaml Outdated
Copilot AI review requested due to automatic review settings June 25, 2026 13:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 22 changed files in this pull request and generated 2 comments.

Comment thread examples/10_Agentic_Inference/accuracy/RUNBOOK.md Outdated
Comment thread examples/10_Agentic_Inference/qwen_agentic_benchmark.yaml Outdated
Copilot AI review requested due to automatic review settings July 6, 2026 18:13
@tianmu-li
tianmu-li force-pushed the feat/swe_bench_scorer branch from 8d66f43 to ae04494 Compare July 6, 2026 18:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 25 changed files in this pull request and generated 3 comments.

Comment thread src/inference_endpoint/commands/benchmark/execute.py Outdated
Comment thread src/inference_endpoint/commands/benchmark/execute.py Outdated
Comment thread src/inference_endpoint/evaluation/scoring.py Outdated
@codecov-commenter

codecov-commenter commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.35821% with 156 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@e060c0e). Learn more about missing BASE report.

Files with missing lines Patch % Lines
.../inference_endpoint/evaluation/swe_bench_scorer.py 82.35% 72 Missing ⚠️
...uation/swebench_service/swebench_service/runner.py 88.61% 32 Missing ⚠️
...uation/swebench_service/swebench_service/server.py 90.40% 26 Missing ⚠️
...on/swebench_service/swebench_service/qwen_tools.py 79.20% 21 Missing ⚠️
...c/inference_endpoint/commands/benchmark/execute.py 96.72% 2 Missing ⚠️
src/inference_endpoint/config/schema.py 96.72% 2 Missing ⚠️
...ion/swebench_service/swebench_service/artifacts.py 97.72% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #342   +/-   ##
=======================================
  Coverage        ?   81.31%           
=======================================
  Files           ?      143           
  Lines           ?    18981           
  Branches        ?        0           
=======================================
  Hits            ?    15434           
  Misses          ?     3547           
  Partials        ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI review requested due to automatic review settings July 6, 2026 22:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 25 changed files in this pull request and generated 3 comments.

Comment thread src/inference_endpoint/evaluation/scoring.py Outdated
Comment thread src/inference_endpoint/evaluation/scoring.py Outdated
Comment thread src/inference_endpoint/evaluation/scoring.py Outdated
Copilot AI review requested due to automatic review settings July 9, 2026 22:09
@tianmu-li
tianmu-li force-pushed the feat/swe_bench_scorer branch from da45a99 to fe442f8 Compare July 9, 2026 22:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 25 changed files in this pull request and generated 2 comments.

Comment thread examples/10_Agentic_Inference/accuracy/actions_toolcall.py
Comment thread examples/10_Agentic_Inference/accuracy/actions_toolcall.py
Copilot AI review requested due to automatic review settings July 9, 2026 23:10
Copilot AI review requested due to automatic review settings July 17, 2026 16:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 38 out of 40 changed files in this pull request and generated 2 comments.

Comment thread src/inference_endpoint/commands/benchmark/execute.py
Comment thread src/inference_endpoint/config/schema.py
Copilot AI review requested due to automatic review settings July 20, 2026 17:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 38 out of 40 changed files in this pull request and generated 1 comment.

Comment thread src/inference_endpoint/evaluation/scoring.py Outdated
Copilot AI review requested due to automatic review settings July 20, 2026 17:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 39 out of 41 changed files in this pull request and generated 2 comments.

Comment thread src/inference_endpoint/commands/benchmark/execute.py
Comment thread src/inference_endpoint/evaluation/swebench_service/swebench_service/runner.py Outdated
Copilot AI review requested due to automatic review settings July 20, 2026 18:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 39 out of 41 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

src/inference_endpoint/evaluation/swebench_service/swebench_service/qwen_tools.py:193

  • isinstance(view_range, list | tuple) will raise TypeError at runtime because isinstance doesn’t accept PEP604 union types. This breaks the str_replace_editor view-range path (and should also fail the added unit tests). Use a tuple of types instead.
            if command == "view":
                view_range = args.get("view_range")
                if view_range is not None:
                    if not isinstance(view_range, list | tuple) or len(view_range) != 2:
                        errors.append(

Copilot AI review requested due to automatic review settings July 20, 2026 19:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 39 out of 41 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (3)

examples/10_Agentic_Inference/README.md:253

  • The note about TestMode.PERF “skipping accuracy datasets” is incorrect per the current benchmark behavior (e.g. _load_datasets(..., TestMode.PERF) still loads accuracy datasets and runs scorer preflight in tests/unit/commands/test_benchmark.py:734+). This sentence should instead explain that --mode acc is used to skip the performance phase and run only the SWE-bench accuracy workflow.
`--mode acc` is required because `type: online` configs default to
`TestMode.PERF`, which skips accuracy datasets.

src/inference_endpoint/evaluation/swebench_service/swebench_service/templates/swebench_template.yaml:20

  • The <IMPORTANT> tag is closed as </important> (case mismatch). If downstream tooling/prompt parsing depends on these tags, this can break parsing or reduce instruction reliability.
    src/inference_endpoint/evaluation/swebench_service/swebench_service/templates/swebench_qwen_tools_template.yaml:20
  • Same <IMPORTANT>/</important> case mismatch as in the default template; worth fixing for consistency and to avoid any tag-sensitive prompt processing issues.
    <IMPORTANT>This is an interactive process where you will think and issue AT LEAST ONE command, see the result, then think and issue your next command(s).</important>

Comment thread examples/10_Agentic_Inference/accuracy/RUNBOOK.md Outdated
Comment thread examples/10_Agentic_Inference/README.md Outdated
Comment thread src/inference_endpoint/evaluation/swebench_service/README.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 42 out of 44 changed files in this pull request and generated 3 comments.

Comment thread tests/unit/evaluation/swebench_service/test_server.py Outdated
Comment thread tests/unit/evaluation/swebench_service/test_runner.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 42 out of 44 changed files in this pull request and generated 2 comments.

Comment on lines 354 to 358
for acc_cfg in accuracy_cfgs:
scorer_cls, extractor_cls = _resolve_accuracy_components(
acc_cfg.name, acc_cfg.accuracy_config
)
assert acc_cfg.accuracy_config is not None
Comment on lines +141 to +151
if (
parsed.scheme not in {"http", "https"}
or not parsed.netloc
or parsed.hostname is None
or parsed.path not in {"", "/"}
or parsed.params
or parsed.query
or parsed.fragment
):
raise SetupError(message)
return parsed._replace(path="/", params="", query="", fragment="").geturl()
@tianmu-li

Copy link
Copy Markdown
Collaborator Author

@arekay-nv I've addressed the comments. Appreciate if you could take another look

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 42 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

src/inference_endpoint/evaluation/swebench_service/swebench_service/qwen_tools.py:193

  • isinstance(view_range, list | tuple) will raise TypeError at runtime (isinstance doesn't accept PEP 604 union types). This breaks the str_replace_editor view_range validation path and will surface as an unhandled exception instead of a FormatError.

Use a normal tuple of types for the check.

                if view_range is not None:
                    if not isinstance(view_range, list | tuple) or len(view_range) != 2:
                        errors.append(

@tianmu-li

Copy link
Copy Markdown
Collaborator Author

Also reverted a previous change that made perf (default) runs execute accuracy eval when accuracy config is present. Default mode should probably be --mode both and runs whatever config is specified in .yaml file, but that's out of this PR's scope.

Comment on lines +38 to +45
settings:
runtime:
min_duration_ms: 0
max_duration_ms: 36000000

load_pattern:
type: agentic_inference
target_concurrency: 8 # Submission-specific concurrency.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/tianmu-li/endpoints/blob/e9c1a6a82ce999f3162c3574e48ce38bc99c8493/examples/10_Agentic_Inference/kimi_agentic_benchmark.yaml#L44-L46

  client:
    warmup_connections: 0
    max_idle_time: 0.5

I saw that Kimi's yaml has this warmup connection settings but Qwen does not, from the code, it looks like this will create a HTTP connection that "warms up" the connection from Endpoint client to the LLM server but does not seem to do much in this case. Kimi effectively does not send any request for this. I believe this should be the same for Qwen as well.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is to bypass some port/connection limit issue that Harshil faced during experiments. I haven't run into this issue from my end, hence not specifying them for Qwen to keep the example yaml minimal.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 42 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

src/inference_endpoint/commands/benchmark/execute.py:1579

  • This get_raw_outputs() call can be triggered for external scorers (SKIP_ENDPOINT_PHASE=True, e.g. SWEBenchScorer) even though they don’t score endpoint outputs. That can cause an unnecessary scan of events.jsonl (often with an empty UUID bound) and noisy warnings in ACC-only external runs where events.jsonl may not exist. Consider skipping the whole response_counts/OSL block for external scorers.
                    out_df = scorer_instance.get_raw_outputs(accuracy_uuids)

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.

[Feature]: SWE-bench using mini-swe-agent

6 participants