Thinking Before Running! Efficient Code Generation with Thorough Exploration and Optimal Refinement
On the map: LLM reasoning → Reasoning for agents, planning and code
Abstract (arXiv)
Code generation is crucial in software engineering for automating the coding process efficiently. While test-time computation methods show promise, they suffer from high latency due to multiple computation rounds. To overcome this, we introduce ThinkCoder, a framework that combines thorough exploration with optimal refinement. The exploration phase diversifies the solution space by searching for potential solutions, followed by a refinement phase that enhances precision. This approach allows us to select the best solution through careful consideration before taking action, avoiding excessive trial and error. To further minimize test-time computation overhead, we introduce preference-driven optimization with Reinforced Self-Training (ReST), which uses exploration trajectories from ThinkCoder to guide LLM's evolution. This approach enhances LLM's exploration efficiency via preference learning, cutting costs while maintaining accuracy. ThinkCoder boosts the performance with a single LLM, excelling on benchmarks like HumanEval and MBPP. Compared to SOTA models, it improves Pass@1 by 3.0% over MapCoder with just 6.4% of the computation cost. Against AgentCoder, ThinkCoder achieves a 0.5% higher Pass@1 after 2 rounds, outperforming AgentCoder's 5 rounds. Additionally, ReST with success trajectories enhances efficiency, allowing models like LLaMA2-7B to achieve competitive results using only 20% of the computational resources. These results highlight the framework's effectiveness and scalability.
Key facts. Cited by 3 papers in the map (data through 14 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 23 of its 36 references that are in the map. First posted on arXiv 30 Dec 2024.
Builds on
23 of 36 references.
Closest ancestors · 4
Same direction, newest first
- 2024RethinkMCTS: Refining Erroneous Thoughts in Monte Carlo Tree Search for Code Generation15 Sep
- 2024MapCoder: Multi-Agent Code Generation for Competitive Problem Solving18 May
- 2024OpenCodeInterpreter: Integrating Code Generation with Execution and Refinement22 Feb
- 2023CodeCoT: Tackling Code Syntax Errors in CoT Reasoning for Code Generation17 Aug
Other references · 19
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,380
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2023Qwen Technical Reportcited by 3,344
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2024Scaling LLM Test-Time Compute Optimally can be More Effective than Scaling Model Parameterscited by 1,986
- 2023ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIscited by 1,947
- 2023Reinforced Self-Training (ReST) for Language Modelingcited by 500
- 2023OctoPack: Instruction Tuning Code Large Language Modelscited by 189
- 2024Debug like a Human: A Large Language Model Debugger via Verifying Runtime Execution Step-by-stepcited by 127
- 2024Code Generation with AlphaCodium: From Prompt Engineering to Flow Engineeringcited by 103
- 2023Improving Code Generation by Training with Natural Language Feedbackcited by 76
7 more
- 2023CodeScore: Evaluating Code Generation by Learning Code Executioncited by 67
- 2023A Survey of Large Language Models for Code: Evolution, Benchmarking, and Future Trendscited by 66
- 2023AgentCoder: Multi-Agent-based Code Generation with Iterative Testing and Optimisationcited by 35
- 2024The Stepwise Deception: Simulating the Evolution from True News to Fake News with LLM Agentscited by 24
- 2023Nuances are the Key: Unlocking ChatGPT to Find Failure-Inducing Tests with Differential Promptingcited by 23
- 2024Text Generation: A Systematic Literature Review of Tasks, Evaluation, and Challengescited by 18
- 2024Planning-Driven Programming: A Large Language Model Programming Workflowcited by 7
Built on by
Citing papers per year: 2025: 1; 2026: 2.
3 papers.
- 2025The Truth Becomes Clearer Through Debate! Multi-Agent Systems with Large Language Models Unmask Fake Newscited by 29
- 2026Breaking the Martingale Curse: Multi-Agent Debate via Asymmetric Cognitive Potential Energycited by 3
- 2026CollabCoder: Plan-Code Co-Evolution via Collaborative Decision-Making for Efficient Code Generationcited by 0
- 2026CollabCoder: Plan-Code Co-Evolution via Collaborative Decision-Making for Efficient Code Generation15 Apr 2026
- 2026Breaking the Martingale Curse: Multi-Agent Debate via Asymmetric Cognitive Potential Energy6 Mar 2026
- 2025The Truth Becomes Clearer Through Debate! Multi-Agent Systems with Large Language Models Unmask Fake News13 May 2025
Similar, not cited
Close in wording, no citation either way
- 2025SELF-REDRAFT: Eliciting Intrinsic Exploration-Exploitation Balance in Test-Time Scaling for Code Generation
- 2024Scattered Forest Search: Smarter Code Space Exploration with LLMs
- 2026TIPCODER: Reinforcement Learning Boosted Test-time Instruction Proposer for Code Generation
- 2026Planning to Explore: Curiosity-Driven Planning for LLM Test Generation
- 2024StepCoder: Improve Code Generation with Reinforcement Learning from Compiler Feedback
- 2025Enhancing LLM Code Generation: A Systematic Evaluation of Multi-Agent Collaboration and Runtime Debugging for Improved Accuracy, Reliability, and Latency
- 2025Afterburner: Reinforcement Learning Facilitates Self-Improving Code Efficiency Optimization
- 2026MaxCode: A Max-Reward Reinforcement Learning Framework for Automated Code Optimization