ReMCTS: Reflect-Enhanced Monte Carlo Tree Search Strategy for Code Generation

Wang Huifei, Huang Xinying, Sun Yiheng, Yifan Yuan


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.
Anthology ID:
2026.findings-emnlp.293
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2026
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
Findings
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
6227–6247
Language:
URL:
https://aclanthology.org/2026.findings-emnlp.293/
DOI:
Bibkey:
Cite (ACL):
Wang Huifei, Huang Xinying, Sun Yiheng, and Yifan Yuan. 2026. ReMCTS: Reflect-Enhanced Monte Carlo Tree Search Strategy for Code Generation. In Findings of the Association for Computational Linguistics: EMNLP 2026, pages 6227–6247, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
ReMCTS: Reflect-Enhanced Monte Carlo Tree Search Strategy for Code Generation (Huifei et al., Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-emnlp.293.pdf