Evolutionary optimization of model merging recipes

Takuya Akiba, Makoto Shing, Yujin Tang, Qi Sun, David Ha

TL;DR

Training foundation models from scratch is astronomically expensive, but combining existing open-source models usually relies on human intuition and trial-and-error. This paper introduces an evolutionary model merging framework that automatically searches both weight space (Parameter Space) and layer execution routing (Data Flow Space) to assemble specialized models. Using this zero-gradient approach, the authors created Japanese-speaking math LLMs and culturally fluent vision-language models (VLMs) that rival or outperform models up to ten times their size.

What Problem Does This Paper Address?

Model merging—combining the weights of fine-tuned neural networks without additional backpropagation—has democratized machine learning by generating competitive models essentially for free. However, merging is widely treated like modern alchemy: practitioners lean heavily on hand-crafted recipes, trial-and-error, and human intuition.

This ad-hoc approach struggles when combining models from completely disparate domains (e.g., merging a non-English language model with an English-only mathematical reasoner, or text with vision). Human engineers rarely know the optimal layer-by-layer mixing proportions or how to interleave inference paths between distinct models.

Methods

The authors automate model discovery using evolutionary algorithms (specifically CMA-ES) across two complementary search dimensions:

  1. Parameter Space (PS) Merging:
    Focuses on blending weight matrices. Building on TIES-Merging and DARE (which drop insignificant delta weights and resolve directional conflicts), the algorithm searches for layer-wise sparsity thresholds and mixing weights $\lambda$.

  2. Data Flow Space (DFS) Merging:
    Preserves internal layer weights intact but re-engineers the inference route. Given $N$ models, the evolutionary algorithm optimizes an indicator array $\mathcal{I}$ that chooses which transformer blocks to include, repeat, or skip. To mitigate the distribution shift caused by feeding representations into layers from a different model, the authors evolve an input scaling matrix $W_{ij}$ (or a conditioned hypernetwork $\pi_\theta(i, j, t)$).

  3. Hybrid PS + DFS Merging:
    The two approaches are orthogonal. The authors first create candidate models via PS merging and add them to the pool, then apply DFS layer sequencing across the expanded set.

          [Model A: Japanese LLM]       [Model B/C: Math LLMs / English VLM]
                     │                                   │
                     ├─── Parameter Space Evolution ─────┤ (DARE-TIES weights & densities)
                     │                 │                 │
                     │                 ▼                 │
                     │         [Evolved PS Model]        │
                     │                 │                 │
                     └─── Data Flow Space Evolution ─────┘ (Layer routing & scaling factors Wij)
                                       │
                                       ▼
                       Final High-Performance Merged Model

Datasets

  • Math Evaluation & Optimization:
  • Optimization / Search Set: 1,069 problems from the GSM8k test set (IDs 250–1318) translated into Japanese.
  • Test Set: The standard Japanese subset of MGSM (250 problems translated from GSM8k IDs 0–249), evaluated on zero-shot reasoning where answers and chain-of-thought rationale must be in Japanese.
  • General Japanese Benchmarking: JP-LMEH (Japanese Language Model Evaluation Harness), a 9-task suite measuring general Japanese language proficiency.
  • Multimodal (VLM) Evaluation:
  • JA-VG-VQA-500: A 500-question subset derived from the Japanese Visual Genome VQA dataset.
  • JA-VLM-Bench-In-the-Wild: A newly introduced benchmark consisting of 42 images and 50 questions specifically featuring Japanese cultural concepts and domestic objects, generated with GPT-4V assistance and human-in-the-loop filtering.

Key Insights and Ideas

  • Weight amplification over interpolation: In PS optimization, the sum of model mixing weights evolved to approach $\sim 2.0$ rather than being constrained to a convex combination ($\sum \lambda_i = 1$). Amplifying feature directions was substantially more effective than simple averaging.
  • Preserving linguistic base density: In math merging, the Japanese language model retained significantly higher parameter density compared to the math models. Because non-English alignment relies on extensive continued pretraining, heavy sparsification damages language coherence.
  • Interface scaling in DFS is critical: Feeding the activation of layer $i$ from Model A directly into layer $j$ of Model B typically degrades performance due to feature distribution mismatch. Evolving the scalar multiplier $W_{ij}$ bridged this gap; removing it caused an immediate $>20\%$ drop in accuracy.
  • Emergent cross-domain reasoning: The resulting model exhibited emergent problem-solving—correctly answering Japanese math questions requiring culture-specific nuance where pure English math models or pure Japanese models failed.

Key Results

  • Japanese Math LLM:
  • Individual 7B source models scored poorly on Japanese MGSM: shisa-gamma-7b-v1 (9.6%), WizardMath-7B-V1.1 (18.4%), and Abel-7B-002 (30.0%).
  • Ours (PS) jumped to 52.0%, and the hybrid Ours (PS + DFS) reached 55.2% (beating commercial GPT-3.5 at 50.4%).
  • On the 9-task JP-LMEH benchmark, Ours (PS) scored 70.5, surpassing the previous 70B parameter state-of-the-art Japanese model (Japanese StableLM 70B at 68.3) despite having only 7B parameters.
  • Culturally Aware Japanese VLM:
  • On the culturally nuanced JA-VLM-Bench-In-the-Wild, Ours (PS) achieved a ROUGE-L score of 51.2, outperforming baseline LLaVA 1.6 Mistral 7B (41.1) and Japanese Stable VLM (40.5).
  • On JA-VG-VQA-500, Ours (PS + DFS) achieved 20.4, outperforming naive heuristic merges like TIES (16.0) and Passthrough (7.3).

Limitations and Future Work

  • Inherited Model Vulnerabilities: Merging operates without instruction fine-tuning or reinforcement learning from human feedback (RLHF), meaning models can occasionally output illogical reasoning or factual inaccuracies present in unaligned source weights.
  • Manual Candidate Selection: While the merging recipe is automated, users must still curate the initial pool of candidate models. The authors propose utilizing evolution to search over vast open-model registries directly.
  • Future Directions: Expanding multiobjective evolutionary algorithms (such as NSGA-II) for balanced multi-domain tasks, and scaling model merging to generative swarms and diffusion models (as demonstrated in downstream follow-ups like EvoSDXL).

Summary updated

BibTeX
@inproceedings{akiba2025evolutionary,
  author = {Takuya Akiba and Makoto Shing and Yujin Tang and Qi Sun and David Ha},
  title = {{Evolutionary optimization of model merging recipes}},
  booktitle = {Nat. Mac. Intell},
  year = {2025},
  url = {https://openreview.net/forum?id=KMPL8Huf1Z},
}
Figure