用蒙特卡洛树搜索提升AI编程生成成功率至92%
Development of an Autonomous AI Coding Agent using Monte Carlo Tree Search (MCTS) and Gemini LLM Frameworks
- 结合Gemini大模型与定制化蒙特卡洛树搜索进行代码生成决策
- 在复杂逻辑任务上达成92%成功率,远超传统零样本生成
- 自评纠错机制支持持续优化,适合开发高可靠AI编程工具
软件工程需求的持续变化催生了从自然语言生成安全源码的自动化工具需求。传统大语言模型受限于‘一次性’生成能力,常出现逻辑幻觉且在复杂操作中表现不佳。本文提出一个自主的AI编程代理,通过结构化决策方法实现大模型输出与生产级代码间的连接。该框架利用Gemini 2.5 Flash API提供核心推理能力,并采用定制化的蒙特卡洛树搜索(MCTS)作为搜索策略解决代码生成难题。代理通过‘自评’评估系统测试多种实现方式,依据准确性和难度排序,并通过反向传播改进自身架构。系统基于Flask Web界面运行,支持即时反馈与语法高亮。实验表明,基于MCTS的方法在复杂逻辑提示下达到92%的成功率,显著优于标准零样本生成模型。
原文摘要 · Abstract (English)
The ongoing changes in software engineering requirements have created a substantial need for automated tools which can create secure source code from natural language input. The performance of traditional Large Language Models (LLMs) becomes limited by their "one-shot" capability which results in logical hallucinations together with reduced algorithmic performance during complicated operations. The research presents an autonomous AI Coding Agent which establishes a connection between LLM-generated content and production-ready software through its organized methodology for decision making. Our framework uses the Gemini 2.5 Flash API for essential reasoning capabilities while employing a tailored Monte Carlo Tree Search (MCTS) method to solve code generation challenges as a search operation. The agent uses a "Self-Critic" evaluator system to test different implementation methods which it ranks according to their accuracy and difficulty level before it improves its operational framework through backpropagation. The system operates through a Flask-based web interface which delivers instant feedback together with syntax highlighting features. Our experimental results show that the MCTS-based method achieves a 92% success rate on complex logical prompts while surpassing standard zero-shot generation models.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。