Next Edit Prediction:基于上下文和交互历史学习预测代码编辑
Next Edit Prediction: Learning to Predict Code Edits from Context and Interaction History
AI总结:
为弥补代码补全与聊天式编辑的不足,本文提出Next Edit Prediction任务,通过从交互历史推断开发者意图来预测后续代码编辑的位置与内容,并构建了数据集与基准进行模型微调与评估,奠定了主动协作的代码编辑新范式。
摘要:
大型语言模型(LLMs)的快速发展促使集成于开发环境中的AI辅助编程工具被广泛采用。一方面,低延迟的代码补全功能提供补全建议,但根本上受限于光标的当前位置。另一方面,基于聊天的编辑能执行复杂修改,却迫使开发者停下工作,用自然语言描述意图,从而导致脱离代码的上下文切换。这造成了次优的用户体验,因为这两种范式都无法在一系列相关编辑中主动预测开发者的下一次编辑。为弥合这一差距并提供无缝的代码编辑建议,我们引入了Next Edit Prediction任务,这是一项旨在从最近的交互历史中推断开发者意图,以预测后续编辑的位置和内容的新任务。具体而言,我们为Next Edit Prediction任务策划了一个高质量的监督微调数据集和一个评估基准。然后,我们对一系列模型进行了监督微调,并对微调后的模型和其他基线模型进行了全面评估,得出了几项新发现。这项工作为一种新的交互范式奠定了基础,该范式通过预判开发者的后续操作来主动与其协作,而不仅仅是对显式指令做出反应。代码可在https://github.com/lurf21/NextEditPrediction获取。
英文摘要:
The rapid advancement of large language models (LLMs) has led to the widespread adoption of AI-powered coding assistants integrated into a development environment. On one hand, low-latency code completion offers completion suggestions but is fundamentally constrained to the cursor's current position. On the other hand, chat-based editing can perform complex modifications, yet forces developers to stop their work, describe the intent in natural language, which causes a context-switch away from the code. This creates a suboptimal user experience, as neither paradigm proactively predicts the developer's next edit in a sequence of related edits. To bridge this gap and provide the seamless code edit suggestion, we introduce the task of Next Edit Prediction, a novel task designed to infer developer intent from recent interaction history to predict both the location and content of the subsequent edit. Specifically, we curate a high-quality supervised fine-tuning dataset and an evaluation benchmark for the Next Edit Prediction task. Then, we conduct supervised fine-tuning on a series of models and performed a comprehensive evaluation of both the fine-tuned models and other baseline models, yielding several novel findings. This work lays the foundation for a new interaction paradigm that proactively collaborate with developers by anticipating their following action, rather than merely reacting to explicit instructions. The code is available at https://github.com/lurf21/NextEditPrediction.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。