UnitCoder: Scalable Iterative Code Synthesis with Unit Test Guidance

Yichuan Ma, Yunfan Shao, Peiji Li, Demin Song, Qipeng Guo +3 more
2/17/2025
cs.CLcs.SE

No confident code implementation found for this paper.

Abstract

Large Language Models (LLMs) have demonstrated remarkable capabilities in various tasks, yet code generation remains a major challenge. Current approaches for obtaining high-quality code data primarily focus on (i) collecting large-scale pre-training data and (ii) synthesizing instruction data through prompt engineering with powerful models.

Show full abstract

While pre-training data faces quality consistency issues, instruction-based synthesis suffers from limited instruction diversity and inherent biases of LLMs. To address this gap, we introduce UnitCoder, a systematic pipeline leveraging model-generated unit tests to both guide and validate the code generation process. Combined with large-scale package-based retrieval from pre-training corpus, we generate a dataset of 500K+ verifiable programs containing diverse API calls. Evaluations on multiple Python benchmarks (BigCodeBench, HumanEval, MBPP) demonstrate that models fine-tuned on our synthetic data exhibit consistent performance improvements. Notably, Llama3.1-8B and InternLM2.5-7B improve from 31\% and 28\% to 40\% and 39\% success rates on BigCodeBench, respectively. Our work presents a scalable approach that leverages model-generated unit tests to guide the synthesis of high-quality code data from pre-training corpora, demonstrating the potential for producing diverse and high-quality post-training data at scale. All code and data will be released (https://github.com).

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{ma2025unitcoder,
  title  = {UnitCoder: Scalable Iterative Code Synthesis with Unit Test Guidance},
  author = {Yichuan Ma and Yunfan Shao and Peiji Li and Demin Song and Qipeng Guo and Linyang Li and Xipeng Qiu and Kai Chen},
  year   = {2025},
  eprint = {2502.11460},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.11460v1}
}

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/2502.11460.svg)](https://codeofpaper.com/paper/2502.11460)

Discussion