arXiv:2609.06406cs.CLSep 2026

Manuscript Offprint

arXiv:2609.06406

Hierarchical Wasserstein Merging for Multi-Domain Multi-Task Learning: From Specialists to a Generalist

Ming Cheng, Jiaying Gong, Hoda Eldardiry

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Multi-domain multi-task learning (MD-MTL) aims to build a single generalist model that performs well across heterogeneous domains and tasks. However, joint training often suffers from interference under distribution shifts. Existing model merging methods mostly operate on model parameters while overlooking the geometric structure of latent representation distributions across domains and tasks. To address these limitations, we propose Hierarchical Wasserstein Merging (HWM), a representation-level framework that models each domain-task specialist as a distribution of hidden representations on a shared support. HWM constructs task-level and global Wasserstein barycenters to capture within-task domain variation and cross-task structure, enabling either training-free specialist aggregation by Wasserstein-derived weights or training-based generalist learning through a hybrid Wasserstein alignment loss. Experiments on four NLP tasks across four domains per task show that HWM achieves superior effectiveness and generalization capability in MD-MTL settings.

1 Introduction

Multi-domain and multi-task learning (MD-MTL) aims to improve learning by sharing knowledge across heterogeneous domains and tasks. Learning one unified model that can handle multiple domains and tasks offers the potential for better generalization (Yang and Hospedales, 2015). However, jointly learning across domains and tasks remains challenging as differences in data distributions and linguistic patterns can lead to interference and negative transfer when domains or tasks are dissimilar.

The goal of MD-MTL is to integrate knowledge from a diverse set of specialists (domain and task-specific fine-tuned LLMs) into a single generalist

model with broad multi-domain and multi-task capabilities. A straightforward solution is data merging, where the LLM is trained directly on the union of all available datasets. While simple, this approach requires access to large quantities of labeled data simultaneously, careful balancing of task objectives, and domain and task identifiers during inference. Recent work on model merging tends to integrate multiple specialist models into a unified model without extensive retraining. Existing merging techniques typically operate at the parameter level, task level, layer level, or neuron level, while overlooking how knowledge is encoded in the model's representation distributions. Directly interpolating or aligning parameters may fail to preserve the geometric structure of latent representations, particularly when specialists are trained on heterogeneous domains and tasks. This motivates a distributional view of MD-MTL model merging. In heterogeneous domain-task settings, the differences among specialists are not only reflected in individual model parameters, but also in how each specialist organizes inputs in its latent representation space. A single feature vector or a linear parameter average may obscure domain-specific structures, whereas a probability distribution over representations captures the geometry and spread of specialist behavior on a shared probing support.

There are three main challenges for MD-MTL merging. First is cross-domain geometry mismatch. Different domains can induce distinct latent structures, causing representation distributions to shift. The second challenge is cross-task hierarchy, where tasks may share partial structure (i.e., information extraction and question answering share factual grounding) while also requiring task-specific semantics. The third challenge is that a generalist is expected to integrate all specialists without requiring domain or task identifiers at inference time.

To address these challenges, we propose Hierarchical Wasserstein Merging (HWM), a

*This work was completed prior to joining Amazon, and does not relate to the author's position at Amazon representation-level framework for MD-MTL model merging through distributional alignment. HWM characterizes each domain-task specialist by the distribution of its hidden representations on a shared support. Using the entropically regularized Wasserstein distance, HWM constructs task-level barycenters that aggregate domains within each task and a global barycenter that captures shared structure across tasks. This hierarchical construction models both within-task domain diversity and cross-task relationships in a geometry-aware manner. By operating on representation distributions, HWM captures how each specialist organizes semantic information, enabling a more stable and interpretable aggregation mechanism. HWM supports two integration strategies: (1) For the non-training method, Wasserstein-derived hierarchical weights are used to aggregate specialists into a generalist without additional training. (2) For the training-based method, a generalist model is trained using supervised fine-tuning augmented with a Wasserstein alignment loss to align with pre-computed task-level and global barycenters. Both strategies operate without requiring domain or task identifiers during inference. The main contributions of this paper are summarized as:

  • We propose Hierarchical Wasserstein Merging (HWM), a representation-level framework for multi-domain multi-task model merging based on distributional alignment.

  • We develop non-training-based and training-based variants of HWM to support both specialists aggregation via Wasserstein-derived weights and generalist learning through a hybrid supervised and alignment loss.

  • Extensive experiments across multiple tasks and domains demonstrate the superior effectiveness and generalization capability of HWM in multi-domain multi-task settings.