Manuscript Offprint

arXiv:2610.22881

No One-Size-Fits-All: Adaptive Code Editing with Feature-Based Strategy Selection

Jun Wan, Zhongxin Liu, Dajun Chen, Wei Jiang, Yong Li, Xiaoxue Ren

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

JUN WAN, Zhejiang University, China

ZHONGXIN LIU, Zhejiang University, China

DAJUN CHEN, Ant Group, China

WEI JIANG, Ant Group, China

YONG LI, Ant Group, China

XIAOXUE REN ∗^{*}, Zhejiang University, China

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.

CCS Concepts: • Software and its engineering → Automatic programming; Software verification and validation; • Computing methodologies → Natural language processing.

Additional Key Words and Phrases: Code Editing, Feature Analysis, Strategy Selection, Large Language Model

ACM Reference Format:

Jun Wan, Zhongxin Liu, Dajun Chen, Wei Jiang, Yong Li, and Xiaoxue Ren. 2026. No One-Size-Fits-All: Adaptive Code Editing with Feature-Based Strategy Selection. Proc. ACM Softw. Eng. 3, ISSTA, Article ISSTA143 (October 2026), 23 pages. https://doi.org/10.1145/3832234

∗^{*}Corresponding author.

Authors' Contact Information: Jun Wan, 22451014@zju.edu.cn, School of Software Technology, Zhejiang University, Hangzhou, Zhejiang, China; Zhongxin Liu, liu_zx@zju.edu.cn, College of Computer Science and Technology and The State Key Laboratory of Blockchain and Data Security, Zhejiang University, Hangzhou, Zhejiang, China; Dajun Chen, chendajun.cdj@antgroup.co, Ant Group, Hangzhou, Zhejiang, China; Wei Jiang, jonny.jw@antgroup.co, Ant Group, Hangzhou, Zhejiang, China; Yong Li, liyong.liy@antgroup.co, Ant Group, Hangzhou, Zhejiang, China; Xiaoxue Ren, xxren@zju.edu.cn, School of Software Technology, Zhejiang University, Hangzhou, Zhejiang, China.

Figure

This work is licensed under a Creative Commons Attribution 4.0 International License.

© 2026 Copyright held by the owner/author(s).

ACM 2994-970X/2026/10-ARTISSTA143

https://doi.org/10.1145/3832234

ISSTA143:2

Jun Wan, Zhongxin Liu, Dajun Chen, Wei Jiang, Yong Li, and Xiaoxue Ren

1 Introduction

Code editing (CE) refers to modifying existing source code to improve its correctness, functionality, performance, or maintainability [26, 30, 36]. Unlike code generation from scratch, CE operates on pre-existing codebases and typically involves localized modifications such as bug fixing, refactoring, and feature extension. As modern software systems undergo continuous evolution, CE has become a fundamental activity throughout the software development lifecycle [6, 30, 36]. Effective CE is increasingly critical as software systems grow in scale and complexity. Large codebases maintained over extended periods require frequent updates to address bugs, security vulnerabilities, and evolving requirements. The quality of CE directly influences software reliability, developer productivity, and long-term maintainability [6, 30, 36]. However, CE remains challenging and time-consuming. Successfully editing code requires a deep understanding of program semantics, design assumptions, and module dependencies. Even small changes may introduce unintended side effects in interconnected codebases, substantially increasing cognitive workload. Studies show developers spend over six hours per week on CE tasks [24], underscoring both its prevalence and importance.

Large language models (LLMs) have achieved significant advances in automating software engineering tasks [5, 8, 33, 45]. Prior work has demonstrated LLM capabilities across diverse activities, including code generation [34], program comprehension [14], bug fixing [21], and test case generation [18], all typically guided by natural language instructions. Notably, many of these tasks fundamentally involve CE rather than generating programs from scratch, as developers iteratively modify existing codebases throughout the development lifecycle. This observation has motivated recent research on LLM-based CE techniques that apply targeted modifications to existing code based on natural language instructions [39].

As illustrated in Fig. 1, existing CE strategies can be broadly categorized into three categories [26]: one-step, search-replace, and plan-apply. (1) One-step strategy [3] directly rewrites the code under edit using prompts that include the original code and the editing instruction (Fig. 1-a). While straightforward, this strategy is highly sensitive to model capability, with weaker LLMs (e.g., <10B parameters) often producing unreliable edits [25]. Additionally, rewriting entire code sections leads to excessive token consumption and latency, particularly for large or complex codebases [26]. (2) Search-replace strategy [46] first generates

Figure

Fig. 1. Modern LLM-based Code Editing Strategies

