Fusing Highly Specialized Language Models for Comprehensive Expertise

Ning Ding, Yulin Chen, Ganqu Cui, Xingtai Lv, Weilin Zhao, Kaiyan Zhang, Ruobing Xie, Bowen Zhou, Zhiyuan Liu, Maosong Sun

Introduction

Large Language Models (LLMs) frequently encounter a performance trade-off known as "catastrophic forgetting" or "mutual weakening." When a model is heavily fine-tuned for a specific domain, such as Python programming or advanced mathematics, its general conversational abilities often decline. While proprietary models like GPT-4 maintain broad expertise, the open-source community has struggled to integrate professional-level specialized skills into general-purpose models without sacrificing performance in other areas.

To address this, researchers have developed ULTRAFUSER, a framework designed to blend highly specialized 13B models—UltraLM-2 (text), CodeLlama (code), and WizardMath (math)—into a single "super-expert" system. Unlike traditional model merging techniques that average weights, ULTRAFUSER employs a dynamic architecture to preserve and enhance the strengths of each specialist.

The ULTRAFUSER Framework

The core innovation of ULTRAFUSER is its token-level gating mechanism. Rather than selecting a single model to handle an entire prompt, the system calculates routing weights for every individual token generated. This allows the model to fluidly transition between domains mid-sentence—for example, utilizing the math specialist for a specific calculation and the text specialist for the accompanying explanation.

Training is conducted in two distinct stages:

  1. Warm-up Stage: The specialized models are frozen while only the gating network is trained, teaching the system how to route tokens without altering the specialists' underlying knowledge.
  2. Joint Fine-tuning Stage: Both the gate and the specialists are fine-tuned together to ensure the entire system is synchronized and optimized for the target tasks.

To support this training, the researchers introduced ULTRACHAT 2, a dataset of 300,000 high-quality instructions equally divided among text, code, and math domains, generated via a multi-stage pipeline using GPT-4.

Key Results and Synergy

Evaluation across standard benchmarks—including TruthfulQA, HumanEval, and GSM8K—revealed that ULTRAFUSER does not merely maintain the performance of its constituent parts; it often exceeds them. This suggests a synergy where logical reasoning patterns from code and math domains benefit general text tasks.

Performance comparison of specialized models (a, b, c) versus the fused UltraFuser model (d) across text, code, and math domains.

As shown in the figure above, ULTRAFUSER (73.51 on text, 53.03 on code, and 30.58 on math) outperformed the original specialists in their respective primary domains. For instance, it achieved a higher HumanEval score than the dedicated CodeLlama-13B (48.78) and a higher math score than WizardMath-13B (28.44). Notably, the inference process can be parallelized, maintaining a time-cost equivalent to a single 13B model despite the increased parameter availability.

Conclusion and Future Work

ULTRAFUSER demonstrates that architecture-based fusion is a viable path toward creating comprehensive open-source experts. While the current implementation requires significant VRAM to house multiple specialists, it avoids the performance degradation typical of weight-averaging methods. Future research may explore scaling this approach to a larger number of specialists using sparse activation methods like Mixture-of-Experts (MoE) to manage computational overhead.

Summary updated

BibTeX
@inproceedings{ding2025fusing,
  author = {Ning Ding and Yulin Chen and Ganqu Cui and Xingtai Lv and Weilin Zhao and Kaiyan Zhang and Ruobing Xie and Bowen Zhou and Zhiyuan Liu and Maosong Sun},
  title = {{Fusing Highly Specialized Language Models for Comprehensive Expertise}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure