arXiv:2508.10074cs.SEcs.LG2025-08被引 4

让代码编辑助手提前预测下一步修改,提升开发流畅度。

Next Edit Prediction: Learning to Predict Code Edits from Context and Interaction History

  • 基于交互历史预测下一次代码修改的位置和内容。
  • 构建了高质量标注数据集与评估基准,验证模型有效性。
  • 适合开发工具设计者与AI编程助手研究者参考。

大型语言模型的快速发展推动了AI编程助手在开发环境中的广泛应用。一方面,低延迟代码补全受限于光标位置;另一方面,基于对话的编辑需开发者暂停工作并用自然语言描述意图,造成上下文切换。这两种范式均无法主动预测开发者后续的连续修改动作。为此,本文提出「下一步编辑预测」任务,旨在从近期交互历史中推断开发者意图,预测下一次编辑的位置与内容。我们构建了一个高质量的监督微调数据集和评估基准,并对多个模型进行微调与全面评估,获得若干新发现。该研究为开发智能协作工具奠定了基础,使系统能主动预判开发者下一步操作,而非仅响应显式指令。代码已开源:https://github.com/lurf21/NextEditPrediction。

原文摘要 · Abstract (English)

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助手交互预测

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。