ACES: 谁测试测试?留一法AUC一致性用于代码生成
ACES: Who Tests the Tests? Leave-One-Out AUC Consistency for Code Generation
AI总结:
本文提出ACES方法,通过留一法AUC评估测试区分正确与错误代码的能力,解决测试正确性判断的循环依赖问题,实现代码生成的高精度筛选。
摘要:
在使用LLM生成测试选择LLM生成的代码候选时,由于测试本身可能不正确,现有方法要么同等对待所有测试,要么依赖随意的启发式过滤。然而,确定测试正确性需要知道哪些代码是正确的,这形成了一种循环依赖。我们的关键见解是不需要确定测试正确性:测试投票应排名而非仅仅计数。重要的是不是多少代码通过测试,而是测试能否区分正确与错误代码。我们通过留一法评估打破循环依赖:排除一个测试,根据所有剩余测试的汇总分数对代码进行排名,并测量排除测试的通过/失败模式是否与此排名一致。我们将这种一致性正式化为留一法AUC(LOO-AUC)并证明LOO-AUC的期望值与每个测试区分正确代码与错误代码的能力成比例。基于此,我们提出了ACES(AUC Consistency Scoring)方法,包含两个互补变种:ACES-C提供闭式权重,能够在平均测试质量的轻微假设下近似Oracle;ACES-O则放弃此假设,通过迭代优化可微LOO-AUC目标。两者仅在二进制通过矩阵上操作,计算开销极小,并在多个代码生成基准上实现了最先进的Pass@$k$性能。
英文摘要:
Selecting LLM-generated code candidates using LLM-generated tests is challenging because the tests themselves may be incorrect. Existing methods either treat all tests equally or rely on ad-hoc heuristics to filter unreliable tests. Yet determining test correctness requires knowing which codes are correct, creating a \emph{circular dependency}. Our key insight is that we need not determine test correctness at all: \emph{test votes should rank, not merely count}. What matters is not how many codes pass a test, but whether the test can \emph{distinguish} correct from incorrect code. We break the circular dependency via leave-one-out evaluation: hold out one test, rank codes by their aggregate scores on all remaining tests, and measure whether the held-out test's pass/fail pattern agrees with this ranking. We formalize this agreement as the leave-one-out AUC~(LOO-AUC) and prove that the expected LOO-AUC is proportional to each test's ability to separate correct code from incorrect code. Building on this, we propose \textbf{ACES}~(\textbf{A}UC \textbf{C}onsist\textbf{E}ncy \textbf{S}coring) with two complementary variants: ACES-C provides closed-form weights that provably approximate the oracle in expectation under a mild assumption on average test quality; ACES-O drops this assumption and iteratively optimizes a differentiable LOO-AUC objective. Both operate solely on the binary pass matrix with negligible overhead, and achieve state-of-the-art Pass@$k$ on multiple code generation benchmarks.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。