Abstract: Runchuan Zhu, Bowen Jiang, Lingrui Mei, Fangkai Yang, Lu Wang, Haoxiang Gao, Fengshuo Bai, Pu Zhao, Qingwei Lin, Saravan Rajmohan, Dongmei Zhang. Findings of the Association for Computational Linguistics: EMNLP 2025.
2025.
TL;DR
AdaptFlow is a meta-learning framework that automatically designs and optimizes "agentic workflows"—structured sequences of LLM calls—using natural language feedback. By adapting the principles of Model-Agnostic Meta-Learning (MAML) to the discrete space of code and prompts, it creates a "global initialization" workflow that can rapidly specialize itself for diverse and unseen tasks at test time.
What Problem Does This Paper Address?
While Large Language Models (LLMs) are powerful, they perform best when organized into "agentic workflows" that involve planning, tool use, and self-reflection. However, most current workflows are either manually designed (which is slow and doesn't scale) or optimized as static templates for an entire dataset.
The authors identify two major hurdles:
- Heterogeneity: A single static workflow rarely works well across a diverse dataset containing different problem types (e.g., a workflow optimized for geometry might fail at number theory).
- Optimization Stability: Searching for the best workflow in "code space" (where the workflow is a program) is difficult because traditional calculus-based gradients cannot be used to find the "direction" of improvement.
Methods
AdaptFlow introduces a bi-level optimization scheme inspired by Model-Agnostic Meta-Learning (MAML), but replaces mathematical gradients with "Textual Gradients." This allows the framework to optimize discrete symbolic structures like code and prompts.
The framework operates through a sophisticated bi-level loop:
- Task Clustering: Before optimization, the training set is partitioned into semantically coherent subtasks using K-Means clustering on instruction embeddings.
- The Inner Loop (Exploration): For each subtask, the system iteratively refines a workflow. An LLM acts as the "optimizer," providing natural language feedback (the textual gradient) on why a workflow failed and suggesting code-level edits. A "continuation signal" ensures the loop only proceeds if the updates actually improve performance.
- The Outer Loop (Exploitation): The system aggregates the best refinements from all subtasks into a shared "global initialization." This is followed by a "reflection step" where the model revisits failure cases to ensure the global starting point is robust.
- Test-Time Adaptation: When faced with a new, unseen task, AdaptFlow performs a "fast adapt" step, using a high-level description of the new task to specialize the workflow one last time before execution.
Key Insights and Ideas
- Symbolic Meta-Learning: The core innovation is that meta-learning doesn't require continuous weights. By treating LLM feedback as a "gradient," the logic of MAML can be applied to discrete programs.
- The Power of Initialization: Just as MAML finds a weight initialization that is "easy to fine-tune," AdaptFlow finds a workflow structure that contains the "shared DNA" of successful strategies, making it highly responsive to minor test-time tweaks.
- Modular Specialization: The optimization process naturally discovers specialized modules. For example, the system learned to introduce an "Approximation Detector" specifically for Prealgebra tasks to handle rounding errors, while using a "Value Tracker" for multi-step Number Theory problems.
Key Results
AdaptFlow achieved state-of-the-art results across the board, with an overall average score of 68.5 across eight benchmarks including HOTPOTQA, HUMANEVAL, and GSM8K.
- Math Gains: On the challenging MATH dataset, AdaptFlow reached 61.5% accuracy, significantly higher than AFLOW (56.2%) and ADAS (35.4%).
- Model Agnostic: While GPT-4 was used as the optimizer, the resulting workflows improved performance across various "executor" models, including GPT-4o-mini, Claude-3.5-Sonnet, and DeepSeek-V2.5.
- Adaptation Impact: Ablation studies showed that the test-time adaptation step alone provided a ~3.5 point boost in accuracy, proving that "one size does not fit all" in agentic workflows.
Limitations and Future Work
The system is dependent on the quality of the LLM's critique; vague "textual gradients" can cause optimization to stall. Additionally, the bi-level process is computationally expensive due to repeated LLM queries. Future work will explore more fine-grained feedback mechanisms and more efficient adaptation strategies to reduce query overhead.
Summary updated