Study in a nutshell

ToolGrad produced a usable example in 99.8% of attempts. Generation used 20 tool steps on average, compared with 34.3 for the question-first approach.

Suppose you want to teach an AI to answer “Will I need an umbrella at the stadium tomorrow?” You write the question, then discover that your stadium directory gives street addresses while your weather service needs coordinates. What looked like a simple exercise is missing a step.

ToolGrad starts at the other end. It tries out the tools, builds a sequence that works, and writes a question that the sequence can answer. In a study by Zhongyi Zhou and colleagues, 99.8% of attempts produced a usable training example, compared with 63.8% for a method that started with the question. The examples also contained more tool uses on average.

What is a textual “gradient”?

An AI uses a tool by sending a request to another program through an interface called an API. One program might supply a stadium address, another might convert it into coordinates, and a third might return a forecast. Each result gives the next program something it can use.

ToolGrad proposes a small group of possible next tools, tries them, and gives a language model the reports of what happened. The model picks a useful tool and indicates where it belongs in the workflow. That choice is what the authors call a textual “gradient”. In ordinary machine learning, a gradient gives a mathematical direction for an adjustment. Here, the direction is a decision such as “add the address lookup to this chain.” The workflow grows, and the system updates the question and reply to fit it.

How ToolGrad builds a worked example. Propose candidate tools.; Run them and inspect the results.; Select a useful tool and place it in the workflow.; Update the question and answer to match.
How ToolGrad builds a worked example

Fewer dead ends, longer worked examples

The comparison method used depth-first search. Starting from a question, it followed one possible sequence of tools and could backtrack to try another. If those attempts failed, the system had spent effort on a question without producing a worked answer.

Attempts producing a usable example. Question first 63.8%; ToolGrad 99.8%
Generation pass rate, Table 2.

The difference between making an example and solving one is crucial here. The 99.8% figure describes how often ToolGrad could produce a worked example of its own. A separate test was needed to find out what another AI could learn from those examples.

Average work involved in generating examples · Table 2
MeasureQuestion firstToolGrad
Tool uses in the reference solution2.13.4
Tool-use steps during generation34.320.0
Language-model calls during generation64.563.9

The saving came mainly from testing tools: about 42% fewer tool-use steps during generation. The number of language-model calls barely changed. These counts explain where the method saved work. A dollar saving would also depend on which tools and models were used.

What did the smaller models learn?

The team used its roughly 500-example collection, ToolGrad-500, to give three sizes of Google’s Gemma 3 model additional training. Then it tested them on ToolBench-I3, which poses tasks involving tools from different categories. All three improved when asked to produce a solution in one turn. The largest went from a score of 9.8 to 19.6. The middle-sized model reached 17.6, tying the strongest reported result for its counterpart trained on ToolBench.

ToolBench scores before and after training. 1B · Base Gemma 1; 1B · ToolGrad 14.1; 4B · Base Gemma 11.2; 4B · ToolGrad 17.6; 12B · Base Gemma 9.8; 12B · ToolGrad 19.6
Single-turn ToolBench-I3 scores, Table 4.

The unanswered question is what people actually ask

Building an exercise around tools that work gives the learner a usable answer key. It also lets the exercise writer choose the question. A real user might ask for a stadium forecast a year in advance, or leave out which stadium they mean. Those cases call for different skills: recognizing a missing detail, asking a follow-up question or explaining a tool’s limits.

There was some evidence of transfer. On a second benchmark, the Berkeley Function-Calling Leaderboard, all three models improved on single-turn tasks, including requests drawn from real users. Gains were larger on its synthetic portion. The authors also identify a gap in the training examples: they record tool workflows without the reasoning examples needed for some step-by-step agent methods. The strongest conclusion is about how to produce and learn from worked examples. Recognizing when a real question has no workable answer remains a separate challenge.

Conclusion

Starting with a working solution reduced wasted attempts and produced examples that helped all three tested models. The harder question for a deployed assistant is how to respond when a user asks for something its tools cannot deliver.

Frequently asked questions

Does 99.8% measure answer accuracy?

It measures successful creation of a training example. Separate benchmarks assessed the models trained on those examples.

What is a textual gradient here?

It is a model’s choice of which tool to add and where it fits, based on reports from tools the system tried.

Read the original research paper

Related study · Why telling an AI how many searches it has left can improve its answers

Explore more Google research papers explained.