GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
ICLR 2025

AFlow: Automating Agentic Workflow Generation

Treat an LLM workflow as code and let Monte Carlo tree search, with an LLM proposing one edit at a time, find a better one. It beat hand-built workflows on six benchmarks. Read the evaluation closely.

Breakdown by FDE Interviews · 14 min read · Updated

About the original · 2024
AUTHORS
Zhang, Xiang, Yu, Teng, et al.
FROM
DeepWisdom, HKUST (Guangzhou), Renmin University, Nanjing University, Fudan University, KAUST, Mila
PUBLISHED
Oct 2024 · ICLR 2025
CITED BY
474Semantic Scholar · Oct 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 18% of this breakdown.

01

The paper in one minute

Most LLM applications that work well are workflows: several model calls in a fixed arrangement, such as generating five answers and voting, or writing a solution and checking it with code. People design these by hand for each task. Jiayi Zhang, Jinyu Xiang and colleagues at DeepWisdom and several universities built AFlow to search for them automatically. The paper appeared at ICLR 2025.

AFlow writes each workflow as a short Python program. Its building blocks are nodes, single LLM calls defined by a model, prompt, temperature and output format, and operators, hand-written combinations of nodes for common patterns: Generate, Format, Review and Revise, Ensemble (a self-consistency vote), Test, Programmer, and a Custom node. To keep the search manageable it fixes the model, temperature and format, and searches over prompts and code.

The search is a variant of Monte Carlo tree search in which every tree node is a complete workflow. Each round it selects a workflow, mixing a uniform choice with a preference for high scores and always allowing a restart from the blank template. An LLM optimizer (Claude 3.5 Sonnet) expands it with one change, using a log of earlier edits to that workflow, whether they helped, and logs of its predictions against the expected outputs. The new workflow is evaluated five times on a validation set, and the result is backpropagated into the experience log. After 20 rounds, the best workflow is tested.

With GPT-4o-mini executing, the found workflows beat every hand-designed baseline on all six benchmarks (HotpotQA, DROP, HumanEval, MBPP, GSM8K and a level-5 MATH subset), averaging 80.3 against 76.0 for the best. Workflows found with one model mostly transferred to others, and cheap models running them matched or beat GPT-4o on HumanEval at a small fraction of its cost.

THE IDEA, VISUALLY
SEARCHING OVER WORKFLOWS AS CODE Select soft mixed probability Expand LLM edits the code Evaluate 5 runs on validation Backpropagate log change + result 20 rounds · optimizer Claude 3.5 Sonnet · executor GPT-4o-mini OPERATORS (HAND-WRITTEN PRIORS) Generate Format Review & Revise Ensemble Test Programmer Custom BEST WORKFLOW FOUND FOR GSM8K 5 × solve custom prompt vote sc_ensemble check with code programmer Self-consistency plus a code check: 93.5% against 92.7% for five-sample CoT SC. The search rediscovered known patterns, which its own operator set had supplied. TEST SCORES, GPT-4O-MINI (TABLE 1) HotpotQA F1 64.5 73.5 DROP F1 76.6 80.6 HumanEval 82.4 94.7 MBPP 53.4 83.4 GSM8K 90.8 93.5 MATH level 5 35.4 56.2 IO CoT SC ADAS AFlow ADAS, the automated rival, fell below plain IO on five of six. HumanEval's test split is about 131 problems: 3.1 points ≈ 4.
AFlow grows a tree of workflows, each a small Python program, by asking an LLM to make one change at a time and keeping what scores better on a validation set. On GSM8K the winner was self-consistency plus a code check, built from the operators the authors supplied.
Research notes: the problem, approach and results
80.3

average across six benchmarks with GPT-4o-mini, against 76.0 for five-sample self-consistency

4.3 pts

the gain over the best hand-designed method, reported as 5.7%, which is the relative figure

4.55%

of GPT-4o's HumanEval cost for a DeepSeek-V2.5 workflow that tied GPT-4o, per the paper's appendix

THE PROBLEM

Agentic workflows (chains of LLM calls with prompts, voting, review and code checks) are designed by hand for each task. Earlier automatic methods tuned prompts inside a fixed workflow, or searched over whole workflows too inefficiently to find good ones.

THE IDEA

Represent the workflow as code calling LLM nodes and reusable operators such as Ensemble, Review and Revise, and Programmer. Search with a Monte Carlo tree: select a workflow, have an LLM edit it using the logged results of earlier edits, run it on a validation set, record the outcome.

THE RESULT

On six benchmarks with GPT-4o-mini, the found workflows averaged 80.3 against 76.0 for the best hand-designed method and 67.2 for ADAS. Cheap models running a found workflow matched GPT-4o on HumanEval at a small fraction of its cost.

02

Why it matters to an FDE

You will build workflows by hand for customers: retrieval, then draft, then check, then format. AFlow is a credible way to search for a better arrangement once you have a scored dataset, and its results line up with what practitioners find by hand.

The winners are familiar. On GSM8K the search settled on five samples, a vote, and a code check. That is self-consistency plus a programmatic verifier. The operator set already contained those ideas. Expect a search like this to recombine your building blocks well, not to invent new ones.

You need an evaluation function first. AFlow works on tasks with a numeric score: exact answers, unit tests, F1. If the customer's task has no automatic score, the search has nothing to climb.

A small validation set will fool you. Picking the best of twenty candidates on a small set inflates the winner's score. Our simulation below shows how much, and how to spend the evaluation budget instead.

Count the search, not just the result. The paper reports what the found workflows cost to run, not what the search cost. Twenty rounds, each run five times on a validation set, plus an optimizer model, is a real bill.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 99 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    The search space, the four steps, the results, and misreadings to avoid

    Free account
  2. 04How it works

    The workflow representation, the four MCTS steps, the operator set, and the evaluation setup

    Premium
  3. 05The numbers that matter

    The gains in points, the cost comparison, the transfer table, and how much each can bear

    Premium
  4. 06Try it yourself

    Check the selection rule's units, then see how a small validation set inflates the winner

    Premium
  5. 07Where it breaks

    The limits of the method and of the evidence

    Premium
  6. 08Using it on a deployment

    Running a workflow search for a customer without fooling yourself

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →