Papers
Topics
Authors
Recent
2000 character limit reached

ToolChain*: Efficient Action Space Navigation in Large Language Models with A* Search

Published 20 Oct 2023 in cs.CL, cs.AI, and cs.LG | (2310.13227v1)

Abstract: LLMs have demonstrated powerful decision-making and planning capabilities in solving complicated real-world problems. LLM-based autonomous agents can interact with diverse tools (e.g., functional APIs) and generate solution plans that execute a series of API function calls in a step-by-step manner. The multitude of candidate API function calls significantly expands the action space, amplifying the critical need for efficient action space navigation. However, existing methods either struggle with unidirectional exploration in expansive action spaces, trapped into a locally optimal solution, or suffer from exhaustively traversing all potential actions, causing inefficient navigation. To address these issues, we propose ToolChain*, an efficient tree search-based planning algorithm for LLM-based agents. It formulates the entire action space as a decision tree, where each node represents a possible API function call involved in a solution plan. By incorporating the A* search algorithm with task-specific cost function design, it efficiently prunes high-cost branches that may involve incorrect actions, identifying the most low-cost valid path as the solution. Extensive experiments on multiple tool-use and reasoning tasks demonstrate that ToolChain* efficiently balances exploration and exploitation within an expansive action space. It outperforms state-of-the-art baselines on planning and reasoning tasks by 3.1% and 3.5% on average while requiring 7.35x and 2.31x less time, respectively.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (61)
  1. Palm 2 technical report. arXiv preprint arXiv:2305.10403, 2023.
  2. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
  3. Program of thoughts prompting: Disentangling computation from reasoning for numerical reasoning tasks. arXiv preprint arXiv:2211.12588, 2022.
  4. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022.
  5. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021.
  6. Pal: Program-aided language models. arXiv, pp.  2211.10435v2, 2022.
  7. Reasoning with language model is planning with world model. arXiv preprint arXiv:2305.14992, 2023a.
  8. Toolkengpt: Augmenting frozen language models with massive tools via tool embeddings, 2023b.
  9. Deberta: Decoding-enhanced bert with disentangled attention. In International Conference on Learning Representations, 2020.
  10. Jie Huang and Kevin Chen-Chuan Chang. Towards reasoning in large language models: A survey, 2023.
  11. Language models as zero-shot planners: Extracting actionable knowledge for embodied agents. arXiv, pp.  2201.07207v2, 2022a.
  12. Inner monologue: Embodied reasoning through planning with language models. arXiv, pp.  2207.05608v1, 2022b.
  13. Mathprompter: Mathematical reasoning using large language models. arXiv preprint arXiv:2303.05398, 2023.
  14. Eric Jang. Can llms critique and iterate on their own outputs? evjang.com, 2023.
  15. Genegpt: Augmenting large language models with domain tools for improved access to biomedical information. ArXiv, 2023.
  16. Maieutic prompting: Logically consistent reasoning with recursive explanations. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pp.  1266–1279, Abu Dhabi, United Arab Emirates, December 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.emnlp-main.82. URL https://aclanthology.org/2022.emnlp-main.82.
  17. Language models can solve computer tasks. arXiv, pp.  2303.17491v1, 2023.
  18. Bandit based monte-carlo planning. In European conference on machine learning, pp.  282–293. Springer, 2006.
  19. Semantic uncertainty: Linguistic invariances for uncertainty estimation in natural language generation. In The Eleventh International Conference on Learning Representations, 2022.
  20. Code as policies: Language model programs for embodied control. arXiv, pp.  2209.07753v3, 2022.
  21. Teaching models to express their uncertainty in words, 2022.
  22. Learn to explain: Multimodal reasoning via thought chains for science question answering, 2022.
  23. Chameleon: Plug-and-play compositional reasoning with large language models. arXiv preprint arXiv:2304.09842, 2023.
  24. Augmented language models: a survey, 2023.
  25. Lila: A unified benchmark for mathematical reasoning. arXiv preprint arXiv:2210.17517, 2022.
  26. Webgpt: Browser-assisted question-answering with human feedback. arXiv preprint arXiv:2112.09332, 2021.
  27. Webgpt: Browser-assisted question-answering with human feedback, 2022.
  28. OpenAI. Gpt-4 technical report. arXiv, pp.  2303.08774v3, 2023.
  29. Art: Automatic multi-step reasoning and tool-use for large language models. arXiv preprint arXiv:2303.09014, 2023.
  30. Talm: Tool augmented language models. arXiv preprint arXiv:2205.12255, 2022.
  31. Gorilla: Large language model connected with massive apis. arXiv preprint arXiv:2305.15334, 2023.
  32. Virtualhome: Simulating household activities via programs. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp.  8494–8502, 2018.
  33. Tool learning with foundation models. arXiv preprint arXiv:2304.08354, 2023a.
  34. Toolllm: Facilitating large language models to master 16000+ real-world apis. arXiv preprint arXiv:2307.16789, 2023b.
  35. Improving language understanding by generative pre-training. OpenAI Blog, 2018.
  36. Language models are unsupervised multitask learners. OpenAI Blog, 2019.
  37. Toolformer: Language models can teach themselves to use tools. arXiv preprint arXiv:2302.04761, 2023.
  38. Hugginggpt: Solving ai tasks with chatgpt and its friends in huggingface. arXiv preprint arXiv:2303.17580, 2023.
  39. Reflexion: an autonomous agent with dynamic memory and self-reflection. arXiv preprint arXiv:2303.11366, 2023.
  40. Mastering the game of go with deep neural networks and tree search. nature, 529(7587):484–489, 2016.
  41. Adaplanner: Adaptive planning from feedback with language models, 2023.
  42. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023.
  43. Code4struct: Code generation for few-shot structured prediction from natural language. arXiv preprint arXiv:2210.12810, 2022a.
  44. Self-consistency improves chain of thought reasoning in language models. In The Eleventh International Conference on Learning Representations, 2022b.
  45. Describe, explain, plan and select: Interactive planning with large language models enables open-world multi-task agents. arXiv, pp.  2302.01560v1, 2023.
  46. Chain-of-thought prompting elicits reasoning in large language models. arXiv, pp.  2201.11903v6, 2022.
  47. A broad-coverage challenge corpus for sentence understanding through inference. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp.  1112–1122, 2018.
  48. Visual chatgpt: Talking, drawing and editing with visual foundation models. arXiv preprint arXiv:2303.04671, 2023.
  49. Decomposition enhances reasoning via self-evaluation guided decoding, 2023.
  50. On the tool manipulation capability of open-source large language models. arXiv preprint arXiv:2305.16504, 2023.
  51. Chatgpt is not enough: Enhancing large language models with knowledge graphs for fact-aware language modeling, 2023a.
  52. Gpt4tools: Teaching large language model to use tools via self-instruction, 2023b.
  53. Mm-react: Prompting chatgpt for multimodal reasoning and action. arXiv preprint arXiv:2303.11381, 2023c.
  54. Tree of thoughts: Deliberate problem solving with large language models, 2023a.
  55. React: Synergizing reasoning and acting in language models. In The Eleventh International Conference on Learning Representations, 2023b. URL https://openreview.net/forum?id=WE_vluYUL-X.
  56. Evaluating and improving tool-augmented computation-intensive math reasoning, 2023.
  57. Jiawei Zhang. Graph-toolformer: To empower llms with graph reasoning ability via prompt augmented by chatgpt. arXiv preprint arXiv:2304.11116, 2023.
  58. Judging llm-as-a-judge with mt-bench and chatbot arena, 2023.
  59. Least-to-most prompting enables complex reasoning in large language models. arXiv, pp.  2205.10625v2, 2022.
  60. Solving math word problems via cooperative reasoning induced language models. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp.  4471–4485, Toronto, Canada, July 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.acl-long.245. URL https://aclanthology.org/2023.acl-long.245.
  61. Toolqa: A dataset for llm question answering with external tools, 2023.
