TL;DR
This paper introduces TOOLFLOW, a novel pipeline for synthesizing realistic dialogue data to improve Large Language Models' (LLMs) tool-calling abilities. By employing a graph-based tool sampling method and a planned dialogue generation strategy, TOOLFLOW creates more coherent and diverse training data, enabling LLMs to achieve performance comparable to or exceeding GPT-4 on tool-calling tasks.
What Problem Does This Paper Address?
Large Language Models (LLMs) are increasingly being integrated with external tools to expand their capabilities. While supervised fine-tuning (SFT) is a common method to enhance this tool-calling ability, it relies heavily on synthesized training data. Existing methods for synthesizing this data often suffer from two major drawbacks:
- Irrelevant Tool Combinations: Tools are often sampled randomly, leading to combinations that are difficult to integrate into complex, real-world scenarios. This limits the diversity and complexity of the generated training data.
- Lack of Dialogue Coherence: Most current approaches focus on single-turn tool-calling instructions, neglecting the natural flow and coherence of multi-turn dialogues that are characteristic of human-AI interactions. This creates a gap between synthesized data and practical application.
These issues result in LLMs that struggle to perform complex, multi-step tool-use tasks in a natural and coherent manner.
Methods
TOOLFLOW addresses these challenges through a two-pronged approach:
- Graph-based Sampling: Instead of random sampling, TOOLFLOW constructs a "tool graph" where nodes represent tools and edges represent their semantic similarity based on shared parameters or return values. This allows for the selection of tool subsets that are more likely to be used together in practical scenarios, leading to more relevant and complex requirements.
- Planned-Generation Strategy: Before generating dialogue turns, an LLM first creates a "dialogue plan." This plan outlines the user's requests, including both tool-calling and non-tool-related chitchat, ensuring a logical flow and coherence across turns. This approach separates the logical structure from the specific phrasing, allowing the LLM to focus on creating a coherent dialogue framework.
These strategies are integrated into a multi-agent synthesis pipeline involving User, Assistant, and Tool agents that interact to generate dialogues.
Datasets
- Training Data: The paper introduces TOOLFLOW, which generates 8,000 synthetic dialogues.
- Evaluation Datasets:
- BFCL-v2: A Python-style tool-calling dataset with various categories (Simple, Multiple, Parallel, Parallel Multiple).
- API-Bank: A dialogue-style tool-calling dataset with "Call" and "Retrieve + Call" settings.
- ToolAlpaca: A dataset designed for evaluating tool-calling capabilities, including error correction.
- MultiWOZ: A well-known task-oriented dialogue dataset used for comparison with synthetic dialogues.
Key Insights and Ideas
- Tool Interconnectivity Matters: The paper strongly emphasizes that the relevance and interconnectedness of tools are crucial for generating realistic and complex training data. Simply sampling tools randomly leads to superficial requirements.
- Planning is Key to Coherence: By introducing a planning step before dialogue generation, TOOLFLOW significantly improves the coherence of synthetic dialogues. This allows LLMs to better mimic natural human-AI conversations.
- Diversity and Coherence are Synergistic: The study demonstrates that both increased data diversity (via graph-based sampling) and enhanced coherence (via planned generation) contribute positively to LLM tool-calling performance.
- Synthetic Data Can Rival Real Data: The evaluation against MultiWOZ suggests that TOOLFLOW-generated dialogues achieve comparable quality to human-created datasets, particularly in task-oriented aspects like helpfulness.
Key Results
- Improved Tool-Calling Performance: Fine-tuning LLaMA-3.1-8B with TOOLFLOW-generated data resulted in performance comparable to or surpassing GPT-4 on various tool-calling benchmarks (BFCL-v2, API-Bank).
- State-of-the-Art on Dialogue Data: TOOLFLOW achieved state-of-the-art accuracy on the API-Bank dialogue dataset.
- Enhanced Error Correction: The fine-tuned model demonstrated an ability to self-correct based on error messages, even without explicit error correction samples in the training data.
- No Catastrophic Forgetting: Fine-tuning with TOOLFLOW did not compromise the LLM's general reasoning and conversational abilities, as evidenced by performance on MMLU, BBH, and MTBench.
- Data Quality Improvements: Automatic evaluations showed that Graph Sampling enhances diversity, while Planned-Generation improves coherence. GPT-4 evaluations also indicated improvements in naturalness and coherence.
Limitations and Future Work
- Seed Tool Set Diversity: The current TOOLFLOW pipeline relies on a pre-collected set of tools. While it can synthesize diverse dialogues, the ultimate diversity of the synthesized data is limited by the initial tool set. Future work could explore methods to enrich this seed tool set.
- Weak-to-Strong Paradigm: The current approach uses powerful models like GPT-4 for synthesis to train smaller models. The authors are interested in exploring whether models can be improved by training on their own synthesized data, a more challenging but potentially more meaningful direction.
Summary updated