We present SWE-Lego, a supervised fine-tuning (SFT) recipe designed to achieve state-of-the-art performance in software engineering (SWE) issue resolving. SWE-Lego comprises three core building blocks:
0
7 commits
5 linked in READMEs
updated Feb 27, 2026
🤗 HF Dataset • 🤗 SWE-Lego-Qwen3-8B/32B • 🧑💻 Code • 📖 Paper
We present SWE-Lego, a supervised fine-tuning (SFT) recipe designed to achieve state-of-the-art performance in software engineering (SWE) issue resolving. SWE-Lego comprises three core building blocks:
Our fine-tuned models are trained exclusively with SFT from Qwen3-8B and Qwen3-32B. Their effectiveness is demonstrated on SWE-Bench-Verified:
We’ve open-sourced everything—our dataset, code, and training scripts, for everyone to progress on scaling and improving software engineering agents.
git clone https://github.com/SWE-Lego/SWE-Lego.git
conda create -n vllm python=3.12 -y
conda activate vllm
pip install vllm
You can refer to the Development Guide from Openhands.
cd SWE-Lego/OpenHands-0.53.0
conda create -n openhands python=3.12 -y
conda activate openhands
conda install -c conda-forge nodejs=24.4.1
conda install -c conda-forge poetry=2.1.4
pip install python-dateutil==2.9.0.post0
poetry run pip install datasets
make build
cd SWE-Lego/SWE-bench-4.0.4
conda create -n swebench python=3.12 -y
conda activate swebench
pip install -e .
cd SWE-Lego/LLaMA-Factory-0.9.4.dev0
conda create -n lf python=3.12 -y
conda activate lf
pip install torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cu128
pip install -e ".[torch,metrics,deepspeed,liger-kernel]" --no-build-isolation
# install flash-attn
wget https://github.com/Dao-AILab/flash-attention/releases/download/v2.8.3/flash_attn-2.8.3+cu12torch2.8cxx11abiFALSE-cp312-cp312-linux_x86_64.whl
pip install flash_attn-2.8.3+cu12torch2.8cxx11abiFALSE-cp312-cp312-linux_x86_64.whl
pip install wandb
We take the SWE-Lego-Qwen3-32B for an example.
bash scripts/swe_lego_qwen3_32b/serve_vllm.sh
bash scripts/swe_lego_qwen3_32b/infer.sh
bash scripts/swe_lego_qwen3_32b/eval.sh
Save the downloaded trajectories to LLaMA-Factory-0.9.4.dev0/data
import json
from datasets import load_dataset
datasets = [
{
"name": "SWE-Lego/SWE-Lego-Real-Data",
"filename": "swe_lego_real_data_resolved_trajectories.json"
},
{
"name": "SWE-Lego/SWE-Lego-Synthetic-Data",
"filename": "swe_lego_synthetic_data_resolved_trajectories.json"
}
]
for config in datasets:
ds = load_dataset(config["name"], split="resolved")
processed_ds = ds.select_columns(["instance_id", "messages"])
data_list = processed_ds.to_list()
with open(config["filename"], "w", encoding="utf-8") as f:
json.dump(data_list, f, ensure_ascii=False, indent=4)
print(f"Saved {len(data_list)} records to {config['filename']}")
bash scripts/swe_lego_qwen3_8b/sft.sh
bash scripts/swe_lego_qwen3_32b/sft.sh
The verifier training configs are:
LLaMA-Factory-0.9.4.dev0/examples/train_full/swe_lego_verifier_qwen3_8b.yamlLLaMA-Factory-0.9.4.dev0/examples/train_full/swe_lego_verifier_qwen3_30b_a3b.yamlswe_lego_real_data_trajectories_verifier (from SWE-Lego/SWE_Lego_real_data_Verifier)Training launch scripts:
scripts/swe_lego_verifier_qwen3_8b/sft.shscripts/swe_lego_verifier_qwen3_30b_a3b/sft.shRun from repo root:
bash scripts/swe_lego_verifier_qwen3_8b/sft.sh
bash scripts/swe_lego_verifier_qwen3_30b_a3b/sft.sh
For verifier inference format, follow the HF training set schema (SWE-Lego/SWE_Lego_real_data_Verifier) to build data as trajectory + patch + judge prompt.
You can convert raw trajectories with:
python LLaMA-Factory-0.9.4.dev0/tts/convert_trajectories_to_verifier.py \
--input /path/to/raw_trajectories.jsonl \
--output /path/to/verifier_input.jsonl
Inference launch scripts:
scripts/swe_lego_verifier_qwen3_8b/infer.shscripts/swe_lego_verifier_qwen3_30b_a3b/infer.shExample:
bash scripts/swe_lego_verifier_qwen3_8b/infer.sh /path/to/verifier_input.jsonl
bash scripts/swe_lego_verifier_qwen3_30b_a3b/infer.sh /path/to/verifier_input.jsonl
This project acknowledges the valuable contributions of the following open-source repositories:
Please cite our paper if you find the repo helpful in your work:
@misc{swelego,
title={SWE-Lego: Pushing the Limits of Supervised Fine-tuning for Software Issue Resolving},
author={Chaofan Tao and Jierun Chen and Yuxin Jiang and Kaiqi Kou and Shaowei Wang and Ruoyu Wang and Xiaohui Li and Sidi Yang and Yiming Du and Jianbo Dai and Zhiming Mao and Xinyu Wang and Lifeng Shang and Haoli Bai},
year={2026},
eprint={2601.01426},
archivePrefix={arXiv},
primaryClass={cs.SE},
url={https://arxiv.org/abs/2601.01426},
}
7 commits
We present SWE-Lego, a supervised fine-tuning (SFT) recipe designed to achieve state-of-the-art performance in software engineering (SWE) issue resolving. SWE-Lego comprises three core building blocks:
0
7 commits
5 linked in READMEs
updated Feb 27, 2026
🤗 HF Dataset • 🤗 SWE-Lego-Qwen3-8B/32B • 🧑💻 Code • 📖 Paper
We present SWE-Lego, a supervised fine-tuning (SFT) recipe designed to achieve state-of-the-art performance in software engineering (SWE) issue resolving. SWE-Lego comprises three core building blocks:
Our fine-tuned models are trained exclusively with SFT from Qwen3-8B and Qwen3-32B. Their effectiveness is demonstrated on SWE-Bench-Verified:
We’ve open-sourced everything—our dataset, code, and training scripts, for everyone to progress on scaling and improving software engineering agents.
git clone https://github.com/SWE-Lego/SWE-Lego.git
conda create -n vllm python=3.12 -y
conda activate vllm
pip install vllm
You can refer to the Development Guide from Openhands.
cd SWE-Lego/OpenHands-0.53.0
conda create -n openhands python=3.12 -y
conda activate openhands
conda install -c conda-forge nodejs=24.4.1
conda install -c conda-forge poetry=2.1.4
pip install python-dateutil==2.9.0.post0
poetry run pip install datasets
make build
cd SWE-Lego/SWE-bench-4.0.4
conda create -n swebench python=3.12 -y
conda activate swebench
pip install -e .
cd SWE-Lego/LLaMA-Factory-0.9.4.dev0
conda create -n lf python=3.12 -y
conda activate lf
pip install torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cu128
pip install -e ".[torch,metrics,deepspeed,liger-kernel]" --no-build-isolation
# install flash-attn
wget https://github.com/Dao-AILab/flash-attention/releases/download/v2.8.3/flash_attn-2.8.3+cu12torch2.8cxx11abiFALSE-cp312-cp312-linux_x86_64.whl
pip install flash_attn-2.8.3+cu12torch2.8cxx11abiFALSE-cp312-cp312-linux_x86_64.whl
pip install wandb
We take the SWE-Lego-Qwen3-32B for an example.
bash scripts/swe_lego_qwen3_32b/serve_vllm.sh
bash scripts/swe_lego_qwen3_32b/infer.sh
bash scripts/swe_lego_qwen3_32b/eval.sh
Save the downloaded trajectories to LLaMA-Factory-0.9.4.dev0/data
import json
from datasets import load_dataset
datasets = [
{
"name": "SWE-Lego/SWE-Lego-Real-Data",
"filename": "swe_lego_real_data_resolved_trajectories.json"
},
{
"name": "SWE-Lego/SWE-Lego-Synthetic-Data",
"filename": "swe_lego_synthetic_data_resolved_trajectories.json"
}
]
for config in datasets:
ds = load_dataset(config["name"], split="resolved")
processed_ds = ds.select_columns(["instance_id", "messages"])
data_list = processed_ds.to_list()
with open(config["filename"], "w", encoding="utf-8") as f:
json.dump(data_list, f, ensure_ascii=False, indent=4)
print(f"Saved {len(data_list)} records to {config['filename']}")
bash scripts/swe_lego_qwen3_8b/sft.sh
bash scripts/swe_lego_qwen3_32b/sft.sh
The verifier training configs are:
LLaMA-Factory-0.9.4.dev0/examples/train_full/swe_lego_verifier_qwen3_8b.yamlLLaMA-Factory-0.9.4.dev0/examples/train_full/swe_lego_verifier_qwen3_30b_a3b.yamlswe_lego_real_data_trajectories_verifier (from SWE-Lego/SWE_Lego_real_data_Verifier)Training launch scripts:
scripts/swe_lego_verifier_qwen3_8b/sft.shscripts/swe_lego_verifier_qwen3_30b_a3b/sft.shRun from repo root:
bash scripts/swe_lego_verifier_qwen3_8b/sft.sh
bash scripts/swe_lego_verifier_qwen3_30b_a3b/sft.sh
For verifier inference format, follow the HF training set schema (SWE-Lego/SWE_Lego_real_data_Verifier) to build data as trajectory + patch + judge prompt.
You can convert raw trajectories with:
python LLaMA-Factory-0.9.4.dev0/tts/convert_trajectories_to_verifier.py \
--input /path/to/raw_trajectories.jsonl \
--output /path/to/verifier_input.jsonl
Inference launch scripts:
scripts/swe_lego_verifier_qwen3_8b/infer.shscripts/swe_lego_verifier_qwen3_30b_a3b/infer.shExample:
bash scripts/swe_lego_verifier_qwen3_8b/infer.sh /path/to/verifier_input.jsonl
bash scripts/swe_lego_verifier_qwen3_30b_a3b/infer.sh /path/to/verifier_input.jsonl
This project acknowledges the valuable contributions of the following open-source repositories:
Please cite our paper if you find the repo helpful in your work:
@misc{swelego,
title={SWE-Lego: Pushing the Limits of Supervised Fine-tuning for Software Issue Resolving},
author={Chaofan Tao and Jierun Chen and Yuxin Jiang and Kaiqi Kou and Shaowei Wang and Ruoyu Wang and Xiaohui Li and Sidi Yang and Yiming Du and Jianbo Dai and Zhiming Mao and Xinyu Wang and Lifeng Shang and Haoli Bai},
year={2026},
eprint={2601.01426},
archivePrefix={arXiv},
primaryClass={cs.SE},
url={https://arxiv.org/abs/2601.01426},
}
7 commits