Citations (37)

Summary

  • The paper presents ToolChain* which integrates A* search to balance exploration and exploitation in large decision spaces.
  • The method utilizes a task-specific cost function combining cumulative and future cost heuristics to efficiently prune high-cost paths.
  • Experiments on ToolBench and GSM8K demonstrate that ToolChain* outperforms baselines in both efficiency and accuracy.

The paper presents ToolChain∗^*, a novel approach for navigating expansive action spaces in LLMs using an A* search-based algorithm. It addresses the inefficiencies and limitations of existing methods by effectively balancing exploration and exploitation. The focus is on improving decision-making in LLMs through a tree search-based framework.

Introduction to ToolChain∗^*

ToolChain∗^* proposes an A* search integrated with a task-specific cost function to navigate the decision spaces of LLMs formulated as decision trees. Each node in the tree signifies a potential API function call, allowing the method to efficiently prune high-cost paths and pursue the most promising routes. The integration of A* search with LLMs enables the efficient handling of large action spaces by focusing on cost-effective paths. Figure 1

Figure 1: A comparison of existing methods that leverage LLMs for decision-making from a searching space perspective.

Methodology

ToolChain∗^* operates through an iterative process comprising three phases: selection, expansion, and update (Figure 2).

  • Selection: Identify and expand the node with the lowest estimated cost from the frontier nodes.
  • Expansion: Generate potential actions for the next step using LLMs, expanding the decision tree.
  • Update: Re-evaluate cost functions with task-specific heuristics to prioritize nodes for future exploration. Figure 2

    Figure 2: ToolChain∗^* framework of three phases: (a) selection, (b) expansion, and (c) update.

Cost Function Design

The cost function f(n)=g(n)+h(n)f(n) = g(n) + h(n) combines:

  • Cumulative Cost g(n)g(n): Evaluates the cost of actions in the current plan using a geometric mean of task-specific heuristics and self-consistency frequency.
  • Future Cost h(n)h(n): Estimates the remaining path cost using task-specific heuristics and the LLM's imaginative capabilities.

Experiments

ToolChain∗^* was evaluated on tool-use tasks from ToolBench and reasoning tasks from GSM8K, demonstrating superior performance and efficiency.

  • On ToolBench datasets, ToolChain∗^* outperformed baselines such as ReAct and MCTS, achieving higher success rates.
  • In GSM8K, ToolChain∗^* showed improved accuracy over baseline methods including Chain-of-Thought and Self-Consistency. Figure 3

Figure 3

Figure 3: Time efficiency evaluation on ToolBench and GSM8K shows ToolChain∗^* efficiency over other methods.

Case Studies

ToolChain∗^*'s capacity to explore expansive decision spaces while mitigating error propagation is illustrated through qualitative assessments. Real-world case studies highlight its adaptability in revising plans and avoiding error paths, distinguishing it from unidirectional methods like Chain-of-Thought. Figure 4

Figure 4: ToolChain∗^* vs. Chain-of-Thought on GSM8K dataset showcasing exploration space.

Conclusion

ToolChain∗^* effectively addresses the challenges of navigating extensive action spaces in LLM-based decision-making. It mitigates the limitations of prior methods by integrating an efficient search framework with robust cost function design, enabling practical applications in real-world scenarios. Its ability to handle complex tasks with improved efficiency makes it a promising approach for future development in AI planning and reasoning capabilities.

Paper to Video (Beta)

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.

Tweets

Sign up for free to view the 1 tweet with 10 likes about this paper.