InfiFusion: A Unified Framework for Enhanced Cross-Model Reasoning via LLM Fusion

ABSTRACT

We introduce InfiFusion, an efficient training pipeline designed to integrate multiple domain-specialized Large Language Models (LLMs) into a single pivot model, effectively harnessing the strengths of each source model. InfiFusion overcomes limitations by enhancing Universal Logit Distillation (ULD) with Top-K selection and Logits Standardization. We propose two fusion strategies: Pairwise Fusion and Unified Fusion. InfiFusion outperforms the state-of-the-art models across 11 widely applied benchmarks while significantly reducing computational costs to only 160 H800 GPU hours compared to the millions typically required for traditional LLM training.

Model FusionKnowledge DistillationUniversal Logit DistillationLarge Language ModelsPairwise FusionUnified Fusion
Feb 17, 2025
Zhaoyi Yan, Yiming Zhang, Baoyi He, Yuhao Fu, Qi Zhou, Zhijie Sang, Chunlin Ji, Shengyu Zhang, Fei Wu, Hongxia Yang

Abstract

We introduce InfiFusion, an efficient training pipeline designed to integrate multiple domain-specialized Large Language Models (LLMs) into a single pivot model, effectively harnessing the strengths of each source model. Traditional fusion methods either merge model parameters directly or rely on knowledge distillation with rigid assumptions, limiting their flexibility and efficiency. InfiFusion overcomes these limitations by enhancing Universal Logit Distillation (ULD) with Top-K selection and Logits Standardization. Top-K selection reduces noise by prioritizing the most informative logits, while logits standardization ensures better alignment between models by normalizing logits across diverse models. We propose two fusion strategies: Pairwise Fusion (InfiFusionp_p), where each source model's knowledge is distilled individually into the pivot model followed by merging and Unified Fusion (InfiFusionu_u), where knowledge from all source models is distilled simultaneously into the pivot model. InfiFusion outperforms the state-of-the-art models, such as Qwen-2.5-14B-Instruct and Phi-4, across 11 widely applied benchmarks covering reasoning, coding, mathematics, and instruction-following tasks. Notably, InfiFusion achieves this superior performance while significantly reduces computational costs, completing full training with only 160 H800 GPU hours compared to the millions typically required for traditional LLM training.

Introduction

Large Language Models (LLMs) have demonstrated remarkable success across various tasks such as general reasoning, mathematics, programming, and scientific applications. However, no single model excels in all domains, and training a comprehensive model from scratch requires significant computational resources. An alternative approach is to fuse multiple domain-specialized models into a single pivot model, combining their strengths without requiring retraining a monolithic model.

Traditional LLM merging techniques rely on direct integration of model parameters, but these methods presuppose uniform architectures across models and often fail to capture the strengths of diverse specialized models. LLM fusion typically transfers expertise from source models to the pivot model via knowledge distillation, supporting models with varying architectures and vocabularies. However, the performance is strongly dependent on vocabulary and token alignment, limiting their applicability. The Universal Logit Distillation (ULD) framework addresses this by using the 1-Wasserstein distance to align token distributions across models with different vocabularies. Despite its potential, ULD faces challenges, like zero-padding noise and inefficiencies in large-scale models.

Pivot Model: Phi-4Pivot Model: Qwen-14B
Training GPU hours for different models

Figure 1: Performance of InfiFusion on the pivot models Phi-4 and Qwen2.5-14B-Instruct. In all cases, InfiFusion significantly outperforms the pivot model in terms of average score. Notably, InfiFusion requires only approximately 1/10000 of the GPU hours compared to LLMs, such as Qwen2.5-14B-Instruct, Phi-4, etc.

In this paper, we introduce InfiFusion, a novel fusion framework that enhances ULD by incorporating Top-K selection and logits standardization. Top-K selection filters out irrelevant logits, reducing noise and computational cost, while Logits Standardization ensures that the pivot model aligns the relative relationships between logits rather than their magnitudes. These innovations improve the efficiency and robustness of knowledge transfer, making it possible to integrate specialized models across different domains. We propose two fusion strategies: Pairwise Fusion (i.e., InfiFusionp_{p}), where each source model's knowledge is distilled separately into the pivot model, and Unified Fusion (i.e., InfiFusionu_{u}), which aggregates knowledge from all source models simultaneously. As shown in the figure above, InfiFusion outperforms state-of-the-art models over 11 tasks while significantly reducing computational costs. Unlike traditional models, which demand millions of GPU hours, InfiFusion achieves superior performance with just 160 H800 GPU hours, making it an exceptionally efficient approach.

Our contributions are summarized as follows:

  • We introduce InfiFusion, a novel framework that improves knowledge transfer between domain-specialized models by enhancing Universal Logit Distillation (ULD) with Top-K selection and Logits Standardization.
  • We propose two fusion strategies: Pairwise Fusion and Unified Fusion, each offering distinct advantages in distilling knowledge from multiple source models into a single pivot model.
  • We demonstrate the effectiveness of InfiFusion through extensive experiments, showing that it outperforms state-of-the-art models while significantly reducing computational costs.

Model Merging

