一句话:面向代码编辑的推测解码方法,通过复用原文与编辑导向草稿模型,将 LLM 代码编辑推理加速最高约 10–13 倍。
LLM 在代码编辑中表现优异,但编辑任务复杂,现有方法多依赖自回归端到端生成,解码速度成为效率瓶颈。通用推测解码未考虑代码编辑的两个特点:改动通常是局部的,且大量原始代码片段可被复用。为此,作者提出 EfficientEdit,在推测解码框架下引入两项机制:其一,在定位潜在编辑位置的同时有效复用原始代码片段;其二,利用面向编辑的草稿模型生成高质量草稿,并配合动态验证机制,在生成质量与加速比之间取得平衡。在 CanItEdit 与 CodeIF-Bench 上,相比标准自回归解码分别取得最高 10.38× 与 13.09× 的加速,较当前最优推理加速方法最高提升 90.6%。
Large Language Models (LLMs) have demonstrated remarkable capabilities in code editing, substantially enhancing software development productivity. However, the inherent complexity of code editing tasks forces existing approaches to rely on LLMs’ autoregressive end-to-end generation, where decoding speed plays a critical role in efficiency. While inference acceleration techniques like speculative decoding are applied to improve the decoding efficiency, these methods fail to account for the unique characteristics of code editing tasks, where changes are typically localized and existing code segments are reused. To address this limitation, we propose EfficientEdit, a novel method that improves LLM-based code editing efficiency through two key mechanisms based on speculative decoding: (1) effective reuse of original code segments while identifying potential edit locations, and (2) efficient generation of edit content via high-quality drafts from edit-oriented draft models and a dynamic verification mechanism that balances quality and acceleration. Experimental results show that EfficientEdit can achieve up to 10.38× and 13.09× speedup compared to standard autoregressive decoding in CanItEdit and CodeIF-Bench, respectively, outperforming state-of-the-art inference acceleration approaches by up to 90.6%. The code and data are available at https://github.com/zhu-zhu-ding/EfficientEdit.
DOI 原文 ·
@inproceedings{paperbot9242,
title = {EfficientEdit: Accelerating Code Editing via Edit-Oriented Speculative Decoding},
author = {Peiding Wang and Li Zhang and Fang Liu and Yinghao Zhu and Wang Xu and Lin Shi and Xiaoli Lian and Minxiao Li and Bo Shen and An Fu},
booktitle = {ASE},
year = {2025},
doi = {10.1109/ase63991.2025.00215}
}