[Paper Review] ToolAlpaca: Generalized Tool Learning for Language Models with 3000 Simulated Cases
ToolAlpaca automatically builds a diverse tool-use corpus and fine-tunes compact language models to achieve generalized tool-use abilities, rivaling GPT-3.5 on unseen tools using only ~3.9k simulated cases.
Enabling large language models to utilize real-world tools effectively is crucial for achieving embodied intelligence. Existing approaches to tool learning have either primarily relied on extremely large language models, such as GPT-4, to attain generalized tool-use abilities in a zero-shot manner, or utilized supervised learning to train limited scopes of tools on compact models. However, it remains uncertain whether smaller language models can achieve generalized tool-use abilities without tool-specific training. To address this question, this paper introduces ToolAlpaca, a novel framework designed to automatically generate a diverse tool-use corpus and learn generalized tool-use abilities on compact language models with minimal human intervention. Specifically, ToolAlpaca first automatically creates a highly diversified tool-use corpus by building a multi-agent simulation environment. The corpus contains 3938 tool-use instances from more than 400 real-world tool APIs spanning 50 distinct categories. Subsequently, the constructed corpus is employed to fine-tune compact language models, resulting in two models, namely ToolAlpaca-7B and ToolAlpaca-13B, respectively. Finally, we evaluate the ability of these models to utilize previously unseen tools without specific training. Experimental results demonstrate that ToolAlpaca achieves effective generalized tool-use capabilities comparable to those of extremely large language models like GPT-3.5, demonstrating that learning generalized tool-use ability is feasible for compact language models.
Motivation & Objective
- Demonstrate whether compact language models can acquire generalized tool-use abilities without tool-specific training.
- Automatically generate a diverse, well-structured tool-use corpus suitable for fine-tuning small LMs.
- Show that fine-tuning on the ToolAlpaca corpus enables generalized tool use to unseen tools and real-world APIs.
Proposed method
- Construct a diverse toolset by converting 400+ real-world tools from public-apis into standardized documentation (name, introduction, description, function documentation, OpenAPI spec).
- Generate 3,938 tool-use instances via a three-agent multi-turn simulation (user, assistant, tool executor) powered by LLMs.
- Use the generated corpus to fine-tune compact LMs (Vicuna-7B and Vicuna-13B) and evaluate on unseen simulated and real-world tools.
- Assess generalization to multi-modal and unseen tools using machine evaluation with GPT-4 and manual evaluation on select subsets.
- Quantify the impact of toolset diversity on generalization performance.

Experimental results
Research questions
- RQ1Can compact language models learn generalized tool-use abilities without tool-specific training?
- RQ2Does automated, diverse synthetic data enable compact LMs to generalize to unseen tools and real-world APIs?
- RQ3How does toolset diversity affect generalization performance?
- RQ4How does ToolAlpaca compare to large LMs (e.g., GPT-3.5) on unseen tools?
Key findings
- Fine-tuned ToolAlpaca-7B and ToolAlpaca-13B achieve higher acceptance/accuracy on unseen tools compared to base Vicuna models.
- ToolAlpaca-13B attains performance comparable to GPT-3.5 on unseen tools.
- Training on 3.9k simulated cases enables generalization to real-world APIs, with ToolAlpaca outperforming Vicuna baselines.
- ToolAlpaca demonstrates strong generalization on out-of-dataset multi-modal tools (GPT4Tools test set).
- Increasing toolset diversity (even with the same number of instances) improves validation performance.
- Diversity is a pivotal factor in enabling generalized tool learning for compact models.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.