Training-free LLM Merging for Multi-task Learning

Zichuan Fu, Xian Wu, Yejing Wang, Wanyu Wang, Shanshan Ye, Hongzhi Yin, Yi Chang, Yefeng Zheng

Abstract

Hi-Merging (Hierarchical Iterative Merging) is a novel, training-free framework designed to synthesize specialized Large Language Models (LLMs) into a single multi-task powerhouse. By addressing parameter interference through a two-stage process of model-wise pruning/scaling and layer-wise iterative conflict elimination, Hi-Merging avoids the high compute costs and data privacy issues associated with traditional Multi-task Learning (MTL). Experimental results demonstrate that Hi-Merging often outperforms models explicitly fine-tuned on multi-task datasets, achieving state-of-the-art performance in bilingual medical QA tasks.

Introduction

The open-source community has produced thousands of specialized LLMs fine-tuned for specific tasks (e.g., medical QA) or languages. However, creating a unified model that excels at all these tasks typically requires Multi-task Learning (MTL), which suffers from three major drawbacks: data scarcity (fine-tuning data is often private), high compute costs, and the "seesaw effect," where improving performance on one task degrades it on another.

Hi-Merging enables the synthesis of models across different tasks and languages without retraining.

Existing model merging techniques, such as simple weight averaging, attempt to solve this without retraining but often fail due to interference. This interference stems from "noise" (overfitting during fine-tuning) and "knowledge misalignment" between models following different optimization paths.

The Hi-Merging Framework

Hi-Merging operates in two distinct phases to harmonize specialized models:

  1. Model-wise Pruning and Scaling: This stage targets the "delta vectors" (the difference between the fine-tuned model and its base foundation model). Pruning keeps only the top $p\%$ of parameter changes to discard noise, while scaling applies a factor $s$ to moderate sharp updates that may indicate overfitting.
  2. Layer-wise Iterative Conflict Elimination: Not all layers are equally important or conflicted. The authors introduce Contribution Analysis, which measures the Deletion Impact (performance drop if a layer is removed) and Addition Impact (performance gain if a layer is added to the base model).
Contribution analysis identifies layer-wise conflicts, allowing the algorithm to iteratively drop, prune, or keep specific layer updates.

By identifying layers where merging causes "Severe Conflict" (impairing both tasks), the algorithm iteratively prunes or scales only the most problematic layers until the models are harmonized.

Evaluation and Key Results

The researchers evaluated Hi-Merging across four primary medical datasets (MedQA, CMExam, HealthCareMagic, and cMedQA2) and a suite of 12 diverse "in-the-wild" medical datasets from Hugging Face.

Key Insights

  • Merging > Retraining: Hi-Merging achieved a 1.84% relative improvement over models specifically fine-tuned on multi-task data. This suggests that merging allows each task's parameters to be optimized independently before integration, avoiding the interference inherent in joint training.
  • Pruning as a Feature: Appropriate pruning and scaling can actually improve the performance of an individual specialized model by removing the noise of fine-tuning.
  • Robustness to Data Size: Unlike standard methods like Model Soups, which degrade as models become more specialized, Hi-Merging maintains a steady performance trend regardless of the training set size.

Limitations and Future Work

While effective, Hi-Merging is currently designed for binary merging (two models at a time). Future research will focus on extending this to $N$ models simultaneously and testing on a broader range of NLP tasks like summarization. Additionally, the method currently requires models to share the same foundation architecture (e.g., Qwen2-7B), leaving cross-architecture merging as an open challenge.

Summary updated

BibTeX
@inproceedings{fu2025training,
  author = {Zichuan Fu and Xian Wu and Yejing Wang and Wanyu Wang and Shanshan Ye and Hongzhi Yin and Yi Chang and Yefeng Zheng and Xiangyu Zhao},
  title = {{Training-free LLM Merging for Multi-task Learning}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure