Tree-of-Code:面向复杂任务处理中端到端代码生成与执行的树状结构探索框架
Tree-of-Code: A Tree-Structured Exploring Framework for End-to-End Code Generation and Execution in Complex Task Handling
AI总结:
针对CodeAct在复杂任务中贪婪生成代码导致的不一致和缺乏监督问题,提出Tree-of-Code框架,通过树状结构自我生长代码程序节点,在无地面真值下实现自我监督,显著提升准确率并减少交互轮次。
摘要:
解决复杂推理任务是智能体在现实世界中的关键应用。得益于大型语言模型(LLM)在代码数据上的预训练,最近的方法如CodeAct成功地将代码用作LLM智能体的行动,取得了良好效果。然而,CodeAct通过依赖零散的思维来贪婪地生成下一步行动的代码块,导致不一致性和不稳定性。此外,CodeAct缺乏与行动相关的地面真值(GT),使其在多轮交互中的监督信号和终止条件受到质疑。为解决这些问题,我们首先引入了一种简单而有效的端到端代码生成范式CodeProgram,它利用代码的系统逻辑与全局推理对齐,实现连贯的问题解决。然后,我们提出了Tree-of-Code(ToC),它基于代码的可执行性自我生长CodeProgram节点,并在无GT场景下实现自我监督。在十个流行的零样本LLM上对两个数据集的实验结果表明,ToC相比CodeAct以少于1/4的轮次显著提高了近20%的准确率。几个LLM甚至在单轮CodeProgram上的表现优于多轮CodeAct。为进一步研究效果与效率之间的权衡,我们测试了不同的ToC树大小和探索机制。我们还强调了ToC的端到端数据生成在监督和强化微调中的潜力。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。