This repository contains the official source code accompanying our paper DisTaC: Conditioning Task Vectors via Distillation for Robust Model Merging.
- Jan 2026: Our paper has been accepted at ICLR 2026!!🥳
In multi-task model merging, we discovered two key failure modes that severely degrade performance:
- 📏 Norm mismatch: Significant differences in task-vector norms across tasks.
- 😟 Low-confidence predictions: Source models who predict with high-entropy outputs.
To address these issues, we introduce DisTaC (Distillation-based Task-Vector Conditioning), a simple and effective pre-conditioning method that leverages knowledge distillation:
- 🎯 Norm Alignment: Adjusts the task-vector norms precisely to avoid merging conflicts.
- 🔥 Confidence Calibration: Enhances low-confidence predictions using temperature-controlled distillation (specifically, using an asymmetric temperature setup).
DisTaC achieves robust model merging with minimal additional computational overhead, effectively eliminating harmful effects caused by norm mismatch and low-confidence predictions.
For full details, experiments, and analyses, please refer to our paper.
pip install -r requirements.txt
Datasets to download:
We are using the same datasets as this repository.
For Cars, the original download link is broken, so please refer to this issue for a workaround. For DTD, EuroSAT, RESISC45, and SUN397, the datasets need to be manually split after downloading. Please refer to this issue for details.
- Download our checkpoints
Under preparation.
- fine-tuned by your own
python src.finetune_wandb.py --model=ViT-B-32 --world-size=2 --save=/path/to/checkpoint/
Please store the files in the following directory structure:
/path/to/checkpoint/
├── head_[dataset_name]_dict.pt # CLIP classification head for the dataset
└── [dataset_name]/
├── finetuned.pt # fine-tuned model weights
└── zeroshot.pt # zero-shot model weights
Conditioning a harmful task vector by DisTaC
Example of performing DisTaC with λ=0.1, T_tchr=10, T_stu=10, β=0.1
python src.distac.py --model=ViT-B-32 --world-size=2 --save=/path/to/checkpoint --norm_lambda=0.1 --distil_T_tchr=10 --distil_T_stu=10 --distil_beta=0.1
python src.eval_task_addtion.py --save=/path/to/checkpoint --model=ViT-B-32
python src.eval_ties_merging.py --save=/path/to/checkpoint --model=ViT-B-32
python src.eval_consensus.py --save=/path/to/checkpoint --model=ViT-B-32
python src.eval_tsvm.py --save=/path/to/checkpoint --model=ViT-B-32