TL;DR
LEMON introduces a unified framework for LLM-based multi-agent orchestration by generating a single, executable specification that jointly determines agent roles, model capacities, and information dependencies. To train this orchestrator effectively, it uses localized counterfactual reinforcement learning to map end-to-end execution rewards directly to specific local design choices, achieving state-of-the-art performance and token efficiency across reasoning and coding benchmarks.
What Problem Does This Paper Address?
Large language model (LLM) multi-agent systems excel at complex tasks by breaking them down into collaborative sub-tasks. However, their success hinges heavily on orchestration design: deciding what specialized roles agents should play, what capacity levels (model sizes) they need, and how information should flow between them.
Existing automation methods typically optimize these components in isolation or sequentially (e.g., fixing the roles first, then figuring out the communication topology). This separation is sub-optimal because these choices are deeply coupled during execution. Furthermore, training an orchestrator via reinforcement learning introduces a severe sparse credit assignment problem. Standard RL rewards are based on end-to-end execution outcomes (like final task success or total token cost). If a multi-agent workflow fails or becomes wildly inefficient, a global reward cannot pinpoint which specific local decision—such as an unnecessary dependency link or an oversized model assignment—was responsible.
Methods
LEMON (Learning Executable Multi-agent OrchestratioN) shifts the optimization target from isolated routing decisions to a single, unified executable specification serialized in YAML format.
The framework operates in three main phases:
- Supervised Fine-Tuning (SFT) Warm-Start: The orchestrator (initialized from a 7B model) is first trained on valid, teacher-generated YAML specifications to ensure it reliably outputs structurally sound, compilable agent graphs.
- Compositional Generation & Execution: For a given task, the orchestrator outputs a specification detailing the agents, their customized duties, their capacity levels (mapping to Qwen2.5-Instruct 7B, 14B, or 32B models), and their upstream dependencies.
- Localized Counterfactual Reinforcement Learning: To train the orchestrator, LEMON augments a global Group Relative Policy Optimization (GRPO) objective with a localized counterfactual signal. For every valid specification generated, the training loop introduces a single local "mutation":
- Dependency Deletion: Removing an information link.
- Role Rollback: Reverting a customized duty to a generic base role.
- Capacity Downgrade: Lowering an agent's model size.
LEMON executes this mutated variant, compares its performance/cost reward against the original, and applies the resulting reward contrast only to the specific token span that was edited. To prevent training costs from exploding due to these extra counterfactual runs, the authors implement node-level execution caching, reusing the outputs of unchanged agent nodes.
Datasets
The authors evaluated LEMON across six diverse text-based reasoning and coding benchmarks:
- Mathematical Reasoning: GSM8K, AQuA, MultiArith, and SVAMP.
- Multiple-Choice Reasoning: MMLU (evaluated on a subset of 1,531 validation examples).
- Code Generation: HumanEval (evaluated on a held-out split of 124 examples).
Key Insights and Ideas
- Joint Optimization is Essential: Treating role specialization, model capacity, and topology as a single coupled space allows the orchestrator to make mutually dependent trade-offs, such as assigning a smaller model to a tightly constrained, simple sub-task.
- Span-Level Credit Assignment: Instead of blaming the entire multi-agent graph for a failure, isolating the reward delta to the exact mutated token span forces the model to learn the precise utility of individual design choices.
- Dynamic Mutation Sampling: Rather than randomly mutating fields, LEMON tracks a running estimate of which mutation families yield the strongest reward contrasts and dynamically shifts its focus to where the orchestrator has the most left to learn.
Key Results
- State-of-the-Art Performance: LEMON achieved the highest average score (90.72%) across all six benchmarks, outperforming the strongest single-agent baseline (SC-CoT) by 3.96 points and the strongest topology-design baseline (AgentPrune) by 2.59 points. It secured the top spot on 5 out of the 6 individual benchmarks.
- Token Efficiency: As shown in the worker token cost comparisons, LEMON consistently sits on or near the Pareto frontier. On MMLU, it achieved competitive accuracy while using roughly a third of the tokens consumed by high-cost topology baselines like OFA-MAS.
Limitations and Future Work
- Training-Time Overhead: Although inference requires only a single forward pass (introducing zero extra cost), generating and executing counterfactual variants during the RL training phase increases computational overhead, even with node-level caching.
- Narrow Task Modalities: The current evaluation is restricted to text-based reasoning and coding benchmarks. The authors note that future work should explore how LEMON scales to broader multi-agent environments involving long-horizon tool usage, multimodal inputs, or interactive, real-time environments.
Summary updated