No One-Size-Fits-All: Adaptive Code Editing with Feature-Based Strategy Selection
Open Access
- 1 October 2026
- journal article
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Software Engineering
- Vol. 3 (ISSTA) , 3271-3293
Abstract
Large language models have shown strong potential in automating code editing (CE) tasks, yet most existing systems rely on a fixed CE strategy (i.e., one-step, search-replace, and plan-apply) across diverse scenarios. In practice, CE tasks vary widely in code context, edit locality, and semantic complexity, causing no single strategy to perform consistently well. Moreover, systematic studies on the relationship between strategies and CE tasks remain scarce, limiting further optimization of LLM-based code editing strategies. To address this gap, we construct CEBench, comprising 500 real-world CE tasks curated from SWE-bench. Then we compare three representative CE strategies (one-step, search-replace, plan-apply). Our study reveals two key findings: (1) each strategy exhibits distinct advantages for specific CE tasks, with no universal optimality; (2) strategy effectiveness is significantly influenced by four core task features: total lines of code, modification type, modification scope, and task type. Motivated by these findings, we propose Ace, an adaptive code editing framework that dynamically selects optimal CE strategies based on task features. Unlike classifier-based or instruction-prompting approaches, Ace employs a fine-tuned LLM that learns feature-strategy mappings from empirical data to recommend strategies with interpretable rationales. Extensive experiments on our CEBench-verified show that Ace outperforms state-of-the-art baselines: it boosts Pass@1 by 21.7% while reducing token consumption by 27.3% compared to the best baseline (AutoCodeRover). Our strategy selector achieves 72.6% selection accuracy with 69.9% rationale accuracy (Cohen’s Kappa=0.807), providing transparent and trustworthy decision-making for developers.Keywords
Funding Information
- National Natural Science Foundation of China (62302437)
- National Natural Science Foundation of China (92582107)
- Yongjiang Talent Program (2023A-402-G)
This publication has 22 references indexed in Scilit:
- Enhancing Project-Specific Code Completion by Inferring Internal API InformationIEEE Transactions on Software Engineering, 2025
- CodeEditor : Learning to Edit Source Code with Pre-trained ModelsACM Transactions on Software Engineering and Methodology, 2023
- Identify and Update Test Cases When Production Code Changes: A Transformer-Based Approach2023
- CoditT5: Pretraining for Source Code and Natural Language Editing2022
- A syntax-guided edit decoder for neural program repair2021
- CURE: Code-Aware Neural Machine Translation for Automatic Program Repair2021
- CODIT: Code Editing With Tree-Based Neural ModelsIEEE Transactions on Software Engineering, 2020
- What makes a code change easier to review: an empirical investigation on code change reviewability2018
- Pearson's Chi-Square Test and Rank Correlation Inferences for Clustered DataBiometrics, 2017
- An empirical study of the impact of modern code review practices on software qualityEmpirical Software Engineering, 2015