Enhancing LLM Code Generation: A Systematic Evaluation of Multi-Agent Collaboration and Runtime Debugging for Accuracy, Reliability, and Latency

Authors:

Abstract
Large language models (LLMs) have shown promising code generation capabilities; however, they still face challenges in generating successful code for non-trivial programming tasks. To enhance the LLM’s code generation abilities, we investigate, in this paper, the combination of two complementary inference-time strategies: multi-agent collaboration and runtime execution-based debugging. We conduct an extensive empirical study to evaluate our proposed framework using 19 diverse LLMs on two established coding benchmarks, measuring functional accuracy as a code quality characteristic. Our study reveals that that our combination outperforms the basic performance of LLMs and the individual approaches. In particlular, on HumanEval benchmark, across 19 LLMs, our approach achieves 64.82% accuracy compared to 56.48% achieved by the basic one-shot prompting approach. It also outperforms the individual multi-agent collaboration approach by more than 7.66%. Moreover, our extensive empirical study revealed that optimal combinatory improvement is achieved when both individual strategies perform at similar levels. The proposed framework can be readily deployed in existing development pipelines to enhance the reliability of code generation while maintaining reasonable generation speeds, offering a practical solution to improve automated code generation in enterprise environments. Our code is available at: https://github.com/nazmus-ashrafi/multiagent_vs_debugger

This publication has 9 references indexed in Scilit: