ToolLoop: Closed-Loop Tool-Use Data Synthesis via Decomposed Generation and Dynamic Self-Feedback

Min Zeng, Yuzhou Liu, Zhenyu Cao, Hanxiu Chen, Heng Li, Caiquan Liu, Yafei Wen, Xiaoxin ChenarXiv 2026

TL;DR

ToolLoop is a novel data synthesis framework that shifts LLM tool-use training from a wasteful "generate-then-filter" approach to an efficient, iterative "generate-verify-refine" loop. By decomposing data generation into three distinct stages with dynamic self-feedback, it produces highly accurate and diverse datasets. A 4B parameter model trained on just 11K ToolLoop-synthesized examples outperforms models trained on up to five times more data across major function-calling benchmarks.

What Problem Does This Paper Address?

To act as effective autonomous agents, large language models (LLMs) must master "tool-use"—the ability to understand a user's intent and invoke external APIs (like weather services or web searches) with the correct parameters. Training models to do this requires high-quality datasets that map natural language queries to precise tool calls.

Currently, creating these datasets relies on a generate-then-filter paradigm: an LLM generates a user query and the corresponding tool call in a single shot, and a static filter discards invalid instances post-hoc. This approach suffers from three major flaws:

  1. High Complexity: Selecting the right tool from a massive pool in one shot is incredibly difficult for a model.
  2. Data Waste and Bias: Binary filtering throws away imperfect data without correcting it, which biases the final dataset toward overly simplistic examples.
  3. Lack of Intermediate Supervision: There is no check to ensure logical consistency between the generated query and the tool call before the final step.
Figure 1: Comparison between existing generate-then-filter paradigm and our ToolLoop closed-loop synthesis framework with generate-verify-refine approach.

Methods

ToolLoop introduces a generate-verify-refine framework that breaks down data synthesis into three progressive stages, integrating a dynamic self-feedback loop at each step:

  1. Candidate Function Construction: To simulate realistic scenarios, the authors use a vector model and K-means clustering to group thousands of raw APIs into distinct semantic domains (e.g., financial, travel, media).
  2. Stage 1: Ground Truth Sampling: Instead of starting with a query, ToolLoop first samples a logical sequence of function names from a domain cluster that can be executed together.
  3. Stage 2: Backward Derivation of User Query: The model performs backward reasoning to generate a natural, conversational user query that perfectly implies the sampled functions.
  4. Stage 3: Forward Derivation of Tool Calls: Finally, the model generates the concrete tool calls, populating the exact arguments and parameters based on the user query.

Dynamic Self-Feedback: At each stage, the output is rigorously checked by a combination of an LLM semantic verifier, deterministic rule checks, and Abstract Syntax Tree (AST) parsing. If an error is detected, the framework doesn't discard the sample. Instead, it constructs a refinement prompt containing the specific error details and instructs the model to correct its mistake (allowing up to three retries).

Figure 2: ToolLoop Framework: Three-Stage Decomposed Generation with Dynamic Self-Feedback

Datasets

  • API Pool: 5,281 executable APIs sampled from ToolBench and the Berkeley Function Calling Leaderboard (BFCL), clustered into 26 semantic groups.
  • Synthesized Dataset: A newly constructed dataset of 11,024 high-quality examples spanning four scenarios: Simple (40.4%), Parallel (33.0%), Multiple (16.2%), and Parallel-Multiple (10.5%).
  • Evaluation Benchmarks: The models were evaluated on BFCL-v4 (testing function-calling accuracy across live and non-live environments) and ACEBench (evaluating broader capabilities like atomic operations and tool discrimination).

Key Insights and Ideas

  • Refinement Beats Filtering: Correcting data iteratively rather than discarding it preserves data diversity. Pure filtering pipelines tend to keep only short queries and simple schemas, whereas ToolLoop successfully retains complex, hard-to-generate examples.
  • Decomposition Lowers Cognitive Load: Breaking the pipeline into Ground Truth $\rightarrow$ Query $\rightarrow$ Tool Call makes data generation manageable for smaller, cost-effective models.
  • Where Models Struggle Most: Alignment is the hardest part of synthesis. Stage 2 (Backward Query Derivation) required the highest retry rate (18.1%), demonstrating that translating symbolic function plans into natural language is a major bottleneck where alignment errors frequently occur.

Key Results

The authors fine-tuned a Qwen3-4B-Instruct model on their synthetic dataset and achieved remarkable data efficiency:

  • Leaderboard Performance: On the BFCL benchmark, ToolLoop-4B achieved an overall accuracy of 86.40% in non-reasoning mode. This outperformed APIGen-4B (83.11% using 60K examples) and ToolMind-4B (83.53% using 55K examples) despite using a fraction of the training data.
  • Data Leakage Control: To prove the model wasn't just memorizing, the authors tested an "Isolate" variant that completely removed any candidate functions overlapping with the BFCL test set. It still achieved 86.07% accuracy, proving the framework teaches generalized tool-selection behavior.
  • Cross-Benchmark Generalization: On ACEBench, ToolLoop-4B scored 72.1% overall accuracy, outperforming APIGen-4B by 5.1 points while utilizing only 18.3% of its baseline training data volume.

Limitations and Future Work

  • Lack of Live Environment Feedback: ToolLoop relies on static verification (LLM judges and AST parsing) rather than executing tool calls in a live sandbox. It cannot currently verify or correct runtime errors like API timeouts or malformed server responses.
  • Verifier Bias: The framework uses a single large model (Qwen-Max) as its semantic judge across all stages. While human agreement was high (94%), this setup could introduce model-specific biases into the dataset.
  • Single-Turn Focus: The current implementation is optimized for single-turn tool invocations. The authors note that expanding this closed-loop refinement to multi-turn agent trajectories is a critical next step.

Summary updated

BibTeX
@misc{zeng2026toolloop,
  author = {Min Zeng and Yuzhou Liu and Zhenyu Cao and Hanxiu Chen and Heng Li and Caiquan Liu and Yafei Wen and Xiaoxin Chen},
  title = {{ToolLoop: Closed-Loop Tool-Use Data Synthesis via Decomposed Generation and Dynamic Self-Feedback}},
  year = {2026},
  eprint = {2609.09072},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.09072},
}
Figure