CodeContests-O: 通过反馈驱动的迭代测试用例生成增强大语言模型
CodeContests-O: Powering LLMs via Feedback-Driven Iterative Test Case Generation
AI总结:
通过反馈驱动的迭代测试用例生成框架,提升大语言模型的验证质量,构建高质量的CodeContests-O数据集,显著提高模型性能。
摘要:
推理模型的兴起需要大规模可验证的数据,编程任务是理想的来源。然而,尽管竞争性编程平台提供了大量问题和解决方案,高质量的验证测试用例仍然稀缺。现有方法尝试利用大语言模型(LLMs)合成测试用例,但仅依赖模型内在的生成能力,缺乏外部反馈,经常导致测试用例多样性不足。为了解决这一限制,我们提出了一种反馈驱动的迭代框架,用于全面的测试用例构建。具体而言,我们的方法利用LLM生成初始测试用例,将其与已知的正确和错误解决方案执行,并利用失败结果作为反馈,指导LLM改进测试用例,使其更接近高保真度和区分性。我们然后将此方法应用于CodeContests数据集,构建了一个优化的高质量衍生数据集,CodeContests-O。在评估整个解决方案池(总计1.1×10⁷)时,我们的数据集实现了89.37%的平均真阳性率(TPR)和90.89%的真阴性率(TNR),显著优于CodeContests和CodeContests+,分别高出4.32%和9.37%。此外,对Qwen2.5-7B模型在CodeContests-O上进行微调,在LiveCodeBench(Pass@1)上提升了9.52%。实验展示了我们框架的有效性和CodeContests-O的质量。为了支持可重复性和促进未来研究,我们发布了代码和数据集。
英文摘要:
The rise of reasoning models necessitates large-scale verifiable data, for which programming tasks serve as an ideal source. However, while competitive programming platforms provide abundant problems and solutions, high-quality test cases for verification remain scarce. Existing approaches attempt to synthesize test cases using Large Language Models (LLMs), but rely solely on the model's intrinsic generation capabilities without external feedback, frequently resulting in insufficiently diverse cases. To address this limitation, we propose a $\textbf{Feedback-Driven Iterative Framework}$ for comprehensive test case construction. Specifically, our method leverages the LLM to generate initial test cases, executes them against known correct and incorrect solutions, and utilizes the failed results as feedback to guide the LLM in refining the test cases toward high fidelity and discriminability. We then apply this method to the CodeContests dataset to construct an optimized high-quality derivative, $\textbf{CodeContests-O}$. Evaluating against the entire pool of solutions ($1.1 \times 10^7$ in total), our dataset achieves an average True Positive Rate (TPR) of $89.37\%$ and True Negative Rate (TNR) of $90.89\%$, significantly outperforming the CodeContests and CodeContests+ by margins of $4.32\%$ and $9.37\%$, respectively. Furthermore, fine-tuning the Qwen2.5-7B model on CodeContests-O results in a $9.52\%$ improvement on LiveCodeBench (Pass@1). Experiments demonstrate the effectiveness of our framework and the quality of CodeContests-O. To support reproducibility and facilitate future research, we release the $\href{https://github.com/cai-jianfeng/CodeContests-O}{code}$ and $\href{https://huggingface.co/datasets/caijanfeng/CodeContests-O}{dataset}$.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。