ToolLoop repairs synthetic tool-use traces; 11K examples lift a 4B model to 86.40% BFCL

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 Chen

EMNLP 2026 Main Conference

cs.CL

2026-09-09

ToolLoop synthesizes tool-use data in three stages with per-stage repair. Fine-tuning Qwen3-4B on 11K examples reaches 86.40% on BFCL, using 18.3% of APIGen's data.

What problem this solves

The bottleneck in teaching models to call APIs is alignment: a user utterance, the right function, and correctly filled arguments have to match. Real traces are scarce. The default synthetic recipe is one-shot generation plus a static filter. Pass and keep; fail and drop.

Three failure modes follow. With a large candidate set, a single generation has to pick tools, fill arguments, and keep calls independent at once. Binary filters discard hard cases, so the retained set drifts toward short queries and simple schemas. Nothing checks intermediate consistency, so a fluent query can still disagree with the final tool calls until the last gate.

Method

ToolLoop from vivo AI Lab splits that job into three stages and repairs each one in place, up to three retries.

Stage 1 pins a ground-truth sequence of function names. Simple and Multiple sample one function at random. Parallel and Parallel Multiple ask an LLM to pick 2-4 calls that share a scenario, can run concurrently, and do not depend on each other's outputs.

Stage 2 derives a user query backward from that sequence. The query must imply exactly those calls, mention every required argument, and read like conversation rather than a command template.

Stage 3 instantiates concrete tool calls in OpenAI function-calling format, with names, types, and structure matching the schema.

Checks are local to the stage. Qwen-Max judges semantics. Deterministic rules cover format, types, and structure. AST parsing catches syntax that would crash at runtime, such as unmatched brackets. A failed attempt is fed back as a negative example plus a specific diagnosis. Only samples that still fail after three retries are dropped.

The pool has 5,281 executable APIs sampled from ToolBench and BFCL. Qwen3-Embedding-8B embeddings plus K-means (K=26, about 200 APIs per cluster) group same-domain tools, then an LLM samples candidates inside a cluster so the set fits the context window. The four single-turn categories are Simple, Multiple, Parallel, and Parallel Multiple.

Results

The student is Qwen3-4B-Instruct-2507, trained for two epochs at 16k context with swift. Evaluation is non-reasoning: the model must emit tool calls directly. The retained set has 11,024 examples: 4,453 Simple (40.4%), 3,634 Parallel (33.0%), 1,783 Multiple (16.2%), 1,154 Parallel Multiple (10.5%). An Isolate variant filters BFCL-overlapping candidate functions before synthesis and keeps 10K.

MethodDataBFCL Overall
Qwen3-4B basenone82.14%
APIGen-4B60K83.11%
ToolMind-4B55K83.53%
Qwen3-32Bnone85.39%
ToolLoop-4B-Isolate10K86.07%
ToolLoop-4B11K86.40%

That 4B student also ranks above Qwen3-32B (85.39%) and Claude-Opus-4-5 (84.19%) on this BFCL snapshot. Non-live is 91.29%, 1.39 points over APIGen-4B at 89.90%. Live is 81.50%, above APIGen-4B at 76.31% and ToolMind-4B at 77.57%. Multiple hits 96.50% and Parallel Multiple 94.50%. Isolate reaches 97.00% on Multiple and drops only 0.33 points overall.

Ablation is the sharper cut. Synthetic data with no feedback lands at 79.97%, 2.17 points below the base model. Static final filtering recovers to 82.56%, barely above base. Closed-loop repair is what reaches 86.40%.

On ACEBench, ToolLoop-4B scores 72.1 overall, 84.0 on Atom, 78.0 on Similar API, using 18.3% of APIGen's data. Single Turn is 66.5, behind ToolMind-4B at 69.5. Profile is 60.0; every fine-tuned model falls below the base model's 64.0.

Synthesis of the 11,024 examples used about 33.41M tokens. Stage 2 is the expensive one: 18.1% of samples need at least one retry. Two or three retries hit 1.72% of Stage 1, 8.05% of Stage 2, and 4.25% of Stage 3. Of 280 samples still invalid after three retries, 192 failed semantic checks, 83 failed rules, and 5 failed both. On 100 manually labeled cases, Qwen-Max agreed with humans 94% of the time.

Why it matters

For anyone fine-tuning function calling, the operational claim is that internal consistency beats volume. 11K repaired traces outperform 55K to 60K generate-then-filter sets, and outperform a 32B sibling in non-reasoning mode.

The reusable piece is the pipeline: pin the function combination first, derive the query backward, instantiate calls forward, and repair with an LLM judge plus rules plus AST. Isolate's 0.33-point drop suggests the model is learning tool selection and argument grounding, not only benchmark function names.

This is still incremental. There is no new optimizer and no executable sandbox. The contribution is data engineering: generate-verify-refine instead of generate-then-filter.

Limitations

The authors flag two gaps. Synthesis never sees real environment feedback, so timeouts, malformed responses, and cascading failures are untested. Real tool use often revises calls from execution results, which static benchmarks do not measure. The semantic verifier is Qwen-Max at every stage; 94% agreement on 100 samples is a sanity check, not a bias audit.

The evaluation is also narrow. All four categories are single-turn. Live Parallel Multiple has 24 items; ToolLoop's 79.17% versus APIGen's 83.33% is a one-sample gap, and the paper itself refuses a category-level claim. ACEBench Profile drops after fine-tuning, so this data does not model user preferences and can hurt personalized selection. Candidate APIs already come from ToolBench and BFCL; Isolate removes name overlap, but domain-level leakage remains possible. The paper does not publish a code or data repository.

Terms

Source

What people are saying

Related papers

All paper explainers