Source-linked AI summary

DyFlow: Dynamic Workflow Framework for Agentic Reasoning

Yanbo Wang, Zixiang Xu, Yue Huang, Xiangqi Wang, Zirui Song, Lang Gao, Chenxi Wang, Xiangru Tang, Yue Zhao, Arman Cohan, Xiangliang Zhang, Xiuying Chen

arXiv:2509.26062v1cs.CL

TL;DR

Existing agent workflows are often static, dataset- or query-specific, and limited in their use of intermediate feedback. DyFlow dynamically plans and executes context-aware subgoals through a designer–executor architecture, and evaluations report improved success and generalization across five reasoning domains. Its current operator set does not integrate external tools and APIs, limiting tasks requiring search, database, or environment interaction.

  • Problem

    Existing workflows rely on fixed or predefined processes, limited intermediate feedback, and inflexible operations, restricting adaptive reasoning across tasks.

  • Method

    DyFlow uses a high-level designer to generate and revise subgoal plans and a low-level executor to run context-aware operator subgraphs using memory.

  • Results

    DyFlow improves task success rates and generalizes across diverse reasoning tasks and executor models, including unseen LLMs.

  • Takeaways & Limitations

    Dynamic subgoal adaptation and structured designer training are jointly associated with DyFlow’s gains across diverse reasoning domains.

  • Takeaways & Limitations

    DyFlow’s operator set lacks external tool and API integration, constraining tasks requiring search, database queries, or environment interaction.

Abstract

from arXiv · show

Agent systems based on large language models (LLMs) have shown great potential in complex reasoning tasks, but building efficient and generalizable workflows remains a major challenge. Most existing approaches rely on manually designed processes, which limits their adaptability across different tasks. While a few methods attempt automated workflow generation, they are often tied to specific datasets or query types and make limited use of intermediate feedback, reducing system robustness and reasoning depth. Moreover, their operations are typically predefined and inflexible. To address these limitations, we propose DyFlow, a dynamic workflow generation framework that adaptively constructs and adjusts reasoning procedures based on task requirements and real-time intermediate feedback, thereby enhancing cross-task generalization. DyFlow consists of two core components: a designer and an executor. The designer decomposes complex problems into a sequence of sub-goals defined by high-level objectives and dynamically plans the next steps based on intermediate outputs and feedback. These plans are then carried out by the executor, which executes each operation using dynamic operators with context-aware parameterization, enabling flexible and semantically grounded reasoning. We systematically evaluate DyFlow across diverse domains, including social reasoning, biomedical tasks, mathematical problem solving, and code generation. Results demonstrate that DyFlow significantly outperforms existing baselines, achieving substantial Pass@k improvements and exhibiting robust generalization across diverse domains. The code is publicly available at https://github.com/wyf23187/DyFlow.

1 Introduction

DyFlow addresses the rigidity and limited feedback use of existing agent workflows with execution-adaptive planning, and reports robust performance across diverse domains, models, and tasks.

  • Motivation: Existing multi-agent frameworks commonly use fixed roles and sequences, while automated alternatives remain tied to datasets or queries and rarely revise subgoals during execution.Static systems can halt or propagate errors after flawed subtasks, whereas recent adaptive methods retain predefined or one-shot planning constraints.
  • Motivation: DyFlow adopts an execution-adaptive workflow paradigm that dynamically adjusts its reasoning process based on intermediate feedback.Figure 1 contrasts static, dataset-specific, and question-specific workflows with DyFlow’s feedback-driven adaptation.
  • Contributions: DyFlow’s designer is trained through supervised planning examples followed by self-play refinement, while the executor requires no additional training.This training strategy is intended to equip lightweight designers with strong planning capabilities.
  • Results: DyFlow demonstrates robust generalization across causal, mathematical, code, medical, and social reasoning, including adaptation to different and unseen executor models.The experiments also cover generalization, efficiency, and ablation.
  • Contributions: DyFlow adaptively revises reasoning procedures through a high-level designer and low-level executor that respond to real-time feedback.The designer generates and revises subgoal plans, while the executor carries them out.

2 Related Work

Related work progresses from static agent workflows toward automated construction and feedback-based correction, but existing methods generally do not revise workflow-level subgoals and operator choices during execution.

  • Static Workflows: Static frameworks hard-code agent roles, execution order, or communication protocols, limiting their ability to revise plans during a task.Examples include MetaGPT [9], AutoGen [5], CAMEL [10], and OpenAgents [11].
  • Automated Agent Construction: Automated workflow-construction methods reduce manual design but typically produce one-shot workflows that remain fixed after construction.AFlow [12], ADAS [13], and AgentSquare [17] automate construction through search or composition, but do not dynamically revise execution plans.
  • Feedback-based Correction: Existing correction mechanisms support self-evaluation, search-based revision, module-level checks, or retries, but generally operate below the workflow-planning level.Examples include Reflexion [19], Tree of Thoughts [20], DSPy [21], and AutoGen [5].
  • Feedback-based Correction: DyFlow integrates intermediate feedback directly into planning so it can revise subgoal decomposition and operator configurations as task progress unfolds.This targets the stricter granularity and adaptability requirements of workflow-level correction.

