[Paper Review] SEMAG: Self-Evolutionary Multi-Agent Code Generation
SEMAG presents a self-evolutionary, multi-agent framework for code generation that adaptively adjusts planning, debugging, and backbone models in real time, achieving state-of-the-art Pass@1 across seven benchmarks.
Large Language Models (LLMs) have made significant progress in handling complex programming tasks. However, current methods rely on manual model selection and fixed workflows, which limit their ability to adapt to changing task complexities. To address this, we propose SEMAG, a Self-Evolutionary Multi-Agent code Generation framework that mimics human coding practices. It decomposes programming tasks into stages, including planning, coding, debugging, and discussion, while adapting workflows to task difficulty. Its self-evolutionary agents can access the latest models in real time and automatically upgrade the backbone model. SEMAG sets new state-of-the-art Pass@1 accuracy across benchmarks. Using identical backbone models, SEMAG outperforms prior methods by 3.3% on CodeContests. When augmented with self-evolutionary model selection that automatically identifies optimal backbones, SEMAG reaches 52.6%, showcasing both framework effectiveness and adaptability to evolving LLM capabilities.
Motivation & Objective
- Motivate the need for adaptive, dynamic workflows in large language model-based code generation.
- Propose a hierarchical, multi-agent framework that adjusts reasoning depth and workflow based on task complexity.
- Introduce a self-evolution mechanism to automatically select and upgrade backbone models in real time.
- Demonstrate state-of-the-art Pass@1 accuracy across seven text-to-code benchmarks and analyze efficiency gains.
Proposed method
- Introduce a four-level hierarchical code synthesis framework that progresses from direct generation to multi-agent refinement.
- Incorporate an adaptive level-transition mechanism driven by trace similarity to switch levels dynamically.
- Implement self-evolution: parallel model-selector agents search, filter, and vote to choose the best backbone model in real time.
- Employ planning, verification, debugging, and debate agents with a discussion–decision module to escape local optima and refine solutions.

Experimental results
Research questions
- RQ1Can a self-evolutionary, multi-agent workflow improve code generation performance across diverse benchmarks?
- RQ2Does adaptive planning depth and collaborative debugging reduce token usage while increasing accuracy?
- RQ3Can automatic backbone model switching sustain high performance as task difficulty and model capabilities evolve?
- RQ4What is the impact of including tool usage in planning and of various ablations on overall performance?
Key findings
- SEMAG achieves new state-of-the-art Pass@1 across seven benchmarks with GPT-4o as backbone (e.g., HumanEval 98.8% and MBPP 87.6%).
- On CodeContests, SEMAG reaches 38.0% Pass@1 with a 3.3% improvement over a fixed-backbone baseline (LPW); self-evolution raises this to 52.6%.
- Adaptive hierarchical prompting reduces token consumption while improving accuracy across datasets compared to fixed-depth baselines.
- Ablation studies show that the full SEMAG with Plan-Verifier-Discuss-Decide components outperforms partial configurations (e.g., 91.5% Pass@1 on HumanEval with GPT-3.5).
- Self-evolution via parallel selectors can identify strong backbones (e.g., Claude-3.7-Sonnet achieving 52.6% on CodeContests; others reaching 48.7-48.7%).
- Planning with tool usage provides measurable gains (3.7% increase in Pass@1 on HumanEval with GPT-3.5).

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.