TL;DR
GOAT (Goal-Oriented Agent with Tools) is a novel, human-annotation-free training framework that automatically synthesizes high-quality training data to fine-tune LLM agents for complex tool use. By flipping the traditional data generation process on its head with a "call-first" paradigm, GOAT enables smaller open-source models to achieve state-of-the-art performance, sometimes even outperforming proprietary models on multi-step, goal-oriented tasks.
What Problem Does This Paper Address?
While large language models (LLMs) excel at simple, single-step tool invocations, they struggle with goal-oriented queries. These are high-level user requests (e.g., "Give me some reviews of the first movie that is similar to Titanic") that do not provide step-by-step instructions. To solve them, an agent must decompose the goal into a sequence of interdependent API calls, where the output of one call serves as the input for the next.
Progress in this area has been bottlenecked by a lack of training data. Manually annotating complex API dependencies is prohibitively expensive. Consequently, current approaches rely on zero-shot prompting, which works decently on massive proprietary models like GPT-4 but fails completely on smaller open-source models. Furthermore, existing synthetic data pipelines use an "instruction-first" strategy—asking an LLM to generate a query first and then predict the API calls. This introduces a self-reinforcing bias, where the model only generates "easy" scenarios it already knows how to solve.
Methods
The authors introduce GOAT, a framework that automatically constructs goal-oriented datasets directly from raw API documentation through two main phases:
-
API Dependency Graph Construction: To understand how APIs can interact, GOAT builds a multidigraph where nodes are APIs and edges represent valid input-output connections. To avoid the extreme cost of using an LLM to check every possible pair, they implement a staged filtering pipeline:
-
Embedding Similarity: A cheap Sentence-BERT (SBERT) filter prunes clearly incompatible pairs.
- LLM Filtering: An LLM evaluates the semantic plausibility of the remaining connections.
- API Call Execution: The connections are validated by executing real API calls with generated arguments to ensure they actually work.
- Call-First Generation Paradigm: Instead of generating a user query first, GOAT samples a valid, connected path from the dependency graph. It executes this sequence of APIs sequentially, passing real data forward. Once the execution trajectory is complete, an LLM looks at the entire successful workflow and abstracts it backward into a natural language user query and a final response.
Finally, the LLM agent is fine-tuned using LoRA. Crucially, the authors use argument masking (setting loss contributions of specific argument values to zero) during training to force the model to learn the structural format of API planning rather than memorizing specific data values.
Datasets
The framework was evaluated on two existing human-annotated benchmarks and one newly introduced dataset:
- RestBench: Real-world API test sets for TMDB (movies) and Spotify (music).
- API-Bank: A benchmark consisting of human-implemented Python APIs.
- GOATBench (New): A large-scale, human-verified benchmark curated using the GOAT pipeline. It features 660 tasks, 293 tools, and 830 APIs from RapidAPI across four domains (financial, food, entertainment, travel). It explicitly splits tasks into seen (in-domain) and unseen (out-of-domain) APIs to test generalization.
Key Insights and Ideas
- The Asymmetry of Abstraction: It is much easier for an LLM to look at a completed, successful API execution chain and summarize it into a query ("call-first") than it is to guess a complex chain from a vague query ("instruction-first"). Flipping the workflow converts the LLM's strong summarization skills into a reliable supervision signal.
- Masking Prevents Overfitting: Standard fine-tuning causes LLMs to overfit to the exact parameter values seen in the training set. Masking argument tokens ensures the model learns how to route data between APIs structurally.
- Graph-Based Sampling Captures Complexity: Generating data from a validated dependency graph naturally creates multi-step, long-horizon planning problems that mimic realistic, complex user scenarios.
Key Results
GOAT-trained open-source models achieved massive performance leaps across all benchmarks:
- RestBench: Without fine-tuning, open-source models scored near 0% success. After GOAT training, Llama2-13B and Vicuna-13B achieved substantial gains, with Vicuna-13B hitting a 29.8% success rate on Spotify, outperforming the zero-shot closed-source baseline (text-davinci-003 at 14.5%).
- API-Bank: A Llama-7B model trained with GOAT achieved a 64% success rate, significantly outperforming both the zero-shot baseline (34%) and the competitive ToolLLM framework (44%).
- GOATBench: On Inter-Tool tasks (the hardest setting, requiring chaining across different tools), GOAT fine-tuning boosted Llama3-8B's Selection Accuracy from 9.7% to 59.4% and Invocation Accuracy from 2.9% to 26.5%.
Limitations and Future Work
While GOAT shows impressive cross-benchmark generalization, its primary design targets in-domain agent training. The authors note that the model's generalization to entirely unseen API schemas remains limited. Additionally, the pipeline is inherently dependent on the quality of the initial API documentation; ambiguous or poorly documented APIs can degrade the accuracy of the generated dependency graph. Future work will likely focus on improving robust generalization to completely novel tool environments.
Summary updated