EvoFlow: Evolving Diverse Agentic Workflows On The Fly
Abstract
The past two years have witnessed the evolution of large language model (LLM)-based multi-agent systems from labor-intensive manual design to partial automation (e.g., prompt engineering, communication topology) and eventually to fully automated design. However, existing agentic automation pipelines often lack LLM heterogeneity and focus on single-objective performance optimization, limiting their potential to combine weaker models for more customized and cost-effective solutions. To address this challenge, we propose EvoFlow, a niching evolutionary algorithm-based framework to automatically search a population of heterogeneous and complexity-adaptive agentic workflows, rather than a single homogeneous, complex workflow. Technically, EvoFlow performs (1) tag-based retrieval to extract parent workflows from an agentic population, evolves new workflows through (2) crossover and (3) mutation, and employs (4) niching-based selection to maintain population diversity and quality. Extensive evaluations across seven benchmarks demonstrate that EvoFlow is: (I) diverse, evolving a population of workflows ranging from simple I/O tasks to complex multi-turn interactions; (II) high-performing, outperforming previous handcrafted and automated workflows by ; (III) economical, surpassing powerful o1-preview at of its inference cost using weaker open-source models. The code will be available at https://github.com/bingreeky/EvoFlow.
Keywords:
Machine Learning, ICML1 Introduction
Large Language Model (LLM)-based agents (Richards & et al., 2023; Nakajima, 2023; Reworkd, 2023) have exhibited remarkable capabilities across a wide spectrum of tasks, including question answering (Zhu et al., 2024a), data analysis (Hong et al., 2024; Li et al., 2024), decision-making (Song et al., 2023), code generation (Shinn et al., 2023), video gaming (Wang et al., 2023), and autonomous driving (Jin et al., 2023), among others. Recent advancements further highlight that integrating single agents into agentic workflows, i.e., structured sequences of LLM-based agent interactions, can surpass the cognitive and functional limitations of individual agents (Du et al., 2023; Liang et al., 2023; Wang et al., 2023b; Jiang et al., 2023; Shinn et al., 2023; Zheng et al., 2023a; Wu et al., 2023; Zhang et al., 2024a), thereby exhibiting human-esque collaborative intelligence in multi-agent systems (Zhang et al., 2023).
The progress of machine learning consistently reveals a recurring pattern: manually crafted artifacts are often replaced by learnable and optimizable ones (Tyson & Zysman, 2022; Clune, 2019). For natural language processing (NLP), this is exemplified by the replacement of hand-designed representations like Bag-of-Words (Mikolov et al., 2013) with learned embeddings like GloVe (Pennington et al., 2014) and BERT (Devlin, 2018). Similarly, agentic systems have experienced a rapid transition from manual to automated over the past two years: Early attempts, e.g., CAMEL (Li et al., 2023), AutoGen (Wu et al., 2023), and MetaGPT (Hong et al., 2023), relied heavily on manual configurations, while follow-up works significantly reduced dependence on human intervention, like DsPy (Khattab et al., 2023) automating prompt optimization, GPTSwarm (Zhuge et al., 2024) optimizing inter-agent communication, and EvoAgent (Yuan et al., 2024) self-evolving agent profiling. More recent efforts (Hu et al., 2024b; Shang et al., 2024; Zhang et al., 2024c), have demonstrated that these automated pipelines enable the development of surprisingly creative and powerful agentic workflows, marking significant progress toward fully autonomous agentic AI. Despite their success, existing automation pipelines often lack diversity in both LLM heterogeneity and complexity scheduling:
- ➠
Lack of LLM heterogeneity. Mainstream multi-agent workflows are often homogeneous, relying on a single, expensive LLM like GPT-3.5/GPT-4o to instantiate all agents (Zhang et al., 2024c; Chen et al., 2023a). However, as highlighted by studies on LLM routing (Chen et al., 2023c; Hu et al., 2024a), the capabilities of different LLMs are often complementary rather than forming a strict superset relationship. In certain scenarios, smaller LLMs can perform tasks comparably or even outperform their larger counterparts at a significantly lower token cost. Against this backdrop, we advocate for agentic workflows to be heterogeneous, incorporating a diverse ensemble of LLMs with varying sizes, capabilities, and sources.
- ➠
Lack of complexity diversity. Existing automated agentic workflows often prioritize single-objective optimization, focusing on performance or solution quality. This typically results in a singular, complex workflow incorporating elements like CoT ensembles and multi-turn discussions (Hu et al., 2024b; Shang et al., 2024). However, real-world user queries vary significantly in difficulty, as exemplified by the MMLU benchmark (Hendrycks et al., 2021a), which spans tasks from elementary to graduate-level. While complex workflows are essential for the latter, simpler queries can be efficiently addressed by single-agent I/O (Feng et al., 2024). Thus, we advocate for optimizing a diverse set of workflows, tailoring simple workflows to straightforward tasks and reserving complex ones for more intricate challenges.
The above considerations and observations raise critical questions regarding the current paradigm of agentic system design: How can we automatically optimize a set of heterogeneous, complexity-adaptive agentic workflows that provide diverse solutions for varied queries?
To this end, we propose EvoFlow, a niching evolutionary algorithm (EA)-based framework for automatically searching a population of heterogeneous, complexity-adaptive agentic workflows, rather than a single, homogeneous, complex workflow. Technically, EvoFlow innovatively frames the agentic search as a multi-objective optimization problem, considering both cost and performance, ultimately generating a Pareto-optimal set of workflows balancing these factors. EvoFlow uses operator nodes, i.e., a set of LLM-agent invoking nodes, as the fundamental units of its search space. The workflow population is initialized by selecting and combining multiple operator nodes. Afterward, EvoFlow continuously evolves by processing incoming queries. It ❶ tag-based retrieves relevant workflows as parents, performs ❷ crossover to generate offspring workflows, applies ❸ mutation with extensive mutation functions, i.e., LLM/prompt/operator mutation, to evolve the offsprings. Finally, ❹ niching selection is leveraged to maintain diversity and quality in the population. During inference, EvoFlow autonomously retrieves domain-relevant and complexity-adapted agentic systems from the well-optimized population, to swiftly and efficiently address user queries.
We conduct comprehensive evaluations on six widely adopted benchmarks. In heterogeneous settings, EvoFlow surpasses powerful o1-preview at of its inference cost by utilizing weaker open-source models (e.g., LLaMa-3.1-70b and QWen-2.5-72b); In homogeneous settings, EvoFlow outperforms state-of-the-art (SOTA) agentic workflows by an average of in performance. More importantly, EvoFlow is highly economical, with a training cost of only one-third of SOTA baseline AFlow ( vs ) and an inference cost of merely one-fifth ( vs ), while surpassing AFlow by on the MATH Benchmark.
Briefly put, our contributions can be summarized as:
- •
Paradigm Transformation. We for the first time explicitly formulate agentic workflow automation as a cost-performance multi-objective optimization problem, highlighting LLM heterogeneity and complexity diversity as key features for the development of multi-agent systems.
- •
Practical Solution. We propose a niching evolutionary algorithm-based framework, EvoFlow, which autonomously evolves a population of heterogeneous and complexity-diverse agentic workflows across various task domains with minimal human intervention.
- •
Emperical Evaluation. Extensive experiments on seven benchmarks show that EvoFlow is (I) diverse, evolving a workflow population ranging from simple I/O to complex multi-turn interactions; (II) high-performing, surpassing previous handcrafted and automated workflows by ; (III) economical, surpassing powerful o1-preview with weaker open-source models.
2 Related Work
LLM-based Autonomous Agents
Building on the success of single agent (Shen et al., 2024; Zhu et al., 2024b; Zhong et al., 2024), studies have shown that interaction among multiple LLM-based agents can substantially enhance individual model capabilities (Wang et al., 2024), as seen in several early frameworks, including CAMEL (Li et al., 2023), AutoGen (Wu et al., 2023), BabyAGI (Nakajima, 2023), and LLM-Debate (Du et al., 2023). However, these initial approaches heavily depended on manually crafted designs, which constrained the adaptability and flexibility of agents in addressing unforeseen challenges (He et al., 2023; Chen et al., 2023d). Consequently, the push toward automating agentic workflows has gained momentum.
Automated Agentic Workflows
Efforts to automate agentic workflows can be broadly categorized into the following types: (1) Prompt Optimization, exemplified by PromptBreeder (Fernando et al., 2023) and DsPy (Khattab et al., 2023); (2) Inter-agent Topology, which focuses on orchestrating interactions among agents, such as GPTSwarm (Zhuge et al., 2024), DyLAN (Liu et al., 2023), EvoMAC (Hu et al., 2024c), and G-Designer (Zhang et al., 2024b); (3) Agent Persona/Profile, represented by AgentVerse (Chen et al., 2023d) and EvoAgent (Yuan et al., 2024). More recently, Hu et al. (2024b) formalized the concept of Automated Design of Agentic Systems, with subsequent advancements by AgentSquare (Shang et al., 2024) and AFlow (Zhang et al., 2024c). However, these automation pipelines are predominantly homogeneous, i.e., utilizing a single-source LLM, and lack the integration of heterogeneous LLM agents of varying sizes and sources. Additionally, they typically produce a fixed workflow (Yuan et al., 2024; Zhuge et al., 2024; Zhang et al., 2024c), which cannot dynamically allocate resources when confronted with tasks/queries of different levels and complexities.
| Method | Prompt Optimize | Agent Topology | Agent Profile | LLM Backbone | Complexity Adaptivity |
| AgentVerse | ✗ | ✗ | ✔ | ✗ | ✗ |
| GPTSwarm | ✗ | ✔ | ✗ | ✗ | ✗ |
| EvoMAC | ✔ | ✔ | ✗ | ✗ | ✗ |
| EvoAgent | ✔ | ✗ | ✔ | ✗ | ✗ |
| EvoPrompt | ✔ | ✗ | ✗ | ✗ | ✗ |
| ADAS | ✔ | ✗ | ✔ | ✗ | ✗ |
| AFlow | ✔ | ✔ | ✔ | ✗ | ✗ |
| AgentSquare | ✗ | ✔ | ✔ | ✗ | ✗ |
| EvoFlow | ✔ | ✔ | ✔ | ✔ | ✔ |
Evolutionary Algorithm
Evolutionary algorithms (EAs) are no new to agentic AI (Cetnarowicz et al., 1996; Li & Liu, 2016; Liu et al., 2020). In the era of LLM-based agents, researchers have explored the interplay between EA and LLM agents, including prompt engineering (Xu et al., 2022; Shi et al., 2024), code generation (Romera-Paredes et al., 2024), project planning (Tao et al., 2023) and inference time scaling (Lee et al., 2025). EvoAgent (Yuan et al., 2024) and EvoPrompt (Guo et al., 2023) employ simple genetic algorithms to optimize agent profiles and prompts, whose, however, level of automation is highly constrained, focusing solely on single-agent prompt optimization and failing to evolve at the workflow level, as illustrated in Table 1.
3 Preliminary
In this section, we formally define the search space of EvoFlow and the objective of workflow optimization.
Search Space. The search space of EvoFlow is defined hierarchically, with the basic unit being the (LLM-)invoking node. These are further assembled into (composite) operator nodes, which are then combined to form the complete workflow , as visualized in Figure 2. Each invoking node is defined as follows:
| (1) |
where represents the associated prompt, with denoting the feasible prompt space, and is the temperature parameter. represents an LLM instance from the feasible model pool , characterized by its model size , token cost , and inference delay . Thus, the feasible space for invoking nodes is given by . Notably, prior agentic automation pipelines have generally excluded from their search space (Zhang et al., 2024c; Yuan et al., 2024; Zhuge et al., 2024), often preselecting a single LLM to instantiate all agents, which constrains the development of more diverse and capability-rich agentic systems. Building upon the invoking nodes, the operator node is represented by:
| (2) |
where is a subset of invoking nodes, and signifies the connectivity relationship among invoking nodes. The overall agentic workflow is defined as:
| (3) | ||||
where , , denotes the number of operator nodes in , / denote intra/inter-operator connections.
Problem Formulation We first present the optimization objective for traditional agentic automation methods. Given a task domain and an performance evaluator function , the objective function is defined as:
| (4) |
where represents the feasible space of invoking nodes, and denotes the invoking node-based search space for . As shown in Equation 4, existing methods (Zhang et al., 2024c; Shang et al., 2024; Zhuge et al., 2024) typically perform single-objective optimization. In contrast, the optimization objective of EvoFlow is multi-objective:
| (5) |
where evaluates the system cost, and represents the Pareto optimal set balancing cost and performance, which includes a set of non-dominated agentic workflows that are well-distributed and located near the Pareto front (PF) in the objective space. Detailed explanations are in Appendix C.
However, the optimization in Equation 5 is currently based on invoking nodes, which results in an excessively large search space and does not explicitly account for many already-existing high-performing composite structures, such as CoT (Wei et al., 2022), ToT (Yao et al., 2023a), and Multi-agent Debate (Du et al., 2023). Therefore, we reformulate the search space to be operator node-based:
| (6) | ||||
Where represents the feasible space for operator nodes.
4 Methodology
As shown in Figure 3, EvoFlow initializes a set of workflows with varying complexities and domain specializations, each tagged with its domain expertise (Section 4.1). As new user queries arrive, EvoFlow performs tag-based retrieval to select the most relevant (workflow) individuals as parents and generates offspring workflows through crossover and mutation (Section 4.2). Upon receiving environmental feedback, the framework evaluates the new workflows in the multi-objective space, and conducts environmental selection to maintain population diversity and efficiency (Section 4.3).
4.1 Population Initialization
EvoFlow initially populates the feasible space of operator nodes with a basket of powerful single-/multi-agent structures, including CoT (Wei et al., 2022), Ensemble (Jiang et al., 2023), Self-Reflexion (Shinn et al., 2023), Multi-agent Debate (Du et al., 2023), etc. Detailed formalizations are in Appendix D. This transforms into a finite set:
| (7) |
Importantly, thought is initialized as a finite set, this does not constrain EvoFlow’s potential to explore a broader search space. This is because (1) practitioners can easily customize operator templates as needed, and (2) EvoFlow’s crossover and mutation can generate novel operators.
To initialize the workflow population (where the population size is set to ), we generate workflows as follows:
| (8) |
where denotes the number of operators in workflow , represents the operator template randomly selected from , and it is instantiated with LLMs (sampled from LLM pool ) and prompts . Upon creating a workflow individual, we assign it multiple utility indicator tags, which suggest the task domains where it might excel. These tags are conducive to a rapid match between user queries and relevant workflows, generated as follows:
| (9) |
where represents the -th tag of , with a total of tags per workflow, and is a LLM-powered tag generation function (see Section E.1). Thus, we have initialized the workflow population prior to iterative evolution.
4.2 Retrieval, Crossover, and Mutation
Upon initializing , we seek to evolve it driven by incoming task queries. Rather than activating the entire population for each query, we select a subset of workflows that are most relevant and complexity-adapted to it, which prevents the population from converging solely toward high-complexity, single-domain evolution. Specifically, for the -th query , we first select the most relevant workflow individuals from the population , based on utility indicator tags:
| (10) | ||||
where is the -th tag of , is a selection function that outputs elements with largest values, and maps queries/tags to fixed-length embeddings using lightweight models such as SentenceBERT (Reimers, 2019) or MiniLM (Wang et al., 2020). The similarity score is computed based on the cosine similarity between the tag/query embeddings. After identifying the most relevant workflows, these are treated as parents to generate offspring workflows with crossover function:
| (11) |
where represents the generated workflow, and the function is LLM-facilitated (see prompts in Section E.2). To further enhance the diversity of the population and foster the evolution of novel agentic architectures, we apply a suite of mutation functions to refine the sketched offspring, as described below:
LLM Mutation replaces the LLM backbone of an invoking node within an existing workflow. This mutation can be beneficial in scenarios where an agent in the workflow is underperforming, such as when a small 7b agent fails to handle complex subtask decomposition and needs to be replaced by a larger one, or when a simpler 72b model suffices to accomplish a task as a 405b model does. The mutation process empowers EvoFlow to evolve into powerful heterogeneous workflows, formalized as follows:
| (12) |
where represents the mutated individual, and is an LLM-powered process that determines whether the LLM in should be changed based on the LLM performance history pool . Details of and are provided in Section F.1 and Section E.3.1, respectively.
Prompt Mutation involves modifying the prompts of invoking nodes, such as incorporating few-shot examples or providing clearer task instructions, as follows:
| (13) |
where is the experience history of the workflow population, the configuration of which is placed at Section F.2. is also LLM-powered (see Section E.3.2).
Operator Mutation refers to the modification of the operators or their topological connections (). Practical scenarios include removing redundant Reflexion operators or adding a “format” operator within the workflow to enhance the formatting accuracy of code generation. The process is described as:
| (14) |
where and are deleted and added operators by , and denotes the modified topological operator connections. The prompts for is in Section E.3.3.
The mutated offspring is denoted as . With new individuals introduced, the critical challenge is: how can we design an efficient selection mechanism to evolve the population toward greater diversity and higher performance?
4.3 Niching-based Selection
The aforementioned challenge is one that prior agentic automation methods have struggled with: their single-objective optimization approaches often result in increasingly complex workflows, lengthier evaluation/test, and significantly higher API costs (Zhang et al., 2024c). For instance, running ADAS (Hu et al., 2024b) on ARC benchmark (Chollet, 2019) with gpt-3.5-turbo-0125 incurs cost up to USD. In contrast, EvoFlow introduces an efficient niching-based workflow selection mechanism, guiding evolution across multiple domains and complexity.
Niching, in our context, analogous to previous niching EAs (White et al., 2023), refers to clusters of similar individuals where environmental selection is conducted. To determine the niching area for a new individual , we compute it based on cost and utility tags as follows:
| (15) |
where denotes the identified niching area comprising individuals. The function computes the approximate ranking of an individual relative to the new individual, which is determined by the cost similarity rank and the tag-based similarity rank . Subsequently, the parents, offspring, and workflows in the niching area are executed for query , and their records are updated as follows:
| (16) | ||||
where measures the economical cost incurred by workflow in addressing query , records the number of times workflow being executed up to iteration , tracks the cumulative cost of . follows a similar formulation for performance metrics. Finally, the environmental selection is performed within the niching area by calculating the fitness value as follows:
| (17) |
where is a Pareto dominance-preserving binary indicator. If individual dominates , i.e., and (aligning with our objective in Equation 5), then . The maximum absolute indicator value, , is defined as . The scaling factor is set to , following established practices (Zitzler & Künzli, 2004). A smaller fitness value in Equation 17 corresponds to a better individual. The worst-performing workflow, , which has the largest fitness value in , will be eliminated from the population.
4.4 Discussion
The evolution process of EvoFlow operates on a query-by-query basis, continuously evolving, mutating, and niching-selecting workflows in response to incoming queries. This iterative process gradually produces a Pareto set of agentic workflows with varying complexity and superior performance. The overall algorithmic procedure is summarized in Appendix B, with notations clarified in Appendix A.
| Method | GSM8K | MATH | MultiArith | HumanEval | MBPP | ALFWorld | Avg. |
| Vanilla | |||||||
| CoT (Wei et al., 2022) | ↓0.35 | ↑0.11 | ↓0.54 | ↑1.05 | ↓0.00 | ↑1.21 | ↑0.25 |
| ComplexCoT (Fu et al., 2022) | ↓0.56 | ↑0.24 | ↓0.15 | ↑0.41 | ↑0.53 | ↑2.97 | ↑0.57 |
| SC (CoT) (Wang et al., 2023a) | ↑0.12 | ↑1.62 | ↓0.27 | ↑1.52 | ↑1.77 | ↑1.84 | ↑1.10 |
| MultiPersona (Wang et al., 2023b) | ↑0.05 | ↓0.86 | ↑0.64 | ↑1.24 | ↑1.36 | ↑0.39 | ↑0.47 |
| LLM-Debate (Du et al., 2023) | ↑2.02 | ↑2.25 | ↑0.48 | ↑1.60 | ↓1.54 | ↑5.97 | ↑1.80 |
| LLM-Blender (Jiang et al., 2023) | ↑0.90 | ↑0.63 | ↑0.44 | ↑1.72 | ↑5.22 | ↑5.08 | ↑2.33 |
| DyLAN (Liu et al., 2023) | ↑2.53 | ↑2.34 | ↑0.27 | ↑3.34 | ↑5.47 | ↑14.61 | ↑4.76 |
| AgentVerse (Chen et al., 2023d) | ↑2.46 | ↑1.06 | ↑0.65 | ↑2.21 | ↑2.45 | ↑6.32 | ↑2.52 |
| MacNet (Qian et al., 2024) | ↑0.50 | ↓1.11 | ↓0.82 | ↓2.51 | ↓6.55 | ↑4.95 | ↓0.92 |
| AutoAgents (Chen et al., 2023b) | ↑0.24 | ↓0.97 | ↓0.43 | ↑0.56 | ↑0.12 | ↑7.44 | ↑1.16 |
| GPTSwarm (Zhuge et al., 2024) | ↑1.69 | ↑1.59 | ↓0.06 | ↑2.24 | ↑5.60 | ↑14.48 | ↑4.26 |
| ADAS (Hu et al., 2024b) | ↓1.33 | ↓3.11 | ↓0.83 | ↓2.89 | ↓3.70 | ↑8.95 | ↓0.49 |
| AgentSquare (Shang et al., 2024) | ↑0.17 | ↑2.22 | ↑0.92 | ↑3.00 | ↑6.63 | ↑27.71 | ↑6.77 |
| AFlow (Zhang et al., 2024c) | ↑3.71 | ↑3.31 | ↓0.63 | ↑3.85 | ↑9.84 | ↑20.45 | ↑7.03 |
| EvoFlow (Ours) | ↑4.85 | ↑11.41 | ↑1.95 | ↑5.77 | ↑10.34 | ↑29.86 | ↑11.18 |
| Model | MATH | MBPP | |||||||||
| Training cost () | Inference cost () | Overall cost () | Inference token | Acc. (%) | Training cost () | Inference cost () | Overall cost () | Overall token | pass@1 (%) | ||
| Single | Llama-3.1-70b | - | - | ||||||||
| Qwen-2.5-72b | - | - | |||||||||
| Deepseek-V2.5 | - | - | |||||||||
| Hermes-3-70b | - | - | |||||||||
| o1-preview | - | - | |||||||||
| Homogeneous | AFlowLlama | ||||||||||
| AFlowQwen | |||||||||||
| AFlowDeepseek | |||||||||||
| AFlowHermes | |||||||||||
| DyLANLlama | |||||||||||
| DyLANQwen | |||||||||||
| DyLANDeepseek | |||||||||||
| DyLANHermes | |||||||||||
| EvoFlow | |||||||||||
5 Experiments
5.1 Experiment Setup
Tasks and Benchmarks.
We evaluate EvoFlow on six public benchmarks covering four domains: (1) math reasoning, GSM8K (Cobbe et al., 2021), MATH (Hendrycks et al., 2021b), and MultiArith (Roy & Roth, 2016); (2) code generation, HumanEval (Chen et al., 2021) and MBPP (Austin et al., 2021)); (3) embodied, ALFWorld (Shridhar et al., 2021). For the MATH benchmark, we follow (Hong et al., 2024) in selecting a harder subset (617 problems). The dataset statistics and splits are in Section G.1.
Baselines.
We compare EvoFlow with two series of agentic baselines: (1) manually designed workflows, including Chain-of-Thought (Wei et al., 2022), ComplexCoT (Fu et al., 2022)), Self-Consistency (SC) (Wang et al., 2023a), LLM-Debate (Du et al., 2023), LLM-Blender (Jiang et al., 2023), DyLAN (Liu et al., 2023), AgentVerse (Chen et al., 2023d) and MacNet (Qian et al., 2024); (2) autonomous workflows, including GPTSwarm (Zhuge et al., 2024), AutoAgents (Chen et al., 2023b), ADAS (Hu et al., 2024b), AgentSquare (Shang et al., 2024) and AFlow (Zhang et al., 2024c). Detailed baseline setups are in Section G.2.
LLM Backbones.
We leverage one closed-source model, gpt-4o-mini-0718, along with four open-source models: llama-3.1-70b, Qwen-2-72b, Deepseek-V2.5, and Hermes-3-70b. LLMs are accessed via APIs, with the temperature set to .
Parameter Configuration.
We select the following operators to initialize the feasible space of operator nodes: CoT, LLM-Debate, Take-a-step-back, Self-consistency, Self-Refine, Ensemble, ReAct, and ExpertPrompting. Detailed instructions are in Appendix D. The function adopts all-MiniLM-L6-v2 (Wang et al., 2020). The number of parent workflows in Equation 10 is set as , and the number of utility indicator tags in Equation 9 is set as . The population size is , and in Equation 15.
5.2 Performance Analysis
We present via three experimental settings: ◼ homogeneous setting, where all methods, including EvoFlow, are equipped with a unified LLM backbone; ◼ heterogeneous setting, where EvoFlow is assigned an LLM pool and optimizes a heterogeneous agentic workflow population; ◼ cross-domain setting, where we mix up multiple cross-domain datasets for training. The analysis is as follows:
Homogeneous Performance
Table 2 demonstrates that EvoFlow outperforms existing hand-crafted or automated agentic workflows across six benchmarks. Specifically, on the MATH benchmark, it exceeds vanilla gpt-4o-mini by and surpasses the SOTA baseline AFlow by . On the embodied benchmark ALFWorld, EvoFlow achieves the optimal , outperforming the second-best AgentSquare by .
Heterogeneous Performance
qwen-2.5-72b exhibits the best performance among the four open-source models, but even with the sophisticated optimization from AFlow, it only shows a improvement on MATH, still trailing behind the powerful o1-preview by ; however, EvoFlow, through the collective assembly and evolution of the four open-source models, surpasses o1-preview by . More importantly, the overall cost of EvoFlow is merely of that of o1-preview. This clearly illustrates both the necessity and potential of optimizing LLM-heterogeneous workflows.
Cross-domain Performance
We also include a cross-domain optimization setting, where training sets from different domain datasets are concatenated to assess whether an agentic automation method can optimize reasonable workflows across domains. As shown in Table 6, cross-domain optimization challenges many existing baselines: vanilla Deepseek-V2.5 achieves on MATH, and GPTSwarm improves it by when optimized solely for MATH. However, joint optimization on MATH+MBPP results in a negative gain, reducing performance to . Other methods like DyLAN and AFlow also suffer from the same issue. In contrast, EvoFlow successfully benefits from cross-domain training on MBPP, improving from to , a result attributed to the optimization of the workflow population rather than a single individual.
5.3 Cost Analysis & Case Study
We demonstrate the resource-friendly nature of EvoFlow’s agentic automation system across three dimensions: training/inference API costs and token consumption. As shown in Table 3, optimizing AFlowQwen on MATH incurs a training cost of and an inference cost of . In comparison, EvoFlow requires only of the training cost and of the inference cost: this is because EvoFlow ’s workflows do not continuously rely on the most expensive qwen-2.5-72b, and instead opt for more economical models such as llama-3.1 or herme-3-70b when appropriate, without compromising performance.
We further visualize the optimized heterogeneous population of EvoFlow in Figure 4. It can be observed that EvoFlow forms a Pareto front in this performance-cost plane. The population begins with simple and inexpensive workflows, consisting solely of basic I/O and self-refine (accuracy@, cost@), and progresses to more complex workflows incorporating multi-agent debate. The most high-performing workflows include iterative generation and ensembling, but at the cost of higher per-query token consumption (accuracy@, cost@). This highlights EvoFlow’s query-aware paradigm: for simple queries, it intelligently selects economical workflows for rapid completion, while for more complex ones, it leverages sophisticated workflows to address the increased demands.
5.4 Framework Analysis
Ablation Study
We perform an ablation study on four variants of EvoFlow: w/o tag, where tag-based retrieval is removed and replaced with random selection in Equation 10; w/o LLM mutation, where Equation 12 is discarded; w/o prompt mutation, where Equation 13 is removed; and w/o operator mutation, where Equation 14 is discarded. The results from Figure 5 reveal that removing tag-based retrieval and LLM mutation consistently leads to performance degradation and greater variance. This is because EvoFlow becomes heavily influenced by random parent workflow selection and the LLM backbone chosen during individual initialization. Removing operator mutation, which eliminates the potential for creating new, creative operators, results in a performance drop of .
Sensitivity Analysis
We perform an ablation study on three key parameters of EvoFlow: the number of selected parents in Equation 10, the number of tags per individual in Equation 9, and the population size . As shown in Figure 6, (1) both too small and large result in performance degradation, likely because a small reduces offspring diversity, while a large challenges the LLM’s ability to aggregate multiple workflows; (2) increasing the population size consistently improves performance, with a gain of from to . However, a larger population also increases complexity, with the per-query cost rising from to . Balancing cost-effectiveness, we set across all experiments.
6 Conclusion
In this paper, we shift the paradigm of autonomous multi-agent workflow search from single-objective to cost-effectiveness-driven multi-objective optimization. Building on niching-based evolutionary algorithms, we propose EvoFlow, an autonomous framework that evolves a population of heterogeneous, complexity-adapted agentic workflows. Extensive experiments across six benchmarks demonstrate the superior performance of EvoFlow with significantly lower token costs.
Impact Statement
Ethical impacts.
We affirm that our proposed EvoFlow method poses no ethical concerns in terms of its motivation, design, experiments, and data usage. The method is built with a focus on fostering advancements in multi-agent systems, ensuring its responsible contribution to scientific research and the development of more efficient and customized solutions.
Expected societal implications.
EvoFlow presents a transformative approach to multi-agent systems by promoting the automation of heterogeneous agent workflows, optimizing for both performance and cost. By facilitating the use of diverse models for task-specific solutions, it offers new avenues for deploying more adaptive and scalable systems in various practical domains.
References
- Austin et al. (2021) Austin, J., Odena, A., Nye, M., Bosma, M., Michalewski, H., Dohan, D., Jiang, E., Cai, C., Terry, M., Le, Q., et al. Program synthesis with large language models. arXiv preprint arXiv:2108.07732, 2021.
- Cetnarowicz et al. (1996) Cetnarowicz, K., Kisiel-Dorohinicki, M., and Nawarecki, E. The application of evolution process in multi-agent world to the prediction system. In Proceedings of the Second International Conference on Multi-Agent Systems, ICMAS, volume 96, pp. 26–32, 1996.
- Chen et al. (2023a) Chen, G., Dong, S., Shu, Y., Zhang, G., Sesay, J., Karlsson, B. F., Fu, J., and Shi, Y. Autoagents: A framework for automatic agent generation. CoRR, abs/2309.17288, 2023a. doi: 10.48550/ARXIV.2309.17288. URL https://doi.org/10.48550/arXiv.2309.17288.
- Chen et al. (2023b) Chen, G., Dong, S., Shu, Y., Zhang, G., Sesay, J., Karlsson, B. F., Fu, J., and Shi, Y. Autoagents: A framework for automatic agent generation. arXiv preprint arXiv:2309.17288, 2023b.
- Chen et al. (2023c) Chen, L., Zaharia, M., and Zou, J. Frugalgpt: How to use large language models while reducing cost and improving performance. arXiv preprint arXiv:2305.05176, 2023c.
- Chen et al. (2021) Chen, M., Tworek, J., Jun, H., Yuan, Q., Ponde de Oliveira Pinto, H., Kaplan, J., Edwards, H., Burda, Y., Joseph, N., Brockman, G., Ray, A., Puri, R., Krueger, G., Petrov, M., Khlaaf, H., Sastry, G., Mishkin, P., Chan, B., Gray, S., Ryder, N., Pavlov, M., Power, A., Kaiser, L., Bavarian, M., Winter, C., Tillet, P., Petroski Such, F., Cummings, D., Plappert, M., Chantzis, F., Barnes, E., Herbert-Voss, A., Hebgen Guss, W., Nichol, A., Paino, A., Tezak, N., Tang, J., Babuschkin, I., Balaji, S., Jain, S., Saunders, W., Hesse, C., Carr, A. N., Leike, J., Achiam, J., Misra, V., Morikawa, E., Radford, A., Knight, M., Brundage, M., Murati, M., Mayer, K., Welinder, P., McGrew, B., Amodei, D., McCandlish, S., Sutskever, I., and Zaremba, W. Evaluating large language models trained on code, July 01, 2021 2021.
- Chen et al. (2023d) Chen, W., Su, Y., Zuo, J., Yang, C., Yuan, C., Qian, C., Chan, C.-M., Qin, Y., Lu, Y., Xie, R., Liu, Z., Sun, M., and Zhou, J. Agentverse: Facilitating multi-agent collaboration and exploring emergent behaviors in agents, 2023d.
- Chollet (2019) Chollet, F. On the measure of intelligence. arXiv preprint arXiv:1911.01547, 2019.
- Clune (2019) Clune, J. Ai-gas: Ai-generating algorithms, an alternate paradigm for producing general artificial intelligence. arXiv preprint arXiv:1905.10985, 2019.
- Cobbe et al. (2021) Cobbe, K., Kosaraju, V., Bavarian, M., Chen, M., Jun, H., Kaiser, L., Plappert, M., Tworek, J., Hilton, J., Nakano, R., Hesse, C., and Schulman, J. Training verifiers to solve math word problems. arXiv prepring, abs/2110.14168, 2021.
- Devlin (2018) Devlin, J. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
- Du et al. (2023) Du, Y., Li, S., Torralba, A., Tenenbaum, J. B., and Mordatch, I. Improving factuality and reasoning in language models through multiagent debate. CoRR, abs/2305.14325, 2023.
- Feng et al. (2024) Feng, T., Shen, Y., and You, J. Graphrouter: A graph-based router for llm selections. arXiv preprint arXiv:2410.03834, 2024.
- Fernando et al. (2023) Fernando, C., Banarse, D., Michalewski, H., Osindero, S., and Rocktäschel, T. Promptbreeder: Self-referential self-improvement via prompt evolution. arXiv preprint arXiv:2309.16797, 2023.
- Fu et al. (2022) Fu, Y., Peng, H., Sabharwal, A., Clark, P., and Khot, T. Complexity-based prompting for multi-step reasoning. In The Eleventh International Conference on Learning Representations, 2022.
- Guo et al. (2023) Guo, Q., Wang, R., Guo, J., Li, B., Song, K., Tan, X., Liu, G., Bian, J., and Yang, Y. Connecting large language models with evolutionary algorithms yields powerful prompt optimizers. arXiv preprint arXiv:2309.08532, 2023.
- He et al. (2023) He, Z., Cao, P., Chen, Y., Liu, K., Li, R., Sun, M., and Zhao, J. Lego: A multi-agent collaborative framework with role-playing and iterative feedback for causality explanation generation. In Findings of the Association for Computational Linguistics: EMNLP 2023, pp. 9142–9163, 2023.
- Hendrycks et al. (2021a) Hendrycks, D., Burns, C., Basart, S., Zou, A., Mazeika, M., Song, D., and Steinhardt, J. Measuring massive multitask language understanding. Proceedings of the International Conference on Learning Representations (ICLR), 2021a.
- Hendrycks et al. (2021b) Hendrycks, D., Burns, C., Kadavath, S., Arora, A., Basart, S., Tang, E., Song, D., and Steinhardt, J. Measuring mathematical problem solving with the math dataset. NeurIPS, 2021b.
- Hong et al. (2023) Hong, S., Zheng, X., Chen, J., Cheng, Y., Wang, J., Zhang, C., Wang, Z., Yau, S. K. S., Lin, Z., Zhou, L., Ran, C., Xiao, L., and Wu, C. Metagpt: Meta programming for multi-agent collaborative framework, August 01, 2023 2023.
- Hong et al. (2024) Hong, S., Lin, Y., Liu, B., Liu, B., Wu, B., Zhang, C., Wei, C., Li, D., Chen, J., Zhang, J., et al. Data interpreter: An llm agent for data science. arXiv preprint arXiv:2402.18679, 2024.
- Hu et al. (2024a) Hu, Q. J., Bieker, J., Li, X., Jiang, N., Keigwin, B., Ranganath, G., Keutzer, K., and Upadhyay, S. K. Routerbench: A benchmark for multi-llm routing system. arXiv preprint arXiv:2403.12031, 2024a.
- Hu et al. (2024b) Hu, S., Lu, C., and Clune, J. Automated design of agentic systems. arXiv preprint arXiv:2408.08435, 2024b.
- Hu et al. (2024c) Hu, Y., Cai, Y., Du, Y., Zhu, X., Liu, X., Yu, Z., Hou, Y., Tang, S., and Chen, S. Self-evolving multi-agent collaboration networks for software development. arXiv preprint arXiv:2410.16946, 2024c.
- Jiang et al. (2023) Jiang, D., Ren, X., and Lin, B. Y. LLM-blender: Ensembling large language models with pairwise ranking and generative fusion. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 14165–14178, Toronto, Canada, July 2023. Association for Computational Linguistics.
- Jin et al. (2023) Jin, Y., Shen, X., Peng, H., Liu, X., Qin, J., Li, J., Xie, J., Gao, P., Zhou, G., and Gong, J. Surrealdriver: Designing generative driver agent simulation framework in urban contexts based on large language model, 2023.
- Khattab et al. (2023) Khattab, O., Singhvi, A., Maheshwari, P., Zhang, Z., Santhanam, K., Vardhamanan, S., Haq, S., Sharma, A., Joshi, T. T., Moazam, H., et al. Dspy: Compiling declarative language model calls into self-improving pipelines. arXiv preprint arXiv:2310.03714, 2023.
- Lee et al. (2025) Lee, K.-H., Fischer, I., Wu, Y.-H., Marwood, D., Baluja, S., Schuurmans, D., and Chen, X. Evolving deeper llm thinking. arXiv preprint arXiv:2501.09891, 2025.
- Li et al. (2023) Li, G., Hammoud, H., Itani, H., Khizbullin, D., and Ghanem, B. CAMEL: communicative agents for ”mind” exploration of large language model society. In NeurIPS, 2023.
- Li & Liu (2016) Li, Z. and Liu, J. A multi-agent genetic algorithm for community detection in complex networks. Physica A: Statistical Mechanics and its Applications, 449:336–347, 2016.
- Li et al. (2024) Li, Z., Zang, Q., Ma, D., Guo, J., Zheng, T., Liu, M., Niu, X., Wang, Y., Yang, J., Liu, J., et al. Autokaggle: A multi-agent framework for autonomous data science competitions. arXiv preprint arXiv:2410.20424, 2024.
- Liang et al. (2023) Liang, T., He, Z., Jiao, W., Wang, X., Wang, Y., Wang, R., Yang, Y., Tu, Z., and Shi, S. Encouraging divergent thinking in large language models through multi-agent debate. CoRR, abs/2305.19118, 2023.
- Liu et al. (2020) Liu, Z., Chen, B., Zhou, H., Koushik, G., Hebert, M., and Zhao, D. Mapper: Multi-agent path planning with evolutionary reinforcement learning in mixed dynamic environments. In 2020 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 11748–11754. IEEE, 2020.
- Liu et al. (2023) Liu, Z., Zhang, Y., Li, P., Liu, Y., and Yang, D. Dynamic llm-agent network: An llm-agent collaboration framework with agent team optimization. CoRR, abs/2310.02170, 2023.
- Madaan et al. (2023) Madaan, A., Tandon, N., Gupta, P., Hallinan, S., Gao, L., Wiegreffe, S., Alon, U., Dziri, N., Prabhumoye, S., Yang, Y., Gupta, S., Majumder, B. P., Hermann, K., Welleck, S., Yazdanbakhsh, A., and Clark, P. Self-refine: Iterative refinement with self-feedback. In NeurIPS, 2023. URL http://papers.nips.cc/paper_files/paper/2023/hash/91edff07232fb1b55a505a9e9f6c0ff3-Abstract-Conference.html.
- Mikolov et al. (2013) Mikolov, T., Chen, K., Corrado, G., and Dean, J. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781, 2013.
- Nakajima (2023) Nakajima, Y. Babyagi. https://github.com/yoheinakajima/babyagi, 2023.
- Pennington et al. (2014) Pennington, J., Socher, R., and Manning, C. D. Glove: Global vectors for word representation. In Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP), pp. 1532–1543, 2014.
- Qian et al. (2024) Qian, C., Xie, Z., Wang, Y., Liu, W., Dang, Y., Du, Z., Chen, W., Yang, C., Liu, Z., and Sun, M. Scaling large-language-model-based multi-agent collaboration. arXiv preprint arXiv:2406.07155, 2024.
- Reimers (2019) Reimers, N. Sentence-bert: Sentence embeddings using siamese bert-networks. arXiv preprint arXiv:1908.10084, 2019.
- Reworkd (2023) Reworkd. Agentgpt. https://github.com/reworkd/AgentGPT, 2023.
- Richards & et al. (2023) Richards, T. B. and et al. Auto-gpt: An autonomous gpt-4 experiment. https://github.com/Significant-Gravitas/Auto-GPT, 2023.
- Romera-Paredes et al. (2024) Romera-Paredes, B., Barekatain, M., Novikov, A., Balog, M., Kumar, M. P., Dupont, E., Ruiz, F. J., Ellenberg, J. S., Wang, P., Fawzi, O., et al. Mathematical discoveries from program search with large language models. Nature, 625(7995):468–475, 2024.
- Roy & Roth (2016) Roy, S. and Roth, D. Solving general arithmetic word problems. arXiv preprint arXiv:1608.01413, 2016.
- Saad-Falcon et al. (2024) Saad-Falcon, J., Lafuente, A. G., Natarajan, S., Maru, N., Todorov, H., Guha, E., Buchanan, E. K., Chen, M., Guha, N., Ré, C., et al. Archon: An architecture search framework for inference-time techniques. arXiv preprint arXiv:2409.15254, 2024.
- Shang et al. (2024) Shang, Y., Li, Y., Zhao, K., Ma, L., Liu, J., Xu, F., and Li, Y. Agentsquare: Automatic llm agent search in modular design space. arXiv preprint arXiv:2410.06153, 2024.
- Shen et al. (2024) Shen, Y., Song, K., Tan, X., Li, D., Lu, W., and Zhuang, Y. Hugginggpt: Solving ai tasks with chatgpt and its friends in hugging face. Advances in Neural Information Processing Systems, 36, 2024.
- Shi et al. (2024) Shi, Z., Wang, Y., Yin, F., Chen, X., Chang, K.-W., and Hsieh, C.-J. Red teaming language model detectors with language models. Transactions of the Association for Computational Linguistics, 12:174–189, 2024.
- Shinn et al. (2023) Shinn, N., Labash, B., and Gopinath, A. Reflexion: an autonomous agent with dynamic memory and self-reflection. arXiv preprint, abs/2303.11366, 2023. doi: 10.48550/arXiv.2303.11366. URL https://doi.org/10.48550/arXiv.2303.11366.
- Shridhar et al. (2021) Shridhar, M., Yuan, X., Cote, M.-A., Bisk, Y., Trischler, A., and Hausknecht, M. {ALFW}orld: Aligning text and embodied environments for interactive learning. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=0IOX0YcCdTn.
- Song et al. (2023) Song, C. H., Wu, J., Washington, C., Sadler, B. M., Chao, W.-L., and Su, Y. Llm-planner: Few-shot grounded planning for embodied agents with large language models. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 2998–3009, 2023.
- Tao et al. (2023) Tao, N., Ventresque, A., and Saber, T. Program synthesis with generative pre-trained transformers and grammar-guided genetic programming grammar. In 2023 IEEE Latin American Conference on Computational Intelligence (LA-CCI), pp. 1–6. IEEE, 2023.
- Tyson & Zysman (2022) Tyson, L. D. and Zysman, J. Automation, ai & work. Daedalus, 151(2):256–271, 2022.
- Wang et al. (2023) Wang, G., Xie, Y., Jiang, Y., Mandlekar, A., Xiao, C., Zhu, Y., Fan, L., and Anandkumar, A. Voyager: An Open-Ended Embodied Agent with Large Language Models. arXiv e-prints, art. arXiv:2305.16291, May 2023.
- Wang et al. (2024) Wang, L., Ma, C., Feng, X., Zhang, Z., Yang, H., Zhang, J., Chen, Z., Tang, J., Chen, X., Lin, Y., Zhao, W. X., Wei, Z., and Wen, J. A survey on large language model based autonomous agents. Front. Comput. Sci., 18, 2024.
- Wang et al. (2020) Wang, W., Wei, F., Dong, L., Bao, H., Yang, N., and Zhou, M. Minilm: Deep self-attention distillation for task-agnostic compression of pre-trained transformers. Advances in Neural Information Processing Systems, 33:5776–5788, 2020.
- Wang et al. (2023a) Wang, X., Wei, J., Schuurmans, D., Le, Q. V., Chi, E. H., Narang, S., Chowdhery, A., and Zhou, D. Self-consistency improves chain of thought reasoning in language models. In The Eleventh International Conference on Learning Representations, 2023a.
- Wang et al. (2023b) Wang, Z., Mao, S., Wu, W., Ge, T., Wei, F., and Ji, H. Unleashing cognitive synergy in large language models: A task-solving agent through multi-persona self-collaboration, July 01, 2023 2023b. work in progress.
- Wei et al. (2022) Wei, J., Wang, X., Schuurmans, D., Bosma, M., Ichter, B., Xia, F., Chi, E., Le, Q., and Zhou, D. Chain-of-thought prompting elicits reasoning in large language models, January 01, 2022 2022.
- White et al. (2023) White, C., Safari, M., Sukthanker, R., Ru, B., Elsken, T., Zela, A., Dey, D., and Hutter, F. Neural architecture search: Insights from 1000 papers. arXiv preprint arXiv:2301.08727, 2023.
- Wu et al. (2023) Wu, Q., Bansal, G., Zhang, J., Wu, Y., Zhang, S., Zhu, E., Li, B., Jiang, L., Zhang, X., and Wang, C. Autogen: Enabling next-gen llm applications via multi-agent conversation framework, August 01, 2023 2023.
- Xu et al. (2023) Xu, B., Yang, A., Lin, J., Wang, Q., Zhou, C., Zhang, Y., and Mao, Z. Expertprompting: Instructing large language models to be distinguished experts. arXiv preprint arXiv:2305.14688, 2023.
- Xu et al. (2022) Xu, H., Chen, Y., Du, Y., Shao, N., Wang, Y., Li, H., and Yang, Z. Gps: Genetic prompt search for efficient few-shot learning. arXiv preprint arXiv:2210.17041, 2022.
- Yao et al. (2023a) Yao, S., Yu, D., Zhao, J., Shafran, I., Griffiths, T. L., Cao, Y., and Narasimhan, K. Tree of thoughts: Deliberate problem solving with large language models, May 01, 2023 2023a.
- Yao et al. (2023b) Yao, S., Zhao, J., Yu, D., Du, N., Shafran, I., Narasimhan, K. R., and Cao, Y. React: Synergizing reasoning and acting in language models. In The Eleventh International Conference on Learning Representations, 2023b.
- Yuan et al. (2024) Yuan, S., Song, K., Chen, J., Tan, X., Li, D., and Yang, D. Evoagent: Towards automatic multi-agent generation via evolutionary algorithms. arXiv preprint arXiv:2406.14228, 2024.
- Zhang et al. (2024a) Zhang, G., Yue, Y., Li, Z., Yun, S., Wan, G., Wang, K., Cheng, D., Yu, J. X., and Chen, T. Cut the crap: An economical communication pipeline for llm-based multi-agent systems. arXiv preprint arXiv:2410.02506, 2024a.
- Zhang et al. (2024b) Zhang, G., Yue, Y., Sun, X., Wan, G., Yu, M., Fang, J., Wang, K., and Cheng, D. G-designer: Architecting multi-agent communication topologies via graph neural networks. arXiv preprint arXiv:2410.11782, 2024b.
- Zhang et al. (2023) Zhang, J., Xu, X., and Deng, S. Exploring collaboration mechanisms for llm agents: A social psychology view. arXiv preprint arXiv:2310.02124, 2023.
- Zhang et al. (2024c) Zhang, J., Xiang, J., Yu, Z., Teng, F., Chen, X., Chen, J., Zhuge, M., Cheng, X., Hong, S., Wang, J., et al. Aflow: Automating agentic workflow generation. arXiv preprint arXiv:2410.10762, 2024c.
- Zhang et al. (2022) Zhang, Z., Zhang, A., Li, M., and Smola, A. Automatic chain of thought prompting in large language models. arXiv preprint arXiv:2210.03493, 2022.
- Zheng et al. (2023a) Zheng, C., Liu, Z., Xie, E., Li, Z., and Li, Y. Progressive-hint prompting improves reasoning in large language models, April 01, 2023 2023a. Tech Report.
- Zheng et al. (2023b) Zheng, H. S., Mishra, S., Chen, X., Cheng, H.-T., Chi, E. H., Le, Q. V., and Zhou, D. Take a step back: Evoking reasoning via abstraction in large language models. arXiv preprint arXiv:2310.06117, 2023b.
- Zhong et al. (2024) Zhong, W., Guo, L., Gao, Q., Ye, H., and Wang, Y. Memorybank: Enhancing large language models with long-term memory. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 38, pp. 19724–19731, 2024.
- Zhu et al. (2024a) Zhu, J.-P., Cai, P., Xu, K., Li, L., Sun, Y., Zhou, S., Su, H., Tang, L., and Liu, Q. Autotqa: Towards autonomous tabular question answering through multi-agent large language models. Proceedings of the VLDB Endowment, 17(12):3920–3933, 2024a.
- Zhu et al. (2024b) Zhu, Y., Qiao, S., Ou, Y., Deng, S., Zhang, N., Lyu, S., Shen, Y., Liang, L., Gu, J., and Chen, H. Knowagent: Knowledge-augmented planning for llm-based agents. arXiv preprint arXiv:2403.03101, 2024b.
- Zhuge et al. (2024) Zhuge, M., Wang, W., Kirsch, L., Faccio, F., Khizbullin, D., and Schmidhuber, J. Gptswarm: Language agents as optimizable graphs. In Forty-first International Conference on Machine Learning, 2024.
- Zitzler & Künzli (2004) Zitzler, E. and Künzli, S. Indicator-based selection in multiobjective search. In International conference on parallel problem solving from nature, pp. 832–842. Springer, 2004.
Appendix A Notations
We present a comprehensive review of the commonly used notations and their definitions in Table 4.
| Notation | Definition |
| An LLM-invoking node | |
| The prompt content of | |
| The feasible prompt space | |
| The base LLM invoked by | |
| Temperature of | |
| LLM pool | |
| The feasible space for invoking nodes | |
| An operator node composed of multiple invoking nodes | |
| The selected invoking nodes in | |
| The connectivity of operator nodes in | |
| The feasible space of operator nodes | |
| An agentic workflow | |
| A subset of operator nodes used in | |
| A subset of invoking nodes selected in | |
| An evaluator function assessing ’s performance in task domain | |
| An evaluator function assessing ’s cost in task domain | |
| The best workflow searched by baseline methods | |
| The Pareto-optimal set of agentic workflows balancing cost and performance | |
| A population of agentic workflows at the -th iteration | |
| The -th tag of workflow | |
| Text embedding function | |
| The similarity score of workflow with respect to query | |
| The generated offspring workflow at the -th iteration | |
| LLM mutation function | |
| Prompt mutation function | |
| Operator mutation function | |
| A mutated workflow | |
| A mutated workflow at the -th iteration | |
| The identified niche area comprising individuals | |
| The cumulative cost of at the -th iteration | |
| The cumulative performance of at the -th iteration | |
| Pareto dominance-preserving binary indicator | |
| The fitness value of |
Appendix B Algorithm Table
We conclude the overall algorithm procedure of EvoFlow in Algorithm 1.
Appendix C Optimization Objective
For a better understanding of the multi-objective optimization in the context of agentic workflows, here, we define some key concepts like dominance, Pareto optimality, and the Pareto set.
A workflow is said to dominate another workflow if and only if:
| (18) |
where represents the utility or performance metric, and denotes the negative system cost. This means performs at least as well as in all objectives and strictly better in at least one objective.
A workflow is considered Pareto optimal if there does not exist any other workflow that dominates . The collection of all Pareto optimal workflows forms the Pareto set:
| (19) |
The corresponding objective space of these workflows defines the Pareto front (PF), which represents the trade-off surface between performance and cost:
| (20) |
In the context of agentic workflows, identifying Pareto optimal solutions is critical as it enables the selection of workflows that provide the best possible trade-off between task performance and system cost. These solutions ensure that the agents, composed of invoking nodes and operator nodes, operate efficiently while maintaining high utility for the target tasks. Furthermore, the Pareto set provides diverse design options, offering flexibility in adapting workflows to varying operational constraints and objectives.
Appendix D Operator Repository
In this section, we detail the initialization of operator nodes, which can be categorized into the following seven types:
- 1.
Chain-of-Thought (CoT). CoT (Wei et al., 2022) reasoning encourages the LLM to think step by step rather than directly outputting an answer. This approach enhances its capability to solve complex problems through intermediate reasoning steps, improving task handling and providing greater transparency in the decision-making process.
- 2.
LLM-Debate. LLM-Debate (Du et al., 2023) allows multiple LLMs to debate, leveraging diverse perspectives to identify better solutions. In practice, we initialize three debaters and permit up to two debate rounds.
- 3.
Take a Step Back. As proposed by Zheng et al. (2023b), this operator prompts the LLM to first consider the principles underlying the task. By focusing on foundational principles, the model enhances its reasoning and delivers more accurate solutions.
- 4.
Self-Consistency. Adopting the methodology from Wang et al. (2023a), this operator aggregates five CoT reasoning paths and determines the final answer through majority voting.
- 5.
Self-Refine. Following Madaan et al. (2023), this operator initially generates an answer using CoT reasoning, then prompts the agent to self-reflect iteratively. We set a maximum of five refinement iterations.
- 6.
Ensemble. Inspired by LLM-Blender (Jiang et al., 2023), this operator involves three LLM-powered agents from different sources outputting answers to the same query. The pairwise ranking is used to evaluate and aggregate their responses into a final solution.
- 7.
ReAct. Following (Yao et al., 2023b), this operator enables the agent to leverage versatile tools, including code interpreter, web searching, external knowledge database, etc., to handle diverse user demands.
- 8.
ExpertPrompt. Similar to AutoGPT (Richards & et al., 2023) and expert prompting (Xu et al., 2023), this operator employs dynamic control flows to allow the agent to decide which expert should be utilized for the task.
We respectfully note that the selection of these operators is highly customizable, allowing users the flexibility to incorporate their desired operators into the operator repository of EvoFlow.
Appendix E Prompt Repository
E.1 Tag Generation Prompt
E.2 Offspring Generation Prompt
E.3 Mutation Prompt
E.3.1 LLM Mutation
E.3.2 Prompt Mutation
E.3.3 Operator Mutation
Appendix F History Management of EvoFlow
F.1 LLM Experience Pool
To evaluate the historical performance of LLMs within agentic workflows, we construct an experience pool, denoted as . This pool captures the interplay between LLM instances, prompts, and workflow configurations, providing a foundation for analyzing and refining their performance across diverse tasks.
captures both quantitative and qualitative evaluations of LLM’s behavior across workflows. For a given workflow associated with task and ground-truth answer , the performance of an LLM is represented as , where denotes a quantitative assessment of the LLM’s output correctness. Specifically, Positive indicates that produced a correct answer, Negative indicates an incorrect answer, and None signifies that was not utilized in . Additionally, provides a qualitative evaluation, offering detailed textual feedback on ’s role in the workflow, including how its behavior contributed to or detracted from solving the task. The overall experience pool is thus defined as , aggregating performance data across all workflows and tasks. By capturing both the correctness and the nuanced role of each LLM in addressing diverse tasks, provides a comprehensive resource for understanding the strengths, weaknesses, and contextual suitability of different LLMs. This facilitates informed decision-making for LLM selection and adaptive workflow optimization.
F.2 Workflow Experience Pool
The workflow experience pool, denoted as , systematically captures the historical performance of workflows by maintaining a collection of records in the form of triplets . Here, represents a specific workflow, denotes a query or task associated with the workflow, and is the corresponding evaluation of the workflow’s performance on the given query. The evaluation consists of two components: a quantitative assessment , which indicates whether the workflow successfully solved the query (Positive) or failed (Negative), and a qualitative assessment , which provides detailed textual feedback on the workflow’s effectiveness, efficiency, and potential limitations in addressing the query. Formally, the experience pool is defined as , aggregating evaluations across diverse workflows and queries. By systematically storing and analyzing these triplets, offers a comprehensive resource for understanding the capabilities and limitations of various workflows, supporting iterative design refinements and enabling the development of more effective and adaptable agentic systems.
Appendix G Experimental Details
G.1 Dataset Statistics and Splits
Following existing practices in workflow automation (Saad-Falcon et al., 2024; Hu et al., 2024b; Zhang et al., 2024c), we partition each dataset with a train:test ratio of 1:4, except from ALFWorld dataset which follows the settings in (Shang et al., 2024). For the MATH benchmark, it is worth noting that we follow (Hong et al., 2024), selecting 617 problems from four representative problem types (Combinatorics & Probability, Number Theory, Pre-algebra, Pre-calculus) at difficulty level 5. The dataset statistics are concluded in Table 5.
| Domain | Dataset | #Train | #Test | Metric |
| Code Generation | HumanEval | 33 | 131 | pass@1 |
| MBPP | 86 | 341 | pass@1 | |
| Math Reasoning | GSM8K | 264 | 1055 | Accuracy |
| MATH | 119 | 486 | Accuracy | |
| MultiArith | 150 | 600 | Accuracy | |
| Embodied | ALFWorld | 230 | 327 | Success ratio |
G.2 Baseline Setups
We detail the settings for all baselines in this section:
- 1.
CoT. CoT encourages LLM agents to reason step by step rather than directly producing an answer. We adopt the implementation from (Zhang et al., 2022).
- 2.
ComplexCoT. The implementation is based on the code from https://github.com/FranxYao/Complexity-Based-Prompting/tree/main.
- 3.
Self-consistency. We ensemble five CoT-generated solutions and adopt the implementation from https://github.com/geekan/MetaGPT/blob/4954729e7564c806d7e58b3ed8b00ef991f889cc/metagpt/ext/aflow/scripts/operator.py#L93.
- 4.
LLM-Debate. We utilize five instances of the same LLM, assigning them distinct roles. These agents engage in up to two debate rounds, with the final answer determined via majority voting. Implementation follows https://github.com/ucl-dark/llm_debate.
- 5.
LLM-Blender. The LLM-Blender is powered by two gpt-4o-mini, one Qwen-2.5-72b, and one llama-3.1-70b.
- 6.
DyLAN. We directly adopt the implementation from (Liu et al., 2023).
- 7.
AgentVerse. The implementation is adopted from (Chen et al., 2023d).
- 8.
MacNet. For MacNet (Qian et al., 2024), we select the ”MacNet-MESH” variant, which is essentially a densely connected complete graph.
- 9.
GPTSwarm. We follow the original implementation and settings described in (Zhuge et al., 2024).
- 10.
AutoAgents. The setup adheres to the original settings from (Chen et al., 2023b).
- 11.
ADAS. Implementation details are directly adopted from (Hu et al., 2024b).
- 12.
AgentSquare. We employ the modular search framework from (Shang et al., 2024). The base LLM is consistently set to gpt-4o-mini, with early stopping patience fixed at 5.
- 13.
AFlow. In (Zhang et al., 2024c), AFlow utilizes both gpt-4o-mini and the advanced claude-3.5-sonnet. To ensure fairness in homogeneous settings, we limit AFlow to gpt-4o-mini and set max_iteration=20.
Appendix H Supplementary Results
| Method | LLM Backbone | MATH | MBPP | MATH+MBPP |
| DyLAN | Deepseek-V2.5 | |||
| QWen-2.5-72b | ||||
| GPTSwarm | Deepseek-V2.5 | |||
| QWen-2.5-72b | ||||
| AFlow | Deepseek-V2.5 | |||
| QWen-2.5-72b | ||||
| EvoFlow | LLM Pool |