Model merging integrates models with the same architecture at the parameter level. Wortsman et al. employed a linear averaging method to merge models that were fine-tuned from the same base model. Matena and Raffel introduced Fisher-based model merging, using Laplace approximation and the Fisher information matrix to enhance parameter merging beyond simple averaging. Ilharco et al. used task vectors to represent the differences among source LLMs and applied task arithmetic on these task vectors to achieve model merging. TIES-Merging builds upon this by trimming redundant values and resolving sign conflicts. DARE facilitates the sparsification of task vectors, eliminating over 90% of the delta parameters while maintaining performance. The SCE method is computationally efficient and memory-conserving, merging parameter matrices using a three-step process. Channel merging clusters and merges channel parameters into several groups offline, significantly reducing parameter conflicts.

Knowledge Distillation

Knowledge Distillation enables transferring knowledge from large models to a smaller one while preserving performance. Early approaches focused on aligning the student model's final layer outputs with the teacher's, known as logits distillation. Feature distillation further improves this by utilizing intermediate teacher model features. Distillation can be classified as on-policy or off-policy depending on whether the data is generated during training. While knowledge distillation is widely studied, most research focuses on single-teacher paradigms, with fewer works exploring multi-teacher combinations, which face challenges like vocabulary mismatch, model parameter differences, and task discrepancies.

Model Fusion

Model fusion combines multiple language models to enhance performance and generalization by integrating their predictions or intermediate representations. Unlike traditional merging methods, fusion does not require parallel deployment or models with identical architectures. Fusion techniques typically rely on logits fusion or distribution matrix fusion, achieved through manually designed functions. For instance, MiniLogit proposes logits fusion for multi-teacher collaborative learning in image classification tasks. FuseLLM introduces a method for fusing diverse LLMs by leveraging their generative distributions, while FuseChat proposes a two-stage framework: first, applying pairwise knowledge fusion to create target LLMs with identical structure and size, and then merging these models within the parameter space. In contrast, our approach offers a highly efficient fusion method based on knowledge distillation.

Methods

Preliminary

We consider a pivot language model (LLM) MoM_o and SS source LLMs {M1,,MS}\{M_1, \ldots, M_S\}, each specializing in distinct domains or tasks. Our objective is to distill the combined strengths of these source models into a single, integrated pivot model MoM_o. Given a dataset D\mathcal{D} of instruction--response pairs, we apply knowledge distillation to guide MoM_o in acquiring complementary expertise from the source models. This process involves defining suitable fusion (distillation) objectives and designing fusion pipelines that integrate diverse knowledge without compromising the overall model quality.

InfiFusion framework

Figure 2: Illustration of the InfiFusion framework, incorporating Top-K selection and logits standardization. Two fusion strategies are proposed: Pairwise Fusion, where each source model's knowledge is distilled separately into the pivot model, and Unified Fusion, which aggregates knowledge from all source models simultaneously.

Supervised Fine-Tuning (SFT). Supervised fine-tuning (SFT) aligns the pivot model MoM_o with instruction-response pairs in the fine-tuning dataset D\mathcal{D}. For each instruction xix_i and its corresponding response yiy_i of length TT, the SFT objective is:

LSFT=E(xi,yi)D[t=1Tlogpθo(yi,tyi,<t,xi)],\mathcal{L}_{\text{SFT}} = -\,\mathbb{E}_{(x_i, y_i) \sim \mathcal{D}} \Bigl[ \sum_{t=1}^{T} \log p_{\theta_o}\bigl(y_{i,t} \mid y_{i,<t}, x_i\bigr) \Bigr],

where yi,<ty_{i,<t} denotes the tokens preceding yi,ty_{i,t} and pθo()p_{\theta_{o}}(\cdot) is the model-predicted token probability under MoM_o.

Optimal Transport Loss. OT provides a powerful way to compare two discrete distributions by solving a "mass transport" problem. Formally, let pp and qq be two discrete distributions over vocabularies of size VoV_o and Vs V_s, respectively.. We define:

OT(p,q)=minγΠ(p,q)m=1Von=1Vsγm,nCm,n.\mathrm{OT}(p, q) = \min_{\gamma \in \Pi(p,q)} \sum_{m=1}^{V_o} \sum_{n=1}^{V_s} \gamma_{m,n} \, C_{m,n}.

Here, Π(p,q)\Pi(p,q) is the set of joint distributions with marginals pp and qq. The cost matrix Cm,nC_{m,n} encodes the cost of "transporting" one unit of mass from token mm to nn. In practice, Sinkhorn-based methods with entropic regularization can be used to approximate the above efficiently.

