🤖 AI Summary
Current large language models for code exhibit insufficient generalization and stability across diverse, instruction-driven code editing tasks. To address this, we propose NextCoder: (1) a synthetic editing instruction generation paradigm that produces multi-style, multi-granularity instructions from seed code and fine-grained editing criteria, enabling efficient expansion of high-quality training data; (2) SeleKT, a sparse adaptation algorithm that dynamically selects critical parameter subsets via gradient importance scoring and applies projection-based fine-tuning—enhancing editing capability with minimal interference to base model functionality; and (3) comprehensive evaluation on QwenCoder-2.5 and DeepSeekCoder backbones, demonstrating consistent state-of-the-art performance across five major code editing benchmarks—outperforming same-scale models and even surpassing larger models on several metrics—while fully preserving original code generation and instruction-following capabilities.
📝 Abstract
Software engineering activities frequently involve edits to existing code. However, contemporary code language models (LMs) lack the ability to handle diverse types of code-edit requirements. In this work, we attempt to overcome this shortcoming through (1) a novel synthetic data generation pipeline and (2) a robust model adaptation algorithm. Starting with seed code examples and diverse editing criteria, our pipeline generates high-quality samples comprising original and modified code, along with natural language instructions in different styles and verbosity. Today's code LMs come bundled with strong abilities, such as code generation and instruction following, which should not be lost due to fine-tuning. To ensure this, we propose a novel adaptation algorithm, SeleKT, that (a) leverages a dense gradient-based step to identify the weights that are most important for code editing, and (b) does a sparse projection onto the base model to avoid overfitting. Using our approach, we obtain a new series of models NextCoder (adapted from QwenCoder-2.5) that achieves strong results on five code-editing benchmarks, outperforming comparable size models and even several larger ones. We show the generality of our approach on two model families (DeepSeekCoder and QwenCoder), compare against other fine-tuning approaches, and demonstrate robustness by showing retention of code generation abilities post adaptation.