JumpCoder: Go Beyond Autoregressive Coder via Online Modification

📄 arXiv: 2401.07870v2 📥 PDF

作者: Mouxiang Chen, Hao Tian, Zhongxin Liu, Xiaoxue Ren, Jianling Sun

分类: cs.CL, cs.AI, cs.SE

发布日期: 2024-01-15 (更新: 2024-06-05)

备注: ACL 2024 (main)

DOI: 10.18653/v1/2024.acl-long.619

🔗 代码/项目: GITHUB


💡 一句话要点

提出JumpCoder以解决代码生成中的自回归限制问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 代码生成 模型无关框架 在线修改 非顺序生成 抽象语法树 性能提升 机器学习

📋 核心要点

  1. 现有代码生成模型在生成过程中缺乏可逆性,无法及时纠正错误,导致性能下降。
  2. JumpCoder通过引入辅助填充模型,实现了在线修改和非顺序生成,增强了代码生成能力。
  3. 在六个最先进的代码LLM上进行的实验显示,JumpCoder在多个基准测试中显著优于所有基线模型。

📝 摘要(中文)

现有的大型代码语言模型(code LLMs)在代码生成方面表现出色,但其自回归生成方式缺乏可逆性,无法像人类一样及时纠正之前遗漏的语句,导致错误传播和性能下降。为此,本文提出了JumpCoder,一个新颖的模型无关框架,能够实现类人在线修改和非顺序生成。JumpCoder的核心思想是在生成过程中根据需要将新代码插入当前生成的代码中,这通过与代码LLM协同工作的辅助填充模型实现。由于事先确定最佳填充位置是不可行的,我们采用了“先填充,后判断”的策略,在每行生成后尝试在k个关键位置进行填充,并利用抽象语法树(AST)解析器和生成模型评分有效判断每个潜在填充的有效性。大量实验表明,JumpCoder在多个多语言基准测试中显著提升了性能。

🔬 方法详解

问题定义:现有的代码生成模型在生成代码时采用自回归方式,缺乏可逆性,无法及时纠正之前的错误,导致错误传播和性能下降。

核心思路:JumpCoder的核心思路是通过引入辅助填充模型,在生成过程中根据需要将新代码插入当前生成的代码中,从而实现类人在线修改。

技术框架:JumpCoder的整体架构包括生成模型和辅助填充模型。生成模型负责生成代码,而辅助填充模型则在生成过程中评估并插入新代码。

关键创新:最重要的技术创新在于采用“先填充,后判断”的策略,允许在生成每行代码后尝试在k个关键位置进行填充,并通过AST解析器和生成模型评分来判断填充的有效性。

关键设计:在设计中,关键参数包括填充位置的选择策略、AST解析器的实现以及生成模型评分的标准,这些设计确保了填充的有效性和生成的准确性。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

在六个最先进的代码LLM上进行的广泛实验表明,JumpCoder在多个多语言基准测试中显著提升了性能,具体提升幅度超过了所有基线模型,展示了其在代码生成任务中的有效性和优势。

🎯 应用场景

JumpCoder的研究成果具有广泛的应用潜力,特别是在自动代码生成、代码补全和智能编程助手等领域。通过增强代码生成模型的灵活性和准确性,JumpCoder能够帮助开发者更高效地编写和维护代码,提升软件开发的整体效率。未来,该技术还可能在教育和培训领域中用于辅助编程学习。

📄 摘要(原文)

While existing code large language models (code LLMs) exhibit impressive capabilities in code generation, their autoregressive sequential generation inherently lacks reversibility. This limitation hinders them from timely correcting previous missing statements during coding as humans do, often leading to error propagation and suboptimal performance. We introduce JumpCoder, a novel model-agnostic framework that enables human-like online modification and non-sequential generation to augment code LLMs. The key idea behind JumpCoder is to insert new code into the currently generated code when necessary during generation, which is achieved through an auxiliary infilling model that works in tandem with the code LLM. Since identifying the best infill position beforehand is intractable, we adopt an \textit{infill-first, judge-later} strategy, which experiments with filling at the $k$ most critical positions following the generation of each line, and uses an Abstract Syntax Tree (AST) parser alongside the Generation Model Scoring to effectively judge the validity of each potential infill. Extensive experiments using six state-of-the-art code LLMs across multiple and multilingual benchmarks consistently indicate significant improvements over all baselines. Our code is public at https://github.com/Keytoyze/JumpCoder.