Discrete 1-Wasserstein. An important special case of OT is the 1-Wasserstein distance (also called the Earth Mover's Distance). In discrete settings, W1(p,q)\mathcal{W}_1(p,q) is obtained by choosing a particular cost matrix. For instance, if we set Cm,n=1C_{m,n}=1 (i.e., uniform cost whenever mnm\ne n), the 1-Wasserstein distance has a closed-form solution:

W1(p,q)=i=1V\mboxsort(p)i\mboxsort(q)i\mathcal{W}_{1}(p,q)=\sum^{V}_{i=1}|\mbox{sort}(p)_i-\mbox{sort}(q)_i|

Let V=max(Vo,Vs)V=\max \bigl(V_o, V_s\bigr) be the effective vocabulary size, we augment either the student or teacher vocabulary size through distribution padding (with 0 value), ensuring equal support size for both. where sort(p)sort(p) rearranges the probabilities in pp in descending order. Intuitively, under uniform cost, the optimal transport simply pairs "largest probability mass" with "largest probability mass," the second-largest with the second-largest, and so on. This makes W1\mathcal{W}_1 particularly simple and effective for aligning distributions whose labels (tokens) may not match one-to-one.

Universal Logit Distillation Loss. To effectively transfer knowledge from multiple source models to the pivot model MoM_o, we adopt Universal Logit Distillation (ULD) loss, which aligns probability distributions across different vocabularies using a structured distance metric. Given a source model MsM_s with vocabulary Vs\mathcal{V}_s and the pivot model MoM_o with vocabulary Vo\mathcal{V}_o, their predicted probability distributions at time step tt are denoted as Pθo(x~<t)P_{\theta_o}(\cdot \mid \tilde{x}_{<t}) and Pθs(x^<t)P_{\theta_s}(\cdot \mid \hat{x}_{<t}), respectively. Since these distributions may not be directly comparable due to vocabulary mismatches, ULD loss mitigates this issue by minimizing the 1-Wasserstein distance:

LULD=t=1TW1(Pθo(x~<t),Pθs(x^<t)).\mathcal{L}_{\text{ULD}} = \sum_{t=1}^{T} \mathcal{W}_1\big( P_{\theta_o}(\cdot \mid \tilde{x}_{<t}), P_{\theta_s}(\cdot \mid \hat{x}_{<t}) \big).

Here, W1\mathcal{W}_1 measures the effort required to transform one probability distribution into another by optimally aligning their probability masses. Unlike KL-divergence, which is sensitive to label mismatches, ULD loss provides a more robust way to distill knowledge across different vocabularies while preserving the semantic structure of the predictions.

Top-K Selection and Logits Standardization

To improve the distillation process, we introduce two strategies: Top-K selection and logits standardization. These techniques aim to enhance knowledge transfer while addressing temperature sharing and vocabulary mismatches between the pivot model MoM_o and the source models {M1,,MS}\{M_1, \ldots, M_S\}.

Top-K Selection. We focus on the top-KK logits for both the pivot model MoM_o and each source model MsM_s, instead of using the entire logit distribution. This is based on the observation that most logits in instruction-based models correspond to low-probability categories, contributing little to the distillation process. By selecting the top-KK logits, we reduce noise from irrelevant categories, improving both knowledge transfer quality and computational efficiency. For high-performance instruction models, such as Phi-4, a small value of KK (e.g., K=10K=10) captures nearly all the probability mass, enhancing distillation while reducing the computational burden of comparing all logits.

Logits Standardization. To address challenges in temperature sharing, we apply logits standardization to the logits before distillation. Traditional methods assume a shared temperature between the models, which can cause performance issues when the logits' ranges differ. By normalizing the logits, we decouple the magnitude of the logits from the distillation process, allowing the pivot model to focus on their relative order and structure. The logits for both models are normalized as follows:

l^o,t=lo,tμoσo,l^s,t=ls,tμsσs,\hat{l}_{o, t} = \frac{l_{o, t} - \mu_{o}}{\sigma_{o}}, \quad \hat{l}_{s, t} = \frac{l_{s, t} - \mu_{s}}{\sigma_{s}},

where μo\mu_o, σo\sigma_o, μs\mu_s, and σs\sigma_s are the mean and standard deviation of the top-K logits for the pivot and source models, respectively. This ensures that the pivot model aligns effectively with the source models, focusing on the relative relationships between logits rather than their magnitudes. Combined with Top-K selection, this preprocessing step ensures more robust and efficient distillation, even when logit distributions differ.

Fusion Strategies

Pairwise Fusion

To integrate knowledge from multiple source models {M1,,MS}\{M_1, \dots, M_S\} into the pivot model MoM_o, we adopt a pairwise fusion strategy, where each source model's knowledge is distilled into MoM_o separately. This fusion is performed by minimizing the Universal Logit Distillation (ULD) loss, incorporating both Top-K selection and logit normalization to enhance the alignment process.

For each source model MsM_s, we first apply Top-K selection to the original logits zsz_s, retaining the most informative logits lsl_s, i.e., ls=TopK(zs,K)l_s = \text{TopK}(z_s, K). We then normalize the logits using logits standardization. The resulting loss is computed as:

Lpair,s=E(xi,yi)D[t=1Tl^o,tl^s,t],\mathcal{L}_{\text{pair}, s}= \mathbb{E}_{(x_i, y_i) \sim \mathcal{D}} \Big[ \sum_{t=1}^{T} \Big| \hat{l}_{\text{o}, t} - \hat{l}_{\text{s}, t} \Big| \Big],

where l^o,t\hat{l}_{\text{o}, t} and l^s,t\hat{l}_{\text{s}, t} are the normalized logits for the student and teacher models, respectively, at time step tt. By minimizing this loss, we encourage the student model to align its predictions with the teacher's on the most probable tokens, while reducing the impact of irrelevant logits. Let Mo,sM_{o,s} be the optimized pivot model, its parameters are θo,s\theta_{o,s} are obtained via:

θo,s=argminθoλLpair,s+(1λ)LSFT\theta_{o,s} = \arg\min_{\theta_o}\lambda \mathcal{L}_{\text{pair}, s} + (1-\lambda )\mathcal{L}_{\text{SFT}}

λ\lambda is the hyper-parameter balancing the losses. By looping ss from 11 to SS, which indicates we perform SS times of training, we obtain Mo,1,Mo,SM_{o,1}, \cdots M_{o,S}. Given {Mo,s}s=1S\{M_{o,s}\}_{s=1}^{S} share the same architecture, they can be merged via model merging methods and obtain the final model Mo,pairM_{o,\text{pair}}.

Mo,pair=Merge(Mo,1,,Mo,S)M_{o, \text{pair}} = \text{Merge}(M_{o,1}, \cdots, M_{o,S})

Unified Fusion

To aggregate knowledge from multiple teacher models, we adopt a unified fusion strategy. In this approach, the knowledge from each source model is distilled into the pivot model by computing the pairwise fusion loss for each teacher, summing the losses, and combining them with the supervised fine-tuning (SFT) loss to form the final objective function. For each source model MsM_s, the pairwise fusion loss Lpair,s\mathcal{L}_{\text{pair}, s} is computed using Top-K selection and logits standardization. The total loss is then given by:

Luf=λs=1SLpair,s+(1λ)LSFT,\mathcal{L}_{\text{uf}} = \lambda\sum_{s=1}^{S} \mathcal{L}_{\text{pair}, s} + (1 - \lambda) \mathcal{L}_{\text{SFT}},

where λ\lambda controls the balance between the distillation and supervised fine-tuning losses. The parameters of the pivot model MoM_o are optimized as:

θo,uf=argminθoλs=1SLpair,s+(1λ)LSFT.\theta_{o, \text{uf}} = \arg\min_{\theta_o} \lambda \sum_{s=1}^S \mathcal{L}_{\text{pair}, s} + (1 - \lambda) \mathcal{L}_{\text{SFT}}.

The result of this fusion process is the unified pivot model Mo,ufM_{o, \text{uf}}, which benefits from both the labeled data in the fine-tuning dataset and the distilled knowledge from the source models, focusing on the most relevant logits via Top-K selection and logits standardization.

Pairwise fusion and unified fusion are proposed as two independent approaches for achieving multi-source model fusion. They are based on different assumptions. Specifically, unified fusion defines an explicit global loss and assumes that the optimal weights for this loss will yield the best performance. In contrast, pairwise fusion defines an objective loss implicitly. It aims to achieve local optimization and assumes that the average of these local optima will result in the best overall performance. We provide a detailed theoretical analysis about the relation between pairwise fusion and unified fusion in the Appendix.

Experiments

Settings

Dataset. In our fusion experiments, we create an InfiFusion-Mix dataset, which consists of 180,000 samples used for facilitating knowledge transfer from the source model to the pivot model. The samples in this dataset are sourced from Infinity-Instruct, ScaleQuest-Math, and opc-sft-stage2. The InfiFusion-Mix dataset is split into train and test sets at an 8:2 ratio, resulting in 144k training and 36k test samples.

TypesGeneral DataMath DataCode Data
DatasetInfinity-InstructScaleQuest-Mathopc-sft-stage2
Original Size1.4M1.0M436K
Sample Size80K50K50K

Training Details. We train all models using the C-AdamW optimizer with a cosine annealing scheduler for a total of 5 epochs. Early stopping is applied at the 4th epoch to prevent overfitting and reduce GPU costs. The entire training of InfiFusionu_u takes approximately 20 hours, utilizing a global batch size of 16 across 8×808\times80GB NVIDIA H800 GPUs, with a learning rate of 1×1061 \times 10^{-6}. By default, we set λ=0.5\lambda = 0.5.

Offline Teacher Loading. Since the source models are static, we can pre-extract their hidden states (before the lm_head layer). For each source model, the hidden states are first compressed and stored on disk, requiring approximately 1.5 TB for InfiFusion-Mix. Each source model only retains a single fully connected layer (i.e., lm_head), which significantly speeds up the InfiFusion training process, making it comparable to the training of pure SFT models. Moreover, this approach greatly reduces the GPU memory footprint of fusion.

Evaluation. We evaluate our models across multiple domains, using 11 different benchmarks that cover a wide range of fields, including general reasoning, mathematics, coding, and text reasoning. Specifically, we assess the model's mathematical capabilities with benchmarks such as GSM8K, Math, and TheoremQA. For coding, we use MBPP+ and HumanEval, while general reasoning is evaluated through BBH, ARC-C and MMLU. We also test instruction-following ability with IFEval, and text reasoning performance using DROP and Hellaswag.

Pivot Model and Source Models. Before choosing the pivot model, we evaluate the performance of state-of-the-art open-source LLMs across 11 benchmarks. To maintain both high training efficiency and strong performance, we select the powerful instruction-following model Phi-4 as the pivot model, and use Qwen2.5-Coder-14B-Instruct, Qwen2.5-14B-Instruct, and Mistral-Small-24B-Instruct-2501 as the source models. By fusion, the strengths of the source models are aggregated and integrated into the pivot model.

Main Results

ModelsGSM8KMATHThQAMBPP+HEvalBBHARC-CMMLUIFEvalDROPHSAvgParamsGPU Hours
Pivot Model
Phi-486.8874.1036.1264.2982.9365.9086.7881.3876.5088.4985.5775.0814B~1.0M
Source Models
Qwen2.5-14B-Coder88.2570.2430.8872.7589.6371.0787.1273.8476.6284.4981.0875.0914B~1.8M
Qwen2.5-14B-Instruct90.1474.3219.5069.0479.8872.7088.8179.3886.3385.5086.5575.6514B~1.8M
Mistral-small-24B92.7269.4840.3867.2279.2781.6785.0878.9283.2186.6886.7177.3924B~1.6M
SFT
SFT (Phi-4)90.7571.9637.8871.0078.0583.0392.8880.2877.2287.6986.7977.9614B145
Model Fusion via Distillation
SeqKD*89.2373.0628.6269.8081.1081.0392.8879.9782.1387.4075.3476.4114B580
MiniLogit*90.3373.3441.4969.2282.4181.3691.1980.1578.4187.5686.9978.4014B220
FuseLLM*89.9572.7641.2869.4481.3482.1791.6379.7478.9486.9786.8678.2814B225
FuseChat*89.8674.2144.0670.1882.1981.7791.0879.6678.0987.9486.6778.7014B650
Pairwise Fusion
InfiFusionp_p & TA90.9874.7046.5072.2082.9383.6292.2080.3479.8688.7387.5279.9614B450
InfiFusionp_p & TIES90.2274.3242.1272.7585.9883.1991.1980.4879.1488.5387.7379.6014B450
InfiFusionp_p & SCE90.2274.4042.0070.6085.3783.2491.1980.3780.3488.6087.7279.4614B450
Unified Fusion
InfiFusionu_u90.4574.9245.7573.0282.9383.4492.8880.1879.5088.7187.3879.9214B160

* denotes methods re-implemented and trained on our dataset, pivot, and source models.

InfiFusionu_u achieves nearly identical performance (79.92 vs. 79.96) compared to InfiFusionp_p & TA, while utilizing only approximately 35% of the GPU hours (theoretically approximated as 1/S1/S, and here S=3S=3). InfiFusionu_u achieves 79.92 (vs. 75.08 for Phi-4), while requiring only about 0.016% of the GPU hours. TA, TIES, and SCE represent different merging methods.

Pairwise and Unified Fusion

Pairwise Fusion. In pairwise fusion, the pivot and source models are grouped into several model pairs. Each pair is then trained using the pairwise fusion loss, resulting in SS fused models. These SS fused models share the same architecture as the pivot model but have distinct weights. They are subsequently merged using commonly used methods, such as Task Arithmetic, Ties-Merging, and SCE. As shown in the table above, the pairwise fused model outperforms the pivot model, Phi-4, across 10 benchmarks. Specifically, the InfiFusionp_p & TA model achieves an average score improvement of 4.88 points. Additionally, InfiFusionp_p significantly surpasses the source models, with average score improvements of 4.87, 4.31, and 2.57 for Qwen2.5-14B-Coder, Qwen2.5-14B-Instruct, and Mistral-small-24B, respectively. We observe that TIES and SCE exhibit moderate performance drops compared to TA. We attribute this to the presence of a hyperparameter, τ\tau, in both methods, which demands precise tuning. In this study, we use the default value to emphasize the robustness of the InfiFusion approach. While more precise tuning of this hyperparameter could potentially enhance performance, such an investigation lies beyond the scope of this paper.

Unified Fusion. In unified fusion, all source models are fused with the pivot model simultaneously. However, this approach presents two key challenges: token misalignment and conflicts arising from the diversity of source models. To address these, we introduce a ULD loss and a Top-K selection mechanism. The ULD loss provides an effective way to measure the distance between distributions of different sizes, mitigating issues caused by token misalignment. Meanwhile, the Top-K selection reduces noise from small logits and alleviates conflicts stemming from the varying styles of the source models.

As shown in the table above, unified fusion, which leverages the strengths of the source models, significantly outperforms the pivot model by 4.84 points. Similarly, when compared to the source models, InfiFusionu_u surpasses them, with average score improvements of 4.83, 4.27, and 2.53 for Qwen2.5-14B-Coder, Qwen2.5-14B-Instruct, and Mistral-small-24B, respectively. InfiFusionu_u delivers performance nearly identical to InfiFusionp_p & TA, with only a 0.04-point difference on average, while consuming only 35% of the GPU hours required by InfiFusionp_p & TA.

Comparison with State-of-the-art Methods

We evaluate five methods: SFT, SeqKD, MiniLogit, FuseLLM, and FuseChat. SFT involves directly fine-tuning the Phi-4 model on our InfiFusion-Mix dataset with only the SFT loss. The performance improves from 75.08 to 77.96, demonstrating the effectiveness of InfiFusion-Mix. With the incorporation of the fusion loss, performance improves further to 79.92 for InfiFusionu_u and 79.96 for InfiFusionp_p, highlighting the efficacy of our fusion approach. SeqKD generates data using all the source models, where each model generates the same volume of InfiFusion-Mix data, thereby expanding the training dataset. However, despite the addition of SS (here S=3S=3) times more generated data, SeqKD results in worse performance than SFT. This suggests that simply adding more generated data may lead to confusion for the pivot model. MiniLogit and FuseLLM both utilize unified fusion. MiniLogit, a commonly used logit fusion method for image classification tasks, and FuseLLM, which applies a simple MinCE distribution fusion for LLMs, both yield lower performance than InfiFusion. This is attributed to the superiority of ULD with Top-K selection and logits standardization compared to the KL divergence loss used by these methods. FuseChat adopts pairwise fusion, achieving a moderate higher average score than FuseLLM, but at the cost of requiring nearly SS (here S=3S=3) times more GPU resources for training.

Ablation Study

Logits Standardization and Top-K Selection. To evaluate the impact of logits standardization and Top-K selection, we compare models trained with and without these techniques. As shown in the following table, applying only Top-K selection results in a notable performance improvement, from 79.02 to 79.66. In contrast, logits standardization alone yields a smaller gain. When both techniques are combined, InfiFusionu_u achieves further performance improvements, reaching 79.92. These results suggest that focusing on the most informative logits can be effective.

MethodTop-K SelectionLogits StandardizationAvg
InfiFusionu_u79.02
InfiFusionu_u79.66
InfiFusionu_u79.29
InfiFusionu_u79.92

Number of Source Models. Next, we explore the effect of increasing the number of source models in the fusion process. Specifically, we investigate two configurations: (1) fusing the pivot model with a single source model, and (2) fusing the pivot model with multiple source models simultaneously using the pairwise/unified fusion strategy. The following table presents the results of this ablation study.

ModelsQwen-CoderQwen-InstructMistralAvg.GPU Hours
Pivot model: Phi-4
Phi-4 SFT---77.96145
InfiFusionp_p
79.56300
79.40300
79.39300
79.96450
InfiFusionu_u
78.70150
78.65150
79.61150
79.54155
79.45155
79.31155
79.92160

It is evident that when fusing a single source model, the average score improves from 77.96 to 78.70, 78.65, and 79.61, for Qwen2.5-Coder-14B, Qwen2.5-14B-Instruct and Mistral-small-24B, respectively. As more source models are fused, both pairwise and unified fusion strategies yield substantial performance improvements. Notably, InfiFusionu_u exhibits performance close to that of InfiFusionp_p, while requiring approximately 1/S1/S of the training GPU hours.

Value of KK. We also investigate the effect of varying the value of KK in Top-K selection. From the following table, we observe that when KK is too small (i.e., K<10K<10), the knowledge transfer quality decreases due to too few logits being considered during fusion. Conversely, when KK is too large (i.e., K>10K>10), noise is introduced, which degrades performance. Consequently, we select K=10K=10 as it yields the best performance. Interestingly, this aligns with our observation that for high-performance instruction models like Phi-4, a small value of KK (e.g., K=10K=10) captures nearly all of the probability mass.

KK510152025
Avg.79.5479.9279.4679.4179.39

Dataset Scaling. We conduct an ablation study to assess the impact of data scaling on InfiFusion by varying the size of the training dataset. Specifically, we train models with datasets ranging from 50k to 144k instruction-response pairs. As shown in the following table, increasing the training data size consistently improves InfiFusion's performance. This emphasizes the value of dataset scaling and indicates that our method benefits from larger datasets, leading to enhanced performance.

Dataset Scale50,000100,000144,000
Avg.79.2479.4979.92

Conclusion

We present InfiFusion, an innovative framework that seamlessly integrates domain-specialized LLMs into a unified pivot model, enhancing Universal Logit Distillation (ULD) through Top-K selection and logits standardization. InfiFusion effectively distills knowledge from diverse source models, overcoming vocabulary mismatches and computational inefficiencies. Two fusion strategies, Pairwise Fusion (InfiFusionp_p) and Unified Fusion (InfiFusionu_u), offer flexibility in merging expertise. Experiments reveal that InfiFusion surpasses state-of-the-art models, such as Qwen-2.5-14B-Instruct and Phi-4, across 11 benchmark tasks, achieving superior performance with only 160 H800 GPU hours. InfiFusion stands as an efficient and scalable solution for high-performance LLM deployment.

Limitations

While our unified fusion approach offers a straightforward and promising framework, it does not consistently outperform the pairwise fusion strategy. Additionally, the current method is limited to large language models (LLMs), and the fusion of models similar to GPT-O1 has not yet been explored. Another limitation is that the source models should not lag too far behind the pivot model in terms of performance, which restricts the selection of viable source models. In future work, we aim to relax this constraint, allowing for more flexible model selection. We also plan to extend our fusion approach to include both traditional instruct LLMs and GPT-O1-like models, thereby broadening the scope of model capabilities.

Appendix

The Relationship between Unified and Pairwise Fusion

In this session, we analyze the relationship between unified fusion and pairwise fusion. First, we will generalize the loss function for unified fusion.

Luf=λ0LSFT+s=1SλsLpair,s\mathcal{L}_{\text{uf}} = \lambda_0\mathcal{L}_{\text{SFT}} + \sum_{s=1}^{S} \lambda_s\mathcal{L}_{\text{pair},s}

where λs=1\sum\lambda_s = 1, LSFT\mathcal{L}_{\text{SFT}} and Lpair,s\mathcal{L}_{\text{pair},s} is defined above, respectively. Therefore, to find the optimal θ\theta for the Unified is to solve the optimization problem:

θo,uf=argminθoλ0LSFT+s=1SλsLpair,s\theta_{o,\text{uf}} = \arg\min_{\theta_o} \lambda_0\mathcal{L}_{\text{SFT}} + \sum_{s=1}^{S} \lambda_s\mathcal{L}_{\text{pair},s}

In the scenario of the pairwise fusion, we can obtain {θo,s}s=1S\{\theta_{o,s}\}_{s=1}^{S} fused models, where we have

θo,s=argminθoαsβsLSFT+αs(1βs)Lpair,s.\theta_{o,s} = \arg\min_{\theta_o} \alpha_s\beta_s\mathcal{L}_{\text{SFT}} + \alpha_s(1-\beta_s)\mathcal{L}_{\text{pair},s}.

where αs\alpha_s is a scaling factor and αs=1\sum \alpha_s=1. Let

Ls=αsβsLSFT+αs(1βs)Lpair,s.\mathcal{L}_{s} = \alpha_s\beta_s\mathcal{L}_{\text{SFT}} + \alpha_s(1-\beta_s)\mathcal{L}_{\text{pair},s}.

Note that when λ0=s=1Sαsβs\lambda_0 = \sum_{s=1}^{S}\alpha_s\beta_s, (1βs)=λs(1-\beta_s) = \lambda_s, we have

Luf(θ)=s=1SLs(θ).\mathcal{L}_{\text{uf}}(\theta) = \sum_{s=1}^{S}\mathcal{L}_{s}(\theta).

The optimization problem can be rewritten as

θo,uf=argminθos=1SLs(θo),\theta_{o,\text{uf}} = \arg\min_{\theta_o} \sum_{s=1}^{S}\mathcal{L}_{s}(\theta_o),

and for s=1,2...,Ss=1,2...,S, can be written as:

{θo,s}s=1S=argminθo1,...,θoSs=1SLs(θos).\{\theta_{o,s}\}_{s=1}^{S} = \arg\min_{\theta_{o}^1,...,\theta_{o}^S}\sum_{s=1}^{S}\mathcal{L}_{s}(\theta_{o}^s).

The final fused model θo,ps\theta_{o, \text{ps}} is derived via weight averaging

θo,ps=s=1Sαsθo,s\theta_{o,\text{ps}} = \sum_{s=1}^{S}\alpha_s\theta_{o,s}

In unified fusion, the loss L\mathcal{L} can be explicitly written in a function of Li\mathcal{L}_i

L(L1,L2,...,LS)=s=1SLs\mathcal{L}(\mathcal{L}_{1},\mathcal{L}_{2},...,\mathcal{L}_{S}) = \sum_{s=1}^{S}\mathcal{L}_{s}

whereas for the pairwise fusion, L\mathcal{L} is not explicitly defined. However, we can assume that the L\mathcal{L} exists such that when

Lsθθ=θo,s=0,\frac{\partial \mathcal{L}_s}{\partial\theta}\bigg|_{\theta = \theta_{o,s}}=0,

we have

Lθθ=s=1Sαsθo,s=0.\frac{\partial \mathcal{L}}{\partial\theta}\bigg|_{\theta = \sum_{s=1}^{S}\alpha_s\theta_{o,s}}=0.

Ideally, unified fusion can infinitely approximate the global optimum of its defined objective function, but it highly depends on the effectiveness of the loss function. Therefore, a well-designed loss, which is favorable for network optimization, mitigates the conflicts between source models and reflects the real world evaluation becomes essential. By comparison, pairwise fusion looks like an experimental tool, as no theory can support the assumption that the average of local optima can lead to the high performance. The future work should be centered around improving the merging methods, instead of simply averaging but more complexity combinations of the local optima.

Model Selection

The guiding philosophy of InfiFusion is to elevate the capabilities of smaller LLMs through the strategic fusion and integration of models, thereby enabling the efficient attainment of high-performance, compact LLMs. Accordingly, we focus our evaluation on state-of-the-art models with fewer than 30B parameters. For the purpose of efficient training on a single node equipped with 8×808\times80GB H800 GPUs, we impose an additional constraint, limiting the pivot model to fewer than 20B parameters. To achieve optimal performance, we select Phi-4 as the pivot model and include Qwen2.5-14B-Instruct, Qwen2.5-Coder-14B-Instruct, and Mistral-Small-24B-Instruct-2501. These models have demonstrated performance either on par with or exceeding that of the pivot model.

ModelsGSM8KMATHThQAMBPP+HEvalBBHARC-CMMLUIFEvalDROPHSParamsAvg
Opencoder-8B-Instruct31.5410.9214.5063.8081.1046.0849.8342.2454.0839.6943.208B43.36
Llama3.1-8B-Instruct79.7849.0432.3859.4068.2967.7881.6969.5085.1382.3473.848B68.11
phi-486.8874.1036.1264.2982.9365.9086.7881.3876.5088.4985.5714B75.08
DeepSeek-Coder-V2-Lite-Instruct85.0660.2019.8872.4075.0062.2271.5362.6262.8374.6368.0114B64.94
Qwen2.5-14B-Instruct90.1474.3219.5069.0479.8872.7088.8179.3886.3385.5086.5514B75.65
Qwen2.5-Coder-14B-Instruct88.2570.2430.8872.7589.6371.0787.1273.8476.6284.4981.0814B75.09
Falcon3-10B-Instruct54.6646.4645.8866.2071.9575.7851.5374.6383.3378.0681.5710B66.36
Llama-3.1-Tulu-3-8B82.2645.5629.2547.0063.4168.7365.7665.8187.4176.6471.748B63.96
Qwen-2.5-Coder-7B-Instruct81.7362.1022.6272.2087.8060.4584.4166.1669.3077.9276.207B69.17
starcoder2-15b-instruct-v0.124.4113.9618.0062.4065.8518.9944.7549.6046.4050.9124.0515B38.12
OpenMath2-Llama3.1-8B85.3765.6825.2514.009.1545.3345.0832.2932.0174.4232.068B41.88
internlm3-8b-instruct85.1472.4618.6257.8080.4955.6277.9773.2686.8183.3989.768B71.03
Mistral-Small-24B-Instruct-250192.7269.4840.3867.2279.2781.6785.0878.9283.2186.6886.7124B77.39

Case Study

The following table shows three examples where Phi-4 is wrong but InfiFusionu_u is correct. These three problems come from GSM8K, HumanEval, and Hellaswag, corresponding to math, coding, and text reasoning domains. Phi-4 misunderstood the phrase 'two times older than' in the question from GSM8K. For the problem from HumanEval, Phi-4 got the index of the number for the quantity of oranges wrong. Phi-4 also failed to make the correct reasoning in the question from Hellaswag, where Option A, 'cuts something on a knife board using an electric tool,' represents an impossible action. These errors were corrected in InfiFusionu_u, indicating that InfiFusionu_u indeed performs better on more tasks and possesses stronger reasoning capabilities.

Case 1: GSM8K (Math)

Prompt: Brandon's iPhone is four times as old as Ben's iPhone. Ben's iPhone is two times older than Suzy's iPhone. If Suzy's iPhone is 1 year old, how old is Brandon's iPhone? Please reason step by step, and put your final answer within \boxed.

Phi-4: Determines Ben's iPhone is 1+2×1=31 + 2 \times 1 = 3 years old, then Brandon's iPhone is 4×3=124 \times 3 = 12 years old. Final answer: 12\boxed{12}.

InfiFusionu_u: Determines Ben's iPhone is 2×1=22 \times 1 = 2 years old, then Brandon's iPhone is 4×2=84 \times 2 = 8 years old. Final answer: 8\boxed{8}.

Case 2: HumanEval (Coding)

Prompt: Implement fruit_distribution(s, n) that takes a string like "5 apples and 6 oranges" and a total number of fruits, and returns the number of mango fruits.

Phi-4: Uses oranges = int(words[4]) which gets the wrong index for the number of oranges.

def fruit_distribution(s, n):
    words = s.split()
    apples = int(words[0])
    oranges = int(words[4])
    mangoes = n - apples - oranges
    return mangoes

InfiFusionu_u: Iterates through the words to find the numbers before "apples" and "oranges", correctly handling the input format.

def fruit_distribution(s, n):
    fruits = s.split()
    apples = 0
    oranges = 0
    for i in range(len(fruits)):
        if fruits[i] == "apples":
            apples = int(fruits[i-1])
        elif fruits[i] == "oranges":
            oranges = int(fruits[i-1])
    mangoes = n - apples - oranges
    return mangoes

Case 3: Hellaswag (Text Reasoning)

Prompt: A woman is reading a newspaper nearby while he speaks to her and shows her something in his hand. The man sharpens his knives using an electric tool. He — Question: Which ending makes the most sense? A. sharpens and cuts something on a knife board using an electric tool. B. then continues cutting his onion. C. travels with his knife under the table and uses it also in his shoe. D. then shows her a spare knife that he has also used on a knife sharpener and drills into a side of the table.

Phi-4: Chose A — "sharpens and cuts something on a knife board using an electric tool." This is an impossible action.

InfiFusionu_u: Chose B — "then continues cutting his onion." This is the correct and logical continuation.

BibTeX

@article{yan2025infifusion,
  title={InfiFusion: A Unified Framework for Enhanced Cross-Model Reasoning via LLM Fusion},
  author={Zhaoyi Yan, Yiming Zhang, Baoyi He, Yuhao Fu, Qi Zhou, Zhijie Sang, Chunlin Ji, Shengyu Zhang, Fei Wu, Hongxia Yang},
  journal={arXiv preprint arXiv:2501.02795},
  year={2025}
}