ArXiv TLDR

Cascaded Code Editing: Large-Small Model Collaboration for Effective and Efficient Code Editing

🐦 Tweet
2604.19201

Chaozheng Wang, Zezhou Yang, Shuzheng Gao, Cuiyun Gao, Zongjie Li + 5 more

cs.SE

TLDR

This paper proposes Cascaded Code Editing, combining large models for edit sketch generation and small models for efficient application.

Key contributions

  • Decomposes code editing into two stages: large model for 'edit sketch' generation.
  • Smaller model applies these sketches to the original code, handling most of the output.
  • Significantly improves efficiency by reducing tokens generated by the large, expensive model.
  • Addresses small models' limitations in long-context and cross-file dependencies for sketch application.

Why it matters

This work tackles the inefficiency of large language models in code editing by introducing a collaborative, cascaded approach. It promises more practical and cost-effective code modification tools by optimizing resource usage while maintaining accuracy.

Original Abstract

Code editing constitutes a fundamental practice in software development, wherein developers modify existing codebases according to natural language requirements. Accurate code editing necessitates a comprehensive understanding of both the existing codebase and the modification requirements. Although large language models (LLMs) have demonstrated promising performance in code editing tasks, they suffer from substantial inefficiency by generating entire modified files that largely consist of unchanged code. While smaller models could potentially address this inefficiency, they typically lack the capacity to effectively comprehend long code contexts required for accurate editing. To ensure both effectiveness and efficiency, we propose to decompose code editing into a two-stage cascade: \textbf{edit sketch generation}, wherein a large model first produces concise sketches representing the requisite modifications (the more challenging phase), and \textbf{edit sketch application}, wherein a smaller model integrates these sketches into the original code to produce the final output edited code (the simpler phase). This cascaded design reduces the number of tokens generated by the large model, as the majority of the output is handled by the smaller, more efficient model, thereby enhancing overall efficiency. However, the effectiveness of this approach is constrained by current small models' limited capabilities in handling long-context scenarios and cross-file dependencies, which are essential for accurate sketch application in real-world codebases. To address these limitations and enhance smaller models' sketch application capabilities, ...

📬 Weekly AI Paper Digest

Get the top 10 AI/ML arXiv papers from the week — summarized, scored, and delivered to your inbox every Monday.