3 Methodology: DyFlow Framework

DyFlow constructs reasoning workflows iteratively: a designer generates context-conditioned stage subgraphs, an executor runs their operators using persistent memory, and training improves designer decisions from successful and failed trajectories.

  • Planning: At each step, DyFlow conditions a designer-generated stage subgraph on the current task state and intermediate outputs, enabling iterative workflow adaptation.The state contains the task, prior plans, outputs, and errors, and the process continues until termination, a step limit, or unrecoverable error.
  • Planning: Each operator instance combines a reusable template, context-specific instruction, and memory keys, while graph edges encode execution dependencies.This structure supports context-aware reuse of previous outputs across reasoning steps.
  • Execution: DyFlow delegates control decisions to the designer, which can proceed, revise, backtrack, or terminate after observing intermediate outputs, errors, and planning history.This designer-centric control simulates conditional and iterative behavior without hard-coded graph control flow.
  • Execution: The executor retrieves operator inputs from memory, executes operations in dependency order, stores results, and updates the next planning state.Algorithm 1 summarizes repeated design, execution, memory-update, and termination steps.
  • Designer Training: The executor uses existing LLMs without additional training, while the designer is trained through knowledge distillation followed by self-play preference optimization.Successful trajectories provide preferred stage-subgraph examples, and trajectory outcomes label generated plans as preferred or discarded.

4 Experiments

DyFlow is evaluated across five reasoning domains, with experiments targeting overall performance, Pass@k stability, model and task generalization, ablations, and qualitative behavior. It consistently outperforms baselines and generalizes across held-out domains and executor models.

  • Overall Performance: DyFlow achieves the highest average accuracy of 61.45 across five reasoning domains and reaches 17.18 on the held-out SocialMaze benchmark, outperforming all baselines.Training uses MATH, PubMedQA, and LiveBench, while HumanEval and SocialMaze assess zero-shot generalization.
  • Performance Comparison: DyFlow consistently outperforms CoT across k values from 1 to 5, with wider margins at higher k and greater stability across multiple completions.The framework reaches Pass@5 of 0.9817 on HumanEval, indicating a strong reasoning upper bound on code tasks.
  • Cross-Designer Generalization: DyFlow outperforms MaAS across all designer backbones, while the 14B Phi-4-based DyPlanner performs comparably to larger proprietary designers across most domains.The two-phase strategy combines supervised subgraph distillation with offline preference-based refinement.
  • Cross-Task Generalization: DyFlow generalizes planning strategies to held-out reasoning domains without task-specific supervision.Each cross-task setting trains on three domains and evaluates on the two excluded domains.
  • Ablation Study: Removing SFT, KTO, or dynamic planning reduces performance, with the largest degradation occurring when intermediate-feedback-driven replanning is disabled.SFT provides structural initialization, KTO refines trajectory-level behavior, and dynamic planning enables iterative subgoal revision.

5 Conclusion

DyFlow constructs dynamic workflows for LLM reasoning by combining subgraph planning with modular operator execution. The framework adapts to intermediate feedback and diverse task requirements, while future work targets richer error signals and broader operator support.

  • Conclusion: DyFlow models reasoning as subgraph planning with modular operator execution, enabling adaptation to intermediate feedback and diverse task requirements.The framework's notation covers planning states, operator structure, execution dynamics, and designer-training objectives.
  • Conclusion: Evaluations across five reasoning domains show improved task success rates and generalization across diverse reasoning tasks.
  • Conclusion: Future work may integrate richer error-detection signals and expand the operator set for more complex interaction protocols.

B Theoretical Analysis

DyFlow is theoretically modeled as a finite-horizon decision process whose feedback-driven policy can represent static workflows and adapt subgraphs to full execution state. The analysis establishes non-inferiority to static policies and bounds performance loss from per-step approximation errors.

  • Problem formulation: DyFlow models each task as a finite-horizon decision process and selects each stage subgraph from the full state, including intermediate outputs and error signals.At each step, a state summary conditions the sampled subgraph, whose execution produces reward and the next state.
  • Policy comparison: DyFlow is never worse than static policies because its policy class contains any static policy that always returns the same subgraph.A static policy is implemented by ignoring the current state and repeatedly returning Gfix.
  • Policy comparison: If feedback-driven replanning improves return on any task, DyFlow strictly outperforms the best static policy on that task.The proof connects the strict improvement to closed-loop correction of deviations in stochastic or error-prone environments.
  • Error analysis: The analysis measures DyFlow’s per-step suboptimality with a Bellman residual and assumes a uniform upper bound εt ≥ δt on that residual.The residual is used to compare optimal and DyFlow value functions over the remaining horizon.
  • Error analysis: Theorem 2 bounds the gap between optimal and DyFlow values by propagating the per-step residual across the finite horizon.The proof proceeds by induction from the equal terminal rewards, with the resulting bound involving T max 1≤k≤T εk.
  • Operator design: DyFlow uses modular operator templates that are instantiated dynamically with context-dependent instructions and inputs during execution.The framework summarizes these reusable templates and analyzes their usage across reasoning domains.

