paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Enhancing LLM Code Generation with Ensembles: A Similarity-Based Selection Approach

增强LLM代码生成:一种基于相似度的集成选择方法
ICSE Proceedings of the 2026 IEEE/ACM 48th International Conference on Software Engineering2026匹配度 3/10 · 论文属于LLM代码生成/程序合成,使用CodeBLEU和CrossHair行为等价性做候选选择,与PL+AI交叉有边缘关联;但其核心目标是提升LLM代码生成准确率,而非将静态分析用于Agentic/ML系统程序,也不是用LLM/Agent改进静态分析或形式化验证,且不涉及浮点程序分析或贝叶斯程序分析。引用 17 inbox
Tarek Mahmud, Bin Duan, Corina Păsăreanu, Guowei Yang
crossref: 2026-09-12

AI 速览

一句话:提出面向LLM代码生成的集成方法,通过语法与语义相似度及行为等价性投票,从多模型候选中选出最可靠程序。

集成学习在机器学习中已被广泛用于提升鲁棒性与泛化能力,但尚未应用于大语言模型的代码生成任务。本文提出一种针对LLM代码生成的集成方法:不再依赖单一模型的输出,而是从不同LLM生成多个候选程序,再通过结构化投票机制选出最可靠的解。投票时,利用CodeBLEU计算候选间的语法与语义相似度,并借助CrossHair的差分行为分析判定行为等价性,最后聚合这些相似度分数,选择与候选共识最一致的方案。在HumanEval和更具挑战性的LiveCodeBench数据集上,该方法分别达到90.2%和50.2%的准确率,优于表现最好的单模型GPT-4o(83.5%和43.4%)。即使仅使用免费开源模型,也能取得80.5%和41.6%的准确率,说明该方法在资源受限场景下同样可行。

问题
单个大语言模型生成的代码可能不可靠,而集成学习虽能提升机器学习模型的鲁棒性与准确性,却尚未被用于LLM代码生成任务。
方法
从多个不同LLM生成候选程序,利用CodeBLEU度量候选间的语法与语义相似度、用CrossHair的差分行为分析判断行为等价性,再通过结构化投票聚合这些分数,选出与候选共识最一致的程序。
评估
在HumanEval与LiveCodeBench两个数据集上对比单模型LLM(如GPT-4o),并额外考察仅使用免费开源模型的资源受限设置。
原文摘要(Abstract)

Ensemble learning has been widely used in machine learning to improve model robustness, accuracy, and generalization, but has not yet been applied to code generation tasks with large language models (LLMs). In this paper, we propose an ensemble approach for LLMs in code generation. Instead of relying on the output of a single model, we generate multiple candidate programs from different LLMs and apply a structured voting mechanism to select the most reliable solution. For voting, we compute syntactic and semantic similarity using CodeBLEU and behavioral equivalence using CrossHair’s differential behavior analysis. By aggregating these similarity scores, we select the program that best aligns with the consensus among the candidates. Our experiments show that our ensemble approach consistently outperforms standalone LLMs on the well-known HumanEval and the more challenging LiveCodeBench datasets, achieving an accuracy of 90.2% and 50.2%, respectively, on the two datasets. In comparison, the best-performing LLM (GPT-4o) has an accuracy of 83.5% and 43.4%, respectively. Furthermore, even when restricted to free open source models, our method achieves an accuracy of 80.5% and 41.6%, respectively, demonstrating the viability of our approach in resource-constrained settings.

链接与引用

DOI 原文 · arXiv · DBLP

BibTeX
@inproceedings{abs-2503-15838,
  title = {Enhancing LLM Code Generation with Ensembles: A Similarity-Based Selection Approach},
  author = {Tarek Mahmud and Bin Duan and Corina Păsăreanu and Guowei Yang},
  booktitle = {ICSE},
  year = {2026},
  doi = {10.1145/3744916.3773143}
}