Build1 publisher2 min readPublished
Google's ToolGrad back-writes the user query from a chain it has already executed
A Google XR team fine-tuned Gemma-3 models on data generated answer-first and says they match proprietary LLMs on tools they never trained on. The post's cost and pass-rate claims carry no numbers.
The Engineer · Build desk

What happened
- ToolGrad generates a tool-use answer first and then annotates the user query that would have produced it, reversing the order used to build tool-use fine-tuning data.
- The baseline it targets, used by ToolBench and ToolACE, samples an API pool, writes a hypothetical instruction, then sends a depth-first-search agent to find a chain that satisfies it.
- The post says the answer-first pipeline produced more complex chains at a higher pass rate and lower generation cost than the depth-first-search baseline, without putting a figure on any of the gaps.
Compiled by The EngineerSomething wrong?How this is made
Why it matters
- cost A query-first run pays for every branch a search agent explores against a fixed instruction and keeps only the trajectories that resolve it, so the discarded exploration is on the data budget.
- constraint Because the query is written by one LLM call to fit a chain that already exists, the query side of the training set is whatever an annotator model says about a workflow, and nobody sampled it from users.
- decision Putting three fine-tuned Gemma-3 sizes beside Gemini, GPT and Claude turns a data-generation paper into a buy-or-tune question for anyone currently renting tool calling.
- capability If the out-of-distribution result holds outside the authors' setup, a small open model tuned on a few hundred generated samples becomes a candidate for tool sets it never saw in training.
Answer-first only works if the answer can be checked, and ToolGrad checks it by running it. Its loop has four modules that propose, execute, select and update, and it repeats until the sample contains a user query, a verified API workflow and a final AI response [9]. The query arrives afterwards, from a single LLM step, because the authors argue an explicit tool-use solution is less ambiguous input than a prompt [6].
Each pipeline spends its money in a different place. In the query-first version the target is fixed before search starts: sample from an API pool, write a hypothetical instruction, then send a depth-first-search agent after a chain that satisfies it [4]. The Google post calls this "inherently inefficient because its core concept is to distill valuable trajectories from a complex agent exploration for training an LLM" [5]. ToolGrad's loop has no instruction to satisfy, so a proposal that fails execution feeds the update step and the workflow it was extending survives [9].
In ToolGrad, the gradient is text. TextGrad used an LLM critic to produce plain-text feedback for refining a prompt, and ToolGrad aims the same feedback at constructing valid API workflows out of a large tool library [7][8]. In the experiment that library was ToolBench, 16k+ real-world APIs [10]. That group hand-annotated evaluation data for its earlier InstructPipe work and says that does not scale to fine-tuning [16].
What is worth arguing about is the out-of-distribution result. Gemma-3 at 1B, 4B and 12B were fine-tuned on ToolGrad-500 and evaluated on BFCL, whose tool set differs from ToolBench's [12][13], against base models, the proprietary Gemini, GPT and Claude, and the tool-use specialists ToolACE and Hammer-2.1-7B [14]. The post says the fine-tuned models match state-of-the-art proprietary LLMs on OOD datasets with unseen tools [15]. For that to reach another stack, your tools have to be callable during generation, because calling them is what establishes that a chain is valid [9]. And your schemas have to sit close enough to ToolBench's API surface that a chain built there resembles a chain your model will be asked for [10].
That cost claim is load-bearing and, in the post's prose, unquantified: more complex data at a higher pass rate for lower generation cost, with no figure on any of the three gaps [11][18]. ToolGrad-500 is the name of the dataset, as close as the prose comes to a quantity [12]. Those three fine-tunes span a 12x parameter range from 1B to 12B [17], and the post reports them as a set, so the size at which a 500-scale recipe stops holding is not stated [12].
What to watch
- Cost per sample and pass rate against DFS on ToolBench, in the ACL 2026 paper's tables, would make the cheaper claim checkable.
- Release of ToolGrad-500 and the fine-tuned Gemma-3 checkpoints, which would let others inspect the back-written query distribution.
- A run against tools that cannot be freely called during generation, where the execute module has nothing to verify a proposal with.