Summary (Overview)

  • DynaFlow is a framework that integrates free-form executable workflow synthesis into the action space of a main agent, enabling it to decide when collaboration is needed and generate task-specific programs coordinating sub-agents.
  • The main agent is trained via two-stage supervised fine-tuning (SFT): first on distilled trajectories, then on a curated subset filtered for orchestration defects (unsupported premises, biased verification, information-flow defects).
  • All sub-agents remain fixed during training, decoupling orchestration learning from executor capability improvement.
  • DynaFlow achieves 88.08% overall accuracy in Forced mode across six benchmarks, outperforming the strongest baseline by 10.90 percentage points with the same Qwen3.5-27B backbone.
  • In Dynamic mode, it answers 47.1% of questions directly while maintaining accuracy close to Forced execution, using 41% fewer sub-agents on average.

Introduction and Theoretical Foundation

Multi-agent systems (MAS) built on large language models (LLMs) often rely on predefined collaboration structures—fixed agent roles, communication patterns, or workflow components. However, coordination requirements vary across tasks: simple queries may need only one agent, independent subtasks benefit from parallel execution, and dependent stages require reliable access to upstream results. Applying a fixed structure across all settings introduces unnecessary communication, latency, and computation.

The authors argue for Free Orchestration: the ability to decide when collaboration is useful and construct task-specific workflows during problem solving. Existing approaches (e.g., DyFlow, MAS-Orchestra) retain constraints on workflow construction—using finite operator templates or generating complete coordination structures in a single decision without observing intermediate execution results.

DynaFlow addresses these limitations by:

  1. Free-form workflow synthesis as a native action of the task-solving agent
  2. Repeated orchestration decisions informed by execution feedback
  3. Decoupling orchestration learning from sub-agent training

The action space is formally defined as:

A=Atool∪{Aans,(P,W(P))},(1)\mathcal {A} = \mathcal {A} _ {\mathrm{tool}} \cup \{A _ {\mathrm{ans}}, (P, W (P)) \},\tag{1}

where AtoolA_{\mathrm{tool}} is the set of ordinary tool-call actions, AansA_{\mathrm{ans}} is a final-answer output action, and (P,W(P))(P, W(P)) denotes a workflow action comprising a JavaScript program PP and its invocation through the workflow tool WW.

Methodology

3.1 Free-Form Workflow Orchestration

The main agent follows a policy πθ\pi_{\theta} over three action forms:

  • Direct answer (AansA_{\mathrm{ans}})
  • Tool calls (AtoolA_{\mathrm{tool}})
  • Workflow actions (P,W(P))(P, W(P))—synthesizing and invoking a JavaScript program

At turn kk, the agent generates ak∼πθ(⋅∣I,q,hk−1)a_k \sim \pi_{\theta}(\cdot \mid I, q, h_{k-1}), where hk−1h_{k-1} is the ordered history of previous actions and observations. The program PP defines sub-agent roles, stages, and dependencies through:

  • Agent calls (sequential or parallel)
  • Explicit information passing between stages
  • Optional phase labels (e.g., "derive", "verify", "aggregate")

The workflow tool executes PP under resource constraints, returning an observation combining program output with an execution trace recording the status and output of each sub-agent call.

3.2 Learning the Orchestration Policy

Stage 1: Trajectory distillation. A teacher model (GLM-5.3 Max) generates trajectories using the same workflow interface. Trajectories with correct final answers following the delegation protocol are retained. The supervised target is s=(r,a1)s = (r, a_1), where rr is the first-turn reasoning and a1=(P,W(P))a_1 = (P, W(P)) is the workflow action. The loss is:

LSFT(θ;D)=−∑(I,q,s)∈Dlog⁡πθ(r,a1∣I,q),(2)\mathcal {L} _ {\mathrm{SFT}} (\theta ; \mathcal {D}) = - \sum_ {(I, q, s) \in \mathcal {D}} \log \pi_ {\theta} (r, a _ {1} \mid I, q),\tag{2}

Stage 2: High-quality data selection. An LLM judge assesses orchestration quality by checking for three defect types:

  1. Premise injection: answer-determining claims beyond task givens presented as established premises
  2. Verification defects: review instructions steering a verifier toward an expected answer
  3. Information-flow defects: missing context, incorrect references, lossy transfer, or hard-coded substitutes preventing required information from reaching downstream agents

The curated dataset is:

