arXiv:2604.06485cs.LGcs.AI2026-04被引 1

通过符号等价划分,在推理时高效选出正确代码。

Inference-Time Code Selection via Symbolic Equivalence Partitioning

  • 利用符号执行将候选代码按功能等价分组,识别正确行为模式。
  • 在HumanEval+上准确率从75.4%提升至82.6%,LiveCodeBench上从56.5%升至64.7%。
  • 无需额外测试生成或模型推理,适合提升代码生成可靠性场景。

在推理时采样多个候选程序是提升大模型代码生成效果的有效方法。然而,其效果依赖于能否从生成结果中可靠地选出正确解。我们观察到:尽管正确代码在语法、实现或算法策略上存在差异,但在有效输入下往往具有相同的函数行为。同时,仅靠共识不足以判断正确性,因为模型也可能产生相关错误的错误解。为此,我们提出符号等价划分(SEP)框架:首先利用题目提供的公开样例作为轻量级有效性信号;然后使用符号执行将剩余候选程序划分为有限的功能等价类,并从主导等价类中选择。在HumanEval+和LiveCodeBench上,SEP在不依赖辅助测试生成、学习型验证器或额外大模型推理的情况下,持续提升选择准确率。当N=10时,HumanEval+平均准确率从0.754提升至0.826,LiveCodeBench从0.565升至0.647,表明符号功能一致性是推理时代码选择的有效信号。

原文摘要 · Abstract (English)

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.

代码生成符号执行推理优化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。