MachinoAI Research
ToolGrad: Efficient Tool-use Dataset Generation with Textual “Gradients”
Generate the successful tool-use workflow first, then synthesize the user query around it.
TL;DR
ToolGrad uses proposer, executor, selector, and updater modules to build verified API workflows; its ToolGrad-500 dataset reaches a 99.8% generation pass rate and trains compact Gemma-3 models that perform strongly on tool-use benchmarks.
Why It Matters
Tool-use data generation is often the bottleneck for reliable agents. ToolGrad reframes dataset construction so successful tool chains are produced before prompts, reducing failed exploration and making long-horizon tool-use data cheaper to generate.
Research Brief
The shortest useful explanation.
ToolGrad uses proposer, executor, selector, and updater modules to build verified API workflows; its ToolGrad-500 dataset reaches a 99.8% generation pass rate and trains compact Gemma-3 models that perform strongly on tool-use benchmarks.
Core Explanation
Prior work generates a user query and then searches for a tool-use solution, causing annotation failures and high cost. ToolGrad reverses the order: it first constructs valid tool-use chains through iterative textual-gradient-guided API selection, then synthesizes the corresponding query and response.
Why It Matters
Tool-use data generation is often the bottleneck for reliable agents. ToolGrad reframes dataset construction so successful tool chains are produced before prompts, reducing failed exploration and making long-horizon tool-use data cheaper to generate.

ToolGrad answer-first generation
Official Google Research figure contrasting query-first tool search with ToolGrad API mini-batch construction.

ToolGrad workflow
Official figure showing proposer, executor, selector, and updater stages.

Generation efficiency comparison
Original result table comparing DFS and ToolGrad generation efficiency.
Section 01
Problem
01. Problem
Tool-use datasets are expensive to create because the conventional pipeline first invents a user query and then searches for a valid API execution path. The search can fail, waste tool calls, and preferentially produce short trajectories. ToolGrad asks whether the direction can be reversed: construct a verified tool-use solution first, then synthesize the query and response from that solution.
Section 02
How It Works
03. How It Works
Each iteration samples an API mini-batch. An API Proposer selects up to m candidate APIs. API Executors run the candidates in parallel and return execution reports. An API Selector chooses the most valuable API and identifies the chain it should extend. The Workflow Updater appends that API and asks an LLM to regenerate the query and response so the sample remains coherent. The loop repeats for a fixed number of iterations.
Section 03
Architecture
05. Architecture
ToolGrad is an agentic data-generation loop around a large API library. The main control plane contains four modules: proposer, executor, selector, and updater. Executors are parallelized because execution is the expensive step. The final generated artifact is a triplet containing a user query, a verified API workflow, and the response.
Section 04
Experiments
06. Experiments
The authors compare ToolGrad against DFS-based ToolBench generation and evaluate models fine-tuned on ToolGrad-500 against ToolBench and BFCL. Generation efficiency is measured by pass rate, ground-truth tool uses, LLM cost, and tool cost. Tool-use quality is evaluated on ToolBench and BFCL, including subscale breakdowns.
Formulas
ToolGrad dataset representation
A training sample contains a user query q, an API workflow W, and a response r.
API proposal
The proposer filters a random API mini-batch into at most m candidates for extending the current workflow.
API selection
The selector chooses the API with the highest hypothetical value based on execution reports and the current workflow; in practice an LLM acts as the proxy for V.
Related Research
Generative Agents
An agent architecture combining memory, retrieval, reflection, and planning to simulate believable long-horizon behavior.
AI AgentsMIRA
MIRA is an autonomous medical agent evaluated in a sandboxed EHR workflow with tools for diagnosis, testing, treatment, and admission decisions.
AI AgentsAgentic Reasoning
A tool-using agent framework that extends LLM reasoning with web search, coding, and structured reasoning memory for deep research tasks.
References
ToolBench
Query-first tool-use dataset generation and DFS-based solution search used as the principal baseline.
TextGrad
Textual-gradient optimization provides the conceptual analogy used by ToolGrad.
ReAct: Synergizing Reasoning and Acting in Language Models
Agent reasoning-and-acting framework discussed in the paper and related tool-use literature.
arXiv v3ACL Anthology Findings of ACL 2026Google Research ToolGradOfficial GitHub repository