EfficientEdit:通过面向编辑的推测解码加速代码编辑
EfficientEdit: Accelerating Code Editing via Edit-Oriented Speculative Decoding
AI总结:
本文提出 EfficientEdit,利用代码局部修改与片段复用特征,通过编辑位置识别、原始代码复用、面向编辑的草稿模型及动态验证机制加速代码编辑,在两个基准上显著优于现有推理加速方法。
摘要:
大型语言模型(LLM)在代码编辑方面展现出卓越能力,显著提升了软件开发生产率。然而,代码编辑任务的内在复杂性迫使现有方法依赖 LLM 的自回归端到端生成,其中解码速度对效率起着关键作用。尽管推测解码等推理加速技术已被用于提高解码效率,但这些方法没有考虑代码编辑任务的独特特征:修改通常是局部的,并且会复用现有代码片段。为解决这一局限,我们提出 EfficientEdit,这是一种基于推测解码、通过两个关键机制提升基于 LLM 的代码编辑效率的新方法:(1)在识别潜在编辑位置的同时有效复用原始代码片段;(2)借助面向编辑的草稿模型生成的高质量草稿,以及在质量与加速之间取得平衡的动态验证机制,高效生成编辑内容。实验结果表明,与标准自回归解码相比,EfficientEdit 在 CanItEdit 和 CodeIF-Bench 上分别实现最高 10.38× 和 13.09× 的加速,相比最先进的推理加速方法最高提升 90.6%。代码和数据可在 https://github.com/zhu-zhu-ding/EfficientEdit 获取。
英文摘要:
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 generate 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$\times$ and 13.09$\times$ 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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。