Table of Contents
Fetching ...

BayesFlow: A Probability Inference Framework for Meta-Agent Assisted Workflow Generation

Bo Yuan, Yun Zhou, Zhichao Xu, Kiran Ramnath, Aosong Feng, Balasubramaniam Srinivasan

TL;DR

BayesFlow reframes automatic workflow design as Bayesian posterior sampling over step-level code chunks, introducing Bayesian Workflow Generation (BWG) and a training-free BayesFlow instance. It combines parallel look-ahead rollouts with a sequential in-loop refiner to construct diverse, high-quality workflows while providing theoretical convergence guarantees in the no-refiner case and controlled exploration when refinement is used. Empirical results across six datasets and two executor families show BayesFlow achieving up to 9 percentage-point gains over state-of-the-art baselines and notable improvements in token efficiency and workflow-level inference-time scaling. The work offers a principled, scalable alternative to optimization-based methods, with practical impact for accelerating robust, automatic design of agentic LLM workflows.

Abstract

Automatic workflow generation is the process of automatically synthesizing sequences of LLM calls, tool invocations, and post-processing steps for complex end-to-end tasks. Most prior methods cast this task as an optimization problem with limited theoretical grounding. We propose to cast workflow generation as Bayesian inference over a posterior distribution on workflows, and introduce \textbf{Bayesian Workflow Generation (BWG)}, a sampling framework that builds workflows step-by-step using parallel look-ahead rollouts for importance weighting and a sequential in-loop refiner for pool-wide improvements. We prove that, without the refiner, the weighted empirical distribution converges to the target posterior. We instantiate BWG as \textbf{BayesFlow}, a training-free algorithm for workflow construction. Across six benchmark datasets, BayesFlow improves accuracy by up to 9 percentage points over SOTA workflow generation baselines and by up to 65 percentage points over zero-shot prompting, establishing BWG as a principled upgrade to search-based workflow design. Code will be available on https://github.com/BoYuanVisionary/BayesFlow.

BayesFlow: A Probability Inference Framework for Meta-Agent Assisted Workflow Generation

TL;DR

BayesFlow reframes automatic workflow design as Bayesian posterior sampling over step-level code chunks, introducing Bayesian Workflow Generation (BWG) and a training-free BayesFlow instance. It combines parallel look-ahead rollouts with a sequential in-loop refiner to construct diverse, high-quality workflows while providing theoretical convergence guarantees in the no-refiner case and controlled exploration when refinement is used. Empirical results across six datasets and two executor families show BayesFlow achieving up to 9 percentage-point gains over state-of-the-art baselines and notable improvements in token efficiency and workflow-level inference-time scaling. The work offers a principled, scalable alternative to optimization-based methods, with practical impact for accelerating robust, automatic design of agentic LLM workflows.

Abstract

Automatic workflow generation is the process of automatically synthesizing sequences of LLM calls, tool invocations, and post-processing steps for complex end-to-end tasks. Most prior methods cast this task as an optimization problem with limited theoretical grounding. We propose to cast workflow generation as Bayesian inference over a posterior distribution on workflows, and introduce \textbf{Bayesian Workflow Generation (BWG)}, a sampling framework that builds workflows step-by-step using parallel look-ahead rollouts for importance weighting and a sequential in-loop refiner for pool-wide improvements. We prove that, without the refiner, the weighted empirical distribution converges to the target posterior. We instantiate BWG as \textbf{BayesFlow}, a training-free algorithm for workflow construction. Across six benchmark datasets, BayesFlow improves accuracy by up to 9 percentage points over SOTA workflow generation baselines and by up to 65 percentage points over zero-shot prompting, establishing BWG as a principled upgrade to search-based workflow design. Code will be available on https://github.com/BoYuanVisionary/BayesFlow.
Paper Structure (40 sections, 3 theorems, 13 equations, 11 figures, 4 tables, 2 algorithms)

This paper contains 40 sections, 3 theorems, 13 equations, 11 figures, 4 tables, 2 algorithms.

Key Result

Theorem 1

Consider Algorithm alg:bayesflow_step without the refiner (i.e., $M{=}0$) for $T$ steps, and let $\widehat{\pi}_{N,T}$ be the empirical distribution of the final $N$ complete workflows. Then, as $N\!\to\!\infty$Standard assumptions for SMC are taken to hold; see doucet2000sequential., the empirical

Figures (11)

  • Figure 1: This diagram depicts Algorithm \ref{['alg:bayesflow_step']} in a setting with $N=3$ candidate partial workflows, $K=2$ look-ahead rollouts per candidate, and $M=3$ refinement attempts. The optimizer LLM is invoked to (i) sample next-step expansions, (ii) generate parallel look-ahead rollouts to estimate downstream value, and (iii) refine the current pool; the executor LLM is invoked to score complete workflows. The figure shows the transition of partial workflows from Step 1 to Step 2.
  • Figure 2: Evolution of validation accuracy across three sampling rounds. Solid lines show the mean over $K=20$ samples; the shaded region spans the minimum and maximum run in each round.
  • Figure 3: Helper function on chat completion
  • Figure 4: Helper function on public test sets
  • Figure 5: MBPP workflow
  • ...and 6 more figures

Theorems & Definitions (6)

  • Theorem 1
  • Theorem 2
  • Theorem 3
  • proof
  • proof
  • proof