Enhancing LLM Code Generation with Ensembles: A Similarity-Based Selection Approach
Not on the map. Why?
Abstract (arXiv)
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). 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. We show through experiments 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.
Key facts. Cited by 10 papers in the map (data through 14 Oct 2026). First posted on arXiv 20 Mar 2025.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2025: 7; 2026: 3.
10 papers.
- 2025A Survey on Test-Time Scaling in Large Language Models: What, How, Where, and How Well?cited by 223
- 2025Trae Agent: An LLM-based Agent for Software Engineering with Test-time Scalingcited by 94
- 2025Risk Analysis Techniques for Governed LLM-based Multi-Agent Systemscited by 18
- 2025Agent-SAMA: State-Aware Mobile Assistantcited by 12
- 2025Incoherence as Oracle-less Measure of Error in LLM-Based Code Generationcited by 6
- 2025InfCode-C++: Intent-Guided Semantic Retrieval and AST-Structured Search for C++ Issue Resolutioncited by 3
- 2026Mixture of Complementary Agents for Robust LLM Ensemblecited by 3
- 2026PatchIsland: Orchestration of LLM Agents for Continuous Vulnerability Repaircited by 2
- 2026N-Version Programming with Coding Agentscited by 2
- 2025Lifecycle-Aware code generation: Leveraging Software Engineering Phases in LLMscited by 0
- 2026N-Version Programming with Coding Agents18 Jun 2026
- 2026Mixture of Complementary Agents for Robust LLM Ensemble21 May 2026
- 2026PatchIsland: Orchestration of LLM Agents for Continuous Vulnerability Repair24 Jan 2026
- 2025InfCode-C++: Intent-Guided Semantic Retrieval and AST-Structured Search for C++ Issue Resolution20 Nov 2025
- 2025Lifecycle-Aware code generation: Leveraging Software Engineering Phases in LLMs28 Oct 2025
- 2025Risk Analysis Techniques for Governed LLM-based Multi-Agent Systems6 Aug 2025
- 2025Trae Agent: An LLM-based Agent for Software Engineering with Test-time Scaling31 Jul 2025
- 2025Incoherence as Oracle-less Measure of Error in LLM-Based Code Generation26 Jun 2025
- 2025Agent-SAMA: State-Aware Mobile Assistant29 May 2025
- 2025A Survey on Test-Time Scaling in Large Language Models: What, How, Where, and How Well?31 Mar 2025