Open-source ToolLLaMA brings 16,000 APIs within reach
ToolLLaMA combines a model based on Meta’s open-source LLaMA with a dataset of API instructions and a system that recommends relevant APIs. In the researchers’ evaluation, it achieved a success rate comparable to ChatGPT on API tasks and could handle unfamiliar APIs by reading their documentation.
An open-source model designed to work with software tools can draw on a pool of more than 16,000 APIs. Called ToolLLaMA, it is part of a framework intended to help open-source models handle API requests at a level comparable to ChatGPT, according to its researchers.
“ToolLLaMA expands AI’s ability to select and use APIs autonomously, a mild increase in agentic capability.”Why it scores Terminator
Training a model to turn requests into API calls
ToolLLaMA is based on Meta’s open-source LLaMA model. Researchers trained it using ToolBench, a dataset of instructions paired with API calls. The dataset was generated automatically with ChatGPT and covers 49 categories.
That training targets a practical challenge: a user’s request may involve several steps and different services. For example, someone planning a movie night might ask for romantic movies from the U.S. and a suitable nearby venue. Handling that request requires the model to identify the right services and make the appropriate API calls.
The point is not simply to produce a response in natural language. The model must connect the request to tools that can retrieve relevant information, then use those tools to address the task. ToolBench gives it examples of how instructions and API calls relate.
Searching for a good route through a task
The researchers used a method called Depth-First Search Decision Tree, or DFSDT, while building ToolBench. It lets language models such as GPT-4 explore multiple search paths when looking for a solution to an API request.
According to the researchers, experiments found that DFSDT had a clear advantage on difficult tasks compared with the native model and other methods, including chain-of-thought reasoning. Exploring multiple paths can help when a request requires more than one decision about which tool or action to use.
ToolLLaMA also works with a neural API retriever. Given a statement, the retriever recommends relevant APIs from a pool of more than 16,000. By combining that recommendation step with the model, the framework aims to automate API selection instead of requiring a person to choose each API manually.
How the researchers measured performance
The team introduced ToolEval, an automated evaluator for comparing API-use systems. It tracks two measures: success rate, which reflects whether a model completes an instruction, and win rate, which compares the quality of its solution with existing methods.
In the ToolEval comparison, ToolLLaMA reached a success rate comparable to ChatGPT, despite being trained with significantly fewer examples. The researchers also report that it can work with APIs it has not encountered before by reading their documentation.
These results concern API tasks measured through the researchers’ evaluation framework. They describe performance on completing instructions and comparing solutions; they do not, by themselves, establish how the system would perform across every possible tool or real-world request.
Why API access matters
APIs let software exchange information and request actions from other services. For a language model, choosing and calling the right API can turn a broad request into a sequence of concrete operations. The movie-night example illustrates why that ability may involve coordinating distinct kinds of searches.
ToolLLaMA’s design addresses two parts of that process: learning from examples of instructions and calls, and finding candidate APIs for a new request. Its reported ability to read documentation for unfamiliar APIs suggests a way to extend tool use beyond those seen during training, though the source does not describe the limits of that capability.
The researchers have made more information and code available on GitHub. ToolBench, DFSDT, the API retriever, and ToolEval together outline an approach for building and assessing open-source systems that use APIs.
Read next