SWEbench User Guideο
SWE-bench is a benchmark for evaluating how well large language models solve real-world software issues collected from GitHub. Given a repository and an issue, the model is expected to generate a patch that fixes the described problem.
1. Feature Overviewο
ais_bench currently supports the following SWEbench capabilities:
Datasets:
full,verifiedγverified_mini,lite,multilingualTasks:
infer: callmini-swe-agentto generate patches (model_patch)eval: call the SWE-bench harness to run evaluation and count resolved instances
Result summary: output key metrics such as
accuracy,submitted_accuracy, andresolved_instances
Directory ais_bench/configs/swe_bench_examples/ provides the following example configs:
mini_swe_agent_swe_bench_lite.py: SWE-bench Lite (princeton-nlp/SWE-Bench_Lite) β commonly used for quick iterations.mini_swe_agent_swe_bench_verified.py: SWE-bench Verified (princeton-nlp/SWE-Bench_Verified, 500 instances) β a human-validated subset of the SWE-bench test set.mini_swe_agent_swe_bench_verified_mini.py: SWE-bench Verified Mini (MariusHobbhahn/swe-bench-verified-mini, 50 instances) β a community subset of Verified designed to be much cheaper to run; see the dataset card and the subset construction repo:https://huggingface.co/datasets/MariusHobbhahn/swe-bench-verified-miniandhttps://github.com/mariushobbhahn/make_swe_bench_verified_mini.mini_swe_agent_swe_bench_full.py: SWE-bench Full (princeton-nlp/SWE-Bench) β the full test set.mini_swe_agent_swe_bench_multilingual.py: SWE-bench Multilingual (SWE-bench/SWE-bench_Multilingual) β multilingual issue statements.mini_swe_agent_swe_bench_multilingual_mini.py: SWE-bench Multilingual Mini (15/30/60 instances) β an AISBench-constructed Multilingual subset designed to significantly reduce evaluation cost; see the dataset card and construction repository:https://modelers.cn/datasets/AISBench/SWE-Bench_Multilingual_miniandhttps://github.com/AISBench/datasets/tree/main/mini_datasets/swe_bench_multiligual_mini.
2. Prerequisitesο
Before running, make sure the following dependencies are available:
Install
mini-swe-agent(required for infer)
git clone https://github.com/AISBench/mini-swe-agent.git
cd mini-swe-agent
pip install -e .
cd -
Install the SWE-bench harness (required for eval)
git clone https://github.com/SWE-bench/SWE-bench.git
cd SWE-bench
pip install -e .
cd -
Docker is available (both infer and eval depend on containerized environments)
docker --version
docker ps
On ARM hosts, enable Docker x86 emulation (binfmt):
docker run --rm --privileged tonistiigi/binfmt --install all
3. Minimal Configuration (Run First, Tune Later)ο
It is recommended to start from mini_swe_agent_swe_bench_lite.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",
type="LiteLLMChat",
model="qwen3",
api_key="EMPTY",
url="http://127.0.0.1:8000/v1",
batch_size=1,
generation_kwargs=dict(),
)
]
Dataset Path Notesο
In the example configs, path="" by default, which means online loading from Hugging Face is preferred.
You can keep
path=""to fetch data online directlyFor offline usage, change
pathto a local parquet file or directory (supportsdata/<split>-*.parquet)
First-Run Recommendationsο
Start with the
litedatasetUse
batch_size=1Keep
step_limit=200(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_examples/mini_swe_agent_swe_bench_lite.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_examples/mini_swe_agent_swe_bench_lite.py -m infer
# Evaluate based on existing predictions
ais_bench ais_bench/configs/swe_bench_examples/mini_swe_agent_swe_bench_lite.py -m eval
Resume from Checkpointο
Use --reuse to skip completed instances, which is useful after interruptions:
ais_bench ais_bench/configs/swe_bench_examples/mini_swe_agent_swe_bench_lite.py -m infer --reuse
5. How to Read Outputsο
The default output directory is outputs/default/<timestamp>/. Focus on:
Inference outputs:
predictions/swebench/swebench_*.jsonEach
instance_idcontainsmodel_patch
Evaluation outputs:
results/swebench/swebench_*.jsonKey fields:
accuracy:resolved_instances / total_instancessubmitted_accuracy:resolved_instances / submitted_instancesresolved_instances/unresolved_instances/error_instancesharness_exit_code: harness exit code
6. Common Issues and Troubleshooting (SWEB Error Codes)ο
The following error codes come from SWEB_CODES. You can also refer to the full FAQ:
FAQ:
docs/source_en/faqs/error_codes.md
1) SWEB-DEPENDENCY-001: Missing mini-swe-agentο
Symptom: infer fails to start with dependency import errors
Cause:
mini-swe-agentis not installedFix: run
pip install mini-swe-agent
2) SWEB-DEPENDENCY-002: Missing SWE-bench harnessο
Symptom: harness import error during eval
Cause: SWE-bench is not installed, or not visible in the current environment
Fix: install SWE-bench as described in βPrerequisitesβ, and make sure you are using the same Python environment
3) SWEB-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
4) SWEB-DATA-002 / SWEB-FILE-003: Dataset loading failureο
Symptom: online loading fails, or local parquet files cannot be found
Cause:
Online mode: network or Hugging Face access issues
Local mode:
pathdoes not exist, or directory layout does not match split parquet rules
Fix:
Switch to local parquet if online loading fails
Ensure local path follows:
<root>/data/test-*.parquetor<root>/test-*.parquet
5) SWEB-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) SWEB-RUNTIME-001 / SWEB-RUNTIME-002: Container or harness runtime failureο
Symptom: Docker image pull failure, or evaluation runtime errors
Cause: unavailable images, network issues, or insufficient container runtime environment
Fix:
Check
docker psfirstVerify images can be pulled from Docker Hub (for example:
docker pull swebench/sweb.eval.x86_64.astropy_1776_astropy-6938:latest)Retry with
--reuseto avoid recomputing completed instances
7. Advanced Tips (Optional)ο
For initial debugging, use
litefirst, then switch toverified/fullafter the pipeline is stableTo reduce empty patches, prioritize improving model capability and agent prompt templates
During evaluation, focus on
empty_patch_instancesanderror_instances; they are often more actionable thanaccuracyin early iterations