C.2 Operator Usage Analysis

DyFlow uses some operators broadly across reasoning domains and reserves others for complex tasks requiring decomposition, refinement, or plan generation. Figure 6 summarizes these domain-dependent usage patterns.

  • Operator Usage Analysis: REVIEW_SOLUTION, TERMINATE, and ORGANIZE_SOLUTION appear frequently across all reasoning tasks, indicating broad usage across domains.Figure 6 presents operator usage frequency across reasoning domains.
  • Operator Usage Analysis: DECOMPOSE_PROBLEM, REFINE_ANSWER, and GENERATE_PLAN are used more selectively in complex domains such as LiveBench and SocialMaze.These patterns correspond to domains where dynamic adaptation and restructuring are more critical.

D.1 Dataset Statistics

The experiments use approximately 1:3 train-to-test splits across datasets, with benchmark-specific sampling and evaluation settings. MATH uses level-5 problems from four categories, while HumanEval uses the full set when excluded from training.

  • Dataset Statistics: The default train-to-test split is approximately 1:3 across all datasets to balance supervision and evaluation coverage.Table 7 summarizes the dataset statistics used in the experiments.
  • Dataset Statistics: MATH uses difficulty-level-5 problems from combinatorics and probability, number theory, pre-algebra, and pre-calculus, while HumanEval is evaluated on all 164 problems when excluded from training.These settings follow the stated benchmark-specific evaluation protocol.

D.2 Designer Training

DyFlow trains its designer with supervised fine-tuning followed by preference-based refinement. The two stages use design trajectories from multiple reasoning tasks and labels based on task success.

  • Designer Training: Supervised fine-tuning uses 1.5k design results from MATH, PubMedQA, and Livebench with LoRA-based tuning of Phi-4.Training uses two Nvidia A6000 GPUs, a 2048-token cutoff, learning rate 5 × 10^-6, and three epochs.
  • Designer Training: KTO preference refinement uses 2k design results with a 1:1 positive-to-negative ratio labeled by task success.This stage uses a 4096-token cutoff, learning rate 2 × 10^-4, KL penalty β = 0.1, and three epochs.

D.3 Inference and Evaluation

DyFlow and all comparison methods use Phi-4 with near-deterministic inference settings to ensure a fair evaluation.

  • Temperature 0.01 is used for both the designer and executor during inference.
  • All methods use Phi-4 as the executor model for fair comparison.
  • The evaluation therefore controls both model choice and output randomness across methods.

D.4 Cost Analysis

DyFlow improves reasoning performance across executors and domains while trading modestly higher inference cost for stronger planning and generalization.

  • Designer cost: DyPlanner achieves the lowest inference cost across domains while matching or outperforming GPT-4.1 and Claude-3.7.The result supports distilling strong planning behavior into a compact Phi-4-based designer.
  • Full pipeline cost: On MATH, DyFlow has the highest performance despite additional training cost and uses approximately 1.4x to 3x the inference tokens of AFlow and MaAS.The extra inference cost comes from the two-stage designer–executor structure and is described as modest relative to the reasoning and generalization gains.
  • Cross-executor performance: DyFlow consistently improves over CoT across three executor models and five reasoning tasks, including lightweight Phi-4 and GPT-4o-mini.Its explicit planning compensates for executor limitations, with substantial gains reported on SocialMaze and MATH.

E Limitations

DyFlow’s main limitation is incomplete tool integration, while case studies illustrate how feedback and structured review correct errors that fixed reasoning paths miss.

  • Limitations: DyFlow currently lacks search, database, and environment-interaction operators, limiting tasks that require complex tool-assisted reasoning.Its operator set primarily supports symbolic and textual reasoning.
  • Limitations: External-tool limitations have limited impact in the evaluated tasks because bottlenecks mainly arise from planning and logical-reasoning errors.
  • Future scope: Future expansion to web, embodied, and multimodal tasks is expected to increase demand for external tool use.The paper proposes extending the executor with special tool-operation operators.
  • Case studies: Structured review also distinguishes correct from incorrect outputs in logical deduction and code parsing, including the correct fruit-distribution implementation.
  • Case studies: In the geometry case, DyFlow obtains 10 pieces by treating three concurrent cuts as 6 regions and the fourth cut as adding 4 more.
  • Case studies: In the social-deduction case, DyFlow correctly identifies Player 4 as the criminal and Player 1 as a lunatic, unlike the incorrect initial judgment.
Loading 2509.26062v1…