Let's Revise Step-by-Step: A Unified Local Search Framework for Code Generation with LLMs
Zhiyi Lyu, Jianguo Huang, Yanchen Deng, Steven Hoi, Bo An
Abstract
Large Language Models (LLMs) with inference-time scaling techniques show promise for code generation, yet face notable efficiency and scalability challenges. Construction-based tree-search methods suffer from rapid growth in tree size, high token consumption, and lack of anytime property. In contrast, improvement-based methods offer better performance but often struggle with uninformative reward signals and inefficient search strategies. In this work, we propose ReLoc, a unified local search framework which effectively performs step-by-step code revision. Specifically, ReLoc explores a series of local revisions through four key algorithmic components: initial code drafting, neighborhood code generation, candidate evaluation, and incumbent code updating, each of which can be instantiated with specific decision rules to realize different local search algorithms such as Hill Climbing (HC) or Genetic Algorithm (GA). Furthermore, we develop a specialized revision reward model that evaluates code quality based on revision distance to produce fine-grained preferences that guide the local search toward more promising candidates. Finally, our extensive experimental results demonstrate that our approach achieves superior performance across diverse code generation tasks, significantly outperforming both construction-based tree search as well as the state-of-the-art improvement-based code generation methods.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext bd57d0b4-eee1-4af4-91b2-02e361edf116Cited by top-tier papers2
- Token-Guard: Towards Token-Level Hallucination Control via Self-Checking DecodingYifan Zhu, Huiqiang Rong, Haoran LuoICLR 2026
- AdverMCTS: Combating Pseudo-Correctness in Code Generation via Adversarial Monte Carlo Tree SearchQingyao Li, Weiwen Liu, Weinan Zhang, Yong Yu et al.ICML 2026
Builds on18
- Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida et al.NeurIPS 2022 · 24,707 citations
- Reflexion: language agents with verbal reinforcement learningNoah Shinn, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan et al.NeurIPS 2023 · 5,828 citations
- Tree of Thoughts: Deliberate Problem Solving with Large Language ModelsShunyu Yao, Dian Yu, Jeffrey Zhao, Izhak Shafran et al.NeurIPS 2023 · 5,068 citations
- Let's Verify Step by StepHunter Lightman, Vineet Kosaraju, Yuri Burda, Harrison Edwards et al.ICLR 2024 · 3,045 citations
- RLAIF vs. RLHF: Scaling Reinforcement Learning from Human Feedback with AI FeedbackHarrison Lee, Samrat Phatale, Hassan Mansoor, Thomas Mesnard et al.ICML 2024 · 598 citations
Related papers
- RPM-MCTS: Knowledge-Retrieval as Process Reward Model with Monte Carlo Tree Search for Code GenerationYuanyuan Lin, Xiangyu Ouyang, Teng Zhang, Kaixin SuiAAAI 2026 · 1 citation
- AlignCoder: Aligning Retrieval with Target Intent for Repository-Level Code CompletionTianyue Jiang, Yanlin Wang, Yanli Wang, Daya Guo et al.ASE 2025 · 2 citations
- Towards Better Correctness and Efficiency in Code GenerationYunlong Feng, Yang Xu, Xiao Xu, Binyuan Hui et al.AAAI 2026 · 3 citations
- Towards Explorative IRBL: Combining Semantic Retrieval with LLM-Driven Iterative Code ExplorationMoumita Asad, Rafed Muhammad Yasir, Sam MalekISSTA 2026
- OrcaLoca: An LLM Agent Framework for Software Issue LocalizationZhongming Yu, Hejia Zhang, Yujie Zhao, Hanxian Huang et al.ICML 2025
