arXiv:2605.08680cs.SEcs.AI2026-05

通过执行指纹聚类提升大模型代码生成的准确率

Semantic Voting: Execution-Grounded Consensus for LLM Code Generation

  • 用代码执行结果指纹聚类候选方案,替代传统投票方式
  • 执行级选择方法比文本投票高18-52个百分点,最优达11.3个百分点优势
  • 输入质量远比聚合规则重要,适合追求高可靠性的代码生成场景

大模型代码生成常生成多个候选并选择最终答案,但缺乏完整验证机制。本文研究18种不同模型、思维层级和基准下的配置,对比输出模式多数投票、加权投票、MBR-Exec与SemanticVote——一种基于大模型生成输入上执行指纹聚类的策略。结果表明:(1)最佳执行级选择器在所有配置中均优于输出模式多数投票19-52个百分点,且所有执行级方法至少高出18个百分点;(2)一旦候选在多样化输入上执行,聚合规则影响有限,SemanticVote、加权投票与MBR-Exec在全部18组配置中无显著差异;输入质量是最大影响因素:基于草图的输入生成比直接大模型生成高0.6-2.1个百分点,比随机模糊测试最高高11.3个百分点;(3)思维层级对不同选择方法影响各异:深度推理可使多数投票提升12个百分点,但执行级方法随候选多样性下降而持平或退化。结论表明,当无法获得完整验证时,行为证据的重要性远超聚合规则。

原文摘要 · Abstract (English)

LLM code-generation pipelines often sample multiple candidates and select one final answer without access to a complete oracle. Existing pipelines mix textual voting, ranking, and execution-based agreement, but the relative contribution of each component remains unclear. We study 18 configurations across different models, thinking levels, and benchmarks, comparing output-pattern majority voting, weighted voting, MBR-Exec, and SemanticVote - a method that clusters candidates by execution fingerprints on LLM-generated inputs. Three findings emerge. (1) The best execution-based selector exceeds output-pattern majority voting by 19-52 percentage points on every configuration, with every execution-based selector exceeding it by at least 18 points. (2) Once candidates are executed on diverse inputs, aggregation rule has limited effect: SemanticVote, weighted voting, and MBR-Exec are statistically indistinguishable across all 18 configurations. The largest factor is input quality: sketch-based input generation consistently outperforms direct LLM generation by 0.6-2.1 pp and random fuzzing by up to 11.3 pp. (3) Thinking level interacts differently with selection families: deeper thinking improves majority voting by 12 pp but execution-based methods stay flat or degrade as candidate diversity falls. These results frame inference-time code selection as a signal-quality problem rather than an aggregation-rule problem: when oracles are unavailable, the behavioral evidence matters more than the aggregation rule.

代码生成执行评估大模型推理

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