--- license: apache-2.0 task_categories: - text-generation language: - en tags: - code-review - software-engineering - swe-bench - agentic - trajectories - sft pretty_name: SWE-Review-Traj size_categories: - 1K

**8,914 decision-correct agentic code review trajectories** for training open-source code review models. Each trajectory captures a full multi-turn review session where an AI agent explores a repository, traces the root cause of a bug, and produces a structured review decision — all verified against executable test suites. [**Project Page**](https://swe-lego.github.io/SWE-Review/) | [**Paper**](https://arxiv.org/abs/2607.06065) | [**Code**](https://github.com/SWE-Lego/SWE-Review) | [**Benchmark**](https://huggingface.co/datasets/SWE-Lego/SWE-Review-Bench) | [**Training Data**](https://huggingface.co/datasets/SWE-Lego/SWE-Review-Traj) | [**Claude Code Plugin**](https://github.com/SWE-Lego/cc-swe-review) ## About SWE-Review **SWE-Review** is a framework for closing the issue-resolution loop with agentic code review. A reviewer agent independently explores the repository, traces the root cause, and compares its own diagnosis against the submitted PR — turning one-shot patch generation into an iterative generate-review-revise loop that raises resolve rates by up to +29.4 percentage points on SWE-bench Verified. ## Data Collection Pipeline ``` SWE-rebench (~6K instances) → Patchgen (3 models) → 14,156 candidate PRs → Teacher Review (GLM-5, agentic) → Decision-Correct Filtering → 8,914 trajectories ``` ### Step 1: Candidate PR Generation Three models generate patches for ~6,000 SWE-rebench instances (**no overlap** with SWE-Review-Bench to prevent data leakage): | Patchgen Model | Trajectories | |----------------|-------------| | GLM-5-FP8 | 3,056 | | Qwen3-Coder-30B-A3B-Instruct | 2,991 | | Qwen3-30B-A3B-Instruct-2507 | 2,867 | ### Step 2: Teacher Review Open-weight **GLM-5 with thinking enabled** reviews each PR agentically via OpenHands-SDK. The review prompt enforces **independent reconstruction**: the reviewer must trace the root cause from the issue description and repository *before* examining the candidate patch, preventing confirmation bias. ### Step 3: Decision-Correct Filtering Only trajectories where the reviewer's decision matches ground truth are retained: - **Approve** a patch that actually resolves the issue ✓ - **Request changes** on a patch that does not resolve the issue ✓ ### Quality Validation - **Semantic quality**: Two independent judges (Claude Opus 4.6, GPT-5.4) rate diagnosis quality. Mean overall score >3.0/5. Cohen's κ = 0.72 (substantial inter-judge agreement). - **Functional quality**: Diagnoses carry actionable information beyond the binary decision — revision RRR rises from 3% (no review) → 8% (decision only) → **21% (teacher review)** → 32% (oracle). ## Training Value Review trajectories are not only useful for training reviewers — they also improve code generation when mixed with issue-resolution data: | Training Data (Qwen3-8B) | RR (one-shot fix) | Loop RRR (self-review + revise) | |---------------------------|------|------| | Issue-resolution 2k | 31.2% | 31.2% | | **+ Review 2k** | **36.8%** (+5.6pp) | **41.8%** (+10.6pp) | | Issue-resolution 3k | 34.0% | 34.0% | | **+ Review 3k** | **37.8%** (+3.8pp) | **41.2%** (+7.2pp) | Mixed training simultaneously improves one-shot resolve rate and enables self-contained generate-review-revise loops within a single model. ## Usage ### Load the Dataset ```python from datasets import load_dataset import json ds = load_dataset("SWE-Lego/SWE-Review-Traj", split="train") print(f"Total trajectories: {len(ds)}") # Inspect a trajectory traj = ds[0] print(f"Instance: {traj['pr_instance_id']}") print(f"Decision: {traj['decision']} (confidence: {traj['confidence']:.2f})") print(f"Turns: {traj['turns']}") print(f"Patch resolved: {traj['patch_resolved']}") ``` ### Train with LLaMA-Factory The `messages` field is in **ShareGPT format** — directly compatible with LLaMA-Factory: ```python import json ds = load_dataset("SWE-Lego/SWE-Review-Traj", split="train") sft_data = [json.loads(row["messages"]) for row in ds] with open("swe_review_traj.json", "w") as f: json.dump(sft_data, f) ``` Then register in `dataset_info.json` and train with LLaMA-Factory. See the [training guide](https://github.com/SWE-Lego/SWE-Review/tree/main/scripts/train) for complete instructions. ### Access Judge Scores 4,548 trajectories include dual-judge quality scores: ```python traj = ds[0] if traj["judge_gpt54"]: scores = json.loads(traj["judge_gpt54"]) print(f"Diagnosis accuracy: {scores['diagnosis_accuracy']}/5") print(f"Suggestion correctness: {scores['suggestion_correctness']}/5") print(f"Overall: {scores['overall_score']}/5") ``` ## Schema | Field | Type | Description | |-------|------|-------------| | `pr_instance_id` | string | PR instance identifier | | `issue_instance_id` | string | Issue instance identifier | | `repo` | string | GitHub repository | | `problem_statement` | string | GitHub issue description | | `patchgen_model` | string | Model that generated the candidate PR | | `model_patch` | string | Candidate patch (unified diff) | | `patch_resolved` | bool | Whether the patch resolves the issue | | `messages` | string (JSON) | Full conversation in ShareGPT format | | `tools` | string (JSON) | Tool definitions used during review | | `turns` | int | Number of conversation turns | | `teacher_model` | string | Teacher model used for review | | `decision` | string | `approve` or `request_changes` | | `confidence` | float | Reviewer confidence (0.0–1.0) | | `report_json` | string (JSON) | Structured review report | | `judge_gpt54` | string (JSON) | GPT-5.4 quality scores (null if not evaluated) | | `judge_opus46` | string (JSON) | Claude Opus 4.6 quality scores (null if not evaluated) | ### Judge Score Fields Each judge JSON contains: | Field | Range | Description | |-------|-------|-------------| | `diagnosis_accuracy` | 1–5 | Correctness of root-cause identification | | `suggestion_correctness` | 1–5 | Correctness of suggested fixes | | `grounding_quality` | 1–5 | Whether suggestions reference specific code locations | | `overall_score` | 1–5 | Overall review quality | | `verdict` | 1–5 | Alignment with ground-truth resolution status | ## Citation ```bibtex @misc{wang2026swereview, title={SWE-Review: Closing the Loop on Issue Resolution with Agentic Code Review}, author={Ruoyu Wang and Jierun Chen and Shaowei Wang and Chaofan Tao and Sidi Yang and Yuxin Jiang and Kim-Hui Yap and Lifeng Shang and Xiaohui Li and Haoli Bai}, year={2026}, eprint={2607.06065}, archivePrefix={arXiv}, primaryClass={cs.SE}, url={https://arxiv.org/abs/2607.06065} } ```