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

Houxing Ren, Zimu Lu, Weikang Shi, Haotian Hou, Yunqiao Yang +5 more
8/27/2025
cs.CL

Official code: SenseLLM/StructureCoder (3 stars, last commit 2025-08-28).

Abstract

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.

View on arXivView PDF

Code Implementations(1)

30PythonAug 25, 20251 years ago

Cite this paper

@article{ren2025alignment,
  title  = {Alignment with Fill-In-the-Middle for Enhancing Code Generation},
  author = {Houxing Ren and Zimu Lu and Weikang Shi and Haotian Hou and Yunqiao Yang and Ke Wang and Aojun Zhou and Junting Pan and Mingjie Zhan and Hongsheng Li},
  year   = {2025},
  eprint = {2508.19532},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2508.19532v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2508.19532.svg)](https://codeofpaper.com/paper/2508.19532)

Discussion