D2=J(D1)⊆D1.(3)\mathcal {D} _ {2} = \mathcal {J} (\mathcal {D} _ {1}) \subseteq \mathcal {D} _ {1}.\tag{3}

Training uses QLoRA, with the main agent only; sub-agents remain frozen.

Empirical Validation / Results

Main Results (Table 1: Accuracy % on six benchmarks, Qwen3.5-27B)

MethodAIME24AIME25AIME26PolyMATHGPQA-DHotpotQAOverall
Single-agent baselines
CoT96.6793.3386.6783.0085.3546.5074.27
CoT-SC90.0093.3396.6784.5085.8650.5076.16
Self-Refine96.6793.3393.3387.5088.3848.0077.18
Automated multi-agent
AFlow93.3396.67100.0086.0087.3747.0076.45
Untrained Main Agent
Base, Direct93.3393.3393.3374.0083.3347.5071.51
Base + Web search83.3373.3373.3366.0079.8077.5074.71
Base, Dynamic63.3363.3373.3364.0077.7853.0065.12
Base, Forced76.6770.0070.0070.0077.7881.5075.87
Trained Main Agent (ours)
DynaFlow (Direct)93.3390.0090.0087.0086.8751.5077.18
DynaFlow (Dynamic)93.33100.0096.6791.5083.8484.5087.94
DynaFlow (Forced)100.00100.00100.0090.5084.8583.5088.08

Training Stage × Execution Mode (Table 2: Overall accuracy %)

Main AgentDirectDynamicForced
Base71.5165.1275.87
Stage 176.7484.4585.47
DynaFlow (Stage 2)77.1887.9488.08

Key Findings

  • Mathematical reasoning: Forced execution solves all 90 AIME questions (100% across 2024, 2025, 2026 sets). Workflows pair symbolic derivations with numerical checks to identify errors.
  • Scientific reasoning (GPQA-Diamond): Forced execution reaches 84.85%, improving over Base, Forced by 7.07 points; failures stem from incorrect intermediate conclusions misguiding verification.
  • Multi-hop retrieval (HotpotQA): Dynamic mode reaches 84.50%, exceeding Base + Web search by 6–7 points. Workflows organize search around intermediate entities and verify connections between hops.

Workflow Analysis

  • Hybrid workflows (parallel + sequential stages) increase from 3.4% (Base) to 83.2% (Stage 1) and 85.6% (Stage 2).
  • Explicit output passing rises from 12.6% (Base) to 93.3% (Stage 1) and 97.7% (Stage 2).
  • Refinement of intermediate results increases from 28.1% (Stage 1) to 35.9% (Stage 2).
  • Major information-flow defects decline from 1.9% (Stage 1) to 0.9% (Stage 2).
  • Task-specific role allocation: Solvers/verifiers account for >90% of nodes on AIME/PolyMATH; researchers account for 59.6% on HotpotQA; verification is 33.2–43.9% across tasks.

Theoretical and Practical Implications

  • Orchestration as learning: The results demonstrate that orchestration can be learned independently of executor capabilities. With fixed sub-agents, training the main agent alone yields substantial gains, supporting the view that coordination—not just capability—is a key bottleneck in MAS performance.
  • Information flow as a key dimension: The analysis identifies cross-stage information use (explicit passing, verification, refinement of upstream outputs) as a critical orchestration property, suggesting future MAS designs should emphasize data-flow correctness alongside task decomposition.
  • Adaptive collaboration: The Dynamic–Forced gap narrows from 10.75 points (Base) to 0.14 points (DynaFlow), showing that a trained agent can decide when to collaborate, reducing computational cost by ~41% without sacrificing accuracy.
  • Practical architecture: Decoupling orchestration from execution allows pretrained models to be reused as fixed executors, enabling scalable deployment without retraining all components.

Conclusion

DynaFlow integrates free-form executable workflow actions with two-stage main-agent training, combining trajectory distillation with demonstration selection based on orchestration quality. Key takeaways:

  1. Free-form workflows outperform fixed structures by adapting to task requirements.
  2. Two-stage training (distillation + curated selection) improves both accuracy and orchestration quality.
  3. Fixed sub-agents validate that coordination learning is distinct from executor improvement.
  4. Adaptive invocation maintains performance while reducing sub-agent usage by ~41%.

Future directions include:

  • Training sub-agents for reliable information transfer and independent verification
  • Extending first-turn supervision to multi-turn trajectories containing disagreements and erroneous results
  • Strengthening the main agent's ability to independently assess conflicting outputs, identify errors, and select recovery actions

Related papers