推理时通过符号等价划分进行代码选择
Inference-Time Code Selection via Symbolic Equivalence Partitioning
AI总结:
本文提出SEP框架,通过符号执行将候选程序划分为功能等价类,提升推理时代码选择的准确性,无需辅助测试生成或额外LLM推理。
摘要:
在推理时采样多个候选程序以提高LLM代码生成效果是一种有效方法,但其收益取决于可靠地从生成池中选择正确解。我们发现该选择问题具有独特的语义结构:尽管正确解在语法、实现或算法策略上可能不同,但它们在有效输入上往往收敛到相同的功能行为。同时,共识本身不足以保证正确性,因为模型也可能生成相关错误解,实现相同的错误行为。我们提出了符号等价划分(SEP),一种推理时选择框架,首先使用问题提供的公共示例作为轻量级有效性信号。SEP随后使用符号执行将剩余候选程序划分为有界功能等价类,并从主导等价类中选择。在HumanEval+和LiveCodeBench上,SEP在不使用辅助测试生成、学习验证器或额外LLM推理的情况下, consistently 提高了选择准确性。在N=10时,SEP在HumanEval+上将平均准确性从0.754提高到0.826,在LiveCodeBench上从0.565提高到0.647,表明符号功能一致性是推理时代码选择的有效信号。
英文摘要:
Sampling multiple candidate programs at inference time is an effective way to improve LLM code generation. However, its benefit depends on reliably selecting a correct solution from the generated pool. We observe that this selection problem has a distinctive semantic structure: correct solutions, despite differences in syntax, implementation, or algorithmic strategy, often converge to the same functional behavior over valid inputs. At the same time, consensus alone is not sufficient for correctness, because models can also produce correlated wrong solutions that implement the same mistaken behavior. We propose Symbolic Equivalence Partitioning (SEP), an inference-time selection framework that first uses problem-provided public examples as lightweight validity signals. SEP then uses symbolic execution to partition the remaining candidate programs into bounded functional equivalence classes and selects from the dominant equivalence class. Across HumanEval+ and LiveCodeBench, SEP consistently improves selection accuracy without auxiliary test generation, learned verifiers, or additional LLM inference. At $N=10$, SEP improves average accuracy from 0.754 to 0.826 on HumanEval+ and from 0.565 to 0.647 on LiveCodeBench, showing that symbolic functional agreement is an effective signal for inference-time code selection.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。