SWE-Bench Pro User Guideο
SWE-Bench Pro is a challenging benchmark evaluating LLMs/Agents on long-horizon software engineering tasks. Given a repository and an issue, the model is expected to generate a patch that fixes the described problem.
Note: Since the official Docker images are all x86 architecture, SWE-bench Pro currently only supports evaluation on x86 environments. ARM environments are not supported.
1. Feature Overviewο
ais_bench currently supports the following SWE-Bench Pro capabilities:
Datasets:
full,miniTasks:
infer: callmini-swe-agentto generate patches (model_patch)eval: call the SWE-bench Pro harness to run evaluation and count resolved instances
Result summary: output key metrics such as
accuracyandeval_resolved_instances_num
Directory ais_bench/configs/swe_bench_pro_examples/ provides the following example configs:
mini_swe_agent_swe_bench_pro_mini.py: SWE-bench Pro Mini β commonly used for quick iterations.mini_swe_agent_swe_bench_pro_full.py: SWE-bench Pro Full β the full test set.
2. Prerequisitesο
Before running, make sure the following dependencies are available:
Install
mini-swe-agent(required for infer)
Note: SWE-Bench Pro official organization scaleapi has adapted mini-swe-agent. You need to download the adapted version from scaleapiβs repository.
# Clone mini-swe-agent repository
git clone https://github.com/scaleapi/mini-swe-agent.git
# Enter the project directory
cd mini-swe-agent/
# Install dependencies
pip install -e .
# Return to parent directory
cd -
Install
SWE-Bench_Pro(required for infer and eval)
# Clone SWE-Bench_Pro repository
git clone https://github.com/scaleapi/SWE-bench_Pro-os.git
# Enter the project directory
cd SWE-bench_Pro-os/
# Install dependencies
pip install -r requirements.txt
# Return to parent directory
cd -
Docker is available (both infer and eval depend on containerized environments)
docker --version
docker ps
3. Minimal Configuration (Run First, Tune Later)ο
It is recommended to start from mini_swe_agent_swe_bench_pro_mini.py and only modify the three fields in models[0]:
model: model name (required)url: model service endpoint (OpenAI-compatible API)api_key: service key (useEMPTYfor local services)
Example (local vLLM setup):
models = [
dict(
attr="local",
abbr="swebench_pro_mini_module",
type="LiteLLMChat",
model="qwen3",
api_key="EMPTY",
url="http://127.0.0.1:8000/v1",
batch_size=4,
generation_kwargs=dict(),
)
]
Dataset Path Notesο
Different datasets have different loading methods:
full dataset: Supports both online loading from Hugging Face and local loading
Online loading: keep
path=""Local loading: set
pathto local parquet file or directory
mini dataset: Must be prepared locally in advance, cannot be fetched online
Download URL:
https://modelers.cn/datasets/AISBench/SWE-Bench_Pro_miniRecommended format: parquet
Set
pathto the locally downloaded parquet file or directory
SWEBP Scripts and Docker Directory Configurationο
SWE-Bench Pro evaluation must specify the following two paths. There is no default behavior:
swebp_scripts_dir: Absolute path to therun_scriptsdirectory of the SWE-bench Pro official repositoryswebp_docker_dir: Absolute path to thedockerfilesdirectory of the SWE-bench Pro official repository
SWEBP_SCRIPT_PATH_ABS = "{your_work_dir}/SWE-bench_Pro-os/run_scripts" # Must be specified
SWEBP_DOCKER_PATH_ABS = "{your_work_dir}/SWE-bench_Pro-os/dockerfiles" # Must be specified
Note: You need to clone the SWE-bench Pro official repository first:
git clone https://github.com/scaleapi/SWE-bench_Pro-os.git
First-Run Recommendationsο
Start with the
minidatasetUse
batch_size=4(each instance creates a container; large batch_size may cause host OOM)Keep
step_limit=250(default in examples; do not change initially)
4. Run Commandsο
Run the following in the repository root (config is the config file path):
ais_bench ais_bench/configs/swe_bench_pro_examples/mini_swe_agent_swe_bench_pro_mini.py
The command above runs the full pipeline (all). You can also run it step by step:
# Inference only, generate predictions
ais_bench ais_bench/configs/swe_bench_pro_examples/mini_swe_agent_swe_bench_pro_mini.py -m infer
# Evaluate based on existing predictions
ais_bench ais_bench/configs/swe_bench_pro_examples/mini_swe_agent_swe_bench_pro_mini.py -m eval
Resume from Checkpointο
Use --reuse to skip completed instances, which is useful after interruptions:
ais_bench ais_bench/configs/swe_bench_pro_examples/mini_swe_agent_swe_bench_pro_mini.py -m infer --reuse
5. How to Read Outputsο
The default output directory is outputs/default/<timestamp>/. The directory structure is as follows:
Inference Outputs (predictions)ο
βββ predictions
β βββ swebench_pro_mini_model
β βββ swebench_pro_mini_data
β β βββ exit_statuses.yaml # Exit status statistics for all instances
β β β
β β βββ instance_gravitational__teleport-xxx # Directory for instance xxx
β β β βββ instance_gravitational__teleport-xxx.config.yaml
β β β βββ instance_gravitational__teleport-xxx.debug.log
β β β βββ instance_gravitational__teleport-xxx.info.log
β β β βββ instance_gravitational__teleport-xxx.pred
β β β βββ instance_gravitational__teleport-xxx.traj.json
β β β
β β βββ instance_qutebrowser__qutebrowser-yyy # Directory for instance yyy
β β βββ instance_qutebrowser__qutebrowser-yyy.config.yaml
β β βββ instance_qutebrowser__qutebrowser-yyy.debug.log
β β βββ instance_qutebrowser__qutebrowser-yyy.info.log
β β βββ instance_qutebrowser__qutebrowser-yyy.pred
β β βββ instance_qutebrowser__qutebrowser-yyy.traj.json
β β
β βββ swebench_pro_mini_data.json # Final inference results
Evaluation Outputs (results)ο
βββ results
β βββ swebench_pro_mini_model
β β βββ instance_gravitational__teleport-xxx # Directory for instance xxx
β β β βββ swebench_pro_mini_data_entryscript.sh
β β β βββ swebench_pro_mini_data_output.json
β β β βββ swebench_pro_mini_data_patch.diff
β β β βββ swebench_pro_mini_data_stderr.log
β β β βββ swebench_pro_mini_data_stdout.log
β β β βββ workspace
β β β
β β βββ instance_qutebrowser__qutebrowser-yyy # Directory for instance yyy
β β βββ swebench_pro_mini_data_entryscript.sh
β β βββ swebench_pro_mini_data_output.json
β β βββ swebench_pro_mini_data_patch.diff
β β βββ swebench_pro_mini_data_stderr.log
β β βββ swebench_pro_mini_data_stdout.log
β β βββ workspace
β β
β βββ swebench_pro_mini_model_swebench_pro_mini_data_report.json # Final evaluation report
Key Fields in Evaluation Reportο
{
"total_instances_num": 2, // Number of dataset instances
"total_prediction_num": 2, // Number of inference results
"build_patch_instances_num": 2, // Number of instances that successfully generated patches within the step limit
"empty_patch_instances_num": 0, // Number of instances with empty patches (failed to complete within step limit)
"eval_resolved_instances_num": 1, // Number of instances evaluated as "resolved"
"eval_unresolved_instances_num": 1, // Number of instances evaluated as "unresolved"
"empty_patch_instances_ids": [], // Instance IDs that failed to complete within step limit
"unresolved_instances_ids": [
"instance_gravitational__teleport-xxx" // Instance IDs evaluated as "unresolved"
],
"accuracy": 50.0 // Final evaluation accuracy
}
6. Common Issues and Troubleshooting (SWEBP Error Codes)ο
The following error codes come from SWEBP_CODES. You can also refer to the full FAQ:
FAQ:
docs/source_en/faqs/error_codes.md
1) SWEBP-DEPENDENCY-001: Missing mini-swe-agentο
Symptom: infer fails to start with dependency import errors
Cause:
mini-swe-agentis not installedFix: install the adapted version from scaleapiβs repository as described in the Prerequisites section
2) SWEBP-PARAM-001: Empty model configurationο
Symptom: prompt indicates model is not configured
Cause:
models[0]['model']is empty or only whitespaceFix: configure
model/url/api_key, and ensuremodelis non-empty at minimum
3) SWEBP-PARAM-002: Invalid dataset nameο
Symptom: prompt indicates dataset name is not supported
Cause:
nameis not in the supported setfull,miniFix: set dataset
nameto one of the supported values
4) SWEBP-DATA-001: Dataset loading failureο
Symptom: online loading fails, or local files cannot be found
Cause:
Online mode: network or Hugging Face access issues (full dataset only)
Local mode:
pathdoes not exist, or file format is not supported
Fix:
For full dataset: switch to local parquet file if online loading fails
For mini dataset: ensure it has been downloaded from
https://modelers.cn/datasets/AISBench/SWE-Bench_Pro_mini
5) SWEBP-FILE-001: Predictions file not foundο
Symptom:
-m evalreports missing predictionsCause: infer was not run first, or work_dir/reuse points to a different location
Fix: run
-m inferfirst, and ensure eval and infer use the same config/output directory
6) SWEBP-RUNTIME-001 / SWEBP-RUNTIME-002: Container or harness runtime failureο
Symptom: Docker image pull failure, or evaluation runtime errors
Cause: unavailable images, network issues, insufficient container runtime environment, or host OOM due to insufficient memory
Fix:
Check
docker psfirstVerify images can be pulled from Docker Hub
If host memory is insufficient, reduce
batch_size(recommended <= 4)Retry with
--reuseto avoid recomputing completed instances
7. Advanced Tips (Optional)ο
For initial debugging, use
minifirst, then switch tofullafter the pipeline is stableTo reduce empty patches, prioritize improving model capability and agent prompt templates
During evaluation, focus on
empty_patch_instances_idsandunresolved_instances_ids; they are often more actionable thanaccuracyin early iterationsSWE-Bench Pro uses Docker images for evaluation; ensure stable network for faster image pulling
Control
batch_sizecarefully to avoid container exit due to host memory exhaustion