TL;DR
The paper introduces OrchDAG, a synthetic data generation pipeline that models complex, multi-turn LLM tool execution as Directed Acyclic Graphs (DAGs) with controllable complexity. To help models learn these intricate tool dependencies, the authors propose a dense, graph-based reward function using Graph Edit Distance (GED) for Reinforcement Learning with Verifiable Reward (RLVR). Their approach significantly improves the ability of open-source models to plan and execute multi-step tool calls, boosting full-graph accuracy from near-zero to over 40%.
What Problem Does This Paper Address?
While Large Language Models (LLMs) have become highly proficient at simple, single-turn tool calling (e.g., checking the weather or searching the web), real-world industrial applications are far more chaotic. An AI agent often needs to coordinate dozens of domain-specific APIs across multiple conversational turns.
This environment introduces three major challenges that existing benchmarks overlook:
- Intricate Dependencies: The output of one tool frequently serves as the input for another.
- Schema Misalignment: Different tools might refer to the exact same entity using entirely different JSON field names.
- Execution Volatility: In multi-turn interactions, tools can time out or return runtime errors, forcing the agent to dynamically replan and reschedule unfinished execution paths.
Current reinforcement learning (RL) methods for tool use struggle here because they rely on sparse rewards (e.g., did the model get the exact final answer right?) or step-level rewards that fail to ensure the global coherence of the entire execution plan.
Methods
1. The OrchDAG Pipeline
The authors developed a graph-based data generation pipeline using LangGraph to synthesize multi-turn tool-use datasets. Instead of generating linear sequences, they model tool execution as a DAG where nodes represent tool calls (with JSON payloads) and edges represent data dependencies.
To make the dataset realistic, the pipeline injects irrelevant tools into the system prompt to test the model's discrimination skills and randomly varies field names to simulate schema misalignment.
For multi-turn settings, the pipeline simulates three distinct scenarios when a user provides a follow-up query or an error occurs:
- Scenario 1 (Tool Error/Timeout): The previous turn failed, requiring the model to generate a partial subgraph to retry failed nodes.
- Scenario 2 (Dependent Query): The user asks a follow-up question that builds on partial outputs from the previous turn.
- Scenario 3 (Irrelevant Query): The user switches topics entirely, requiring a completely new tool execution DAG.
2. Graph-Based Reward Shaping
To train models effectively using Group Relative Policy Optimization (GRPO), the authors replace sparse exact-match rewards with a dense Graph Edit Distance (GED) reward. GED measures the minimum number of graph operations (edge/node insertions, deletions, or relabeling) required to transform the model's predicted plan DAG into the ground-truth DAG. This ensures the model receives partial credit for getting parts of the dependency structure right.
Datasets
The OrchDAG pipeline bootstraps high-quality seed tools from two existing benchmarks:
- APIGEN (contributing 2,542 filtered data points)
- TOOLACE (contributing 1,005 filtered data points)
The authors filtered these datasets to retain only complex examples involving more than two distinct functions. The final synthesized OrchDAG dataset consists of:
- Training set: 1,800 samples (30% multi-turn)
- Test set: 250 samples (25% multi-turn)
To evaluate generalizability, the trained models were also benchmarked on StableToolBench.
Key Insights and Ideas
- Step-level success $\neq$ Global coherence: The authors discovered that models trained with standard step-level rewards (like ToolRL) achieved decent accuracy per individual step (~60%) but scored 0% on full-query accuracy. They simply couldn't maintain a globally coherent plan.
- Dense rewards prevent optimization dead-ends: In ablation studies, training an open-source model with a coarse "exact match" reward resulted in 0% accuracy even after extensive training steps. The dense GED reward is absolutely critical for providing a gradient signal in highly complex topological spaces.
- Mitigating Entropy Collapse: During standard GRPO training, the model's performance suddenly collapsed around step 51 due to a low-entropy situation where the model became overly confident and stopped exploring. Integrating DAPO (Direct Action Preference Optimization) stabilized the training by maintaining higher policy entropy.
Key Results
- A Formidable Benchmark: Even advanced closed-source models find OrchDAG difficult. In a zero-shot setting, GPT-4o achieved a Pass@1 accuracy of only 18%, and Claude 4 achieved 15%. Native open-source models like Qwen2.5-7B scored near 0%.
- Massive RLVR Gains: Fine-tuning Qwen2.5-7B using GRPO combined with the proposed GED reward dramatically improved its capabilities. With a rollout number of $n=8$, the model's full-query accuracy skyrocketed from 2% to 40.2% on the single-turn test set.
- Robust Multi-Turn Performance: In multi-turn evaluations, the fine-tuned 7B model achieved up to 35.2% accuracy in handling tool timeouts (Scenario 3) and 20.3% in handling complex cross-turn dependencies (Scenario 2).
- Generalizability: When evaluated on the independent StableToolBench benchmark, the OrchDAG-trained Qwen model achieved performance competitive with GPT-4o (CoT), proving that the learned graph-planning capabilities generalize beyond the synthetic training set.
Limitations and Future Work
The primary limitation acknowledged by the authors is that OrchDAG currently only models explicit dependencies (where data is passed directly via JSON fields). It does not yet account for implicit dependencies, such as state changes in a file system or operating system environment (e.g., a tool that modifies a file that a subsequent tool reads without explicitly passing the file path as an output variable). The authors plan to extend the framework to capture these implicit state-dependency cases in future work.
Summary updated