arXiv:2508.19532cs.CL2025-08EMNLP被引 7

通过拆分代码块提升大模型生成能力,让代码更准确。

Alignment with Fill-In-the-Middle for Enhancing Code Generation

  • 将代码切分为小片段,生成更多样化的训练对。
  • 在多个基准测试中,代码生成准确率显著提升。
  • 适合需要高精度代码生成的研究者和开发者。

大型语言模型(LLMs)在工具调用和问题求解等代码生成任务中表现日益出色。然而,受限于可验证且具备精确测试用例的训练数据,提升代码相关任务性能仍具挑战。尽管直接偏好优化(DPO)已展现出潜力,现有测试用例生成方法仍存在局限。本文提出一种新方法,将代码片段拆分为更细粒度的模块,利用相同测试用例生成更多样化的DPO训练对。同时引入抽象语法树(AST)分割与课程学习训练策略,进一步优化DPO训练过程。实验在HumanEval(+), MBPP(+), APPS, LiveCodeBench, BigCodeBench等多个基准数据集上验证了该方法的有效性。代码与数据已公开于https://github.com/SenseLLM/StructureCoder。

原文摘要 · Abstract (English)

The code generation capabilities of Large Language Models (LLMs) have advanced applications like tool invocation and problem-solving. However, improving performance in code-related tasks remains challenging due to limited training data that is verifiable with accurate test cases. While Direct Preference Optimization (DPO) has shown promise, existing methods for generating test cases still face limitations. In this paper, we propose a novel approach that splits code snippets into smaller, granular blocks, creating more diverse DPO pairs from the same test cases. Additionally, we introduce the Abstract Syntax Tree (AST) splitting and curriculum training method to enhance the DPO training. Our approach demonstrates significant improvements in code generation tasks, as validated by experiments on benchmark datasets such as HumanEval (+), MBPP (+), APPS, LiveCodeBench, and BigCodeBench. Code and data are available at https://github.com/SenseLLM/StructureCoder.

代码生成大模型强化学习数据增强

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