TL;DR
DiDi-Merging introduces a slim dynamic model merging framework that uses differentiable rank allocation to optimally balance shared and task-specific expert parameters. By avoiding the storage-heavy extremes of prior methods, it retains over 98% of fine-tuned model accuracy at just 1.24× the parameter cost of a single model, outperforming baselines that require more than double the storage.
What Problem Does This Paper Address?
Deploying multiple task-specific models fine-tuned from a single large backbone (like Llama or CLIP) is incredibly expensive at scale. While static model merging fuses these models into a single monolithic checkpoint to save space, it suffers from "task interference," where performance degrades across the board.
Dynamic model merging solves this by using a router to dynamically activate task-relevant parameters at inference time. However, existing dynamic methods hit a massive storage bottleneck due to how they split parameters between the shared backbone and task-specific "experts." They typically fall into two failure modes:
- Heavy Shared: Keeping a full-sized shared model alongside tiny per-task experts (e.g., TALL-Mask, FREE-Merging).
- Heavy Expert: Dropping the shared component entirely and pushing all knowledge into per-task expert vectors (e.g., TSV-C, SMILE), causing storage to scale linearly with the number of tasks.
The authors introduce DiDi-Merging (Dynamic Merging with Differentiable Rank) to find the golden mean: a balanced, slim shared-expert architecture.
Methods
DiDi-Merging operates in three main stages, completely free of the original training data:
- Low-Rank Decomposition: Task vectors (the difference between fine-tuned and pre-trained weights) are statically averaged into a shared knowledge vector. The remaining unique features for each task are treated as expert residuals. Both components are then decomposed using Singular Value Decomposition (SVD).
- Differentiable Rank Optimization: Instead of manually tuning the rank (capacity) of the shared and expert modules, the authors formulate parameter budgeting as an end-to-end differentiable optimization problem. They introduce a smooth, continuous truncation function controlled by a learnable rank parameter $r$. Ranks are jointly optimized across all layers and tasks against a joint objective that minimizes task-vector reconstruction error while penalizing total parameter size.
- Data-Free LoRA Refinement: Truncating ranks naturally causes minor accuracy drops. To recover this, the framework instantiates low-rank LoRA-style modules and refines them in a data-free pass, using the original uncompressed task vectors as the reconstruction targets.
Datasets
The authors evaluated DiDi-Merging across three distinct modalities:
- Vision: 8 standard classification benchmarks (including SUN397, Stanford Cars, RESISC45, EuroSAT, SVHN, GTSRB, MNIST, and DTD) using CLIP-ViT-B/32 and ViT-L/14, scaled up to 14 and 20 tasks.
- Large Language Models (LLMs): Four fine-tuned models based on Llama-3.1-8B-Instruct and Qwen-2.5-7B-Instruct evaluated across 10 benchmarks spanning general knowledge (MMLU-Pro), math (GSM8K, MATH), coding (HumanEval, MBPP), and instruction-following (AlpacaEval-2, MT-Bench).
- Multimodal LLMs (MLLMs): Four specialized MLLMs (Vision, Audio, Video, Point Cloud) fine-tuned from Vicuna-7B-v1.5, evaluated on 14 dual-modal QA and captioning tasks (e.g., VQAv2, TextVQA, Clotho, MSVD, ModelNet40).
Key Insights and Ideas
- Task Similarity Dictates Rank Allocation: The optimization automatically discovers task relationships without human intervention. For instance, highly similar tasks (like the digit datasets MNIST and SVHN) naturally receive a much higher shared-rank ratio, whereas distinct tasks reserve more capacity for their specific expert modules.
- Architectural Awareness: The differentiable rank allocation naturally aligns with the underlying transformer architecture. The optimization automatically assigns the lowest ranks to attention-output projections and the highest ranks to MLP modules, matching the relative information density of each layer type.
- Cross-Modal Synergy: In MLLM merging, the dynamically merged model actually exceeded the performance of individual fine-tuned models on certain audio and point-cloud tasks. The shared knowledge base allows instruction-following capabilities to transfer beneficially across modalities.
Key Results
- Vision Merging: At a slim 1.24× parameter budget, DiDi-Merging matches the strongest dynamic baseline (TSV-C) while using less than 60% of its storage overhead. At a 1.4× budget, it achieves the highest overall accuracy (89.8% on ViT-B/32).
- LLM Merging: On the challenging Llama-3.1-8B suite, DiDi-Merging-L (2× budget) outperforms prior dynamic methods by an average of +5.4%, showing massive improvements on instruction-following benchmarks like AlpacaEval-2.
- Compute Efficiency: The framework achieves these results with a very modest compute footprint, requiring only 1.1 GB of GPU memory and roughly 14 minutes of total optimization time on the 8-task vision benchmark.
Limitations and Future Work
The authors note three primary limitations:
- Ideal Router Assumption: The framework currently relies on an MoE-style "ideal router" that knows the task identity at inference time. Developing a router that can infer task identity directly from raw inputs remains future work.
- Storage During Merging: While the final deployed model is slim, the optimization process itself requires access to the full, uncompressed fine-tuned checkpoints to act as targets.
- Sequential Bottleneck: The rank optimization stage currently runs sequentially per task, making it the primary wall-clock bottleneck of the pipeline, though the authors note this could be mitigated via parallelization.
Summary updated