Content area

Abstract

The rapid progress of Large Language Models (LLMs) has greatly improved natural language tasks like code generation, boosting developer productivity. However, challenges persist. Generated code often appears “pseudo-correct”—passing functional tests but plagued by inefficiency or redundant structures. Many models rely on outdated methods like greedy selection, which trap them in local optima, limiting their ability to explore better solutions. We propose AnnCoder, a multi-agent framework that mimics the human “try-fix-adapt” cycle through closed-loop optimization. By combining the exploratory power of simulated annealing with the targeted evolution of genetic algorithms, AnnCoder balances wide-ranging searches and local refinements, dramatically increasing the likelihood of finding globally optimal solutions. We speculate that traditional approaches may struggle due to narrow optimization focuses. AnnCoder addresses this by introducing dynamic multi-criteria scoring, weighing functional correctness, efficiency (e.g., runtime/memory), and readability. Its adaptive temperature control dynamically modulates the cooling schedule, slowing cooling when solutions are diverse to encourage exploration, then accelerating convergence as they stabilize. This design elegantly avoids the pitfalls of earlier models by synergistically combining global exploration with local optimization capabilities. After conducting thorough experiments with multiple LLMs analyses across four problem-solving and program synthesis benchmarks—AnnCoder showcased remarkable code generation capabilities—HumanEval 90.85%, MBPP 90.68%, HumanEval-ET 85.37%, and EvalPlus 84.8%. AnnCoder has outstanding advantages in solving general programming problems. Moreover, our method consistently delivers superior performance across various programming languages.

Details

1009240
Business indexing term
Title
AnnCoder: A Mti-Agent-Based Code Generation and Optimization Model
Author
Zhang, Zhenhua 1 ; Wang, Jianfeng 1 ; Li Zhengyang 2   VIAFID ORCID Logo  ; Wang, Yunpeng 1   VIAFID ORCID Logo  ; Zheng Jiayun 3 

 College of Software, Taiyuan University of Technology, Taiyuan 030024, China; [email protected] (Z.Z.); [email protected] (Y.W.) 
 Department of Computer Science, DigiPen Institute of Technology, Redmond, WA 98052, USA; [email protected] 
 College of Engineering, University of Michigan Ann Arbor, Ann Arbor, MI 48104, USA 
Publication title
Symmetry; Basel
Volume
17
Issue
7
First page
1087
Number of pages
26
Publication year
2025
Publication date
2025
Publisher
MDPI AG
Place of publication
Basel
Country of publication
Switzerland
Publication subject
e-ISSN
20738994
Source type
Scholarly Journal
Language of publication
English
Document type
Journal Article
Publication history
 
 
Online publication date
2025-07-07
Milestone dates
2025-05-26 (Received); 2025-06-30 (Accepted)
Publication history
 
 
   First posting date
07 Jul 2025
ProQuest document ID
3233253290
Document URL
https://www.proquest.com/scholarly-journals/anncoder-mti-agent-based-code-generation/docview/3233253290/se-2?accountid=208611
Copyright
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/). Notwithstanding the ProQuest Terms and Conditions, you may use this content in accordance with the terms of the License.
Last updated
2025-07-25
Database
ProQuest One Academic