AI
Multi-Agent Framework Uses Filtering and Repair to Boost LLM Code Generation
CodeCoR combines multiple agents with quality pruning and iterative fixing to improve how large language models generate working code from text descriptions.
Generating correct code automatically from natural language descriptions remains a challenge for large language models like ChatGPT, even though they show considerable promise in the field. While code-writing LLMs often struggle with syntactic and semantic correctness, researchers have begun deploying multi-agent systems that assign different roles—such as analysis, generation, and testing—to improve results. Yet these sequential workflows often falter because errors at each stage compound through the pipeline.
A Pruning and Repair Approach#
Researchers have introduced CodeCoR, a multi-agent framework designed to catch and fix mistakes before they propagate. The system deploys four specialized agents that work in parallel and iteratively: one frames prompts, another generates candidate code, a third creates test cases, and a fourth offers repair guidance. Rather than accepting the first output from each agent, CodeCoR produces multiple candidates and filters out weak ones at each step.
When code fails the locally-run test suite, the repair agent analyzes the failure and provides suggestions. The code-generation agent then attempts to revise the solution based on that feedback. The final step returns whichever code snippet passes the most test cases to the user.
Strong Results Across Benchmarks#
Testing on four standard evaluation datasets—HumanEval, HumanEval-ET, MBPP, and MBPP-ET—CodeCoR achieved a Pass@1 score of 77.13% on average, surpassing earlier multi-agent systems such as CodeCoT and MapCoder. This improvement demonstrates that intermediate filtering and error-correction cycles can meaningfully reduce the failure rate of LLM-based code generation.

