Skip to content

Latest commit

 

History

History
130 lines (98 loc) · 6.33 KB

README.md

File metadata and controls

130 lines (98 loc) · 6.33 KB

🚥 Evaluation

Evaluate your model-agent combination on SWE-bench-Live.

Agent Rollout on SWE-bench-Live

The forked source codes of the agents we used to run SWE-bench-Live:

SWE-agent

OpenHands

ClaudeCode

Win-Agent (for windows tasks)

Example trajectories of the above agents on SWE-bench-Live:

SWE-Live-Trajectory-Archive

Run your model-agent combination on SWE-bench-Live

SWE-bench-Live evaluation strictly follows the original SWE-bench protocol:

  1. During a rollout, the agent may access only the problem_statement field of the Hugging Face dataset and the docker image of the task instance. It must not access any other fields, such as hint, FAIL_TO_PASS, or test_patch. The test_patch must not be applied to the repository before or during the rollout. The agent must perform a single rollout based solely on the problem_statement on the docker container started from the image of the task instance.
  2. Prompts, skills, and workflow instructions provided to the agent must not contain solutions specific to any task instance. They may contain only general instructions for the entire benchmark or, at most, for a specific repository. The agent must not use results from the ground-truth evaluation script to refine its solution. The agent must not access future commits and PRs published after the target issue to be resolved, and must not access oracle solution & test patches by git operations or searching on the target GitHub repo / Huggingface benchmark dataset on the Internet.

Compliant prompts should follow the SWE-agent prompt and the OpenHands prompt, which contain only the problem statement and general workflow instructions.

When submitting results to our submissions repository, you must include your agent's raw rollout trajectories so that the maintainers can verify compliance with the SWE-bench protocol. A trajectory consists of the complete sequence of exact inputs to and outputs from the LLM you use across all rollout rounds for a given task instance, including the initial prompt provided to the agent. Please follow this SWE-agent compliant trajectory example when submitting your result. If your organization's policies prohibit sharing the complete set of trajectories, you must provide at least 10 representative samples for verification. There is a checklist when submitting a PR to help you check whether you meet the protocol requirements again.

Collect patch diff of your agent

# unix
cd /testbed;
[ -d .git ] || { g=$(find . -maxdepth 2 -mindepth 2 -type d -name .git -print -quit); [ -n "$g" ] && cd "${g%/.git}"; } ;
git --no-pager diff HEAD  --text;
# win
cd C:\testbed;
if (-not (Test-Path .git)) { $g = Get-ChildItem -Directory -Recurse -Depth 2 -Force -ErrorAction SilentlyContinue | Where-Object { $_.Name -eq '.git' } | Select-Object -First 1; if ($g) { Set-Location $g.Parent.FullName } };
git --no-pager diff HEAD  --text;

Prediction patch file format:

{
    "instance_id1": {
        "model_patch": "git diff", 
        ...
    },
    "instance_id2": {
        "model_patch": "git diff", 
        ...
    },
    ...
}

Run gold patch

Note

Estimated resource for one instance: 4 CPUs with 16 GB RAM. For some large repos like C++ repos even 50GB RAM is required. Otherwise these large repos would go OOM and fail...

Though we have run tests 3 times during task creation to filter out unstable instances, tests may become invalid overtime, and users have reported that different tests may fail on different machines -- docker does not guarantee full isolation. For benchmarking and training we suggest running evaluation with gold patch three times to filter invalid instances. We allow success rate report with the dorminator the actual number of instances passed with gold patch on your machine at your experiment time.

# For windows if there are decoding issues: $env:PYTHONUTF8="1" ; $env:PYTHONIOENCODING="utf-8"

python -m evaluation.evaluation \
    --dataset SWE-bench-Live/SWE-bench-Live \
    # or SWE-bench-Live/MultiLang, SWE-bench-Live/Windows
    # or path to local dataset file like jsonl
    --split < refer to Huggingface SWE-bench-Live > \
    # if local jsonl file then ignore this field
    --platform linux \
    # or windows 
    --patch_dir gold \
    --output_dir logs/gold \
    --workers 10 \
    --overwrite 0 \
    # 0 for no and 1 for yes
    --start-month 2025-06 \
    --end-month 2025-07
    # default to oldest and newest if not specified

The still valid instances on your machine will be saved to logs/gold/gold_patch_evaluated_instances.jsonl, which is the actual subset you can use for benchmarking&training.

Evaluation of agent-predicted patches

# For windows if there are decoding issues: $env:PYTHONUTF8="1" ; $env:PYTHONIOENCODING="utf-8"

python -m evaluation.evaluation \
    --dataset SWE-bench-Live/SWE-bench-Live \
    # or SWE-bench-Live/MultiLang, SWE-bench-Live/Windows
    # or path to local dataset file like jsonl
    --split < refer to Huggingface SWE-bench-Live > \
    # if local jsonl file then ignore this field
    --platform linux \
    # or windows 
    --patch_dir <prediction-patch-file-path> \
    --output_dir logs/test \
    --workers 10 \
    --overwrite 0
    # 0 for no and 1 for yes

Docker images

Instance-level Docker images are hosted on DockerHub with name:

def get_default_image_name(instance_id: str, platform: Literal["windows", "linux"]) -> str:
    if platform == "linux":
        med = "x86_64"
    else:
        med = "win"
    name = instance_id.replace("__", "_1776_").lower()
    image = f"starryzhang/sweb.eval.{med}.{name}"
    return image