Large Language Models as Tool Makers

Tianle Cai,Xuezhi Wang,Tengyu Ma,Xinyun Chen,Denny Zhou
2023-05-27
Abstract:Recent research has highlighted the potential of large language models (LLMs) to improve their problem-solving capabilities with the aid of suitable external tools. In our work, we further advance this concept by introducing a closed-loop framework, referred to as LLMs A s Tool Makers (LATM), where LLMs create their own reusable tools for problem-solving. Our approach consists of two phases: 1) tool making: an LLM acts as the tool maker that crafts tools for a set of tasks. 2) tool using: another LLM acts as the tool user, which applies the tool built by the tool maker for problem-solving. On the problem-solving server side, tool-making enables continual tool generation and caching as new requests emerge. This framework enables subsequent requests to access cached tools via their corresponding APIs, enhancing the efficiency of task resolution. Recognizing that tool-making requires more sophisticated capabilities, we assign this task to a powerful, albeit resource-intensive, model. Conversely, the simpler tool-using phase is delegated to a lightweight model. This strategic division of labor allows the once-off cost of tool-making to be spread over multiple instances of tool-using, significantly reducing average costs while maintaining strong performance. Furthermore, our method offers a functional cache through the caching and reuse of tools, which stores the functionality of a class of requests instead of the natural language responses from LLMs, thus extending the applicability of the conventional cache mechanism. We evaluate our approach across various complex reasoning tasks, including Big-Bench tasks. With GPT-4 as the tool maker and GPT-3.5 as the tool user, LATM demonstrates performance equivalent to using GPT-4 for both roles, but with a significantly reduced inference cost.
Machine Learning,Computation and Language,Artificial Intelligence
What problem does this paper attempt to address?
The paper aims to address the cost and performance issues of large language models (LLMs) when handling complex tasks. Specifically, the paper proposes a closed-loop framework called LLMs As Tool Makers (LATM), which solves problems by allowing LLMs to create their own reusable tools. This approach is divided into two stages: 1. **Tool Making**: A powerful but costly LLM acts as a "tool maker" to design tools (implemented as Python functions) for a range of tasks. 2. **Tool Using**: Another less costly LLM acts as a "tool user" to apply these tools to solve problems. The tool user can be the same LLM or a different one. This division of labor allows the one-time cost of tool making to be amortized over multiple uses of the tools, significantly reducing the average cost while maintaining high performance. Additionally, this method introduces a functional caching mechanism that caches tools instead of natural language responses, further improving task-solving efficiency and reducing service costs. Experimental results show that in various complex reasoning tasks, including Big-Bench tasks, LATM can achieve performance comparable to using GPT-4 alone but at a lower cost when using GPT-4 as the tool maker and GPT-3.5 as the tool user.