{"slug": "toolgrad-efficient-tool-use-dataset-generation-with-textual-gradients", "title": "ToolGrad: Efficient tool-use dataset generation with textual \"gradients\"", "summary": "Google researchers Zhongyi Zhou and Ruofei Du introduced ToolGrad, a data generation framework that reverses the traditional tool-use dataset paradigm by generating ground-truth tool-use chains before user queries, presented at ACL 2026. Using ToolBench's 16k+ real-world APIs, ToolGrad produced more complex long-horizon tool-use data at lower cost and higher pass rate than the query-first depth-first search baseline, and LLMs trained on its data outperformed baseline-trained models and matched state-of-the-art proprietary LLMs on out-of-distribution datasets with unseen tools.", "body_md": "September 10, 2026\n\nZhongyi Zhou, Research Scientist, and Ruofei Du, Interactive Perception & Graphics Lead, Google XR\n\nToolGrad 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.\n\nAI 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](https://research.google/blog/instructpipe-generating-visual-blocks-pipelines-with-human-instructions-and-llms/), 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](https://arxiv.org/abs/2307.16789) and [ToolACE](https://arxiv.org/abs/2409.00920), 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.\n\nIn “[ToolGrad: Efficient Tool-use Dataset Generation with Textual ‘Gradients](https://arxiv.org/abs/2508.04086)’”, presented at [ACL 2026](https://aclanthology.org/2026.findings-acl.950/), we introduce an alternative solution paradigm. [ToolGrad](https://github.com/zhongyi-zhou/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.\n\nStandard 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](https://arxiv.org/abs/2406.07496) 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.\n\nToolGrad 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.\n\nToolGrad features four core modules that sequentially propose, execute, select, and update.\n\nRepeating this iterative process results in a data sample consisting of a user query, a verified API workflow, and the final AI response.\n\nWe first evaluate the cost and quality of the data generation. We use [ToolBench](https://arxiv.org/abs/2307.16789) 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.\n\nWe generated small-scale tool-use datasets called ToolGrad-500, using API databases from ToolBench. We then fine-tuned [Gemma-3](https://arxiv.org/abs/2503.19786) 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)](https://gorilla.cs.berkeley.edu/leaderboard.html), 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](https://arxiv.org/abs/2409.00920), [Hammer-2.1-7B](https://arxiv.org/abs/2410.04587v2)).\n\nThe following summarizes our findings.\n\nToolGrad 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.\n\nLooking 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.\n\n*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.*", "url": "https://wpnews.pro/news/toolgrad-efficient-tool-use-dataset-generation-with-textual-gradients", "canonical_source": "https://research.google/blog/toolgrad-efficient-tool-use-dataset-generation-with-textual-gradients/", "published_at": "2026-09-10 22:50:22+00:00", "updated_at": "2026-09-10 23:18:01.395634+00:00", "lang": "en", "topics": ["ai-agents", "ai-research", "large-language-models", "ai-tools", "developer-tools"], "entities": ["Google", "ToolGrad", "Zhongyi Zhou", "Ruofei Du", "ToolBench", "ToolACE", "InstructPipe", "ACL 2026"], "alternates": {"html": "https://wpnews.pro/news/toolgrad-efficient-tool-use-dataset-generation-with-textual-gradients", "markdown": "https://wpnews.pro/news/toolgrad-efficient-tool-use-dataset-generation-with-textual-gradients.md", "text": "https://wpnews.pro/news/toolgrad-efficient-tool-use-dataset-generation-with-textual-gradients.txt", "jsonld": "https://wpnews.pro/news/toolgrad-efficient-tool-use-dataset-generation-with-textual-gradients.jsonld"}}