TL;DR
FIREFLY is a novel data-generation pipeline that flips the traditional approach to training tool-calling AI agents by exploring real-world APIs first and synthesizing user tasks backward from successful executions. Combined with a retrieval-augmented simulator to prevent environment drift, this method yields a high-quality dataset that allows a compact 4B-parameter model to match the performance of proprietary giants like Claude Sonnet 4.6 on complex tool-use benchmarks.
What Problem Does This Paper Address?
Building LLM-based agents that can interact with external APIs (tool-calling) is central to modern AI engineering. However, training these agents requires large-scale, high-quality trajectory data with verifiable labels.
Existing synthetic data pipelines suffer from a fundamental catch-22:
- Simulated environments are easy to control but often fail to capture the messy, stochastic behavior of real-world APIs.
- Forward-generation pipelines (where an LLM generates a user task first, then tries to guess the tool trajectory) often produce hallucinated, stale, or completely infeasible tool calls, making it incredibly difficult to verify if the final answer is actually correct.
Furthermore, real APIs are moving targets. They suffer from "environment drift"—live data changes (like weather or stock prices), servers go down, and repeated calls during reinforcement learning (RL) rollouts run into rate limits, destroying reproducibility.
Methods
The authors introduce FIREFLY, a pipeline that guarantees label correctness by construction through an inverted generation paradigm.
The pipeline operates in three core phases:
- Graph-Guided DAG Exploration: Instead of blindly guessing tool combinations across nearly 1,000 real tools, FIREFLY builds a directed "tool graph" based on input-output compatibility judged by an LLM. It then samples sub-DAGs (Directed Acyclic Graphs) from this neighborhood, letting a strong LLM interactively execute real tool steps against live Model Context Protocol (MCP) servers.
- Back-Chaining Task Synthesis: Because every node in the DAG comes from a successful live execution, all states are guaranteed to be reachable. The LLM looks at the final outputs and works backward to synthesize a natural-language user query that would require those exact tool steps. It also generates a structured JSON answer schema for automated evaluation.
- Retrieval-Augmented Tool-Call Simulator: To enable stable, offline RL training without hitting live API rate limits or experiencing data drift, FIREFLY caches every single tool call. During training rollouts, a simulator intercepts agent calls, replaying exact matches or using an LLM backend to generate fuzzy matches based on historical data.
Finally, the authors fine-tune a base model using Group Relative Policy Optimization (GRPO) with a curriculum-like dynamic filtering mechanism that discards tasks once the model has mastered them.
Datasets
The pipeline was applied to the Smithery registry, filtering roughly 3,000 unique MCP servers down to 240 stable, stateless, and non-trivial servers.
This process produced the FIREFLY dataset:
- 5,144 verified tasks and 9,749 trajectories.
- Covers 993 distinct tools across diverse domains.
- Includes multi-turn, cross-server compositions (38.5% of tasks require tools from multiple servers).
For evaluation, the authors held out 200 tasks as an in-distribution test set and tested cross-domain generalization on three public benchmarks: Tau2-Bench, MCPMark, and MCP-Atlas.
Key Insights and Ideas
- Correctness by Construction: Inverting the generation order (Execution $\rightarrow$ Task rather than Task $\rightarrow$ Execution) completely bypasses the need for expensive, post-hoc filtering of hallucinated trajectories.
- The Power of Weak Semantic Priors: Naive exploration of 1,000 tools is a needle-in-a-haystack problem. Using an LLM-generated tool graph to guide exploration ensures that the generated trajectories form semantically coherent workflows.
- Deterministic RL via Caching: Simulating the environment by caching live API states turns a volatile, non-reproducible online RL problem into a stable, fully offline optimization task.
Key Results
The authors trained a Qwen3-4B model using the FIREFLY pipeline. Despite its small size, the RL-trained model achieved remarkable results:
- Matches Closed Sovereigns: On the held-out FIREFLY test set, the 4B model improved its pass@1 accuracy from 28.1% (base) to 41.5%, effectively matching Claude Sonnet 4.6 (42.2%).
- Approaches Frontier Performance at Pass@8: At pass@8, the fine-tuned 4B model reached 52.8%, surpassing Claude Sonnet 4.6 (50.3%) and closing in on Claude Opus 4.7 (54.4%).
- Strong Out-of-Distribution Generalization: The model didn't just memorize the training set; it showed substantial gains across all evaluated public benchmarks, including an absolute accuracy jump from 19.4% to 26.0% on MCP-Atlas and clear improvements across Retail, Airline, and Telecom domains in Tau2-Bench.
Limitations and Future Work
- Model Scale: Due to compute constraints, the authors only evaluated a 4B-parameter model. They note that the modest gap between pass@1 and pass@16 suggests the model's capacity limits its ability to solve the hardest multi-step tasks, implying that scaling to 30B+ models would yield even higher performance ceilings.
- Single-Turn Constraint: Currently, all tasks in FIREFLY follow a single-turn format (one user request followed by multi-step tool execution). Real-world applications frequently require multi-turn dialogues involving user clarification and changing requirements, which remains an open direction for future pipeline extensions.
Summary updated