这篇论文用MineValiCoder框架搞定代码生成不可靠问题,HumanEval跑出96.34%通过率,比之前的方法强一截,搞LLM代码的同学值得看看。
MineValiCoder 提出一种协作闭环测试驱动开发(TDD)框架,包含三个模块:测试用例质量挖掘(TCQM)通过自验证过滤缺陷测试,并行TDD迭代优化生成高质量代码候选,二分图代码-测试互验(BiCoTeV)动态建模代码-测试交互进行可靠选择。在 HumanEval 上 Pass@1 达 96.34%,MBPP 上 87.40%,APPS 上 64.00%,LiveCodeBench 上 51.33%,显著优于现有方法。MineValiCoder 有效缓解了 LLM 随机性导致的不稳定代码生成问题。
MineValiCoder: Reliable Code Generation with Test Case Quality Mining and Bipartite Graph-Based Mutual Validation
Large Language Model (LLM)-based Test-Driven Development (TDD) has advanced automated code generation. However, existing approaches depend heavily on human-crafted test cases and cannot operate effectively when only natural-language requirements are available. Although recent work enables automatic test generation, it often overlooks the inherent stochasticity of LLMs, leading to two key defects: faulty tests generate misleading feedback that distorts code optimization, while mixed-quality test cases produce conflicting evaluation signals that hinder reliable code selection. To address these challenges, we propose MineValiCoder, a collaborative closed-loop TDD framework based on the mutual reinforcement of test-case quality and code quality. MineValiCoder comprises three modules. The Test Case Quality Mining (TCQM) module filters faulty test cases through self-validation, providing reliable optimization supervision. The Parallel TDD Refinement module iteratively optimizes code and generates diverse high-quality code candidates using validated test-case feedback. The Bipartite Graph-Based Code-Test Mutual Validation (BiCoTeV) module dynamically models code-test interactions and performs mutual validation scoring for stable and reliable optimal-code selection. Extensive evaluations across four LLMs and mainstream benchmarks show that MineValiCoder significantly outperforms state-of-the-art methods. Specifically, it achieves Pass@1 scores of 96.34% on HumanEval, 87.40% on MBPP, 64.00% on APPS, and 51.33% on LiveCodeBench. These results demonstrate the effectiveness of MineValiCoder in mitigating LLM stochasticity and improving the reliability of automated code generation.