← Latest papers
💻 computer science

SEMAG: Self-Evolutionary Multi-Agent Code Generation

SEMAG is a self-evolutionary multi-agent framework that mimics human coding practices by dynamically decomposing tasks and automatically upgrading its backbone models, achieving state-of-the-art performance on benchmarks like CodeContests.

Original authors: Yulin Peng, Haowen Hou, Xinxin Zhu, Ying Tiffany He, F. Richard Yu

Published 2026-03-18
📖 4 min read☕ Coffee break read

Original authors: Yulin Peng, Haowen Hou, Xinxin Zhu, Ying Tiffany He, F. Richard Yu

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to build a complex piece of furniture, like a grand piano, but you don't have a single master carpenter. Instead, you have a team of AI assistants.

Most current AI coding systems are like a rigid assembly line. They have a fixed set of instructions: "Cut wood, glue parts, sand surface." If the task is simple (like building a birdhouse), this rigid line is overkill and wastes time. If the task is hard (like the piano), the line doesn't have enough steps to get it right, and the piano falls apart.

SEMAG (Self-Evolutionary Multi-Agent Code Generation) is like a dynamic, self-improving workshop that mimics how a real human team of expert engineers works. It doesn't just follow a script; it adapts, argues, and upgrades itself in real-time.

Here is how SEMAG works, broken down into simple concepts:

1. The "Smart Manager" (Adaptive Workflow)

Imagine a project manager who looks at your job and asks, "How hard is this?"

  • If the job is easy (like "write a function to add two numbers"), the manager says, "Okay, just one person, go ahead and do it." This saves time and money.
  • If the job is hard (like "build a self-driving car algorithm"), the manager says, "Okay, we need a full team. Let's plan it, build a prototype, test it, argue about the design, and fix it."

This is the Hierarchical Framework. Unlike other AIs that use the same heavy process for every task, SEMAG scales its effort up or down depending on the difficulty.

2. The "Specialized Crew" (Multi-Agent Collaboration)

When the job gets tough, SEMAG doesn't just ask one AI to "fix it." It deploys a team of specialists, each with a specific job:

  • The Planner: Draws the blueprints before any code is written.
  • The Verifier: Checks the blueprints to make sure they make sense before building starts.
  • The Coder: Actually writes the code based on the plan.
  • The Debugger: If the code breaks, this agent reads the "error logs" (like a mechanic listening to a car engine) to find the exact problem.
  • The Explainer: Translates the confusing error logs into plain English for the team.
  • The Debaters: If the debugger gets stuck, a group of agents holds a "town hall meeting." They propose different solutions, argue their pros and cons, and vote on the best one.

This prevents the AI from getting stuck in a loop of making the same mistake over and over.

3. The "Self-Upgrading Team" (Self-Evolution)

This is the most magical part. Imagine your team of carpenters is working in 2024, but a new, super-powerful tool is released in 2025. A normal team would keep using the old tools until you manually told them to switch.

SEMAG is different. It has a Research Agent that constantly scans the internet, news, and tech forums.

  • It sees a new, smarter AI model has been released.
  • It reads reviews and tests it.
  • It says, "Hey team, this new model is better at math problems! Let's switch our main brain to this new one immediately."

It does this automatically. It doesn't wait for a human to tell it to upgrade. It evolves its own "brain" to stay at the cutting edge.

The Results: Why It Matters

Think of coding benchmarks (tests) as different types of puzzles:

  • Easy Puzzles: Simple logic.
  • Hard Puzzles: Competitive programming contests (like the Olympics of coding).

Previous AI methods were like a student who studies hard but gets stuck on the hardest questions. SEMAG is like a super-student who knows when to ask for help, when to debate with classmates, and when to buy a new textbook.

  • On standard tests, SEMAG solved 98.8% of the problems (nearly perfect).
  • On the hardest "Olympics" level tests, it improved the success rate by 3.3% over the previous best method.
  • But when it used its "Self-Evolution" feature to pick the absolute best AI model available at that moment, it jumped to 52.6% success on the hardest tasks—a massive leap that no other system has achieved.

In Summary

SEMAG is not just a better coder; it's a better organization.

  1. It adapts its effort (don't use a sledgehammer to crack a nut).
  2. It collaborates (uses a team to solve problems instead of one lonely brain).
  3. It evolves (automatically finds and uses the smartest tools available).

It turns code generation from a rigid machine process into a flexible, human-like problem-solving session.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →