MAP: Low-compute Model Merging with Amortized Pareto Fronts via Quadratic Approximation

## Abstract

Abstract Model merging has emerged as an effective approach to combine multiple single-task models into a multitask model. This process typically involves computing a weighted average of the model parameters without any additional training. Existing model-merging methods focus on enhancing average task accuracy. However, interference and conflicts between the objectives of different tasks can lead to trade-offs during the merging process. In real-world applications, a set of solutions with various trade-offs can be more informative, helping practitioners make decisions based on diverse preferences. In this paper, we introduce a novel and low-compute algorithm, Model Merging with Amortized Pareto Front (MAP) . MAP efficiently identifies a Pareto set of scaling coefficients for merging multiple models, reflecting the trade-offs involved. It amortizes the substantial computational cost of evaluations needed to estimate the Pareto front by using quadratic approximation surrogate models derived from a pre-selected set of scaling coefficients. Experimental results on vision and natural language processing tasks demonstrate that MAP can accurately identify the Pareto front, providing practitioners with flexible solutions to balance competing task objectives. We also introduce Bayesian MAP for scenarios with a relatively low number of tasks and Nested MAP for situations with a high number of tasks, further reducing the computational cost of evaluation.

## 1 Introduction

Large pre-trained foundation models have become available in many real-world applications
Wornow et al. (); Thirunavukarasu et al. (); Cui et al. (). This increasing availability has led to a popular practice of fine-tuning these pre-trained models to adapt to a wide range of downstream tasks. Practitioners can independently fine-tune the same pre-trained model, such as CLIP style models Radford et al. (); Wu et al. (); Zhai et al. (), large language models Brown et al. (); Rozière et al. (); Touvron et al. (); Jiang et al. (), etc., and then release the fine-tuned models without releasing the training data. As the deployment of such fine-tuned models increases, combining models with identical architectures and initializations has emerged as a promising approach to combine their respective capabilities. This is useful, especially in scenarios where the training data for each task is private and cannot be shared, such as individual-level patient data in a hospital and behavior data in social media recommendation systems.

Existing methods for merging models typically involve calculating a weighted average of the parameters from multiple models to enhance performance uniformly across various tasks. However, this approach often overlooks the conflicts among the diverse objectives of these tasks, which can lead to trade-offs in terms of model performance on various tasks. In real-world applications, it is often useful to obtain a set of Pareto optimal solutions rather than a single model. Such solutions allow practitioners to choose among different trade-offs, depending on their specific needs. For example, hospitals specializing in certain areas might prefer a model that excels in tasks relevant to their specialty while maintaining adequate performance across a broader spectrum of diseases.

Figure: Figure 1: Illustration of the overall process of MAP for the case of two tasks. Step 1: Select 2 tasks and compute their corresponding task vectors. Step 2: Sample a few scaling coefficients $\mathbf{c}$ and query the evaluation metrics for each task, respectively. Step 3: Use the quadratic model as a surrogate model to approximate the mapping $\mathbf{c}\rightarrow\textit{metrics}$. Step 4: Use the NSGA-III algorithm with the surrogate objective functions to find amortized Pareto fronts. Subfigure (a) shows a contour plot of the actual accuracy landscape for the ViT-B/32 model Dosovitskiy et al. () obtained from 100 scaling coefficients (sampled uniformly) evaluated on the SUN397 Xiao et al. () and Cars Krause et al. () datasets. Subfigure (b) shows a contour plot of the fitted quadratic functions. Red lines represent the Pareto front in the decision variable $(c_{1},c_{2})$ space. Subfigure (c) shows an example of the resulting Pareto fronts. The Pareto front (Grid search) is regarded as the ground truth given the sufficient number of grid points evaluated. The Pareto front (MAP, predicted) is the amortized Pareto front. The Pareto front (MAP, real) is the Pareto front involving the same $\{(c_{1},c_{2})\}$ but re-evaluated to obtain the ground truth metrics for comparison. The yellow lines are the fine-tuned single-task models’ evaluated performance.

In this paper, we introduce a novel method that identifies the Pareto front without retraining the models to be merged. Our algorithm utilizes a quadratic approximation of the evaluation metric. Furthermore, we enhance it with a Bayesian adaptive sampling method and a nested merging scheme, which further bring down the computational cost. We validate our method across a diverse set of tasks, spanning from vision to natural language processing, and demonstrate its applicability to a variety of architectures, including ResNets He et al. (), ViT Dosovitskiy et al. (), and large language models Brown et al. (); Rozière et al. (); Touvron et al. (); Jiang et al. (). Our results confirm that this novel approach supports the seamless integration of diverse model capabilities and aligns more closely with various real-world preference by providing a set of optimal fronts across the tasks.

##### Contributions

The main contributions of this paper are:

- C1
We propose the MAP algorithm that utilizes quadratic surrogate models to approximate the evaluation metric functions, which amortize the computation of Pareto fronts;
- C2
We demonstrate the effectiveness of MAP across a diverse set of architectures, including vision models (e.g., ResNet, ViT) and large language models, showing its generalizability and flexibility for different domains.
- C3
We introduce two variants of MAP: the nested-merging MAP, which decreases computational complexity from $O(N\cdot 2^{N})$ to $O(N\log_{2}^{N})$, and the Bayesian MAP, which efficiently queries the computationally expensive evaluations according to loss information.
- C4
To our best knowledge, this paper is the first work, that estimates the Pareto front for task-vector-based model-merging methods with low compute, and without relying on gradient descent for deep neural networks. Our code is available at [https://github.com/luli-git/MAP](https://github.com/luli-git/MAP).

Figure: Figure 2: Subfigure (a) Comparison of our method with direct search for merged ViT-B/32 models Dosovitskiy et al. (), based on evaluation results of 250 combinations of scaling coefficients. Our method identifies a more diverse set of solutions across eight tasks within the same computational budget. Both methods aim to maximize the performance of one task while ensuring that all other tasks meet a minimum threshold of $40\%$. The bar plot displays the maximized accuracy for each task. Subfigure (b) When the threshold is increased to $65\%$ of the single-task model’s performance, the brute-force direct search method fails to find any feasible solutions within the same computational budget.

In Figure 2, we compare our method to direct search. It is important to note that evaluating models in our problem setting is computationally expensive; as a result, our proposed method can only query the evaluation pipeline a limited number of times. We choose to compare with direct brute-force search within the scaling coefficient spaces. When the number of tasks is low, the Pareto fronts obtained through direct brute-force search can be considered ground truth because the scaling coefficient spaces have been sufficiently explored. However, when the number of tasks is high, we may not be able to derive reasonable ground truth Pareto fronts using direct brute-force search. Nonetheless, we can still demonstrate the efficiency of our method by comparing the winning ratio of MAP and direct brute-force search.

## 2 Background

### 2.1 Model merging

Model merging aims to combine two or more trained models into a single model to leverage the strengths of each and improve overall performance. A recent work by Ilharco et al. () introduced task arithmetic as a simple and effective way to perform model merging. The task vector for task $n$ is defined as $\mathbf{v}_{n}=\bm{\theta}_{ft}^{n}-\bm{\theta}_{\textup{pre}}$, which is the element-wise difference between the pre-trained weights and the fine-tuned weights for task $n$. To perform model merging with task vectors, we can compute the merged model as $\bm{\theta}_{m}=\bm{\theta}_{\textup{pre}}+\sum_{n=1}^{N}c_{n}\mathbf{v}_{n},$ where $c_{n}$ are the scaling coefficients that have been shown to be essential to the performance of the merged model Yadav et al. (); Yang et al. ().

Denoting the metric of task $n$ as $M_{n}$, most of the existing approaches for model merging aim to improve an equal weight average metric $\frac{1}{N}\sum_{n=1}^{N}M_{n}$. This target implies that user of the algorithm has no preferences between tasks. However, in real-world applications, users might have biased preferences for the importance of tasks, necessitating trade-offs. In such cases, the goal of model merging is no longer the simple average metric. Instead, we need to answer a broader question:

Given any preferences over the set of tasks, what is the best way to merge the models?

### 2.2 Pareto fronts

###### Definition 1 (Pareto dominance) .

Let $X$ be a set representing the solution space, where each element $x\in X$ is a possible solution to the multi-objective optimization problem. Let there be $n$ objectives, and define an evaluation loss function $f_{i}:X\to\mathbb{R}$, where $i\in\{1,2,\ldots,n\}$.

Given two solutions $x,y\in X$, we define that $x$ Pareto dominates $y$, denoted by $x\succ_{P}y$, if and only if:

$$ $\forall i\in\{1,2,\dots,n\},f_{i}(x)\leq f_{i}(y)\text{ and }\exists j\in\{1,2 ,\dots,n\},f_{j}(x)<f_{j}(y)$ $$

###### Definition 2 (Pareto optimal solutions) .

The Pareto front is the set of solutions in the solution space $X$ that are not Pareto dominated by any other solutions in $X$. The Pareto front is given by:

$$ $\text{PF}=\{x\in X\mid\not\exists y\in X\text{ s.t. }y\succ_{P}x\}$ (1) $$

Pareto optimal solutions have been studied in multi-task (multi-objective) learning (MTL) Sener & Koltun (); Lin et al. (). However, in most of the studies, approximating the Pareto front is computationally expensive and data inefficient. We introduce our method, MAP, a computationally efficient method to find the Pareto front for model merging.

###### Definition 1 (Pareto dominance) .

###### Definition 2 (Pareto optimal solutions) .

### 2.3 Motivation

A key observation is that finetuned models tend to converge around the pretrained model in parameter space. Thus, the task vectors, which represent the difference between the finetuned models and the pretrained model, exhibit small magnitudes in weights compared to the pretrained models Chung et al. (); Merlin et al. ().

**Table 1: We compute the $L_{1}$ norm of the weight matrices of the pretrained models and the task vectors for each of the 8 tasks using the ViT-B/32 model, and compute the ratio.**
| Metric | SUN397 | Cars | DTD | SVHN | RESISC45 | MNIST | GTSRB | EuroSAT |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| $||\bm{\theta}_{pre}||_{1}$ | 1,270,487 | 1,270,487 | 1,270,487 | 1,270,487 | 1,270,487 | 1,270,487 | 1,270,487 | 1,270,487 |
| $||\mathbf{v}_{n}||_{1}$ | 21,055 | 20,127 | 13,621 | 19,349 | 18,409 | 17,578 | 16,712 | 15,941 |
| $||\mathbf{v}_{n}||_{1}/||\bm{\theta}_{pre}||_{1}$(%) | 1.66% | 1.58% | 1.07% | 1.52% | 1.45% | 1.38% | 1.32% | 1.25% |

[Uncaptioned image]: extracted/5900994/imgs/task_vector_tensor_magnitude_distribution.png

We calculate the $L_{1}$ norm of the parameters for the 8 task vectors and their ratios relative to the $L_{1}$ norm of the pretrained model. As shown in Table 1, the ratio between the $L_{1}$ norm of the task vectors and the $L_{1}$ norm of the weight matrices of the pretrained model is approximately $1\%$ to $2\%$ for each of the 8 tasks.

We further examine the density plot of the absolute values of the weight matrices of the 8 task vectors (Section 2.3). We find that the maximum magnitude of the task vectors is 0.00859, while the mean is 1.57336 $\times 10^{-4}$. These findings motivate and validate our key assumption 1 of using a second-order Taylor expansion to approximate the evaluation metrics.

## 3 Methods

In this section, we discuss the proposed MAP method in detail. To enhance readability, we present a table of notations in Table 5.

### 3.1 Quadratic approximation of evaluation metric

Given the task vectors $\{\mathbf{v}_{n}\}_{\{n=1,...,N\}}$ and the initialization $\bm{\theta}_{\textup{pre}}\in\mathbb{R}^{d}$, we denote the merged model parameters as $\bm{\theta}_{m}(\mathbf{c})=\bm{\theta}_{\textup{pre}}+\mathbf{V}\mathbf{c}=
\bm{\theta}_{\textup{pre}}+\sum_{n=1}^{N}c_{n}\mathbf{v}_{n}$, where $\mathbf{V}=\text{concat}(\mathbf{v}_{1},...,\mathbf{v}_{N})\in\mathbb{R}^{d
\times N}$ is the task matrix and $\mathbf{c}=[c_{1},...,c_{N}]^{\top}\in\mathbb{R}^{N}$ is the vector of scaling coefficients for the task vectors.

Let $M_{n}(\mathbf{c})=M_{n}(\theta_{m}(\mathbf{c}))$ denote the evaluation metric for task $n$ of the merged model. We aim to optimize the evaluation metric for each task via the multi-objective optimization (MOOP)(^1^11The evaluation metric $M$ can be differentiable (e.g., mean square loss or cross-entropy/perplexity) or not necessarily (e.g., classification accuracy, F1 score, BLEU, or Rouge)):

$$ $\min_{c_{1},\ldots,c_{N}}M_{1}(\mathbf{c}),\ldots,M_{N}(\mathbf{c})$ (2) $$

This problem has $N$ variables and $N$ objectives, and we seek the Pareto optimal solutions.

Motivated by the observation that the finetuned models tend to have parameters close to the pretrained model (as shown in Table 1), we put forward the following assumption.

###### Assumption 1 .

The task vectors ${\mathbf{v}_{n}}$ have small norms relative to the pretrained model parameters $\bm{\theta}_{\textup{pre}}$, i.e., $|\mathbf{v}_{n}|\ll|\bm{\theta}_{\textup{pre}}|$ for $n=1,\ldots,N$. Additionally, the evaluation metrics $M_{n}(\theta)$ are sufficiently smooth around $\bm{\theta}_{\textup{pre}}$, such that higher-order terms in their Taylor expansions are negligible within the region defined by the task vectors.

Denote $p$ as the number of parameters in the pre-trained model and also the number of parameters in each task vector. $N$ is the number of tasks.

To derive our algorithm, MAP, we utilize the second-order Taylor expansion to approximate $M_{n}$:

$$ $\displaystyle M_{n}(\mathbf{c})$ $\displaystyle\equiv M_{n}(\bm{\theta}_{\text{m}}(\mathbf{c}))=M_{n}(\bm{\theta }_{\textup{pre}})+\nabla M_{n}(\bm{\theta}_{\textup{pre}})^{\top}(\bm{\theta}_ {m}(\mathbf{c})-\bm{\theta}_{\textup{pre}})$ $\displaystyle+\frac{1}{2}(\bm{\theta}_{m}(\mathbf{c})-\bm{\theta}_{\textup{pre }})^{\top}\mathbf{H}_{n}(\bm{\theta}_{\textup{pre}})(\bm{\theta}_{m}(\mathbf{c })-\bm{\theta}_{\textup{pre}})+R_{n}(\bm{\theta}_{m}(\mathbf{c})-\bm{\theta}_{ \textup{pre}})$ $\displaystyle=\underbrace{M_{n}(\bm{\theta}_{\textup{pre}})}_{\in\mathbb{R}}+ \underbrace{\nabla M_{n}(\bm{\theta}_{\textup{pre}})^{\top}}_{\in\mathbb{R}^{1 \times p}}\underbrace{\mathbf{V}}_{\in\mathbb{R}^{p\times N}}\underbrace{ \mathbf{c}}_{\in\mathbb{R}^{N\times 1}}+\frac{1}{2}\underbrace{(\mathbf{V} \mathbf{c})^{\top}}_{\in\mathbb{R}^{1\times p}}\underbrace{\mathbf{H}_{n}(\bm{ \theta}_{\textup{pre}})}_{\in\mathbb{R}^{p\times p}}\underbrace{\mathbf{V} \mathbf{c}}_{\in\mathbb{R}^{p\times 1}}+\underbrace{R_{n}}_{\in\mathbb{R}}$ $$

where $\mathbf{H}_{n}(\bm{\theta}_{\textup{pre}})=\nabla^{2}M_{n}(\bm{\theta}_{
\textup{pre}})\in\mathbb{R}^{d\times d}$ is the Hessian matrix and $R_{n}(\bm{\theta}_{m}(\mathbf{c})-\bm{\theta}_{\textup{pre}})=R_{n}(\mathbf{V}
\mathbf{c})$ is the third-order remainder, which in Assumption 1, is negligible when $||\mathbf{V}\mathbf{c}||^{3}=||\bm{\theta}_{m}(\mathbf{c})-\bm{\theta}_{
\textup{pre}}||^{3}$ is small. Note that the second-order Taylor expansion is widely used  McCandlish et al. (); Bu et al. (); Kaplan et al. (); Hoffmann et al. () and provides a close approximation (see Figure 2 (a) and (b) and more discussion in Appendix 5).

Leveraging this quadratic approximation, we can define surrogate models for each task $N$,

$$ $\tilde{M}_{n}(\mathbf{c};\mathbf{A}_{n},\mathbf{b}_{n},e_{n})\equiv\frac{1}{2} \mathbf{c}^{\top}\mathbf{A}_{n}\mathbf{c}+\mathbf{b}_{n}^{\top}\mathbf{c}+e_{n}$ (3) $$

and optimize the proxy problem of Equation 2
via

$$ $\displaystyle\min_{c_{1},\ldots,c_{N}}\tilde{M}_{1}(\mathbf{c}),\ldots,\tilde{ M}_{N}(\mathbf{c})$ (4) $$

where $\mathbf{A}_{n}\in\mathbb{R}^{N\times N}$ is a parameterized matrix aiming to approximate $\mathbf{V}^{\top}\mathbf{H}_{n}(\bm{\theta}_{\textup{pre}})\mathbf{V}$; $\mathbf{b}_{n}\in\mathbb{R}^{N}$ is a parameterized vector targeting to $\mathbf{V}^{\top}\nabla M_{n}(\bm{\theta}_{\textup{pre}})$; $e_{n}$ is a parameter scalar which estimates $M_{n}(\bm{\theta}_{\textup{pre}})+R_{n}$.

Importantly, Equation 4 is parameterized in contrast to Equation 2, with a total of $\frac{(N+1)(N+2)}{2}$ surrogate model parameters in ($e_{n}$, $\mathbf{b}_{n}$, $\mathbf{A}_{n}$), i.e., 1 coefficient for $e_{n}$, $N$ coefficients in $\mathbf{b}_{n}$ and $N(N+1)/2$ coefficients in $\mathbf{A}_{n}$ due to its symmetry ($1+N+\frac{N(N+1)}{2}=\frac{(N+1)(N+2)}{2}$). We do not calculate the gradient or Hessian to obtain the parameters $\mathbf{A}_{n}$, $\mathbf{b}_{n}$, $e_{n}$. Instead, we estimate them by minimizing the MSE between ${M}_{n}$ and $\tilde{M}_{n}$, $n=1,\ldots,N$:

$$ $\mathbf{A}_{n}^{*},\mathbf{b}_{n}^{*},e_{n}^{*}=\arg\min_{\mathbf{A}_{n}, \mathbf{b}_{n},e_{n}}\sum_{\mathbf{c}\in\Omega}|M_{n}(\bm{\theta}_{\text{merge }}(\mathbf{c}))-\tilde{M}_{n}(\mathbf{c};\mathbf{A}_{n},\mathbf{b}_{n},e_{n})| ^{2}$ (5) $$

where $\Omega=\{\mathbf{c}^{(1)},\ldots,\mathbf{c}^{(K)}\}$ is the set of $\mathbf{c}$ and $M_{n}(\bm{\theta}_{\text{merge}}(\mathbf{c}))$ is the corresponding evaluation metric. Below we discuss 3 extensive cases of this problem.

###### Assumption 1 .

##### Case 1:

If the evaluation metric spans the whole real-number axis $\mathbb{R}$, we use the vanilla form of the surrogate model in Equation 3. As shown in Corollary 1, we have a closed-form solution for Equation 5

###### Corollary 1 (Closed-form Solution for Surrogate Model Parameters) .

Under Assumption 1, for each task $n=1,\dots,N$, the optimization problem 5 is equivalent to solving a linear regression where the predictors include all quadratic, interaction, linear, and constant terms of $\mathbf{c}$. The closed-form solution for the parameters is given by

$$ $\begin{pmatrix}\text{vec}(A_{n}^{*})\\ \mathbf{b}_{n}^{*}\\ e_{n}^{*}\end{pmatrix}=\left(\mathbf{C}_{n}^{\top}\mathbf{C}_{n}\right)^{-1} \mathbf{C}_{n}^{\top}\mathbf{y}_{n}$ $$

where $\mathbf{C}_{n}(\mathbf{c})=(c_{1}^{2},c_{2}^{2},\ldots,c_{N}^{2},c_{1}c_{2},c_
{1}c_{3},\ldots,c_{N-1}c_{N},c_{1},c_{2},\ldots,c_{N},1)$, and $\mathbf{y}_{n}$ is the vector of observed metrics $M_{n}(\theta_{m}(\mathbf{c}))$ for all $\mathbf{c}\in\Omega$. Please refer to Corollary 3 for a more detailed corollary.

###### Corollary 1 (Closed-form Solution for Surrogate Model Parameters) .

##### Case 2:

When the evaluation metric is restricted to a specific range $[l,u]$, e.g. accuracy is restricted to $[0,1]$, we can warp the quadratic part using a sigmoid function, i.e.

$$ $\tilde{M}_{n}(\mathbf{c};\mathbf{A}_{n},\mathbf{b}_{n},e_{n})\equiv(u-l)\sigma (e_{n}+\mathbf{b}_{n}^{\top}\mathbf{c}+\frac{1}{2}\mathbf{c}^{\top}\mathbf{A}_ {n}\mathbf{c})+l.$ $$

##### Case 3:

Similarly, if the evaluation metric is restricted to $[l,+\infty)$, a softplus function as a wrapper would be beneficial:

$$ $\tilde{M}_{n}(\mathbf{c};\mathbf{A}_{n},\mathbf{b}_{n},e_{n})\equiv\text{ softplus}(e_{n}+\mathbf{b}_{n}^{\top}\mathbf{c}+\frac{1}{2}\mathbf{c}^{\top} \mathbf{A}_{n}\mathbf{c})+l,$ $$

where $\text{softplus}(x)=\ln(1+e^{x})$.

In Cases 2 and 3, please note that $u$ and $l$ mentioned here are not learnable parameters. They are specific to the feasible area of the metric. Since the non-linear functions are introduced in the definition of $\tilde{M}_{n}$, there are no closed-form solutions. We use gradient descent to solve the optimization problem 5. This approach remains fast and computationally inexpensive, as the number of parameters in the surrogate model is $\frac{(N+1)(N+2)}{2}$. In the case of merging 8 models, the number of parameters is 45 which is significantly less than the millions of parameters typically found in deep learning models.

### 3.2 Model merging with amortized Pareto fronts

In this section, we introduce our generalized algorithm for estimating the amortized Pareto fronts. As mentioned in Section 3.1, we approximate the evaluation metric $M_{n}(\cdot)$ by a surrogate quadratic model $\tilde{M}_{n}(\cdot)$. We then utilize $\tilde{M}_{n}(\cdot)$ to compute the amortized Pareto fronts. Please see the detailed experiments in Section 4 and the algorithm details in Algorithm 1. Different from other Pareto multi-task learning algorithms, our algorithm does not require calculating the gradients or performing gradient descent on the deep learning model parameters.

Figure: Algorithm 1 MAP

### 3.3 Further methods to bring down the computation cost when the number of tasks is high

In addition to MAP, we also introduce MAP variants, nested merging MAP (NMMAP) and Bayesian MAP (BMAP). Both nested merging MAP (NMMAP) and Bayesian MAP (BMAP) are MAP variants designed to further reduce the computation of MAP. When the number of tasks $N$ is low ($N=2,3$) and the computational resources are very limited, BMAP can reduce the number of scaling coefficients $\mathbf{c}$ and therefore reduce the number of evaluations of merged models while maintaining competitive performance. As illustrated in Figure 3 (a), BMAP uses Bayesian optimization to determine the distribution of scaling coefficients for task vectors when approximating the surrogate model in MAP. For more details and experiments, please refer to Section E.3.

When the number of tasks $N$ is high and computational resources are also limited, NMMAP reduces the number of evaluations from $O(TN2^{N})$ to $O(N\log{N})$. It achieves a 250x speedup when the number of tasks is 8, while also outperforming direct search methods. However, it can no longer output the entire Pareto front for all tasks, and the practitioners need to be able to quantify their preferences during the merging since it merges models in pairs in nested fashion, as shown in Figure 3 (b). For more details and experiments, please refer to Section E.2.

Figure: Figure 3: Subfigure (a) Utilize Bayesian optimization to guide the sampling of scaling coefficients according to uncertainty distribution; Subfigure (b) An example of nested model merging for $N=8$ models.

## 4 Experiments

### 4.1 Experiment setup

##### Datasets and models

We study multi-task model merging on eight normal zero-shot image classification datasets following Ilharco et al. (): SUN397 Xiao et al. (), Cars Krause et al. (), GTSRB Stallkamp et al. (), MNIST LeCun (), EuroSAT Helber et al. (), SHVN Netzer et al. (), DTD Cimpoi et al. (), RESISC45 Cheng et al. (). We use the ViT-B/32 architecture in CLIP Radford et al. () as the pre-trained model for the experiments on vision tasks in the main text. We show the results of these experiments in the main pages.

The rest of the experiments are presented in the Appendix due to the page limits. The results of the datasets and tasks we experimented on are as follows: a zero-shot medical chest X-ray image classification task to show our model merging scheme also works in a real-world application in the medical domain Wang et al. () (Section D.3); 4 fine-tuned Llama3 models in different languages: French, Arabic, Chinese, and Japanese (Section D.4)(^2^22All the fine-tuned language Llama3 models can be found on Hugging Face. The IDs of the models are: French: jpacifico/French-Alpaca-Llama3-8B-Instruct-v1.0; Arabic: MohamedRashad/Arabic-Orpo-Llama-3-8B-Instruct; Chinese: shenzhi-wang/Llama3-8B-Chinese-Chat; Japanese: haqishen/Llama-3-8B-Japanese-Instruct.); 3 vision tasks on the ResNet18 He et al. () architecture: CIFAR-10 Krizhevsky et al. (), Flowers-102 Nilsback & Zisserman (), and GTSRB Stallkamp et al. () to show our model merging scheme also works on other model architectures (Section D.5).

### 4.2 Baseline and metrics

##### Pareto front-finding baselines

Our baseline method for obtaining Pareto fronts is the brute-force direct search, which can be regarded as the gold standard when the number of tasks is low ($N<4$). This is because we can sample enough grid points of $\mathbf{c}$ and query the corresponding evaluation metrics $\{M_{n}(\theta(\mathbf{c}))\}_{n=1}^{N}$. We can then directly use the resulting evaluation metrics to find the Pareto front by direct comparisons of each task’s performance of the merged model by $c_{i}\in\mathbf{c}$.

However, when the number of tasks grows, the required number of $(\mathbf{c},\{M_{n}(\theta(\mathbf{c}))\}_{n=1}^{N})$ pairs grows exponentially, which is much larger than the points we evaluated. Thus, when the number of tasks is high ($N\geq 4$), the results from the brute-force direct search can no longer be considered ground truth.

In Figure 4, we show an illustration of why the curse of dimensionality occurs when the number of tasks increases.

Figure: Figure 4: The discretization of scaling coefficients when the number of tasks is 2 and 3. As the dimension grows, preserving the same number of pts per dimension results in exponentially more grid points. This serves to illustrate why when the dimension is low (e.g., < 4), we can regard the brute-force direct search method as ground truth, but it becomes insufficient when the dimension is higher.
Refer to caption: x1.png

##### Single merged model baselines

In addition to the brute-force method, we compare with other model merging methods including SLERP Shoemake (), TIES-merging Yadav et al. (), Task Arithmetic with a single scalar Ilharco et al. (), Task Arithmetic with preferences as scalars Ilharco et al. (), DARE combined with Task Arithmetic Yu et al. (); Ilharco et al. (), and DARE combined with TIES-merging Yu et al. (); Yadav et al. ().

##### Win rate

We used the win rate to measure how often the Pareto front found by MAP outperforms the Pareto front found by the baseline in terms of multiple objectives. Let $PF_{MAP}$ and $PF_{baseline}$ represent the set of solutions in the Pareto fronts obtained from the MAP and the baseline methods, respectively. Each solution in these sets is a vector in $\mathbb{R}^{N}$, where $N$ is the number of objectives or tasks. We sampled $K=100$ points from the decision space of each of the two Pareto fronts, denoted as $\mathbf{c}_{k}^{MAP}$ and $\mathbf{c}_{k}^{baseline},k=1,\ldots,K$. Then, we compared $M_{n}(\theta(\mathbf{c}_{k}^{MAP}))$ and $M_{n}(\theta(\mathbf{c}_{k}^{baseline}))$ pairwise for $k=1,\ldots,K$ and $n=1,\ldots,N,$ resulting in $K^{2}N$ comparisons. The ratio of instances where $M_{n}(\theta(\mathbf{c}_{k}^{MAP}))>M_{n}(\theta(\mathbf{c}_{k}^{baseline}))$ is computed as the win rate of $PF_{MAP}$:

$$ $\text{Win Rate}=\frac{1}{K^{2}N}\sum_{i=1}^{K}\sum_{j=1}^{K}\sum_{n=1}^{N} \mathbb{I}\left[M_{n}(\theta(\mathbf{c}_{i}^{\text{MAP}}))>M_{n}(\theta( \mathbf{c}_{j}^{\text{baseline}}))\right]$ $$

where $K=100,\mathbf{c}_{i}^{\text{MAP}}\in\text{Decision Space of }PF_{\text{MAP}},i
=1,\ldots,K,$ $\mathbf{c}_{j}^{\text{baseline}}\in\text{Decision Space of }PF_{\text{baseline
}},j=1,\ldots,K,\mathbb{I}[\cdot]$ is the indicator function.

### 4.3 Win rate of MAP over the direct search method

Table 2 shows the results for the win rate of MAP over the brute force direct search method when the number of tasks is small ($N<4$). In such cases, the Pareto front can be regarded as the ground truth Pareto front, and we can only query 30 and 50 scaling coefficients to achieve similar performance with the ground truth Pareto front.

Table 3 shows the results for the win rate of MAP over the brute force direct search method when the number of tasks is high ($N\geq 4$). In such cases, the Pareto front generated by the brute force method can no longer be considered ground truth due to the limited number of points per dimension that is covered. In this setting, MAP performs much better than the brute-force (not ground truth) Pareto solutions.

**Table 2: Win rate of the amortized PF over the brute-force direct search PF, where the latter can be regarded as the ground truth when $N<4$. # $\mathbf{c}$ is the number of scaling coefficient vectors each algorithm evaluated to find the Pareto front. # $\mathbf{c}$ per dim = (# $\mathbf{c}\text{ direct search})^{1/N}$ measures the sparsity of points the direct search method uses, as illustrated in Figure 4.**
| N | # $\mathbf{c}$ (direct search) | # $\mathbf{c}$ per dim | # $\mathbf{c}$ (MAP) | Win rate (MAP) | $R^{2}$ (MAP) |
| --- | --- | --- | --- | --- | --- |
| 2 | 200 | 14.14 | 30 | 49.81% $(\pm 0.30)$ | 0.953 $(\pm 0.018)$ |
| 3 | 300 | 6.69 | 50 | 46.90% $(\pm 0.71)$ | 0.980 $(\pm 0.003)$ |

**Table 3: Win rate of the amortized PF over the brute-force direct search PF, where the latter can no longer be regarded as the ground truth when $N\geq 4$. # of $\mathbf{c}$ is the number of scaling coefficient vectors each algorithm evaluated to find the Pareto front. # $\mathbf{c}$ per dim = (# $\mathbf{c}\text{ direct search})^{1/N}$ measures the sparsity of points the direct search method uses, as illustrated in Figure 4.**
| N | # $\mathbf{c}$ (direct search) | # $\mathbf{c}$ per dim | # $\mathbf{c}$ (MAP) | Win rate (MAP) | $R^{2}$ (MAP) |
| --- | --- | --- | --- | --- | --- |
| 4 | 300 | 4.16 | 60 | 50.67% $(\pm 2.44)$ | 0.984 $(\pm 0.004)$ |
| 5 | 500 | 3.47 | 85 | 53.00% $(\pm 1.88)$ | 0.941 $(\pm 0.019)$ |
| 6 | 500 | 2.82 | 100 | 60.71% $(\pm 1.34)$ | 0.941 $(\pm 0.030)$ |
| 7 | 1000 | 2.68 | 140 | 63.42% $(\pm 1.91)$ | 0.891 $(\pm 0.024)$ |
| 8 | 1000 | 2.37 | 250 | 65.58% $(\pm 0.94)$ | 0.868 $(\pm 0.028)$ |

### 4.4 Comparing with other single merged model baseline methods

We compared the performance of MAP with TIES-merging Yadav et al. (), TIES-merging with DARE Yu et al. (), Task Arithmetic with DARE, Task Arithmetic with normalized preference as scaling coefficients Ilharco et al. (), and SLERP Shoemake (). For dimension 2, we can directly visualize the results, as shown in Figure 5.

##### MAP offers a well-distributed set of Pareto optimal solutions

We can see that none of the baseline methods can directly dominate all Pareto solutions found by MAP, and most of them lie either within or on the Pareto front found by MAP. In addition, we sampled 10 points from the predicted Pareto front by MAP and evaluated them (MAP Pareto solutions, real) to confirm that they indeed lie close to the predicted Pareto front. This evidence further confirms the usefulness of MAP as a general strategy for finding a set of diverse and well-distributed Pareto solutions that none of the existing model merging methods can substitute.

Figure: Figure 5: The Pareto fronts obtained using MAP with Task Arithmetic, MAP with Task Arithmetic and DARE. We sampled 10 Pareto solutions from the predicted front by MAP and evaluated them to obtain the real values. We plotted the results obtained using TIES-merging, Task Arithmetic (TA) with a single scalar for all tasks, Task Arithmetic with preferences as scalars, TA combined with DARE (DARE-TA), TIES-merging combined with DARE (DARE-TIES), and SLERP.
Refer to caption: extracted/5900994/imgs/DTDVal_CarsVal_4_44_withbaselines_generated.png

##### MAP is an out-of-the-box plugin for other task-vector based model merging methods

As shown in Figure 5, MAP is a plug-in that can be directly combined with other model merging methods where the users can control their preferences over each task using some scaling coefficients. For example, MAP can be combined with DARE, Task Arithmetic, etc.

For dimensions higher than 2, we use preference-weighted evaluation sum to compare the Pareto front found by MAP with other baseline methods. We sample 20 preference vectors and normalize them. Then, we pick the solution by MAP that maximizes the preference-weighted sum of accuracies and compare it with those of the baseline methods. The results are shown in Table 4. We can observe that even in higher dimensions, when the user has certain preferences, MAP is still useful and can better accommodate user preferences. Please note that when using MAP, we do not require the user to pre-specify their preference vector. In fact, the users can get the entire Pareto front to better understand the trade-offs. This preference vector based metric is only for evaluation purposes.

**Table 4: We compared MAP with a set of baseline methods by sampling a set of 20 normalized preference vectors and computing the preference-weighted sum of accuracies and win rate. The win rate is defined as the proportion of the 20 preference vectors where the preference-weighted sum of accuracies of MAP is higher than those of the baseline methods. $\uparrow$ indicates higher is better. The number after $\pm$ is the standard deviation. Please refer to Table 2 and Table 3 for the number of scaling coefficient vectors used for different numbers of tasks.**
| Preference weighted sum of accuracies ($\uparrow$) |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- |
| # tasks | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| Single task models | 75.84$\pm$1.76 | 77.03$\pm$1.84 | 82.43$\pm$4.40 | 87.69$\pm$4.50 | 88.52$\pm$4.02 | 89.26$\pm$3.58 | 90.62$\pm$2.52 |
| MTL | 73.63$\pm$0.30 | 75.13$\pm$1.00 | 80.10$\pm$2.79 | 84.93$\pm$3.58 | 86.78$\pm$2.94 | 87.40$\pm$2.56 | 89.11$\pm$2.36 |
| Model soups (Wortsman et al. ()) | 67.79$\pm$1.46 | 64.25$\pm$2.15 | 66.04$\pm$3.22 | 67.01$\pm$3.42 | 63.11$\pm$1.99 | 63.35$\pm$2.17 | 64.36$\pm$2.77 |
| TIES-merging (Yadav et al. ()) | 69.30$\pm$0.33 | 67.60$\pm$0.58 | 71.79$\pm$2.93 | 76.49$\pm$3.10 | 73.74$\pm$2.96 | 72.54$\pm$2.87 | 72.24$\pm$1.91 |
| DARE-TIES | 67.62$\pm$1.65 | 66.49$\pm$2.34 | 71.39$\pm$4.45 | 74.55$\pm$4.55 | 73.34$\pm$4.10 | 71.43$\pm$3.84 | 71.89$\pm$2.86 |
| Task Arithmetic (Ilharco et al. ()) | 70.73$\pm$1.84 | 61.15$\pm$2.33 | 52.69$\pm$4.23 | 61.58$\pm$4.62 | 51.37$\pm$3.84 | 39.79$\pm$3.97 | 60.77$\pm$2.84 |
| TA with preference as weights | 69.22$\pm$1.4 | 66.88$\pm$2.37 | 68.73$\pm$5.48 | 71.92$\pm$5.5 | 68.13$\pm$4.69 | 68.14$\pm$4.2 | 68.17$\pm$2.89 |
| DARE-TA | 70.61$\pm$0.22 | 64.18$\pm$1.24 | 58.04$\pm$8.19 | 65.39$\pm$7.03 | 56.76$\pm$7.01 | 46.75$\pm$5.73 | 64.51$\pm$3.81 |
| MAP | 70.70$\pm$0.21 | 69.05$\pm$1.41 | 72.84$\pm$1.05 | 77.31$\pm$0.83 | 74.26$\pm$0.52 | 73.40$\pm$-0.14 | 72.96$\pm$0.73 |

## 5 Related Work

Due to space constraints, for a more comprehensive discussion, please refer to Appendix B.

##### Multi-objective optimization

Multi-objective optimization (MOOP) identifies diverse Pareto solutions with different trade-offs. The multi-task problem has been approached from a MOOP perspective Sener & Koltun (); Lin et al. (), utilizing algorithms like MGDA, IMTL, GradNorm, RLW, and scalarization. While these methods iteratively optimize $\mathbb{R}^{d}$ model parameters with significant computational cost, our approach performs post-training MOOP over $\mathbb{R}^{N}$ scaling coefficients, reducing computational burden. For $N\geq 3$ objectives, MOOP becomes many-objective optimization, challenging traditional algorithms (e.g. NSGA-II and SPEA2). Advanced methods such as $\epsilon$-MOEA Deb et al. (), MSOPS Hughes (), SMS-EMOA Beume et al. (), and NSGA-III Deb & Jain (), or the KKT approach Augusto et al. () are required. Selection factors include solution quality and computational efficiency, noting that some methods like hypervolume indicators Auger et al. () have super-polynomial time complexity with objective count.

##### Task arithmetic

Task arithmetic, a model merging method gaining attention, uses weighted averages of models for multi-task performance. Various approaches exist for selecting scaling coefficients Ilharco et al. (); Yadav et al. (); Yang et al. (): Ilharco et al. () uses equal scaling, which is suboptimal and limited; Yang et al. () optimizes weights using Shannon entropy but requires unlabeled test data, conflicting with data privacy goals in model merging Matena & Raffel () and only applies to classification tasks.
Wortsman et al. ()’s ’WiSE-FIT’ averages pre-trained and fine-tuned parameters for trade-offs. Task Arithmetic Ilharco et al. () adds weighted differences between fine-tuned and pre-trained models. Ortiz-Jiménez et al. () enhanced weight disentanglement through tangent space fine-tuning.
Beyond task arithmetic, Ainsworth et al. () merge models via weight matrix permutations, even without shared pretraining. Jin et al. () introduced dataless knowledge fusion. Daheim et al. () proposed uncertainty-based gradient matching for improved merging performance and robustness.

## 6 Conclusion and Limitations

We introduced MAP, a novel low-compute approach to efficiently merge models while accounting for trade-offs between multiple tasks. By leveraging a quadratic approximation of the evaluation metrics, MAP successfully identifies amortized Pareto fronts without the need for gradient descent for deep neural networks. The algorithm’s efficiency is further enhanced through Bayesian adaptive sampling and nested merging, enabling it to scale to problems with a higher number of tasks. Moreover, MAP is an out-of-the-box plug-in for other task-vector-based model merging methods.

However, we would like to point out some limitations of our method. We do not have a detector algorithm to detect if two tasks have proper trade-offs. Approximating a Pareto "front" with only a single Pareto solution can lead to degenerate solutions. In this case, practitioners should be informed.

## Appendix A Notations

For aid of readability, we provide the table of notations in Table 5.

**Table 5: Table of notations.**
| Notations | Explanation |
| --- | --- |
| $N$ | Number of tasks |
| $\mathbf{c}$ | Vector of scaling coefficients for task vectors |
| ${c_{n}}$ | Scaling coefficients for the $n$th task |
| $\bm{\theta}_{\textup{pre}}$ | Pretrained model parameters |
| $\theta_{m}(\mathbf{c})$ | Merged model parameters as a function of scaling vector $\mathbf{c}$ |
| $\mathbf{v_{n}}$ | Task vector for task $n$ |
| $\mathbf{V}$ | Task matrix formed by concatenating task vectors |
| $M_{n}(\mathbf{c})$ | Evaluation metric for task $n$ as a function of $\mathbf{c}$ |
| $\mathbf{A}_{n}$ | Quadratic coefficient matrix in the surrogate model |
| $\mathbf{b}_{n}$ | Linear coefficient vector in the surrogate model |
| $e_{n}$ | Constant term in the surrogate model |
| $\tilde{M}_{n}(\mathbf{c};\mathbf{A}_{n},\mathbf{b}_{n},e_{n})$ | Surrogate quadratic model for task $n$ |
| $\Omega$ | Set of scaling coefficient vectors $\mathbf{c}$ used for estimating surrogate model parameters |
| $K$ | Number of sampled coefficient vectors in set $\Omega$ |

## Appendix B More Discussion on Related Work

##### Second-order Taylor expansion

In deep learning, the second-order Taylor expansion and thus the quadratic approximation on the evaluation metric is an important technique, that characterizes the metric landscape. For example, the Newton-Ralphson method is derived from it: $\mathbf{w}_{t}-\mathbf{w}_{t+1}=\mathbf{H}^{-1}\mathbf{G}=\text{argmin}_{
\mathbf{v}}M(\mathbf{w}_{t}-\mathbf{v})$ given that $M(\mathbf{w}_{t}-\mathbf{v})=M(\mathbf{w}_{t})-\mathbf{v}\mathbf{G}+\frac{1}{2
}\mathbf{v}^{\top}\mathbf{H}\mathbf{v}$. The quadratic approximation is also combined with Lipschitz smoothness ($L$) in the classic convergence analysis of SGD Bubeck et al. (); Ghadimi & Lan (), through $M(\mathbf{w}_{t}-\eta\mathbf{G})\leq M(\mathbf{w}_{t})-\eta||\mathbf{G}||^{2}+
\frac{L\eta^{2}}{2}||\mathbf{G}||^{2}$. Interestingly, although the approximation is only accurate in the local neighborhood, it can be used to indicate the global convergence over the iterations. One reason is that state-of-the-art neural networks are usually over-parameterized and undergo lazy training, meaning that the converging parameters are close to the initialization Chizat et al. (); Du et al. (); Allen-Zhu et al. (). Thus, the local approximation informs the global convergence behavior. In particular, this approximation has played important roles in the scaling laws of neural networks (e.g. Equation 3.3 in Su et al. ()) that predict the performance and help select hyperparameters before training actually takes place.

##### Pareto fronts for Multi-task Learning

Recent advancements in multi-task learning (MTL) have seen diverse approaches to Pareto Front learning in machine learning.
Sener & Koltun () explicitly formulated multi-task learning as a multi-objective optimization problem and adapted gradient-based multi-objective optimization algorithms to large-scale learning problems. Lin et al. () developed a constrained optimization approach to find multiple Pareto optimal solutions representing different trade-offs among tasks in multi-task learning and solved decomposed subproblems in parallel using gradient-based optimization. It requires separate training runs for each solution. Navon et al. () and Lin et al. () employed hypernetworks for continuous Pareto Front approximation, generating target network weights based on preferred trade-offs. However, the size of these hypernetworks can become prohibitively large and needs to be properly trained as well. Ruchte and Grabocka Ruchte & Grabocka () introduced a memory-efficient method by augmenting network inputs with desired trade-offs, although this may obscure the network’s conditioning due to nonlinear dynamics, and it is also based on the gradient updating method.

##### Model-merging Applications in LLM

In the realm of model merging applications for language model preferences, recent research has made significant progress. Ramé et al. () and Jang et al. () introduced "rewarded soups" and "personalized soups", which utilize model soup to interpolate weights of networks fine-tuned on diverse rewards to achieve Pareto-optimal generalization across preference spaces and address the challenge of aligning large language models with individual perspectives. Zhong et al. () developed "Panacea", which reframes alignment as a multi-dimensional preference optimization problem, using singular value decomposition-based low-rank adaptation to guide model behavior with a low-dimensional preference vector. To address the limitations of scalar rewards in RLHF, Zhou et al. () introduced Multi-Objective Direct Preference Optimization, an RL-free algorithm that extends Direct Preference Optimization to handle multiple alignment objectives efficiently. Finally, Wang et al. () proposed the Directional Preference Alignment framework, which incorporates multi-objective reward modeling to represent user preferences, offering intuitive arithmetic control over LLM generation for diverse user preferences.

##### Bayesian Optimization

Bayesian optimization has been widely used in scenarios that require efficient exploration of parameter spaces, particularly when evaluating the performance of each configuration is costly or time-consuming. This method is especially advantageous in machine learning and hyperparameter tuning, where traditional optimization techniques may be computationally prohibitive. Popular Bayesian optimization methods and applications are Wilson et al. (); Jain et al. (); Moss et al. (); Pyzer-Knapp (); Terayama et al. ().

## Appendix C Additional details on the methods

### C.1 Proof: Negligibility of the Remainder in Multivariate Taylor Series

###### Corollary 2 .

If $f:\mathbb{R}^{n}\rightarrow\mathbb{R}$ is $(k+1)$ times continuously differentiable in a neighborhood around a point $a\in\mathbb{R}^{n}$, then the Taylor polynomial $T_{k}(x)$ of order $k$ provides an accurate approximation of $f(x)$ when $x$ is sufficiently close to $a$. Furthermore, the remainder term $R_{k}(x)$ becomes negligibly small as $||x-a||$ approaches zero, assuming that the $(k+1)$th derivatives of $f$ are bounded by a constant $M$ in the neighborhood between $a$ and $x$.

###### Corollary 2 .

##### Proof

Consider the Taylor series expansion of $f$ around the point $a$, truncated at order $k$:

$$ $T_{k}(x)=\sum_{|\alpha|\leq k}\frac{D^{\alpha}f(a)}{\alpha!}(x-a)^{\alpha}$ $$

where $\alpha$ is a multi-index of non-negative integers, $D^{\alpha}f(a)$ denotes the partial derivatives of $f$ at $a$ corresponding to $\alpha$, and $(x-a)^{\alpha}=(x_{1}-a_{1})^{\alpha_{1}}\ldots(x_{n}-a_{n})^{\alpha_{n}}$.

##### Assumptions

- 1.
Proximity: $\|x-a\|\rightarrow 0$ where $\|\cdot\|$ denotes the Euclidean norm in $\mathbb{R}^{n}$.
- 2.
Bounded Derivatives: There exists a constant $M$ such that for all multi-indices $\alpha$ with $|\alpha|\equiv k+1$, the norm of the tensor $D^{\alpha}f$ evaluated at any point $\xi$ between $a$ and $x$ is bounded by $M$.

$$ $\|D^{\alpha}f(\xi)\|=\sup_{\|v_{1}\|=1,\ldots,\|v_{k+1}\|=1}|D^{\alpha}f(\xi)( v_{1},\ldots,v_{k+1})|\leq M$ $$

The remainder term of the Taylor series expansion is given by:

$$ $R_{k}(x)=\sum_{|\alpha|=k+1}\frac{D^{\alpha}f(\xi)}{\alpha!}(x-a)^{\alpha}$ $$

Given the assumptions, we estimate:

$$ $|R_{k}(x)|\leq\sum_{|\alpha|=k+1}\frac{\|D^{\alpha}f(\xi)\|}{\alpha!}\|x-a\|^{ k+1}\leq\sum_{|\alpha|=k+1}\frac{M}{\alpha!}\|x-a\|^{k+1}$ $$

As $\|x-a\|\rightarrow 0$, the term $\|x-a\|^{k+1}$ goes to zero. Thus, the remainder term $R_{k}(x)$ becomes arbitrarily small, making it negligible.

In conclusion, under the stated assumptions, the Taylor series truncated at order $k$, $T_{k}(x)$, provides an accurate approximation of $f(x)$ near $a$, and the remainder $R_{k}(x)$ can be ignored as $\|x-a\|\rightarrow 0$ and the higher-order derivatives remain bounded by $M$.

### C.2 Closed-form Solution for Surrogate Model Parameters

###### Corollary 3 (Closed-form Solution for Surrogate Model Parameters) .

Under Assumption 1, for each task $n=1,\dots,N$, the optimization problem

$$ $(A_{n}^{*},\mathbf{b}_{n}^{*},e_{n}^{*})=\arg\min_{A_{n},\mathbf{b}_{n},e_{n}} \sum_{\mathbf{c}\in\Omega}\left|M_{n}\left(\theta_{m}(\mathbf{c})\right)- \tilde{M}_{n}(\mathbf{c};A_{n},\mathbf{b}_{n},e_{n})\right|^{2}$ $$

is equivalent to solving the following linear regression problem:

- 1.
Predictors: For each coefficient vector $\mathbf{c}=(c_{1},c_{2},\dots,c_{N})^{\top}\in\mathbb{R}^{N}$, construct the predictor vector $\mathbf{C}_{n}(\mathbf{c})\in\mathbb{R}^{\frac{N(N+3)}{2}+1}$ as
$\mathbf{C}_{n}(\mathbf{c})=[c_{1}^{2},c_{2}^{2},\ldots,c_{N}^{2},c_{1}c_{2},c_
{1}c_{3},\ldots,c_{N-1}c_{N},c_{1},c_{2},\ldots,c_{N},1]$
This vector includes:
•
Quadratic terms: $c_{i}^{2}$ for $i=1,\dots,N$.
•
Interaction terms: $c_{i}c_{j}$ for $1\leq i<j\leq N$.
•
Linear terms: $c_{i}$ for $i=1,\dots,N$.
•
Constant term: $1$.
- 2.
Response Variable: Let $\mathbf{y}_{n}\in\mathbb{R}^{K}$ be the vector of observed evaluation metrics for task $n$ across all sampled coefficients $\Omega=\{\mathbf{c}^{(1)},\dots,\mathbf{c}^{(K)}\}$:
$\mathbf{y}_{n}=\begin{bmatrix}M_{n}\left(\theta_{m}(\mathbf{c}^{(1)})\right)\\
M_{n}\left(\theta_{m}(\mathbf{c}^{(2)})\right)\\
\vdots\\
M_{n}\left(\theta_{m}(\mathbf{c}^{(K)})\right)\end{bmatrix}$
- 3.
Design Matrix: Construct the design matrix $\mathbf{C}_{n}\in\mathbb{R}^{K\times\left(\frac{N(N+3)}{2}+1\right)}$ where each row corresponds to $\mathbf{C}_{n}(\mathbf{c}^{(k)})^{\top}$ for $k=1,\dots,K$.
- 4.
Coefficient Vector: Define the coefficient vector $\bm{\beta}_{n}\in\mathbb{R}^{\frac{N(N+3)}{2}+1}$ as
$\bm{\beta}_{n}=\begin{bmatrix}\text{vec}(A_{n})\\
\mathbf{b}_{n}\\
e_{n}\end{bmatrix}$
where $\text{vec}(A_{n})$ represents the vectorization of the upper triangular part of $A_{n}$, including the diagonal elements.

Optimal Solution: The parameters $(A_{n}^{*},\mathbf{b}_{n}^{*},e_{n}^{*})$ that minimize the mean squared error are obtained via the Ordinary Least Squares (OLS) solution:

$$ $\bm{\beta}_{n}^{*}=\left(\mathbf{C}_{n}^{\top}\mathbf{C}_{n}\right)^{-1} \mathbf{C}_{n}^{\top}\mathbf{y}_{n}$ $$

Interpretation: This closed-form solution provides the optimal surrogate model parameters by fitting a quadratic model to the observed evaluation metrics through linear regression. The design matrix $\mathbf{C}_{n}$ incorporates all necessary quadratic, interaction, linear, and constant terms, enabling the surrogate model $\tilde{M}_{n}(\mathbf{c};A_{n},\mathbf{b}_{n},e_{n})$ to accurately approximate $M_{n}(\theta_{m}(\mathbf{c}))$ within the specified region.

###### Corollary 3 (Closed-form Solution for Surrogate Model Parameters) .

## Appendix D Additional Details on Experiments

### D.1 Experiment setup

**Table 6: Experiment setup in terms of task details and models.**
| Task type | Metric | # of total tasks | Model type |
| --- | --- | --- | --- |
| Zero-shot Classification (normal) | Accuracy | 8 | ViT-B/32 (CLIP) (Dosovitskiy et al. ()) |
| Zero-shot Classification (medical) | Accuracy | 2 | ViT-B/32 (CLIP) (Dosovitskiy et al. ()) |
| Language Generation | Loss/Perplexity | 4 | Llama3-8B (Touvron et al. ()) |
| Image Classification | Accuracy | 3 | ResNet-18 (He et al. ()) |

### D.2 Additional metric: Generational distance and inverted generational distance

We evaluated the quality of the Pareto front in capturing the shape of the ground truth Pareto front by measuring how much the predicted Pareto front converges to the ground truth Pareto front by calculating the generational distance (GD) Van Veldhuizen () and how much the predicted Pareto front covers the ground truth Pareto front by calculating the inverted generational distance (IGD) Coello & Cortés (). GD and IGD are standard measures used in evolutionary multi-objective optimization to evaluate the solutions found by the evolutionary algorithms.Given two solution sets $PF_{i}=\{\tilde{M}_{1}^{i}(\theta_{merged}(\mathbf{c})),\ldots,\tilde{M}_{N}^{
i}(\theta_{merged}(\mathbf{c}))\},i=1,2$, the GD and IGD metrics are defined as

$$ $GD(PF_{1})\equiv\frac{1}{K}\left(\sum_{i=1}^{K}d_{i}^{p}\right)^{1/p}\text{ and }IGD(PF_{1})\equiv\frac{1}{M}\left(\sum_{i=1}^{M}\tilde{d}_{i}^{p}\right)^ {1/p}$ $$

where $d_{i}$ is the minimal Euclidean distance from $\tilde{M}_{1}^{1}(\theta_{merged}(\mathbf{c}))$ to $PF_{2}$ and $\tilde{d}_{i}$ is the minimal Euclidean distance from $\tilde{M}_{1}^{2}(\theta_{merged}(\mathbf{c}))$ to $PF_{1}$.

Since the Pareto front that resulted from the direct search method when the number of tasks is low (i.e., < 4) can be deemed as ground truth Pareto fronts, we calculated the GD and IGD between the Pareto fronts obtained by MAP and the brute force grid search method.

Figure: Figure 6: (a) Generational distance between the Pareto fronts by MAP and by direct search for dimensions 2 and 3. (b) Inverted generational distance between the Pareto fronts by MAP and by direct search for dimensions 2 and 3. For both subfigures, the x-axis is the number of total scaling coefficients used by MAP. For dimension 2, direct search used 200 scaling coefficients, and 300 for dimension 3.

### D.3 Zero-shot Medical Image Classification

In addition to natural images, we used another dataset consisting of over 112,000 chest X-rays and 30,000 unique patients of Health et al. (). It originally contained 15 classes (14 diseases and 1 class for no finding). We split the dataset into two groups, where medical task 1 specifically tries to classify Atelectasis, Consolidation, Infiltration, Pneumothorax, and medical task 2 tries to classify Nodule, Mass, and Hernia. An example image taken from the dataset is shown in Figure 7 (a).

Figure: Figure 7: (a) Example figure from the NIH of Health et al. () dataset. (b) Pareto fronts found by brute-force direct search using 400 points and by MAP using 30 points. We randomly sampled 25 points from the predicted Pareto front by MAP. The resulting IGD is 0.016, and GD is 0.014.

### D.4 Merging language model

We merged language models in French and Arabic, as well as Chinese and Japanese. Please refer to Table 7. As we can see, the ground truth Pareto front is not in good shape. There are only a few points on the ground truth Pareto front which means few merged models could dominate the rest and the trade-off between the metrics of different languages might not be very significant. Even under this condition, our algorithm is still able to find the Pareto fronts. We further tried to merge ‘Arabic+French’ and ‘Chinese+Japanese’ in the nested scheme in Algorithm 2 with various preferences. However, the Pareto front usually only contains a single model, which prevents us from predicting a Pareto front.

**Table 7: Llama-3 fine-tuned models merging**
|  | GD | IGD | GD+IGD |
| --- | --- | --- | --- |
| Arabic+French | $0.023_{0.010}$ | $0.035_{0.018}$ | $0.058_{0.028}$ |
| Chinese+Japanese | $0.014_{0.013}$ | $0.028_{0.017}$ | $0.041_{0.026}$ |

Figure: Figure 8: (a) Amortized Pareto front on merging Llama-3 fine-tuned on French with Llama-3 fine-tuned on Arabic; (b) Amortized Pareto front on merging Llama-3 fine-tuned on Chinese with Llama-3 fine-tuned on Japanese

### D.5 Additional experiment results on ResNet

We performed additional experiments on ResNet18 He et al. () by merging two models finetuned on CIFAR10 Krizhevsky et al. () and Flowers102 Nilsback & Zisserman () and show the obtained Pareto front in Figure 9. Unlike ViT models, which perform zero-shot classification, ResNet requires additional fine-tuning of the classification head after model merging. We demonstrate that our method still applies to those models.

Figure: Figure 9: Pareto front obtained for two ResNet18 models on CIFAR-10 and Flowers-102. We perform additional finetuning of the classification head after merging the model weights.
Refer to caption: extracted/5900994/imgs/plot.png

## Appendix E More Details on Algorithms

### E.1 Plain MAP

It is important to note that Plain MAP (Algorithm 1) is an out-of-the-box plugin-like method. Many parts of it are kept generic: there are multiple ways to sample $\Omega$ in terms of the number of $\mathbf{c}$ and the style of sampling (Bayesian or not), thus creating a tradeoff between the quality of the Pareto front and the computational time; the task vector can be computed on the more memory-capable CPU and possibly in a parameter-efficient manner (e.g. LoRA, Adapter, and BiTFiT): for example, computing $\mathbf{v}_{n}$ via the subtraction of two full 7B models requires $2\times 23=46$GB of memory capacity, but the memory cost for PEFT models may reduce to 16MB by only subtracting the non-frozen components; the for-loops in lines 2 and 4 can be computed in parallel, possibly using a much smaller subset of the data, and thus enjoying a computational speed-up.

### E.2 Nested-Merging MAP

#### E.2.1 Overview

In this section, we explain the procedure of the algorithm in Figure 3 in detail. Here tasks 1 to 8 are Cars, GTSRB, DTD, SUN397, Resisc45, MNIST, EuroSAT, and SVHN. If we minimize Equation 4 without the nested merging, we would need to estimate $\mathbf{A}_{1},...,\mathbf{A}_{8}\in\mathbb{R}^{8\times 8}$, with hundreds of $\mathbf{c}$.

With the nested merging, for the first round, we merge $(\bm{\theta}_{ft}^{1},\bm{\theta}_{ft}^{2})$ into $\bm{\theta}_{\text{merge}}^{1,2}$.
Similarly, we merge $(\bm{\theta}_{ft}^{3},\bm{\theta}_{ft}^{4})$into $\bm{\theta}_{\text{merge}}^{3,4}$, and $(\bm{\theta}_{ft}^{5},\bm{\theta}_{ft}^{6})$ into $\bm{\theta}_{\text{merge}}^{5,6}$. Next, we merge $(\bm{\theta}_{\text{merge}}^{1,2},\bm{\theta}_{\text{merge}}^{3,4})$ into $\bm{\theta}_{\text{merge}}^{1,2,3,4}$, and finally into $\bm{\theta}_{\text{merge}}^{1,2,3,4,5,6,7,8}$.

Empirically, we only need 20 scaling coefficients to get a Pareto front of good quality to merge 2 tasks. However, due to the curse of dimensionality, we need exponentially more pairs of $(\mathbf{c},\{\tilde{M}_{n}(\theta_{m}(\mathbf{c}))\}_{n=1}^{N})$ pairs to achieve a good quality of the Pareto front in the case of 8 tasks. Theoretically, in the best case, the number of points required to obtain a good quality Pareto front for $N$ tasks is $O(N^{3})$. In the worst case, when the curse of dimensionality dominates, it could be $O(N\cdot 2^{N})$. Using the nested merging scheme, we reduce the computation complexity from $O(N\cdot 2^{N})$ to $O(N\log_{2}^{N})$. Please refer to Table 8 for the detailed computational complexity comparison. Algorithm details are presented in Algorithm 2.

Figure: Algorithm 2 Nested-merging MAP

#### E.2.2 Time Complexity of Nested-Merging MAP

**Table 8: Computational cost of model merging for $N$ models.**
|  | # evals per task | minimum # evals (total) | # evals (total) |
| --- | --- | --- | --- |
| Naive model merging | $O(N^{2})$ | $O(N^{3})$ | $O(N\cdot 2^{N})$ |
| Nested model merging | $O(1)$ | $O(N\log_{2}^{N})$ | $O(N\log_{2}^{N})$ |

To estimate the computational complexity of nested-merging MAP, we denote N as the number of tasks. The number of total evaluations needed for nested-merging MAP is: $N/2\times 2+\ldots+N/{2^{m}}\times 2^{m}=O(N\log_{2}^{N})$ where $2^{m-1}<N\leq 2^{m}$.

Detailed calculations are as follows. When the number of tasks is 8, in the first rounds, 4 2-task merging procedures are running in parallel. Each of the procedures evaluates 2 tasks. In the procedure of model-merging between 2 tasks, as discussed, we need to sample 20 scaling coefficients $\mathbf{c}$ and evaluate 20 merged models on the 2 tasks. Thus, it takes $4\times 20\times 2=160$ times of evaluation in the first round. In the second round, 2 2-task merging procedures are running in parallel, each of them evaluating 4 tasks. Thus, it takes $2\times 20\times 4=160$ times of evaluation. In the last round, there is only one 2-task merging and evaluation on 8 tasks. It takes $1\times 20\times 8=160$ times of evaluation. In total, NMMAP takes 480 times of evaluations. Generalizing the calculation, the number of rounds can be calculated by $\log_{2}(N)$. In each round, we need to evaluate $T\cdot N/2^{i}\cdot 2^{i}=TN$ where $T$ is the number of scaling coefficient vectors needed to be evaluated when the number of tasks is 2. In the above example, $T=20$. Thus, the time complexity is $O(TN\log_{2}(N))$. We rewrite it as $O(N\log_{2}(N))$ if ignoring $T$ which is a constant.

#### E.2.3 Intermediate Pareto Fronts in Each Round

To determine if NMMAP affects performance negatively when compared to merging multiple models in a single operation. We show the intermediate Pareto fronts obtained when merging 8 models using nested-merging MAP in Figure 10, where we merge two models at a time. The figures illustrate the intermediate Pareto fronts obtained, where $A_B$ means the model obtained by merging model A and model B.

Figure: Figure 10: Illustration of the sequential steps involved in merging 8 models using nested-merging MAP (left to right, top to bottom). The figures show the intermediate Pareto fronts obtained, where $A_B$ means the model obtained by merging model A and model B.
Refer to caption: extracted/5900994/imgs/nested/CarsVal_EuroSATValpareto_front.png

#### E.2.4 Results on using nested merging to merge 8 models

**Table 9: We compared nested-merging MAP with MAP and baseline methods in merging 8 models using a set of 10 preference vectors in terms of preference-weighted sum of accuracies.**
| Metric | Single-task models | MAP-nested | MAP-plain | TIES-merging | DARE-TIES | Task Arithmetic (TA) | DARE-TA |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Preference weighted sum ($\uparrow$) | 90.05$\pm$3.02 | 67.05$\pm$3.89 | 72.12$\pm$3.78 | 70.79$\pm$3.81 | 70.51$\pm$3.58 | 59.44$\pm$5.68 | 63.14$\pm$4.91 |

We further evaluate the effectiveness of nested-merging MAP. Supplemental Figure 10 shows the intermediate Pareto fronts obtained using nested-merging MAP (NMMAP) sequentially. In addition, we compared the performance of NMMAP with Plain MAP (Algorithm 1). The results are shown in Table 9. The results confirm that nested-merging MAP can obtain comparable results to those obtained by MAP while using much fewer evaluation runs. As discussed in Section E.2.2, in total, we run $40\times 4+80\times 2+160\times 1=480$ evaluations. In contrast, when running the Plain MAP (Algorithm 1), we used 280 coefficients and evaluate $280\times 8=2240~{}\text{times}$. In addition, while being suboptimal to MAP (Algorithm 1), nested-merging MAP can still outperform other baseline methods such as TA and DARE-TA in accommodating various user preferences with relatively low computational cost, especially when the number of tasks is high.

### E.3 Bayesian MAP

#### E.3.1 Overview

In the case of a relatively low number of tasks ($N\leq 3$), we consider using the Bayesian adaptive sampling method inspired by Bayesian optimization.

In the Plain MAP (Algorithm 1), we only sample a single round of scaling weights $\mathbf{c}$ and query the ground truth metric by evaluation through the $M_{n}(\bm{\theta}(\mathbf{c}))$. In contrast, as for the Bayesian adaptive sampling, we sample the scaling weights $\mathbf{c}$ in multiple rounds. In each round, the sampling strategy depends on the previous sampling $\mathbf{c}$ and its evaluation metrics.

The process begins with an initial uniform sampling of scaling coefficients, $\{(c_{1},\ldots,c_{N})_{i}\}_{i=0}^{n_{0}}$, from $[0,1]^{N}$. For simplicity, we define $\mathbf{c}_{i}$ as $(c_{1},\ldots,c_{N})_{i}$. We evaluate the merged model $\theta_{m}(\mathbf{c}_{i})$ for tasks $1$ through $N$ and compute the corresponding $L_{2}$ loss. We then discretize the regions of $\mathbf{c}$ into bins within a hyper-spherical coordinate system and discretize along the angular dimensions. Please refer to Figure 11 for examples in 2-dimensional and 3-dimensional discretization. The posterior distribution is computed proportional to an acquisition function (e.g., upper confidence bound) of the approximation loss within specific bins.

We iteratively update each surrogate model for task $n$. Similar to the plain MAP Algorithm 1, after meeting the stopping criterion, we use the surrogate models for tasks $\{t\}_{n=1}^{N}$ to generate a lot of $(\mathbf{c},\{\tilde{M}_{n}(\theta_{m}(\mathbf{c}))\}_{n=1}^{N})$ and apply the MOOP algorithm (e.g. NSGA-III) to $\{\tilde{M}_{n=1}^{N}\}$ to calculate the Pareto front. See the algorithm 3 for more details.

Figure 11 includes illustration of our discretization method (how we create bins) in 2D and 3D decision variable ($\mathbf{c}$) space.

Figure: (a)
Refer to caption: x3.png

Figure: Algorithm 3 Bayesian Adaptive of Surrogate Model

#### E.3.2 Performance of Bayesian MAP

We further improve the efficiency of MAP by proposing an adaptive Bayesian sampling algorithm. This Bayesian approach samples the points from regions with the highest level of uncertainty, where uncertainty is quantified with the Upper Confidence Bound (UCB). Please refer to Algorithm 3 for more details about the algorithm.

Please refer to Figure 12 for the experimental results comparing Bayesian MAP Algorithm 3 with MAP Algorithm 1. The very left column shows the names of the 2 tasks being merged. Below, we define points (pts) as scaling coefficients and evaluation metrics of the corresponding merged models. Please note that the results shown in this figure are the mean of 7 merging tasks that merge 2 models: DTD+Cars, DTD+RESISC45, EuroSAT+RESISC45, GTSRB+Cars, GTSRB+RESISC45, RESISC45+SVHN, SUN397+SVHN. The Pareto front estimated by Bayesian MAP with only one iteration (6+3 pts) is shown in Figure 13.

The experiments are initialized with 6 pairs of $\mathbf{c},\{M_{n}\}_{n=1}^{N}$ (iter 0). In every following iteration, we sample more points following the Bayesian adaptive sampling algorithm. We compare the Bayesian adaptive sampling beginning with 6 points and adding 3 additional points ($6+3$ pts) with running Algorithm 1 with 9 points in a row. We also compare the Bayesian adaptive sampling beginning with 6 points and adding 3 additional points for 2 times ($6+2\times 3$ pts) with running Algorithm 1 with 12 points in a row. We show that, in most cases, utilizing the same number of points, Bayesian adaptive sampling performs better than the run-in-a-row scheme in Algorithm 1.

In conclusion, when the number of data points (scaling coefficients and evaluation metrics of the corresponding merged models) is small, Bayesian MAP Algorithm 3 performs better than MAP Algorithm 1. As the number of data points increases, their performance becomes closer. Thus, we recommend implementing Bayesian MAP when computational resources are very limited and the number of models (tasks) to merge is not high.

Figure: Figure 12: Bayesian MAP compared to MAP. The x-axis represents the number of points used by either MAP or Bayesian MAP, while the y-axis represents the value for IGD or GD. We compared MAP with 6, 9, and 12 points, and Bayesian MAP with 6 initial points, sampling 3 more points each round for two rounds.
Refer to caption: extracted/5900994/imgs/bayesian_exp_mean.png

Figure: Figure 13: (a) This plot shows a failure case of the amortized Pareto front when we only have 6 initial randomly sampled pairs of $(\mathbf{c},\{M_{i}(\theta_{m}(\mathbf{c}))\}_{i=1}^{N})$ (b) After one iteration of Bayesian adaptive sampling for 3 more pairs (9 in total), the amortized Pareto front is much better than the initial Pareto front.

## Appendix F Potential Q & A

In this section, we anticipate and address some potential questions that readers might have.

### F.1 The authors assume a setting where it is computationally expensive to query the model evaluations. But is this the reality?

Yes, to get the Pareto front of tasks that have trade-offs. We need to have a lot of data points to show the trade-off. Here, each data point is the evaluation metric of a model. To get the ground truth evaluation metric of a task (e.g. let’s say classification), we need to run the evaluation script of the model to determine the metric. If we have 4 tasks, and we set 5 possible values (let’s say 0.2, 0.4, 0.6, 0.8, 1) for the scaling coefficient vector of each model specialized for one task. We will have to evaluate $5^{4}=625$ models on all 4 tasks. Assuming each evaluation takes 1 minute, evaluating all the models on all the 4 tasks will take $625\text{ models}\times 4\text{ tasks}\times 1\text{ minute}=2500\text{
minutes}=41.7\text{ hours}$ which is expensive. In big O notation, assuming we have T tasks, the time of evaluation for each task is $T$. The time (computational) complexity is $O(TN2^{N})$.

### F.2 How is MAP different from other MOOP methods, such as linear scalarization?

##### Computational Efficiency

MAP is computationally efficient because it leverages a surrogate model (the quadratic approximation) to estimate the evaluation metrics for different model combinations. Once the quadratic model is learned, solving the optimization problem (approximating the Pareto front) is much faster because the complexity is reduced to optimizing over the quadratic approximation, rather than needing to directly evaluate the task metrics over the entire solution space.

Additionally, MAP doesn’t require gradient descent or re-training when merging models and the surrogate model provides an efficient way to approximate the Pareto front without re-evaluating every model configuration.

On the other hand, linear scalarization involves computing a weighted sum of the objectives and solving it as a single-objective optimization problem. However, it often requires multiple optimization runs with different weight configurations to explore different points on the Pareto front. Since linear scalarization doesn’t model non-linear relationships, it might require more iterations or grid searches over different weights to achieve a decent approximation of the Pareto front. This can become computationally expensive, especially for a large number of tasks or highly complex models.

##### Non-convex Pareto Fronts

Many real-world multi-objective optimization problems have non-convex Pareto fronts, which require more sophisticated methods. While linear scalarization can only explore the convex regions of the Pareto front, NSGA-III allows MAP to discover non-convex regions of the Pareto front. It does this by evolving a population of solutions that are non-dominated (i.e., not Pareto dominated by any other solution) and spreading these solutions across the entire Pareto front, including both convex and non-convex regions.

### F.3 Why does quadratic approximation have a lower cost?

For the MAP algorithm (Algorithm 1), the time complexity is the same as what we mentioned above; what is different is that we fitted an approximation of the evaluation metrics. We only need the scaling coefficient vectors to input to a quadratic function model to be able to get the estimated evaluation score. Running the quadratic function once takes only $3.91\times 10^{-6}s\pm 894\times 10^{-9}s$. Thus, evaluating $2500$ times takes $<2500\times 4\times 10^{-6}s=10^{-2}s$.

### F.4 Why not compare to Git-Rebasin Ainsworth et al. ( 2023 ) ?

We didn’t compare our method to Git Re-Basin because their study focuses on the scenarios of merging the models from different initializations, whereas our background works on the same initialization of different fine-tuned models.

### F.5 Why does nested-merging MAP not give a complete Pareto front?

In nested-merging MAP, we merge the models in pairs. For example, there are $model_{i}$ for task i as individual fine-tuned models where $i=1,2,3,4$. We first merge model 1 and model 2 given the preference of the user between task 1 and task 2. We then get $model_{1,2}$. At the same time, we merge model 3 and model 4 given the preference of the user between task 3 and task 4 and get $model_{3,4}$. Finally, we merge the $model_{1,2}$ and $model_{3,4}$ given the preference of user to get $model_{1,2,3,4}$. We output the $model_{1,2,3,4}$ as the output merged model of the algorithm. Please note that the merging order in the algorithm should be decided by the loss function clustering. It is a heuristic decision and does not always dominate other merging orders. Thus, we choose not to emphasize the contribution of this order. The practitioner may use any order they think can be helpful for the merging.

### F.6 It seems nested-merging MAP performs worse than MAP. What is the meaning of it?

In theory, the surrogate model can be easily fitted when the number of tasks is low. When it is high (e.g. 8), the fit of the surrogate model can no longer be a near-perfect approximation (please find the $R^{2}$ in Table 3). Thus, even if the NMMAP can only find the suboptimal solution, it is still comparable to MAP Algorithm 1 according to Table 9. We understand in general that NMMAP does not find the global optimum, but please kindly keep in mind that even if their performance is comparable, NMMAP takes way less computation for evaluation.

### F.7 Why does nested-merging MAP not output the optimal solution?

The solution found by nested-merging MAP (NMMAP) is indeed suboptimal given the limited search space compared with merging all models at once. However, it does not mean that it is not useful in all situations. When the number of tasks is high, it has comparable performance to MAP while consuming much fewer computations for evaluation.

### F.8 How do you deal with gradient and Hessian in the second-order Taylor expansion?

Notations:

- •
$p$ as the number of parameters in the pre-trained model (also the number of parameters in each task vector).
- •
$\mathbf{V}$ is the matrix of task vectors of different N tasks. Thus, $\mathbf{V}\in\mathbb{R}^{p\times N}$.
- •
$\mathbf{c}$ is the scaling coefficient vector $\in\mathbb{R}^{N}$.
- •
$M_{n}$ is the metric (e.g. accuracy) for the task n.

$$ $\displaystyle M_{n}(\mathbf{c})$ $\displaystyle=\underbrace{M_{n}(\bm{\theta}_{\textup{pre}})}_{\in\mathbb{R}}+ \underbrace{\nabla M_{n}(\bm{\theta}_{\textup{pre}})^{\top}}_{\in\mathbb{R}^{1 \times p}}\underbrace{\mathbf{V}}_{\in\mathbb{R}^{p\times N}}\underbrace{ \mathbf{c}}_{\in\mathbb{R}^{N\times 1}}+\frac{1}{2}\underbrace{(\mathbf{V} \mathbf{c})^{\top}}_{\in\mathbb{R}^{1\times p}}\underbrace{\mathbf{H}_{n}(\bm{ \theta}_{\textup{pre}})}_{\in\mathbb{R}^{p\times p}}\underbrace{\mathbf{V} \mathbf{c}}_{\in\mathbb{R}^{p\times 1}}+\underbrace{R_{n}}_{\in\mathbb{R}}$ (6) $\displaystyle=\underbrace{e_{n}}_{\in\mathbb{R}}+\underbrace{\mathbf{b}_{n}^{ \top}}_{\in\mathbb{R}^{1\times N}}\underbrace{\mathbf{c}}_{\in\mathbb{R}^{N \times 1}}+\underbrace{\mathbf{c}^{\top}}_{\in\mathbb{R}^{1\times N}} \underbrace{\mathbf{A}_{n}}_{\in\mathbb{R}^{N\times N}}\underbrace{\mathbf{c}} _{\in\mathbb{R}^{N\times 1}}$ (7) $$

$$ $\tilde{M}_{n}(\mathbf{c};\mathbf{A}_{n},\mathbf{b}_{n},e_{n})\equiv e_{n}+ \mathbf{b}_{n}^{\top}\mathbf{c}+\frac{1}{2}\mathbf{c}^{\top}\mathbf{A}_{n} \mathbf{c}$ $$

where

$$ $\displaystyle\mathbf{A}_{n}=\mathbf{V}^{\top}\mathbf{H}_{n}(\bm{\theta}_{ \textup{pre}})\mathbf{V}\in\mathbb{R}^{N\times N},\mathbf{b}_{n}=\mathbf{V}^{ \top}\nabla M_{n}(\bm{\theta}_{\textup{pre}})\in\mathbb{R}^{N},e_{n}=M_{n}(\bm {\theta}_{\textup{pre}})+R_{n}$ (9) $$

Please notice that $\mathbf{A}$ is a symmetric matrix.
Specifically, when the number of tasks is 2, we have:

$$ $\displaystyle\tilde{M}_{1}(\mathbf{c};\mathbf{A}_{1},\mathbf{b}_{1},e_{1})$ $\displaystyle\equiv e_{1}+\mathbf{b}_{1}^{\top}\mathbf{c}+\frac{1}{2}\mathbf{c }^{\top}\mathbf{A}_{1}\mathbf{c}$ (10) $\displaystyle=\frac{1}{2}A_{1,11}c_{1}^{2}+A_{1,12}c_{1}c_{2}+\frac{1}{2}A_{1, 22}c_{2}^{2}+b_{1,1}c_{1}+b_{1,2}c_{2}+e_{1}$ (11) $\displaystyle\tilde{M}_{2}(\mathbf{c};\mathbf{A}_{2},\mathbf{b}_{2},e_{2})$ $\displaystyle\equiv e_{2}+\mathbf{b}_{2}^{\top}\mathbf{c}+\frac{1}{2}\mathbf{c }^{\top}\mathbf{A}_{2}\mathbf{c}$ (12) $\displaystyle=\frac{1}{2}A_{2,11}c_{1}^{2}+A_{2,12}c_{1}c_{2}+\frac{1}{2}A_{2, 22}c_{2}^{2}+b_{2,1}c_{1}+b_{2,2}c_{2}+e_{2}$ (13) $$

We don’t calculate the gradient or Hessian to get $\mathbf{A}_{1}$, $\mathbf{A}_{2}$, $\mathbf{b}_{1}$, $\mathbf{b}_{2}$, $e_{1}$ and $e_{2}$.
We use linear regression to estimate them. How? Given a $(c_{1},c_{2})$ pair, we can define a merged model $\bm{\theta}_{\text{merge}}(c_{1},c_{2})$. We evaluate the merged model on task 1 and task 2 to get the metrics (e.g. accuracy). Given 20 pairs of $(c_{1},c_{2})$, we would be able to evaluate and get 20 corresponding, $(M_{1},M_{2})$ which are metrics for task 1 and task 2. Thus, we can fit the surrogate model $\tilde{M}_{1}(\mathbf{c};\mathbf{A}_{1},\mathbf{b}_{1},e_{1})$ and $\tilde{M}_{2}(\mathbf{c};\mathbf{A}_{2},\mathbf{b}_{2},e_{2})$.

## Peer Reviews

confidence: 3
contribution: 3
initial_rating: 8
presentation: 2
questions: N/A
soundness: 3
strengths: The paper does a good job explaining the motivating the idea of using a Pareto frontier when evaluating model merging and a good job explaining their win-rate metric.

The paper gives a good overview of the quadratic approximation of the Pareto frontier.
summary: When merging models (generally finetuned on different tasks), many techniques boil down to a weighted sum (generally of "task vectors", the difference between the finetuned model and the pre-trained model) include _per-model_ scaling parameters. This creates an exponential number of settings and makes it intractable to try all the different possible merges.

Normally, merging methods are evaluated based on their average performance across many tasks, but they point out that this setting ignores the idea that a user may care more about performance on some subset of tasks than others. To capture this, they introduce the metric of the "win rate" how often a model on one method's Pareto frontier outperforms the models on another methods frontier.

They find that by sampling several _per-model_ scaling hyperparameters, they can use a quadratic approximation to create a better Pareto frontier with less computational resources.
weaknesses: The Pareto frontier based metric they use (win rate) is explained well, but during the comparisons to other common merging methods, it would have been nice to see another experiment that used their approach to set merging hyperparameters for those methods to see if greater average performance could be achieved. For example, comparing the avg performance of TIES with the hyperparameters from the original paper vs parameters found by their method.

Often merging methods are also evaluated on if they retain the ability to generalize to new tasks, it would be nice to see some experiments to test the generalization abilities of models merged with hyperparameters found using their method.

They include some talk of using Bayesian optimization for the sampling of hyperparameters and of using nested model merging, but their discussion (intro, methods, results, etc.) for these are so sparse they should probably be cut.

MAP is already a very common acronym for Maximum a Posteriori estimation. This collision will hurt adoption of their approach and is distracting as you need to keep reminding yourself is something else when you see MAP in their paper.

Figure 5 is designed to demonstrate the exponential growth of having _per-model_ hyperparameters. This growth is explained well enough in the paper that such a large figure is not the most effective use of space.

Nit: Lots of places where references appear to be part of the text, where they shouldn't be, i.e., it is Author (year) instead of (Author, year).

---

confidence: 4
contribution: 3
initial_rating: 5
presentation: 2
questions: - In Fig 2 it is not immediately clear to me why the brute force approach of finding the best multitask scaling factor performs worst, also since you call it gold standard. Could you please explain this a bit further? What does the direct search look for exactly? Is it just over Task Arithmetic scaling factors, and if so, what grid is used?
soundness: 3
strengths: - The idea of focusing on trade-offs between tasks for which models are merged and Pareto fronts instead of only a single model merging solution is interesting and a useful reframing of model merging.

- The method is derived from sound theory and can reduce the cost of model merging.

- The method can be used as a plug-in addition to Task-Arithmetic-based merging schemes.
summary: The paper introduces a new model merging method that aims to approximate the pareto front of the performance of various model merging scaling factors by a quadratic approximation of the metric that is used for performance evaluation.
By not requiring a full search over possible scaling factors, the amount of computation that is needed is drastically reduced.
The authors show that this approach is favorable especially for a larger number of tasks, where the number of possible scaling factor combinations increases exponentially.
weaknesses: - The paper overall is not easy to follow. Many details are left to the reader and there is not always a clear flow in writing, requiring the reader to jump back-and-forth. In particular, the following points could be improved:

- Section 2.3: it is not immediately clear why these norms are calculated, because the fact that the method uses taylor approximations is only introduced at the end of it but even then it is unclear how it ties in with the bigger picture, esp. how closeness of parameters may be related to a taylor approximation of the evaluation metric. This could be clarified. In particular, it is directly showing empirical evidence that Assumption 1 may be valid but this only comes in the section afterwards.

- Section 3.1 (the main description of the method) is not written very well. For example, case 2 and 3: why is the "warping" by a sigmoid benificial and why does a softplus help in Case 3? Many details are left for the reader to figure out. Also, it is mentioned that you optimize Eq.5 in L252 but that you do it with gradient descent is loosely thrown in in L283. Overall, Eq.5 could be discussed more, too.

- The nested MAP (nMAP) is only described in Fig. 4 of the main paper and I can not seem to find any description of bMAP at all. Could you please clarify this? While I agree that how nested merging is done is very intuitive a better description would be helpful.

- It would be helpful to discuss related works more, in particular, Rame et al. 2023, who also seek to use Task-Arithmetic-based merging for Pareto fronts of multiple objectives

---

confidence: 4
contribution: 2
initial_rating: 5
presentation: 3
questions: 1. The paper lacks comparative experiments with other established MOOP algorithms, such as MOEA/D and NSGA-II. Including these comparisons would enhance the evaluation of both solution quality and computational efficiency, providing a clearer context for assessing the performance of the proposed method. Additionally, brute force may not be the most appropriate baseline for this type of analysis and could be replaced by a simple MOOP method like MOEA/D.

2. The experiments related to large language models are somewhat limited. Typically, mainstream model fusion effectiveness is tested on benchmarks like math and code tasks, as seen in recent work such as DARE (arXiv: 2311.03099). Including comparisons on these types of benchmarks would lend stronger support to the method’s effectiveness relative to established model fusion approaches.

3. The paper would benefit from additional results or comparative analysis with other state-of-the-art model merging methods, such as Adamerging (ICLR 2024) and DELLA-Merging (arXiv: 2406.11617v1). Adding these would help situate the proposed method within the current landscape and highlight any unique strengths or trade-offs.
soundness: 3
strengths: 1. This is the first algorithm to estimate the Pareto front for task-vector-based model merging without relying on gradient descent, which is often computationally expensive.
  
2. The Nested MAP variant reduces computational complexity, making it suitable for large-scale problems.
summary: The paper introduces Model Merging with Amortized Pareto Front (MAP), a low-compute algorithm that merges multiple single-task models into a multitask model by efficiently identifying a Pareto set of scaling coefficients. MAP uses quadratic surrogate models to reduce evaluation costs while providing flexible solutions to balance competing task objectives.
weaknesses: 1. The motivation for applying Multi-Objective Optimization Problems (MOOP) in model merging needs further clarification. While this work represents a direct application of MOOP in this area, it lacks an in-depth explanation of why MOOP would be advantageous over traditional gradient descent-based methods. 

2. To enhance the clarity and impact of the paper, consider including a direct comparison with gradient descent-based optimization. Specifically, the authors could discuss MOOP’s potential benefits in terms of computational efficiency, ability to handle non-differentiable objectives, flexibility in exploring trade-offs, and its capacity to fully explore the Pareto front, which gradient-based methods may not achieve. This comparison would help elucidate the unique value of MOOP for model merging.

3, The paper would benefit from a more thorough comparative analysis with recent relevant works, particularly "Knowledge Fusion by Evolving Weights of Language Models" and "It's Morphing Time: Unleashing the Potential of Multiple LLMs via Multi-objective Optimization." Both studies propose innovative methods for model merging with evolutionary approaches.
A direct comparison with these methods could clarify the specific advancements and trade-offs associated with the MAP approach, such as variations in fusion strategies, optimization techniques, or performance across diverse benchmarks. Discussing how MAP aligns or diverges in terms of methodology, effectiveness, or scope will provide readers with a more complete understanding of its contribution to the field.

Meta-review: The paper looks at model merging for creating a model to perform on known tasks.  
Current merging methods often propose a single merged models, this paper proposes a new method to create multiple models that have different capabilities as shown by tradeoffs between which evaluated dataset gets better scores. 

Strengths:  
New algorithm. 
Clear claims. 

Weaknesses:  
Presentation.

Decision: Accept (Poster)