arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.02393cs.SE
收藏

AP2O-Coder: 适应性渐进偏好优化用于减少LLM生成代码的编译和运行时错误

AP2O-Coder: Adaptively Progressive Preference Optimization for Reducing Compilation and Runtime Errors in LLM-Generated Code

Tencent(腾讯)

Jianqing Zhang, Wei Xia, Hande Dong, Qiang Lin, Jian Cao

AI总结:

AP2O-Coder通过适应性渐进偏好优化方法,减少LLM生成代码的编译和运行时错误,提升代码生成性能。

摘要:

LLM的代码生成能力已在编程任务的有效性上取得了显著进步。然而,LLM生成的代码仍然存在编译和运行时错误。现有的离线偏好优化方法主要通过偏好数据中的通过/失败信号来增强LLM的编码能力,忽略了失败代码中的深层次错误类型。为了解决这个问题,我们提出了适应性渐进偏好优化(AP2O)用于编码(即AP2O-Coder),一种引导LLM适应性且系统性地减少代码错误的方法。具体来说,我们从失败代码中构建了一个错误笔记本,并逐步优化LLM以逐类纠正错误。此外,我们适应性地回放错误类型,以适应LLM在训练过程中的变化弱点。通过在代码和通用LLM(Llama、Qwen和DeepSeek系列)上进行广泛的实验,参数范围从0.5B到34B,我们的AP2O-Coder在pass@k上将代码生成性能提高了最高3%,同时使用更少的偏好数据。

英文摘要:

LLMs' code generation capabilities have yielded substantial improvements in the effectiveness of programming tasks. However, LLM-generated code still suffers from compilation and runtime errors. Existing offline preference optimization methods primarily focus on enhancing LLMs' coding abilities using pass/fail signals in the preference data, overlooking the deep-level error types in the failed codes. To address this, we propose Adaptively Progressive Preference Optimization (AP2O) for coding (i.e., AP2O-Coder), a method that guides LLMs adaptively and methodically to reduce code errors for code generation. Specifically, we construct an error notebook from failed codes and progressively optimize the LLM to correct errors type by type. Furthermore, we adaptively replay error types to tailor to the LLM's changing weaknesses throughout the training process. Through extensive experiments on both code and general LLMs (Llama, Qwen, and DeepSeek series) with parameters ranging from 0.5B to 34B, our AP2O-Coder improves code generation performance by up to 3% in pass@k while using less preference data. Code: https://github.com/TsingZ0/AP2O

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