Self-MoE: Towards Compositional Large Language Models with Self-Specialized Experts

Junmo Kang, Leonid Karlinsky, Hongyin Luo, Zhen Wang, Jacob A Hansen, James R. Glass, David Daniel Cox, Rameswar Panda, Rogerio Feris, Alan Ritter

TL;DR

Self-MoE transforms a monolithic Large Language Model (LLM) into a modular "Mixture of Self-specialized Experts" (MiXSE) using only synthetic data. By training lightweight LoRA adapters on self-generated instructions and adding a smart router, the authors achieve a significant performance boost (+6.5% on average) across diverse tasks without the need for expensive human labels or massive parameter overhead.

The Problem with Monolithic Models

Most state-of-the-art LLMs are "monolithic"—they are single, massive blocks of parameters trained to be generalists. While effective, this architecture has three major flaws:

  1. Inefficiency: Scaling these models is computationally expensive.
  2. Catastrophic Forgetting: If you fine-tune a generalist model to be an expert in medicine, it often "forgets" how to write code or solve math problems.
  3. The Black Box Problem: It is difficult to interpret why a monolithic model makes a specific decision.

The authors tackle the challenge of "compositional" AI: How can we build a system that is a collection of specialized modules that work together, rather than one giant, rigid brain? Crucially, they aim to do this without relying on high-quality, human-annotated datasets, which are the primary bottleneck in domain specialization.

Concept and Performance of Self-MoE

How Self-MoE Works

The authors introduce Self-MoE, a framework that builds a MiXSE (Mixture of Self-specialized Experts) system in three main stages:

  1. Targeted Synthetic Generation: The base LLM acts as its own teacher. Starting with just 100 "seed" examples per domain (Knowledge, Reasoning, Math, Coding), the model brainstorms new instructions and generates its own responses. This creates a domain-specific synthetic dataset.
  2. Building Lightweight Experts: Instead of retraining the whole model, they train LoRA (Low-Rank Adaptation) adapters for each domain. These are tiny sets of trainable parameters (adding <0.3% per expert) that "plug into" the frozen base model.
  3. Self-Optimized Routing: To make these experts work together, they add a Router—a simple linear layer. The router is trained on the aggregated synthetic data to look at an incoming token and decide which expert (or "Top-K" experts) is best suited to handle it.
Self-MoE Architecture and Routing

Importantly, the experts are frozen while the router is trained. This ensures that the "Knowledge Expert" stays a knowledge expert and doesn't get diluted by other tasks.

Evaluation and Datasets

The researchers evaluated Self-MoE using a suite of standard benchmarks:

  • Target Domains: MMLU (Knowledge), BBH (Reasoning), GSM8K (Math), and HumanEval (Coding).
  • Generalization/Forgetting Tests: They tested the model on "unseen" tasks like MATH, MBPP, and various world knowledge/commonsense benchmarks (TriviaQA, Hellaswag, PIQA) to ensure the model didn't lose its generalist edge.
  • Base Models: They proved the method's versatility by applying it to Gemma-7B, LLaMA-2 (7B & 13B), Mistral-7B, and LLaMA-3 8B.

Key Insights and Results

Using Gemma-7B as a baseline, Self-MoE achieved an overall average improvement of 6.5 percentage points over the base model (jumping from 47.8 to 54.3). Specific domain improvements were substantial:

  • Knowledge (MMLU): Jumped from 58.4 to 65.6.
  • Math (GSM8K): Jumped from 42.5 to 52.5.

Beyond raw metrics, the study revealed several fascinating properties of the MiXSE system:

  • Synergy, Not Just Specialization: One of the most striking findings is that the modular system often outperforms the individual specialized experts. For example, the "Reasoning Expert" often assists the "Math Expert," showing that the router learns to exploit cross-domain synergies.
  • Modularity Defeats Forgetting: Unlike monolithic models that see-saw in performance (gaining in math but losing in coding), Self-MoE maintains or improves performance across the board. The modular design "protects" the base model's original knowledge.
  • Semantic Interpretability: Because the experts are trained on specific domains, the routing decisions are human-readable. You can visualize the model's "thought process" and see it literally switching to the "Coding Expert" when it encounters a Python function.
  • Efficiency is King: The entire MiXSE system adds only about 1% total parameter overhead, making it a highly scalable way to upgrade existing models. It also consistently outperformed "Instance Merging" (multi-task fine-tuning) and advanced weight-merging techniques like TIES and DARE.

Limitations and Future Work

While highly effective, the approach has a few limitations. Relying on self-generated data carries a risk of the model "hallucinating" its own training signal or reinforcing biases, though n-gram analysis showed no significant data contamination. Additionally, the base model needs a certain level of "seed" capability to generate high-quality synthetic data; older models like LLaMA-2 7B struggled more than newer models like LLaMA-3 or Gemma.

Future work will likely explore scaling this approach to 70B+ parameter models, increasing the number of experts, and developing more complex routing architectures beyond a single linear layer to handle even more nuanced task switching.

Summary updated

BibTeX
@inproceedings{kang2025self,
  author = {Junmo Kang and Leonid Karlinsky and Hongyin Luo and Zhen Wang and Jacob A Hansen and James R. Glass and David Daniel Cox and Rameswar Panda and Rogerio Feris and Alan Ritter},
  title = {{Self-MoE: Towards Compositional Large Language Models with Self-Specialized Experts}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=IDJUscOjM3},
}
Figure