mlsanityData to 14 Oct 2026

Thinking Before Running! Efficient Code Generation with Thorough Exploration and Optimal Refinement

arXiv 2502.17442 ↗First posted 30 Dec 2024cs.SE cs.AIcited by 3

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

  1. 2024RethinkMCTS: Refining Erroneous Thoughts in Monte Carlo Tree Search for Code Generation15 Sep
  2. 2024MapCoder: Multi-Agent Code Generation for Competitive Problem Solving18 May
  3. 2024OpenCodeInterpreter: Integrating Code Generation with Execution and Refinement22 Feb
  4. 2023CodeCoT: Tackling Code Syntax Errors in CoT Reasoning for Code Generation17 Aug

Other references · 19

  1. 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,380
  2. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  3. 2021Program Synthesis with Large Language Modelscited by 3,637
  4. 2023Qwen Technical Reportcited by 3,344
  5. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  6. 2024Scaling LLM Test-Time Compute Optimally can be More Effective than Scaling Model Parameterscited by 1,986
  7. 2023ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIscited by 1,947
  8. 2023Reinforced Self-Training (ReST) for Language Modelingcited by 500
  9. 2023OctoPack: Instruction Tuning Code Large Language Modelscited by 189
  10. 2024Debug like a Human: A Large Language Model Debugger via Verifying Runtime Execution Step-by-stepcited by 127
  11. 2024Code Generation with AlphaCodium: From Prompt Engineering to Flow Engineeringcited by 103
  12. 2023Improving Code Generation by Training with Natural Language Feedbackcited by 76
7 more
  1. 2023CodeScore: Evaluating Code Generation by Learning Code Executioncited by 67
  2. 2023A Survey of Large Language Models for Code: Evolution, Benchmarking, and Future Trendscited by 66
  3. 2023AgentCoder: Multi-Agent-based Code Generation with Iterative Testing and Optimisationcited by 35
  4. 2024The Stepwise Deception: Simulating the Evolution from True News to Fake News with LLM Agentscited by 24
  5. 2023Nuances are the Key: Unlocking ChatGPT to Find Failure-Inducing Tests with Differential Promptingcited by 23
  6. 2024Text Generation: A Systematic Literature Review of Tasks, Evaluation, and Challengescited by 18
  7. 2024Planning-Driven Programming: A Large Language Model Programming Workflowcited by 7

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 1; 2026: 2.

3 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025SELF-REDRAFT: Eliciting Intrinsic Exploration-Exploitation Balance in Test-Time Scaling for Code Generation
  2. 2024Scattered Forest Search: Smarter Code Space Exploration with LLMs
  3. 2026TIPCODER: Reinforcement Learning Boosted Test-time Instruction Proposer for Code Generation
  4. 2026Planning to Explore: Curiosity-Driven Planning for LLM Test Generation
  5. 2024StepCoder: Improve Code Generation with Reinforcement Learning from Compiler Feedback
  6. 2025Enhancing LLM Code Generation: A Systematic Evaluation of Multi-Agent Collaboration and Runtime Debugging for Improved Accuracy, Reliability, and Latency
  7. 2025Afterburner: Reinforcement Learning Facilitates Self-Improving Code Efficiency Optimization
  8. 2026MaxCode: A Max-Reward Reinforcement Learning Framework for Automated Code Optimization