TL;DR
Seal-Tools is a large-scale, open-source dataset designed to bridge the gap in Large Language Model (LLM) tool-calling capabilities. By employing a structured self-instruct pipeline, the authors generated over 4,000 diverse tools and 14,000 usage instances, including complex "nested" calls where one tool's output feeds into another. Finetuning open-source models on this data significantly boosts their performance, allowing a LLaMA-2-7B model to rival ChatGPT in tool-calling accuracy.
What Problem Does This Paper Address?
While LLMs have shown promise as "agents" capable of using external APIs (tools) to solve tasks, training and evaluating these agents remains difficult. Existing datasets suffer from three main issues:
- Scale and Diversity: Hand-crafted datasets are too small, while those scraped from real-world API hubs often lack diversity or contain repetitive, low-quality examples.
- Complexity: Most benchmarks focus on simple, single-tool calls. Real-world tasks often require multiple tools or "nested" logic (e.g., using a restaurant's location from a search tool to then call a taxi service).
- Evaluation Rigor: Many benchmarks rely on "LLM-as-a-judge" or text similarity metrics, which are expensive, non-deterministic, and often fail to catch subtle parameter errors.
Methods
The authors propose a three-stage self-instruct pipeline to generate high-quality data with minimal human intervention:
- Field Generation: To ensure diversity, the LLM first generates a hierarchical list of fields and sub-fields (e.g., Science -> Physics). This acts as an "anchor" to prevent the model from generating the same common tools repeatedly.
- Tool Generation: For each sub-field, the model generates API-like tools using a strict template. Crucially, the authors ask the model to generate example parameter values during this stage, which helps ground the subsequent instance generation. Tool template and example
- Instance Generation: The model creates user queries and the corresponding tool calls. They separate this into two steps for complex tasks: first selecting the necessary tools, then filling in the parameters and writing the query. This reduces "hallucination" errors.
A key innovation is the inclusion of nested tool callings, where the response of a previous tool is used as a parameter for the next, forming a directed acyclic graph (DAG) of operations rather than a simple linear sequence.
Datasets
- Seal-Tools (New): Contains 4,076 tools across 146 fields and 14,076 instances. This includes 10,000 multi-tool instances and 586 nested-tool instances.
- Comparison Benchmarks: The paper compares Seal-Tools against ToolBench, API-Bank, and ToolAlpaca. Seal-Tools stands out for being fully open-source, extensible, and featuring deterministic evaluation via JSON format control.
- Generalization Verification: The authors also transformed existing Task-Oriented Dialogue (TOD) datasets (like Multiwoz2.2) into tool-learning formats to verify their model's ability to generalize.
Key Insights and Ideas
- Diversity through Hierarchy: Without the "Field Generation" step, LLMs tend to output duplicate or generic tools. Hierarchical categorization (Figure 3) is essential for a broad-spectrum dataset. Examples of fields and tools
- The "Nested" Challenge: Nested calling is significantly harder for models than simple multi-tool calling. It requires the model to understand the data flow between APIs, not just the individual functions.
- Deterministic Evaluation is King: By forcing the model to output in a strict JSON format, the authors can calculate precise Precision, Recall, and F1 scores for both tool selection and parameter filling, removing the ambiguity of LLM-based evaluation.
Key Results
- Massive Performance Gains: Finetuning LLaMA-2-7B on Seal-Tools improved its Tool F1 score by 45.92% and its Parameter F1 by 47.59% compared to the base model.
- Rivaling the Giants: The finetuned LLaMA-2-7B (using a DPR retriever) achieved a Tool F1 of 80.25, outperforming ChatGPT (74.73) and approaching GPT-4 (81.65).
- Retriever Impact: The authors found that Dense Passage Retrieval (DPR) significantly outperforms BM25 for tool selection, suggesting that the model needs to understand the semantics of a tool's documentation rather than just matching keywords.
- Nested Difficulty: Even for the best models, nested instances remain the most difficult. The finetuned model's Parameter F1 dropped by about 5% on unseen nested data compared to standard multi-tool instances.
Limitations and Future Work
- Multi-tool Bottleneck: While single-tool performance is high, there is still a significant gap between open-source models and GPT-4 in complex multi-tool scenarios.
- Retriever Training: The authors noted that current retrievers often fail to find all necessary tools for a complex query. Improving retriever training specifically for multi-tool dependencies is a suggested area for future research.
- Hallucination: Models still occasionally "hallucinate" tools that aren't in the provided tool pool, particularly when the retriever fails to provide the correct candidates.
Summary updated