Abstract
Large Language Models (LLMs) have evolved into "Strong Executors" capable of complex tasks but often requiring intricate steering. Traditional methods like direct fine-tuning are costly, while manual workflow design is labor-intensive. We present Weak-for-Strong (W4S) Harnessing, a framework that trains a small 7B-parameter "meta-agent" to autonomously design and refine Python-based workflows for stronger models. Using Reinforcement Learning for Agentic Workflow Optimization (RLAO), the meta-agent learns to optimize workflows based on environmental feedback. W4S achieves performance gains up to 24.6% over state-of-the-art automated methods across eleven benchmarks, demonstrating that specialized small models can effectively architect high-performance strategies for their larger counterparts at a fraction of the cost.
Introduction
We are currently in an era of "Strong Executors"—massive models like GPT-4o or Claude 3.5 that possess immense latent capability but are often difficult to steer toward optimal performance on specialized tasks. Current approaches to maximizing these models generally fall into two categories: expensive direct fine-tuning or labor-intensive manual workflow engineering. While automated workflow designers have emerged, they often treat the problem as a search task without learning from historical data.
The W4S framework shifts this paradigm by training a smaller, open-source model (the "meta-agent") to act as a specialized architect. This architect's sole purpose is to discover the most effective way to utilize a strong model's capabilities through structured, executable code.
The Weak-for-Strong Framework
The W4S framework treats workflow design as a multi-turn Markov Decision Process (MDP). The process centers on three core components:
- The Meta-Agent: A Qwen2.5-Coder-7B model is fine-tuned to generate and refine agentic workflows. Despite its small size, its specialization in "meta-design" allows it to outperform much larger general-purpose models in this specific domain.
- Workflow as Code: The meta-agent generates executable Python code that defines the interaction logic for the strong executor. This includes defining specific roles (e.g., "Math Expert," "Critical Thinker"), implementing self-correction loops, or setting up ensemble methods like majority voting.
- Reinforcement Learning for Agentic Workflow Optimization (RLAO): This iterative training algorithm allows the meta-agent to learn from the environment. It generates a workflow, observes the resulting accuracy and error cases, and updates its strategy using Reward-Weighted Regression.
Experimental Setup and Benchmarks
The framework was rigorously evaluated across eleven benchmarks in three domains: Math Reasoning (e.g., GSM8K, MATH), Question Answering (e.g., MMLU Pro, GPQA), and Code Generation (HumanEval, MBPP). The meta-agent was typically trained on a subset of tasks and then tested on its ability to generalize to entirely unseen benchmarks and domains.
Results and Analysis
W4S demonstrated significant improvements over existing automated baselines like AFlow and ADAS:
- Performance Gains: The framework achieved accuracy boosts ranging from 2.9% to 24.6%. Notably, on the "GSM Hard" dataset, it improved performance by 24.6% over previous automated methods.
- Generalization: A meta-agent trained on math problems successfully designed high-performing workflows for coding and general QA tasks, indicating it learned the fundamental logic of optimization rather than task-specific patterns.
- Efficiency: W4S is remarkably cost-effective. The meta-agent requires only one GPU hour of training to surpass long-optimized baselines. Furthermore, because the meta-agent is a small local model, the API costs associated with the design phase are eliminated.
Conclusion
The success of W4S reinforces the "Bitter Lesson" of AI: adaptive, data-driven systems eventually surpass hand-engineered heuristics. By specializing a small model as an "architect" rather than a "genius," researchers can unlock the full potential of massive executors more efficiently than ever before. Future work will explore applying this framework to long-horizon planning and ensuring safety in autonomously generated agentic workflows.
Summary updated