Google researchers have introduced ToolGrad, a new framework for generating synthetic training datasets that teach large language models to use tools more effectively. Rather than the traditional approach of creating hypothetical user queries and then searching for solutions, ToolGrad inverts the process by first generating valid tool-use chains, then automatically annotating corresponding user prompts. The approach, presented at ACL 2026, reduces generation costs while producing higher-quality training data by leveraging "textual gradients"—detailed LLM feedback that iteratively refines API workflows.
The ToolGrad system operates through four sequential stages: an API Proposer identifies promising function candidates, parallel Executors test selected calls, a Selector evaluates execution reports and provides directional feedback, and an Updater revises user queries to match verified workflows. When tested against ToolBench's database of over 16,000 real-world APIs, ToolGrad achieved significantly higher pass rates and lower computational costs compared to query-first approaches like the baseline DFS method used in prior work.
Fine-tuned Gemma-3 models trained on ToolGrad-generated datasets demonstrated competitive or superior performance against proprietary LLMs including Gemini, GPT, and Claude on out-of-distribution tool-use benchmarks. The results suggest that answer-first dataset generation could become a standard approach for training more capable AI agents, with implications for both enterprise and open-source LLM development.
Key Points
ToolGrad reverses traditional dataset generation by creating verified tool-use chains before user queries, reducing cost and improving quality
Uses iterative "textual gradients" from LLM feedback to construct complex API workflows from large tool libraries
Gemma-3 models fine-tuned on ToolGrad datasets match or exceed proprietary LLMs on tool-use benchmarks with unseen tools
Framework demonstrates 40%+ higher pass rates compared to query-first baseline approaches at lower computational cost