UTCS Artificial Intelligence
courses
talks/events
demos
people
projects
publications
software/data
labs
areas
admin
CodeTree: Agent-guided Tree Search for Code Generation with Large Language Models (2025)
Jierui Li
, Hung Le, Yingbo Zhou, Caiming Xiong, Silvio Savarese, Doyen Sahoo
Pre-trained on massive amounts of code and text data, large language models (LLMs) have demonstrated remarkable achievements in performing code generation tasks. With additional execution-based feedback, these models can act as agents with capabilities to self-refine and improve generated code autonomously. However, on challenging coding tasks with extremely large search space, current agentic approaches still struggle with multi-stage planning, generating, and debugging. To address this problem, we propose CodeTree, a framework for LLM agents to efficiently explore the search space in different stages of the code generation process. Specifically, we adopted a unified tree structure to explicitly explore different coding strategies, generate corresponding coding solutions, and subsequently refine the solutions. In each stage, critical decision-making (ranking, termination, expanding) of the exploration process is guided by both the environmental execution-based feedback and LLM-agent-generated feedback. We comprehensively evaluated CodeTree on 7 code generation benchmarks and demonstrated the significant performance gains of CodeTree against strong baselines. Using GPT-4o as the base model, we consistently achieved top results of 95.1 on HumanEval, 98.7 on MBPP, and 43.0 on CodeContests. On the challenging SWEBench benchmark, our approach led to significant performance gains.
View:
PDF
,
Arxiv
Citation:
Nations of the Americas Chapter of the Association for Computational Linguistics (NAACL)
(2025).
Bibtex:
@article{li:naacl25, title={CodeTree: Agent-guided Tree Search for Code Generation with Large Language Models}, author={Jierui Li and Hung Le and Yingbo Zhou and Caiming Xiong and Silvio Savarese and Doyen Sahoo}, booktitle={Nations of the Americas Chapter of the Association for Computational Linguistics (NAACL)}, month={April}, url="http://www.cs.utexas.edu/users/ai-labpub-view.php?PubID=128118", year={2025} }
People
Jierui Li
Ph.D. Student
jierui [at] cs utexas edu
Areas of Interest
Deep Learning
Natural Language for Software Engineering
Natural Language Processing
Labs
Machine Learning