# DynaFlow: Learning Free-Form Multi-Agent Orchestration

> DynaFlow integrates free-form executable workflows into a main agent's actions, achieving 88.08% accuracy via two-stage training with fixed sub-agents, while cutting collaboration costs by 41%.

- **Source:** [arXiv](https://arxiv.org/abs/2610.34467)
- **Published:** 2026-10-28
- **Permalink:** https://picx.dev/p/R2Y58i
- **Whiteboard:** https://picx.dev/p/R2Y58i/image

## Summary

## 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:
$$ \mathcal {A} = \mathcal {A} _ {\mathrm{tool}} \cup \{A _ {\mathrm{ans}}, (P, W (P)) \},\tag{1} $$
where $A_{\mathrm{tool}}$ is the set of ordinary tool-call actions, $A_{\mathrm{ans}}$ is a final-answer output action, and $(P, W(P))$ denotes a workflow action comprising a JavaScript program $P$ and its invocation through the workflow tool $W$.

## Methodology

### 3.1 Free-Form Workflow Orchestration

The main agent follows a policy $\pi_{\theta}$ over three action forms:
- **Direct answer** ($A_{\mathrm{ans}}$)
- **Tool calls** ($A_{\mathrm{tool}}$)
- **Workflow actions** $(P, W(P))$—synthesizing and invoking a JavaScript program

At turn $k$, the agent generates $a_k \sim \pi_{\theta}(\cdot \mid I, q, h_{k-1})$, where $h_{k-1}$ is the ordered history of previous actions and observations. The program $P$ 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 $P$ 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, a_1)$, where $r$ is the first-turn reasoning and $a_1 = (P, W(P))$ is the workflow action. The loss is:

$$ \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:
$$ \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)

| Method | AIME24 | AIME25 | AIME26 | PolyMATH | GPQA-D | HotpotQA | Overall |
|---|---|---|---|---|---|---|---|
| **Single-agent baselines** | | | | | | | |
| CoT | 96.67 | 93.33 | 86.67 | 83.00 | 85.35 | 46.50 | 74.27 |
| CoT-SC | 90.00 | 93.33 | 96.67 | 84.50 | 85.86 | 50.50 | 76.16 |
| Self-Refine | 96.67 | 93.33 | 93.33 | 87.50 | 88.38 | 48.00 | 77.18 |
| **Automated multi-agent** | | | | | | | |
| AFlow | 93.33 | 96.67 | 100.00 | 86.00 | 87.37 | 47.00 | 76.45 |
| **Untrained Main Agent** | | | | | | | |
| Base, Direct | 93.33 | 93.33 | 93.33 | 74.00 | 83.33 | 47.50 | 71.51 |
| Base + Web search | 83.33 | 73.33 | 73.33 | 66.00 | 79.80 | 77.50 | 74.71 |
| Base, Dynamic | 63.33 | 63.33 | 73.33 | 64.00 | 77.78 | 53.00 | 65.12 |
| Base, Forced | 76.67 | 70.00 | 70.00 | 70.00 | 77.78 | 81.50 | 75.87 |
| **Trained Main Agent (ours)** | | | | | | | |
| DynaFlow (Direct) | 93.33 | 90.00 | 90.00 | 87.00 | 86.87 | 51.50 | 77.18 |
| DynaFlow (Dynamic) | 93.33 | 100.00 | 96.67 | 91.50 | 83.84 | 84.50 | **87.94** |
| DynaFlow (Forced) | **100.00** | **100.00** | **100.00** | **90.50** | 84.85 | 83.50 | **88.08** |

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

| Main Agent | Direct | Dynamic | Forced |
|---|---|---|---|
| Base | 71.51 | 65.12 | 75.87 |
| Stage 1 | 76.74 | 84.45 | 85.47 |
| DynaFlow (Stage 2) | 77.18 | 87.94 | 88.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

---

_Markdown view of https://picx.dev/p/R2Y58i, served by PicX — AI-generated visual whiteboard summaries of research papers._
