Dataless Knowledge Fusion by Merging Weights of Language Models

Xisen Jin, Xiang Ren, Daniel Preotiuc-Pietro, Pengxiang Cheng

TL;DR

Fusing knowledge from multiple specialized language models usually requires access to their raw training data or introduces heavy computational overhead during inference. This paper introduces Regression Mean (RegMean), a dataless model merging method that safely combines weights in parameter space using only basic input statistics. RegMean significantly outperforms existing weight-averaging baselines, offering a highly efficient alternative to multi-task learning and ensembling without compromising data privacy.

What Problem Does This Paper Address?

Fine-tuning pre-trained language models (like RoBERTa or T5) on specific tasks or domains is the dominant paradigm in NLP. However, this practice creates a fragmented ecosystem of highly specialized models. If you want a single model that performs well across all these domains, traditional approaches like Multi-Task Learning (MTL) require pooling all the original training data together. In reality, data privacy laws, intellectual property boundaries, or massive dataset sizes often make sharing raw training data impossible.

Alternative solutions carry heavy trade-offs. Model ensembling keeps individual models separate but multiplies computational and memory costs at inference time. Federated learning preserves privacy but demands complex, multi-round training coordination. The authors tackle the challenge of dataless model merging: combining multiple specialized models into a single model in a single step, without accessing any training data, while preserving or improving performance across all domains.

Figure 1: Diagram containing the problem formation for model merging and its comparison to other setups including multi-task learning, model ensembling and federated learning. Models f1..N trained by individuals or organizations are released to the user (optionally with some statistics) but the training data D1..N is kept private.

Methods

The authors propose Regression Mean (RegMean). Instead of simply averaging model weights (which assumes all weights are equally important) or using gradient-based importance (like Fisher-weighted averaging), RegMean treats weight merging as an optimization problem. It aims to find a merged weight matrix that minimizes the $\ell_2$ distance between the merged model's predictions and each individual model's predictions.

For linear layers, this optimization yields a clean, closed-form solution that relies on the inner product matrices of the layer inputs ($XTX$). To make this work for complex Transformer architectures without causing model degeneration, the authors introduce a scaling factor ($\alpha$) to reduce the impact of non-diagonal elements in these inner product matrices, acting as a form of regularization. Crucially, calculating these matrices only requires a single forward pass after training, and the resulting low-dimensional matrices can be shared publicly without leaking private training data.

Figure 2: Comparison between Simple, Fisher, and RegMean for merging transformer-based language models. Fisher and RegMean require Fisher Information matrix or inner product matrices of layer inputs, but neither of them requires training data. For linear models, RegMean produces optimal weights that minimize ℓ2-distance to individual model predictions on the corresponding training sets.

Datasets

The method was evaluated across a diverse battery of NLP tasks and setups:

  • GLUE Benchmark: Used to simulate non-i.i.d. (independent and identically distributed) data splits and multi-task merging across 8 distinct tasks (e.g., SST-2, MRPC, STS-B).
  • Emotion Classification: 5 high-resource datasets for in-domain training (DailyDialog, CrowdFlower, TEC, Tales-Emotion, ISEAR) and 5 low-resource datasets for out-of-domain (OOD) evaluation (Emoint, SSEC, ElectoralTweets, GroundedEmotions, AffectiveText).
  • Named Entity Recognition (NER): 6 domains from OntoNotes for in-domain training, with CoNLL and Twitter NER used to test OOD generalization.

Experiments were conducted across multiple model types, including RoBERTa-base, DeBERTa-large-v3, and T5-base.

Key Insights and Ideas

  • Geometry of Pre-trained Spaces: Models fine-tuned from the same pre-trained checkpoint retain a shared geometric structure. Because they start from the same initialization, their weights do not suffer from severe permutation issues, making direct parameter-space merging mathematically viable.
  • Input Statistics Matter More Than Gradients: Traditional advanced merging methods use Fisher Information (gradients) to weight parameter importance. RegMean demonstrates that the structure of the input space ($XTX$) provides a more effective guide for minimizing prediction discrepancies between the merged and source models.
  • The Off-Diagonal Danger: Directly applying linear regression formulas to deep transformers fails because off-diagonal correlations accumulate errors. Dampening these off-diagonal elements ($\alpha \approx 0.9$) is the secret sauce that stabilizes merging for deep networks.

Key Results

  • Outperforming Baselines: RegMean consistently beat simple averaging and Fisher-weighted averaging. For instance, on RoBERTa-base evaluated on the Emotion dataset, RegMean reduced the performance drop compared to domain-specific models from 55% (simple average) down to just 12%.
  • Beating Ensembles with Less Memory: RegMean frequently outperformed standard model ensembling (which averages logits at inference time), all while maintaining the exact same memory and inference speed footprint as a single individual model.
  • Closing the Multi-Task Gap: In many settings, RegMean closely approached the performance of Multi-Task Learning (MTL), providing a zero-retraining, zero-data alternative that achieves competitive cross-domain robustness.

Limitations and Future Work

  • Data-Free, but Not Statistic-Free: While RegMean doesn't need raw training data, it does require the inner product matrices ($XTX$) from the original model creators. If these aren't published, a user needs at least a few proxy training examples to estimate them.
  • Privacy Leakage Risks: The authors note that while $XTX$ is low-dimensional, future work needs to rigorously quantify whether these matrices could inadvertently leak sensitive information about the training distribution.
  • Shared Initialization Constraint: The current formulation strictly requires models to share the exact same architecture and base pre-trained checkpoint. Merging models with different initializations or architectures remains an open challenge.

Summary updated

BibTeX
@inproceedings{jin2023dataless,
  author = {Xisen Jin and Xiang Ren and Daniel Preotiuc-Pietro and Pengxiang Cheng},
  title = {{Dataless Knowledge Fusion by Merging Weights of Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=FCnohuR6AnM},
}
Figure