---
title: "ToolGrad: Efficient tool-use dataset generation with textual \"gradients\""
description: "ToolGrad generates synthetic tool-use training data answer-first: it builds a verified API chain iteratively, then has an LLM write the matching user query, instead of inventing a query and searching for a solution with a DFS agent as ToolBench and ToolACE do."
url: "https://swe.quest/articles/toolgrad-efficient-tool-use-dataset-generation-with-textual-gradients-6d6804c563cc5125"
canonical: "https://research.google/blog/toolgrad-efficient-tool-use-dataset-generation-with-textual-gradients/"
source: "Google Research"
published: "2026-09-10"
difficulty: "hard"
kind: "Research"
reading_minutes: 6
tags: ["model-training","ai-agents","llms","evals"]
---

# ToolGrad: Efficient tool-use dataset generation with textual "gradients"

A post on [Google Research](https://swe.quest/sources/google-research.md), published 2026-09-10, 6 min read, Research. Original: [https://research.google/blog/toolgrad-efficient-tool-use-dataset-generation-with-textual-gradients/](https://research.google/blog/toolgrad-efficient-tool-use-dataset-generation-with-textual-gradients/)

## Summary

ToolGrad generates synthetic tool-use training data answer-first: it builds a verified API chain iteratively, then has an LLM write the matching user query, instead of inventing a query and searching for a solution with a DFS agent as ToolBench and ToolACE do. Borrowing TextGrad's idea of textual "gradients", each iteration runs four modules: an API Proposer, parallel API Executors, an API Selector that picks the best call as directional feedback, and an LLM Updater that revises the query and response. On ToolBench's 16k+ APIs this reaches a 99.8% pass rate with fewer steps than DFS. Gemma-3 12B fine-tuned on just 500 such samples scores 83.1 on the Berkeley Function Calling Leaderboard, close to gemini-2.5-pro (83.2) and ahead of its gemini-2.5-flash-lite teacher.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Evaluation](https://swe.quest/tags/evals.md) (AI & ML)

## Prerequisites

- LLM fine-tuning ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- LLM tool calling ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- synthetic data generation

## Keywords

ToolGrad, TextGrad, ToolBench, Berkeley Function Calling Leaderboard, Gemma-3, ToolACE, Gemini

## Related posts

- [AI Agent Code Execution API](https://swe.quest/articles/ai-agent-code-execution-api-8f63888d403b81a8.md): Replit · 2023-09-19 · Medium · 4 min read · AI agents, Sandboxing & isolation, LLMs, Serverless, Python
  Replit offers sandboxed code execution so LLM agents can run untrusted generated code, contrasting a stateless model (like Bard's implicit code execution for math) with a stateful, session-long project environment (like ChatGPT).
- [Building Ghostwriter Chat](https://swe.quest/articles/building-ghostwriter-chat-cdc3d6aa03870bc4.md): Replit · 2023-03-27 · Easy · 5 min read · AI for coding, LLMs, Developer tools
  Ghostwriter Chat embeds an LLM-powered assistant directly in the Replit IDE, using file context, chat history and program output so users never copy-paste into a separate tool.
- [CoderForge-Preview: SOTA open dataset for training efficient coding agents](https://swe.quest/articles/coderforge-preview-sota-open-dataset-for-training-efficient-coding-agents-83e1f3c7a7bdb67a.md): Together AI · 2026-02-25 · Hard · 14 min read · Model training, AI for coding, AI agents, Evaluation, LLMs
  CoderForge-Preview is an open dataset of 258K test-verified coding agent trajectories (155K passing) covering 51K tasks across 1,655 repositories from R2E-Gym, SWE-Smith and SWE-Rebench.
- [Tool Use, Unified](https://swe.quest/articles/tool-use-unified-117f148d6f2c2374.md): Hugging Face · 2024-08-12 · Medium · 11 min read · LLMs, AI agents, Python, API design
  Hugging Face Transformers extends Jinja chat templates to cover tool use, giving a single portable API for passing tools to Mistral, Cohere, NousResearch and Llama models.
- [Ghostwriter AI & Complete Code Beta](https://swe.quest/articles/ghostwriter-ai-complete-code-beta-eb4c500f5fc252eb.md): Replit · 2022-09-08 · Medium · 9 min read · AI for coding, Inference & serving, LLMs, Developer tools
  Replit's Ghostwriter adds AI code completion, generation, transformation, explanation and semantic search to its IDE, with Complete Code starting in closed beta.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