code diffs instead of complete rewrites, and then locates and applies these diffs to the original code (Fig. 1-b). While diff-based generation improves token efficiency, LLM-generated diffs often lack precision in identifying edit locations or correctly applying changes, leading to syntax or semantic errors that cause task failures [1]. (3) Plan-apply strategy [26] decomposes CE tasks into planning and applying stages (Fig. 1-c). By decoupling planning from execution, this strategy reduces token usage during planning and enables efficient application through optimized decoding techniques such as speculative decoding [23, 28, 47]. It represents a recent advancement that addresses both correctness and efficiency challenges in CE, which is widely used in existing coding assistants like GitHub Copilot [32] and Cursor [10]. However, it introduces additional system complexity and places higher demands on model capabilities during the applying stage. Weaker models frequently

ISSTA143:3

produce incomplete code (e.g., omitting necessary content or inserting placeholders), unauthorized modifications (e.g., unintended style changes), or inaccurate changes (e.g., incorrectly applying specified edits).

Overall, the three CE strategies exhibit complementary strengths and weaknesses. In practice, CE tasks demonstrate substantial heterogeneity in terms of codebase size, editing scope, and modification requirements. This heterogeneity raises fundamental questions regarding the comparative effectiveness of different strategies and the task features that determine their relative performance. To systematically investigate the practical effectiveness of existing CE strategies, we conduct a controlled empirical study comparing one-step, search-replace, and plan-apply strategies under a unified setting. To perform the empirical study, we construct CEBENCH, a benchmark comprising 500 real-world editing tasks derived from SWE-bench [21]. Then, we employ three representative techniques corresponding to each strategy: CodePlan [3] for one-step, AutoCodeRover [50] for search-replace, and FuseApply [26] for plan-apply. Using these techniques, we conduct comparative experiments on CEBENCH to address two empirical questions: How much do strategies differ in effectiveness on CE tasks (RQ1)? And which features of CE tasks influence the relative effectiveness of these strategies (RQ2)?

Our empirical study reveals two principal findings: (1) No single CE strategy achieves universal optimality, with each strategy exhibiting distinct advantages for different task characteristics. (2) Strategy effectiveness is task-specific and significantly influenced by four key features: total lines of code, modification type, modification scope, and task type.

Inspired by these findings, we propose ACE, the first Adaptive Code Editing framework with feature-based strategy selection to enhance both the correctness and the token efficiency of CE tasks. 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. Specifically, ACE includes three phases: feature extraction (Phase I), strategy selection (Phase II), and code editing (Phase III). First, we utilize the dataset in CEBENCH to fine-tune a feature-based strategy selection model. Then, ACE employs the fine-tuned model to analyze task features and recommend the most appropriate strategy from one-step, search-replace, or plan-apply, along with interpretable rationales for the selection. The selected strategy then guides LLMs to perform code editing in a task-aligned manner. By adapting strategy selection to individual task requirements rather than applying fixed approaches, ACE achieves superior performance across diverse CE scenarios while maintaining interpretability through explicit strategy justifications.

To evaluate ACE, we further construct a benchmark CEBENCH-VERIFIED with 650 real-world code editing tasks, including 429 single-file and 221 multi-file instances, derived from SWE-bench and SWE-bench Verified [21]. We focus on code editing as the core repair step in end-to-end issue resolution, and our evaluation strictly aligns with this scope to ensure consistency between motivation and experimental setting. Experimental results on CEBENCH-VERIFIED show that ACE significantly outperforms both fixed-strategy approaches and alternative adaptive baselines in task correctness and token efficiency. Compared to the best-performing fixed strategy (i.e., search-replace), ACE achieves 21.7% improvement in task correctness (Pass@1) while reducing token consumption by 27.3%. Against adaptive baselines using instruction-prompting and classifier-based selection, ACE achieves up to 75.2% improvement in Pass@1. Our strategy selector achieves 72.6% selection accuracy. Its rationale accuracy, as measured by manual labeling (Cohen's Kappa = 0.807), reaches 69.9%. Furthermore, ACE demonstrates robust generalization across six diverse LLMs (both closed-source and open-source), consistently improving correctness by an average of 21.9% while reducing token consumption by 22.0%.

In summary, our contributions are as follows:

ISSTA143:4

Jun Wan, Zhongxin Liu, Dajun Chen, Wei Jiang, Yong Li, and Xiaoxue Ren

• We conduct the first empirical study that not only offers a fine-grained comparison of existing CE strategies but also provides critical insights that no single CE strategy achieves universal optimality, and strategy effectiveness is significantly influenced by task-specific features.

• We propose ACE, an adaptive code-editing framework that uses a feature-based strategy selection to enhance both correctness and token efficiency in CE tasks.

• We construct CEBENCH and CEBENCH-VERIFIED from SWE-bench to compare code-editing performance. Extensive experiments compare ACE with state-of-the-art baselines to evaluate its correctness and token efficiency in code editing tasks. Additionally, further experiments validate the applicability of ACE across different LLMs for CE tasks.

• We open-source the replication package [44], including the source code of ACE, dataset, and all experimental results.

References (15)