# ldcye/swe-bench architecture

> Architecture diagram of the GitHub repository ldcye/swe-bench, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ldcye/swe-bench
- Repository: https://github.com/ldcye/swe-bench

## Overview

SWE-bench is a benchmark toolkit: it collects and publishes software-issue tasks, builds their reproducible Docker environments, and evaluates model patches against tests. The principal user flow is selecting a dataset and predictions (or gold patches), preparing images, running each task in containers, grading test logs, and saving a report; users may then package and publish results. Separate capabilities support inference and training-data preparation. Relationships below use README workflows and SOURCE INDEX references; unsampled implementation details are represented only where documented.

Main entry points: [`swebench/harness/run_evaluation.py`](https://github.com/ldcye/swe-bench/blob/main/swebench/harness/run_evaluation.py) (Evaluation runner), [`swebench/cli/submit.py`](https://github.com/ldcye/swe-bench/blob/main/swebench/cli/submit.py) (Submission commands), [`swebench/cli/cli.py`](https://github.com/ldcye/swe-bench/blob/main/swebench/cli/cli.py) (Command interface), [`swebench/image_builder/prepare_images.py`](https://github.com/ldcye/swe-bench/blob/main/swebench/image_builder/prepare_images.py) (Image preparation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tasks["Task data"]
  node_dataset_cli["Dataset commands<br/>[dataset.py]"]
  node_collection["Task collection"]
  node_task_repo[("Task repository<br/>[repo.py]")]
  node_task_checks["Task validation<br/>[checks.py]"]
  node_task_publish["Dataset and image publishing<br/>[publish.py]"]
end

subgraph group_images["Image building"]
  node_image_cli["Image commands<br/>[images.py]"]
  node_image_prepare["Image preparation<br/>[prepare_images.py]"]
  node_image_spec["Image specifications<br/>[image_spec.py]"]
  node_image_build["Docker image builds<br/>[docker_build.py]"]
  node_docker_registry[("Docker registry")]
end

subgraph group_eval["Evaluation"]
  node_eval_cli["Evaluation commands<br/>[evaluate.py]"]
  node_eval_runner["Evaluation runner<br/>[run_evaluation.py]"]
  node_container_runtime["Docker containers"]
  node_grading["Test grading<br/>[grading.py]"]
  node_log_parsers["Language log parsers"]
  node_reporting["Run reports<br/>[reporting.py]"]
end

subgraph group_models["Inference and data"]
  node_infer_cli["Inference commands<br/>[infer.py]"]
  node_inference["Model inference<br/>[run_api.py]"]
  node_training_data["Training data preparation"]
end

subgraph group_results["Results and submission"]
  node_submit_cli["Submission commands<br/>[submit.py]"]
  node_package["Package evaluation run<br/>[package.py]"]
  node_publish["Publish submission<br/>[publish.py]"]
  node_register["Register leaderboard entry<br/>[register.py]"]
  node_verify["Verify submission<br/>[verify.py]"]
end

node_user(("Benchmark user"))
node_cli["Command interface<br/>[cli.py]"]
node_github[("GitHub repositories")]
node_huggingface[("Hugging Face datasets")]

node_user -->|"runs commands"| node_cli
node_cli -->|"starts evaluation"| node_eval_cli
node_cli -->|"manages images"| node_image_cli
node_cli -->|"starts inference"| node_infer_cli
node_cli -->|"submits results"| node_submit_cli
node_user -->|"checks task repo"| node_dataset_cli
node_collection -->|"creates tasks"| node_task_repo
node_dataset_cli -->|"validates repo"| node_task_checks
node_task_publish -->|"checks repo"| node_task_checks
node_task_publish -->|"reads tasks"| node_task_repo
node_task_publish -->|"publishes datasets"| node_huggingface
node_image_cli -->|"builds images"| node_image_prepare
node_image_prepare -->|"selects tasks"| node_task_repo
node_image_prepare -->|"creates specs"| node_image_spec
node_image_prepare -->|"builds specs"| node_image_build
node_image_build -.->|"pushes images"| node_docker_registry
node_eval_cli -->|"runs evaluation"| node_eval_runner
node_eval_runner -->|"runs task tests"| node_container_runtime
node_eval_runner -->|"loads task data"| node_task_repo
node_eval_runner -->|"prepares images"| node_image_prepare
node_eval_runner -->|"grades logs"| node_grading
node_grading -->|"parses test output"| node_log_parsers
node_eval_runner -->|"writes reports"| node_reporting
node_infer_cli -->|"generates predictions"| node_inference
node_user -->|"prepares training data"| node_training_data
node_submit_cli -->|"packages run"| node_package
node_package -->|"re-grades results"| node_grading
node_submit_cli -->|"publishes artifacts"| node_publish
node_publish -->|"reads package"| node_package
node_publish -->|"pushes artifacts"| node_github
node_submit_cli -->|"registers entry"| node_register
node_register -->|"reads package"| node_package
node_register -->|"updates entry"| node_github
node_submit_cli -->|"checks submission"| node_verify
node_verify -->|"checks artifacts"| node_package
node_submit_cli -->|"uploads eval results"| node_huggingface

click node_cli "https://github.com/ldcye/swe-bench/blob/main/swebench/cli/cli.py"
click node_dataset_cli "https://github.com/ldcye/swe-bench/blob/main/swebench/cli/dataset.py"
click node_collection "https://github.com/ldcye/swe-bench/blob/main/swebench/collect/get_tasks_pipeline.py"
click node_task_repo "https://github.com/ldcye/swe-bench/blob/main/swebench/task/repo.py"
click node_task_checks "https://github.com/ldcye/swe-bench/blob/main/swebench/task/checks.py"
click node_task_publish "https://github.com/ldcye/swe-bench/blob/main/swebench/task/publish.py"
click node_image_cli "https://github.com/ldcye/swe-bench/blob/main/swebench/cli/images.py"
click node_image_prepare "https://github.com/ldcye/swe-bench/blob/main/swebench/image_builder/prepare_images.py"
click node_image_spec "https://github.com/ldcye/swe-bench/blob/main/swebench/image_builder/image_spec.py"
click node_image_build "https://github.com/ldcye/swe-bench/blob/main/swebench/image_builder/docker_build.py"
click node_eval_cli "https://github.com/ldcye/swe-bench/blob/main/swebench/cli/evaluate.py"
click node_eval_runner "https://github.com/ldcye/swe-bench/blob/main/swebench/harness/run_evaluation.py"
click node_grading "https://github.com/ldcye/swe-bench/blob/main/swebench/harness/grading.py"
click node_log_parsers "https://github.com/ldcye/swe-bench/tree/main/swebench/harness/log_parsers"
click node_reporting "https://github.com/ldcye/swe-bench/blob/main/swebench/harness/reporting.py"
click node_infer_cli "https://github.com/ldcye/swe-bench/blob/main/swebench/cli/infer.py"
click node_inference "https://github.com/ldcye/swe-bench/blob/main/swebench/inference/run_api.py"
click node_training_data "https://github.com/ldcye/swe-bench/tree/main/swebench/inference/make_datasets"
click node_submit_cli "https://github.com/ldcye/swe-bench/blob/main/swebench/cli/submit.py"
click node_package "https://github.com/ldcye/swe-bench/blob/main/swebench/submit/package.py"
click node_publish "https://github.com/ldcye/swe-bench/blob/main/swebench/submit/publish.py"
click node_register "https://github.com/ldcye/swe-bench/blob/main/swebench/submit/register.py"
click node_verify "https://github.com/ldcye/swe-bench/blob/main/swebench/submit/verify.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dataset_cli,node_collection,node_task_repo,node_task_checks,node_task_publish,node_user toneBlue
class node_image_cli,node_image_prepare,node_image_spec,node_image_build,node_docker_registry,node_github,node_huggingface toneAmber
class node_eval_cli,node_eval_runner,node_container_runtime,node_grading,node_log_parsers,node_reporting toneMint
class node_infer_cli,node_inference,node_training_data toneRose
class node_submit_cli,node_package,node_publish,node_register,node_verify toneIndigo
class node_cli toneTeal
```

## Components

### Task data

- [Dataset commands](https://github.com/ldcye/swe-bench/blob/main/swebench/cli/dataset.py): `swebench/cli/dataset.py`
- [Task collection](https://github.com/ldcye/swe-bench/blob/main/swebench/collect/get_tasks_pipeline.py): `swebench/collect/get_tasks_pipeline.py`
- [Task repository](https://github.com/ldcye/swe-bench/blob/main/swebench/task/repo.py): `swebench/task/repo.py`
- [Task validation](https://github.com/ldcye/swe-bench/blob/main/swebench/task/checks.py): `swebench/task/checks.py`
- [Dataset and image publishing](https://github.com/ldcye/swe-bench/blob/main/swebench/task/publish.py): `swebench/task/publish.py`

### Image building

- [Image commands](https://github.com/ldcye/swe-bench/blob/main/swebench/cli/images.py): `swebench/cli/images.py`
- [Image preparation](https://github.com/ldcye/swe-bench/blob/main/swebench/image_builder/prepare_images.py): `swebench/image_builder/prepare_images.py`
- [Image specifications](https://github.com/ldcye/swe-bench/blob/main/swebench/image_builder/image_spec.py): `swebench/image_builder/image_spec.py`
- [Docker image builds](https://github.com/ldcye/swe-bench/blob/main/swebench/image_builder/docker_build.py): `swebench/image_builder/docker_build.py`
- **Docker registry**

### Evaluation

- [Evaluation commands](https://github.com/ldcye/swe-bench/blob/main/swebench/cli/evaluate.py): `swebench/cli/evaluate.py`
- [Evaluation runner](https://github.com/ldcye/swe-bench/blob/main/swebench/harness/run_evaluation.py): `swebench/harness/run_evaluation.py`
- **Docker containers**
- [Test grading](https://github.com/ldcye/swe-bench/blob/main/swebench/harness/grading.py): `swebench/harness/grading.py`
- [Language log parsers](https://github.com/ldcye/swe-bench/tree/main/swebench/harness/log_parsers): `swebench/harness/log_parsers`
- [Run reports](https://github.com/ldcye/swe-bench/blob/main/swebench/harness/reporting.py): `swebench/harness/reporting.py`

### Inference and data

- [Inference commands](https://github.com/ldcye/swe-bench/blob/main/swebench/cli/infer.py): `swebench/cli/infer.py`
- [Model inference](https://github.com/ldcye/swe-bench/blob/main/swebench/inference/run_api.py): `swebench/inference/run_api.py`
- [Training data preparation](https://github.com/ldcye/swe-bench/tree/main/swebench/inference/make_datasets): `swebench/inference/make_datasets`

### Results and submission

- [Submission commands](https://github.com/ldcye/swe-bench/blob/main/swebench/cli/submit.py): `swebench/cli/submit.py`
- [Package evaluation run](https://github.com/ldcye/swe-bench/blob/main/swebench/submit/package.py): `swebench/submit/package.py`
- [Publish submission](https://github.com/ldcye/swe-bench/blob/main/swebench/submit/publish.py): `swebench/submit/publish.py`
- [Register leaderboard entry](https://github.com/ldcye/swe-bench/blob/main/swebench/submit/register.py): `swebench/submit/register.py`
- [Verify submission](https://github.com/ldcye/swe-bench/blob/main/swebench/submit/verify.py): `swebench/submit/verify.py`

### Other components

- **Benchmark user**
- [Command interface](https://github.com/ldcye/swe-bench/blob/main/swebench/cli/cli.py): `swebench/cli/cli.py`
- **GitHub repositories**
- **Hugging Face datasets**

## Connections

- Benchmark user → Command interface: runs commands
- Command interface → Evaluation commands: starts evaluation
- Command interface → Image commands: manages images
- Command interface → Inference commands: starts inference
- Command interface → Submission commands: submits results
- Benchmark user → Dataset commands: checks task repo
- Task collection → Task repository: creates tasks (evidence: `swebench/collect/get_tasks_pipeline.py`)
- Dataset commands → Task validation: validates repo
- Dataset and image publishing → Task validation: checks repo (evidence: `swebench/task/publish.py`)
- Dataset and image publishing → Task repository: reads tasks (evidence: `swebench/task/publish.py`)
- Dataset and image publishing → Hugging Face datasets: publishes datasets (evidence: `swebench/task/publish.py`)
- Image commands → Image preparation: builds images (evidence: `swebench/cli/images.py`)
- Image preparation → Task repository: selects tasks (evidence: `swebench/image_builder/prepare_images.py`)
- Image preparation → Image specifications: creates specs (evidence: `swebench/image_builder/prepare_images.py`)
- Image preparation → Docker image builds: builds specs (evidence: `swebench/image_builder/prepare_images.py`)
- Docker image builds → Docker registry: pushes images
- Evaluation commands → Evaluation runner: runs evaluation
- Evaluation runner → Docker containers: runs task tests
- Evaluation runner → Task repository: loads task data (evidence: `swebench/harness/run_evaluation.py`)
- Evaluation runner → Image preparation: prepares images (evidence: `swebench/harness/run_evaluation.py`)
- Evaluation runner → Test grading: grades logs (evidence: `swebench/harness/run_evaluation.py`)
- Test grading → Language log parsers: parses test output (evidence: `swebench/harness/grading.py`)
- Evaluation runner → Run reports: writes reports (evidence: `swebench/harness/run_evaluation.py`)
- Inference commands → Model inference: generates predictions
- Benchmark user → Training data preparation: prepares training data
- Submission commands → Package evaluation run: packages run (evidence: `swebench/cli/submit.py`)
- Package evaluation run → Test grading: re-grades results (evidence: `swebench/submit/package.py`)
- Submission commands → Publish submission: publishes artifacts (evidence: `swebench/cli/submit.py`)
- Publish submission → Package evaluation run: reads package (evidence: `swebench/submit/publish.py`)
- Publish submission → GitHub repositories: pushes artifacts (evidence: `swebench/submit/publish.py`)
- Submission commands → Register leaderboard entry: registers entry (evidence: `swebench/cli/submit.py`)
- Register leaderboard entry → Package evaluation run: reads package (evidence: `swebench/submit/register.py`)
- Register leaderboard entry → GitHub repositories: updates entry (evidence: `swebench/submit/register.py`)
- Submission commands → Verify submission: checks submission (evidence: `swebench/cli/submit.py`)
- Verify submission → Package evaluation run: checks artifacts (evidence: `swebench/submit/verify.py`)
- Submission commands → Hugging Face datasets: uploads eval results
