SWE-Refactor: A Repository-Aware Benchmark for Evaluating LLMs on Real-World Code Refactoring
SWE-Refactor SWE-Refactor is a new benchmark for evaluating LLM-based code refactoring. It contains 1099 real-world, pure refactorings collected from 18 Java projects. Each refactoring instance is verif
SWE-Refactor
SWE-Refactor is a new benchmark for evaluating LLM-based code refactoring. It contains 1099 real-world, pure refactorings collected from 18 Java projects.
Each refactoring instance is verified through:
- Compilation
- Test execution
- Automated refactoring detection tools
This ensures the correctness and purity of each refactoring.
Compared to existing refactoring benchmarks such as ref-Dataset, community corpus, extended corpus, and RefactorBench,
SWE-Refactor stands out in several key aspects:
- Includes both atomic and compound refactorings.
- Guarantees pure refactorings with no entangled changes.
- Provides developer-written ground truth and test cases.
- Ensures test availability for correctness validation.
- Built through a fully automated pipeline from real project commits.
SWE-Refactor Sample Schema
Each sample in the SWE-Refactor benchmark contains the following fields:
Basic Information
type(string)
Type of the applied refactoring (e.g.,Inline Method).description(string)
A concise summary of the refactoring action, including involved methods and visibility changes.projectName(string)
Name of the project containing the refactoring (e.g.,checkstyle).commitId(string)
Git commit hash where the refactoring was applied.uniqueId(string)
A unique identifier derived from commit and line information.
Location & Structure
diffLocations(list of dicts)
Each dictionary contains:filePath: path of the modified file.startLine,endLine: start/end line numbers.startColumn,endColumn: start/end column numbers.
filePathBefore(string)
File path before the refactoring.filePathAfter(string)
File path after the refactoring (if moved).moveFileExist(bool)
Indic📤 Share this page
Found this useful? Share it with your network.
Files are hosted on the source repository. Click download to access the full dataset.