TL;DR
BACAM (Behavior-Aware Continual Agent Merging) is a new framework for sequentially integrating specialized AI agents into a single generalist without needing all experts simultaneously. By optimizing parameter-wise merging gates based on actual interaction trajectories rather than just static weights, it achieves a 62.82% average success rate—outperforming the strongest existing merging methods by over 21 percentage points.
What Problem Does This Paper Address?
Large Language Model (LLM) agents are increasingly specialized for tasks like web shopping, tool use, or embodied navigation. While we want a single "generalist" agent capable of all these tasks, training one from scratch on every environment is computationally prohibitive. Model merging offers a shortcut: combining the weights of specialized "experts" into one model.
However, existing merging techniques face two major hurdles in the context of agents:
- The Continual Setting: Most methods assume all experts are available at once (batch merging). In reality, new capabilities often arrive sequentially. Merging a new expert into an existing model without access to the original training data of previous experts often leads to "catastrophic forgetting."
- The Interaction Gap: Agents operate in multi-turn environments where a single wrong action early on completely changes the future state of the world. Traditional merging, which focuses on parameter distances or single-turn predictions, fails to capture these complex behavioral trajectories.
Methods
The authors introduce BACAM, which treats merging as a behavior-guided optimization problem. Instead of using a single global mixing coefficient, BACAM learns parameter-wise gates—essentially deciding, for every single weight in the model, how much to lean toward the new expert versus the existing merged model.
Key components include:
- Trajectory-Based Supervision: Rather than looking at static data, BACAM "rolls out" the agent in its environment. It collects trajectories and uses the experts as teachers to guide the merged model's behavior on those specific paths.
- Task-Level Stability–Plasticity Control:
- New-task Plasticity Control (NPC): Uses forward KL divergence to encourage the model to acquire the new expert's behavior.
- Old-task Stability Control (OSC): Uses reverse KL divergence to ensure the model doesn't assign high probability to actions that the previous version of the model (the "stability reference") would have considered unlikely.
- Tensor-Level Conflict-Aware Plasticity Budgeting (CAPB): This is a granular safety mechanism. It identifies specific tensors where the goal of learning the new task directly conflicts with maintaining the old ones. In these "high-conflict" areas, it restricts the update budget to protect existing capabilities.
Crucially, once the gates are learned, they are "folded" back into the model weights. This means the final agent has the exact same architecture and inference speed as the original LLM.
Datasets
The framework was evaluated across four diverse interactive benchmarks:
- WebShop: A simulated e-commerce environment for web shopping.
- ToolRL (BFCL v3): A benchmark for multi-turn tool use and function calling.
- MuSiQue: A multi-hop information retrieval task.
- ALFWorld: A synthetic environment for embodied interaction and navigation.
Key Insights and Ideas
- Behavior > Parameters: The core "aha moment" is that for agents, preserving the distribution of actions over a trajectory is far more important than keeping weights close to some original value.
- Directional KL Matters: The authors found that using different directions of KL divergence for acquisition (forward) and preservation (reverse) provides a much cleaner signal for the model to balance new and old knowledge.
- Granularity is Key: By using parameter-wise gates and tensor-level budgeting, the model can make surgical updates. It might use one part of a layer to learn how to shop and another part to preserve its ability to use a calculator.
Key Results
BACAM significantly outperformed all baselines, including general model merging methods (like TIES-Merging and DARE) and specialized agent merging methods (like RAM and WUDI-Merging).
- Average Success Rate: BACAM achieved 62.82%, compared to 41.13% for the strongest baseline (WUDI-Merging).
- Task-Specific Gains: The most dramatic improvements were seen in Tool Use (38.00% success vs. 0-2% for most baselines) and WebShop (77.20% success).
- Robustness to Order: While the order in which experts are merged does affect the final performance (a common issue in continual learning), BACAM remained the top performer across all tested sequences.
Limitations and Future Work
- Merging Order Sensitivity: Although BACAM is robust, the final performance still fluctuates based on the arrival order of experts (e.g., a ~6.8% difference in average success rate between the best and worst orders).
- Expert Gap: In some tasks like ALFWorld, the merged model still trails slightly behind the performance of the standalone, specialized expert.
- Future Directions: The authors suggest exploring ways to make the merging process even more invariant to the sequence of experts and investigating how this scales to dozens of experts rather than just four.
Summary updated