arXiv cs.CL论文
ReMCTS:用于代码生成的反思增强蒙特卡洛树搜索
针对开源大语言模型在生成代码时难以处理隐藏语义及重复错误的问题,提出 ReMCTS 框架。该方法结合执行反馈与记忆增强机制,利用 LLM 引导的 MCTS 算法组织程序候选项为树结构,通过保留分支局部调试上下文和跨分支检索失败经验,提升代码生成的准确性与修复能力。
这篇是正式发表的长论文,站内提供中文解读,全文请到原文阅读 PDF。
Abstract:Open-weight large language models (LLMs) can generate function-level programs from natural-language prompts, but plausible candidates still fail on hidden semantics and repeat mistakes across repair attempts. We present ReMCTS, an execution-grounded, memory-augmented, LLM-guided MCTS-style search framework. It organizes program candidates as tree states, retains branch-local debugging context, retrieves failure experience across branches, and distinguishes failed checks from unavailable evidence. On HumanEval and MBPP-Sanitized, visible-test ReMCTS improves over direct generation in 8 of 10 model-dataset pairs under held-out evaluation, whereas proxy-only search is less stable. Controlled tree-search, sampling, repair, and memory ablations characterize the source and limits of these gains. A 30-task HumanEval-X C++ pilot further demonstrates compatibility with compiler-backed execution, but does not constitute a broad multilingual evaluation.