September 10, 2026
Zhongyi Zhou, Research Scientist, and Ruofei Du, Interactive Perception & Graphics Lead, Google XR
ToolGrad is a data generation framework that reverses the traditional paradigm by first generating tool-use answers before user queries. We show this design enables LLMs to achieve better tool-use performance.
AI agents have shown great potential in automating real-world tasks, such as conducting a Google Search, reading local computer files, or executing generated Python scripts. To achieve such agentic workflows, LLMs need to learn how to use tools correctly and efficiently. To teach large language models tool uses, we need datasets of tool-use chains and their corresponding user queries. In our prior work introduced in InstructPipe, we manually annotated our evaluation data, but it is impractical to scale up the human annotation for advanced LLM fine-tuning workstreams. To streamline the data workstream, prior work, e.g., ToolBench and ToolACE, explored using an agent to automatically search a tool-use path with trial and error. This representative annotation approach involves two steps: (1) generate a hypothetical user instruction from a sampled API pool, and (2) use a depth-first search (DFS) agent to find its tool-use solution. This approach is inherently inefficient because its core concept is to distill valuable trajectories from a complex agent exploration for training an LLM.
In “ToolGrad: Efficient Tool-use Dataset Generation with Textual ‘Gradients’”, presented at ACL 2026, we introduce an alternative solution paradigm. ToolGrad first generates a ground-truth tool-use chain and then annotates its corresponding user prompt. Intuitively, an explicit tool-use solution provides more unambiguous information than a prompt, making the annotation, from tool usage to the use query, much easier and requiring only one LLM step. Our result shows that our answer-first approach can generate more complex (long-horizon) tool-use data with lower cost. LLMs trained on our generated data also outperform those trained on baseline methods, and even match SoTA proprietary LLMs on out-of-distribution (OOD) datasets with unseen tools.
Standard machine learning (ML) systems improve by computing numerical loss gradients across mini-batches of training samples, which are then used by an optimization algorithm to update model weights. Recently, TextGrad adapted this paradigm for prompt engineering using an LLM critic to provide rich, descriptive feedback in plain text — feedback called “textual gradients”. These textual gradients then guide the refinements of a given prompt into a new draft that can better resolve the target task.
ToolGrad adapts the concept of textual gradients from prompt optimization to synthetic dataset generation. Rather than optimizing a static text prompt, ToolGrad uses these gradients to iteratively construct complex, valid API workflows from large tool libraries.
ToolGrad features four core modules that sequentially propose, execute, select, and update.
Repeating this iterative process results in a data sample consisting of a user query, a verified API workflow, and the final AI response.
We first evaluate the cost and quality of the data generation. We use ToolBench as our API database, consisting of 16k+ real-world APIs, to generate our tool-use dataset. We compare the original query-first data generation approach on ToolBench, using depth-first search (DFS), with our answer-first approach, ToolGrad. The results demonstrate that ToolGrad can generate more complex tool-use data with higher pass rate, using lower generation cost.
We generated small-scale tool-use datasets called ToolGrad-500, using API databases from ToolBench. We then fine-tuned Gemma-3 models (1B, 4B and 12B) using ToolGrad-500, and we called these fine-tuned models ToolGrad-1B, ToolGrad-4B and ToolGrad-12B. We evaluated these models' tool-use performance on Berkeley Function Calling Leaderboard (BFCL), a tool-use benchmark with a different tool set from ToolBench. We compare our fine-tuned models against (1) base models without fine-tuning, (2) SoTA proprietary models (Gemini, GPT and Claude), and (3) SoTA tool-use specialized models (ToolACE, Hammer-2.1-7B).
The following summarizes our findings.
ToolGrad demonstrates that high-quality tool-use datasets can be generated more efficiently and reliably through an answer-first paradigm. By designing an agentic framework that iteratively chains APIs via textual gradients, ToolGrad addresses the longstanding cost and scalability bottlenecks in producing ground-truth data. Our design achieves almost 100% pass rate in data generation, enables relatively compact models to perform exceptionally well, and shows that student LLMs can even surpass their teachers.
Looking ahead, this research can be expanded to broader, real-world applications by scaling the framework to handle increasingly dynamic and vast API ecosystems. Future work will also explore extending this self-evolving capability to support continuous, on-the-fly learning for personalization over time. As agentic workflows become increasingly embedded in enterprise and everyday tasks, frameworks like ToolGrad lay the essential groundwork for training digital agents that are both highly capable and economically scalable to deploy.
This research was primarily conducted by Zhongyi Zhou during his Visiting Researcher tenure at Google. We extend our sincere gratitude to key contributors, Kohei Uehara, Haoyu Zhang, Jingtao Zhou, Lin Gu, Zheng Xu, Tatsuya Harada, for their support, and to Adarsh Kowdle and Shahram Izadi for their strategic guidance and thoughtful reviews.
Facts Only
September 10, 2026.
Zhongyi Zhou and Ruofei Du from Google XR.
ToolGrad is a data generation framework for LLM tool-use.
ToolGrad was presented at ACL 2026.
The framework utilizes an "answer-first" paradigm (generating tool-use chains before user queries).
TextGrad is the prior prompt engineering paradigm from which ToolGrad adapts "textual gradients."
ToolGrad consists of four modules: propose, execute, select, and update.
ToolBench provided the API database of over 16,000 real-world APIs.
ToolGrad-500 is a small-scale dataset used to fine-tune Gemma-3 models in 1B, 4B, and 12B sizes.
Performance was evaluated using the Berkeley Function Calling Leaderboard (BFCL).
Comparison models included Gemini, GPT, Claude, ToolACE, and Hammer-2.1-7B.
Executive Summary
ToolGrad introduces a "answer-first" data generation framework designed to improve how large language models (LLMs) utilize tools and APIs. Unlike traditional "query-first" methods—which generate a user prompt and then use trial-and-error search to find a solution—ToolGrad first constructs a verified API workflow and then generates the corresponding user query. This reversal is intended to reduce the cost of synthetic data generation while increasing the complexity and reliability of the resulting training sets.
The framework employs "textual gradients," adapting a concept from prompt optimization to iteratively refine API chains through a process of proposing, executing, selecting, and updating. When applied to Gemma-3 models (1B, 4B, and 12B) using a 500-sample dataset derived from ToolBench, the resulting models demonstrated performance that matches or exceeds certain proprietary and specialized models on the Berkeley Function Calling Leaderboard. This suggests that highly capable agentic workflows can be achieved using relatively compact models trained on efficiently generated synthetic data.
Full Take
Using ACADEMIC MODE:
The methodology represents a strategic inversion of synthetic data generation. By treating the "answer" (the API chain) as the anchor rather than the "query," the authors bypass the combinatorial explosion and high failure rates associated with depth-first search (DFS) in complex tool environments. The use of "textual gradients" provides a structured feedback loop that allows the system to self-correct, effectively turning dataset generation into an optimization problem.
A peer reviewer would likely flag the sample size of ToolGrad-500 as being remarkably small for the claims of matching SoTA proprietary models. While the results on the BFCL are promising, the leap from a 500-sample fine-tuning set to "surpassing teachers" requires more rigorous ablation studies to ensure the performance isn't an artifact of the specific tool-set overlap or over-fitting to the benchmark's structure. Furthermore, the "almost 100% pass rate" is a bold claim that warrants a detailed breakdown of the "select" and "update" modules to see where failures were discarded versus corrected.
If these findings hold, the primary implication is a shift toward "distillation-by-design," where small, deployable models can achieve enterprise-grade agency without the massive compute overhead of traditional RLHF or exhaustive search. It suggests that the bottleneck for AI agents is not the model's capacity, but the structural integrity of the training data.
Bridge Questions:
1. How does ToolGrad perform when the API documentation is intentionally ambiguous or contradictory?
2. Would the "answer-first" approach maintain its efficiency if scaled to millions of samples, or does the textual gradient loop introduce a new ceiling of diminishing returns?
3. To what extent does the performance on OOD datasets depend on the diversity of the initial ToolBench API pool versus the logic of the ToolGrad framework?
Sentinel — Human
The text exhibits the dense, technical style typical of academic research communication, suggesting a high probability of human authorship focused on conveying complex methodological advancements.
