Tree-of-Code: A Tree-Structured Exploring Framework for End-to-End Code Generation and Execution in Complex Task Handling
On the map: LLM reasoning → Reasoning for agents, planning and code
Abstract (arXiv)
Solving complex reasoning tasks is a key real-world application of agents. Thanks to the pretraining of Large Language Models (LLMs) on code data, recent approaches like CodeAct successfully use code as LLM agents' action, achieving good results. However, CodeAct greedily generates the next action's code block by relying on fragmented thoughts, resulting in inconsistency and instability. Moreover, CodeAct lacks action-related ground-truth (GT), making its supervision signals and termination conditions questionable in multi-turn interactions. To address these issues, we first introduce a simple yet effective end-to-end code generation paradigm, CodeProgram, which leverages code's systematic logic to align with global reasoning and enable cohesive problem-solving. Then, we propose Tree-of-Code (ToC), which self-grows CodeProgram nodes based on the executable nature of the code and enables self-supervision in a GT-free scenario. Experimental results on two datasets using ten popular zero-shot LLMs show ToC remarkably boosts accuracy by nearly 20% over CodeAct with less than 1/4 turns. Several LLMs even perform better on one-turn CodeProgram than on multi-turn CodeAct. To further investigate the trade-off between efficacy and efficiency, we test different ToC tree sizes and exploration mechanisms. We also highlight the potential of ToC's end-to-end data generation for supervised and reinforced fine-tuning.
Key facts. Cited by 11 papers in the map (data through 7 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 28 of its 45 references that are in the map. First posted on arXiv 19 Dec 2024.
Builds on
28 of 45 references.
Closest ancestors · 3
Same direction, newest first
- 2024SRA-MCTS: Self-driven Reasoning Augmentation with Monte Carlo Tree Search for Code Generation17 Nov
- 2024MapCoder: Multi-Agent Code Generation for Competitive Problem Solving18 May
- 2023Chain of Code: Reasoning with a Language Model-Augmented Code Emulator7 Dec
Other references · 25
- 2023GPT-4 Technical Reportcited by 18,132
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,355
- 2022Large Language Models are Zero-Shot Reasonerscited by 4,323
- 2023Qwen Technical Reportcited by 3,273
- 2023Sparks of Artificial General Intelligence: Early experiments with GPT-4cited by 2,579
- 2023ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIscited by 1,880
- 2023MetaGPT: Meta Programming for A Multi-Agent Collaborative Frameworkcited by 1,761
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
- 2023WizardLM: Empowering large pre-trained language models to follow complex instructionscited by 1,116
- 2023GAIA: a benchmark for General AI Assistantscited by 1,084
- 2022Program of Thoughts Prompting: Disentangling Computation from Reasoning for Numerical Reasoning Taskscited by 1,057
- 2023ChatDev: Communicative Agents for Software Developmentcited by 893
13 more
- 2023API-Bank: A Comprehensive Benchmark for Tool-Augmented LLMscited by 574
- 2024Executable Code Actions Elicit Better LLM Agentscited by 537
- 2024Improve Mathematical Reasoning in Language Models by Automated Process Supervisioncited by 426
- 2024Quiet-STaR: Language Models Can Teach Themselves to Think Before Speakingcited by 292
- 2024ReFT: Reasoning with Reinforced Fine-Tuningcited by 236
- 2024Data Interpreter: An LLM Agent For Data Sciencecited by 222
- 2023AutoAgents: A Framework for Automatic Agent Generationcited by 211
- 2023Is Self-Repair a Silver Bullet for Code Generation?cited by 191
- 2024Self-Contrast: Better Reflection Through Inconsistent Solving Perspectivescited by 71
- 2023L2MAC: Large Language Model Automatic Computer for Extensive Code Generationcited by 30
- 2023LeTI: Learning to Generate from Textual Interactionscited by 25
- 2024Learning Task Decomposition to Assist Humans in Competitive Programmingcited by 14
- 2024JumpCoder: Go Beyond Autoregressive Coder via Online Modificationcited by 7
Built on by
Citing papers per year: 2025: 8; 2026: 3.
11 papers.
- 2025Towards Reasoning Era: A Survey of Long Chain-of-Thought for Reasoning Large Language Modelscited by 381
- 2026Code as Agent Harnesscited by 40
- 2025GitTaskBench: A Benchmark for Code Agents Solving Real-World Tasks Through Code Repository Leveragingcited by 25
- 2025RepoMaster: Autonomous Exploration and Understanding of GitHub Repositories for Complex Task Solvingcited by 19
- 2025Position: Foundation Models for Tabular Data within Systemic Contexts Need Groundingcited by 5
- 2025Adaptive Test-Time Reasoning via Reward-Guided Dual-Phase Searchcited by 2
- 2025Learning-Based Automated Adversarial Red-Teaming for Robustness Evaluation of Large Language Modelscited by 2
- 2025Neural Algorithmic Reasoners informed Large Language Model for Multi-Agent Path Findingcited by 1
- 2026TheoremForge: Scaling up Formal Data Synthesis with Low-Budget Agentic Workflowcited by 1
- 2025Knowledge-Guided Multi-Agent Framework for Application-Level Software Code Generationcited by 0
- 2026LogicEval: A Systematic Framework for Evaluating Automated Repair Techniques for Logical Vulnerabilities in Real-World Softwarecited by 0
- 2026Code as Agent Harness18 May 2026
- 2026LogicEval: A Systematic Framework for Evaluating Automated Repair Techniques for Logical Vulnerabilities in Real-World Software14 Apr 2026
- 2026TheoremForge: Scaling up Formal Data Synthesis with Low-Budget Agentic Workflow24 Jan 2026
- 2025Learning-Based Automated Adversarial Red-Teaming for Robustness Evaluation of Large Language Models21 Dec 2025
- 2025Knowledge-Guided Multi-Agent Framework for Application-Level Software Code Generation22 Oct 2025
- 2025Adaptive Test-Time Reasoning via Reward-Guided Dual-Phase Search29 Sep 2025
- 2025GitTaskBench: A Benchmark for Code Agents Solving Real-World Tasks Through Code Repository Leveraging26 Aug 2025
- 2025Neural Algorithmic Reasoners informed Large Language Model for Multi-Agent Path Finding25 Aug 2025
- 2025RepoMaster: Autonomous Exploration and Understanding of GitHub Repositories for Complex Task Solving27 May 2025
- 2025Position: Foundation Models for Tabular Data within Systemic Contexts Need Grounding26 May 2025
- 2025Towards Reasoning Era: A Survey of Long Chain-of-Thought for Reasoning Large Language Models12 Mar 2025
Similar, not cited
Close in wording, no citation either way
- 2024Tree-of-Code: A Hybrid Approach for Robust Complex Task Planning and Execution
- 2024CodeTree: Agent-guided Tree Search for Code Generation with Large Language Models
- 2025TALM: Dynamic Tree-Structured Multi-Agent Framework with Long-Term Memory for Scalable Code Generation
- 2026Codoku: Renewable Program-Reasoning Challenges for Frontier Coding Agents
- 2025MapCoder-Lite: Distilling Multi-Agent Coding into a Single Small LLM
- 2025Guided Code Generation with LLMs: A Multi-Agent Framework for Complex Code Tasks
- 2025Breakpoint: Scalable evaluation of system-level reasoning in LLM code agents
- 2025RA-Gen: A Controllable Code Generation Framework Using ReAct for Multi-Agent Task Execution