Buckets:
SVC: Singular Value Calibration for Model Merging
English | ไธญๆ
Training-free and data-free singular value calibration for robust model merging across shared subspaces.
๐ฐ News
- ๐ฅ2026-05-01: Our paper is accepted by ICML'26. See you all in Seoul, Korea!
- ๐ฅ2026-03-20: We appreciate Anke Tang for including our work in fusion_bench!
- ๐ฅ2026-02-05: We have submitted our paper to arXiv.
๐ Quick Links
๐งญ Contents
- Project Overview
- News
- Quick Start (5 Minutes)
- Detailed Usage Guide
- Project Structure
- Technical Background
- Advanced Usage
- Troubleshooting
๐ Project Overview
Model merging combines multiple fine-tuned models into a single model by adding their weight updates, providing a lightweight alternative to retraining. Existing methods primarily target resolving conflicts between task updates, leaving the failure mode of over-counting shared knowledge unaddressed. We show that when tasks share aligned spectral directions (i.e., overlapping singular vectors), a simple linear combination repeatedly accumulates these directions, inflating the singular values and biasing the merged model toward shared subspaces. To mitigate this issue, we propose Singular Value Calibration (SVC), a training-free and data-free post-processing method that quantifies subspace overlap and rescales inflated singular values to restore a balanced spectrum. Across vision and language benchmarks, SVC consistently improves strong merging baselines and achieves state-of-the-art performance. Furthermore, by modifying only the singular values, SVC improves the performance of Task Arithmetic by 13.0%.
Highlights
- Training-free and data-free post-processing for model merging.
- Targets spectral over-counting in shared singular directions.
- Plug-and-play with common merging baselines (TA, TIES, STAR, TSV-M, Iso-*).
- Strong empirical gains across vision and language benchmarks.
๐ Quick Start (5 Minutes)
1๏ธโฃ Environment Setup
# Create environment from environment.yml
conda env create -f environment.yml -n SVC
conda activate SVC
2๏ธโฃ Prepare Checkpoints
Download from Google Drive and organize:
checkpoints/
โโโ ViT-B-32/
โโโ zeroshot.pt # Pre-trained CLIP
โโโ Cars/finetuned.pt
โโโ DTD/finetuned.pt
โโโ ... (other tasks)
3๏ธโฃ Run Your First Experiment
# Task Arithmetic (baseline)
python main.py --model ViT-B-32 --merge TA
# Task Arithmetic + SVC (calibrated)
python main.py --model ViT-B-32 --merge TA --c
# Try all methods
bash run.sh
โ
Results will appear in logs/ViT-B-32/log_*.txt
๐ Detailed Usage Guide
Command Line Reference
python main.py [OPTIONS]
| Option | Default | Description |
|---|---|---|
--model |
ViT-B-32 | Model architecture (ViT-B-32, ViT-L-14, etc.) |
--merge |
TA | Merging method (TA, TSV-M, etc.) |
--c |
False | Enable Support Vector Calibration |
--alpha |
0.1 | Calibration weight parameter |
--scaling_coef |
1.0 | Task vector scaling factor |
--base_dir |
. | Base directory for checkpoints |
Available Merging Methods
| Method | Description | Best For | Link |
|---|---|---|---|
| TA | Task Arithmetic (simple average) | Baseline, fast | link |
| TIES | Sign-alignment sparse merging | Conflict reduction | link |
| DARE | Randomized task vector selection | Regularization | link |
| TSV-M | Task singular vectors merging | Spectral alignment | link |
| Iso-C | Isolated common subspace | Common-space control | link |
| Iso-CTS | Common + task-specific subspaces | Fine-grained decomposition | link |
| STAR | Spectral task arithmetic | Non-uniform spectrum | link |
Usage Examples
Example 1: Reproduce Baseline Results
python main.py --model ViT-B-32 --merge TA --scaling_coef 0.3
Example 2: Use SVC for Better Performance
python main.py --model ViT-B-32 --merge TA --c --alpha 0.5
Example 3: Compare Multiple Methods
for method in TA WA TIES STAR; do
python main.py --model ViT-B-32 --merge $method --c
done
Example 4: Batch Processing (All Methods)
bash run.sh
๐ Project Structure
SVC/
โโโ main.py # Main entry point
โโโ merge_func.py # All merging algorithm implementations
โโโ run.sh # Batch script to run all experiments
โโโ utils.py # Common utilities
โ
โโโ clip/ # CLIP model implementation
โ โโโ clip.py
โ โโโ model.py # ViT architecture
โ โโโ simple_tokenizer.py # Tokenization
โ
โโโ src/
โ โโโ args.py # Argument parsing
โ โโโ eval.py # Evaluation on multiple datasets
โ โโโ modeling.py # Model instantiation
โ โโโ task_vectors.py # TaskVector class - core data structure
โ โโโ ties_merging_utils.py # TIES algorithm utilities
โ โ
โ โโโ datasets/ # Dataset implementations
โ โโโ registry.py # Dataset registry & factory
โ โโโ common.py # Base dataset class
โ โโโ cifar10.py
โ โโโ cifar100.py
โ โโโ imagenet.py
โ โโโ ... (20+ datasets)
โ
โโโ logs/ # Output logs (auto-created)
โ โโโ ViT-B-32/
โ โโโ log_*.txt
โ
โโโ checkpoints/ # Model checkpoints (external)
โโโ ViT-B-32/
โโโ zeroshot.pt
โโโ */finetuned.pt
๐ Technical Background
Core Concepts
Task Vector: The difference between fine-tuned and pre-trained weights:
Merging Task: Combine n task vectors into a single merged model while preserving knowledge:
Support Vector Calibration: Our proposed method identifies and weights critical parameters for better merging.
Why Task Vector Merging?
- โ No Task ID Needed: Merged model works on all tasks without task-specific routing
- โ Parameter Efficient: Single model replaces N fine-tuned models
- โ Knowledge Preservation: Combines learned knowledge across tasks
- โ ๏ธ Challenge: Preventing negative transfer between tasks
๐ง Advanced Usage
Custom Merging Method
Add new method to merge_func.py:
@torch.no_grad()
def MyMethod(task_vector_avg, task_vectors, config):
"""
Args:
task_vector_avg: Initial averaged task vector
task_vectors: List[TaskVector] of all tasks
config: Configuration object with hyperparameters
Returns:
TaskVector: Merged task vector
"""
# Your implementation
print(f"Processing {len(task_vectors)} task vectors...")
for key in task_vector_avg.vector:
# Modify task_vector_avg.vector[key]
pass
return task_vector_avg
Then register in main.py:
merge_methods = {
'TA': TA,
'MyMethod': MyMethod,
}
Dataset Extension
- Create new dataset class in
src/datasets/:
from src.datasets.common import AbstractDataset
class MyDataset(AbstractDataset):
def __init__(self, root, split='train'):
# Load your dataset
pass
- Register in
src/datasets/registry.py
๐ Experimental Results
Typical evaluation metrics:
- Accuracy per dataset
- Average accuracy across all tasks
- Runtime and memory consumption
Results logged in: logs/ViT-B-32/log_YYYYMMDD_HHMMSS_mainV2.txt
โ ๏ธ Troubleshooting
Problem: Checkpoint Loading Fails
RuntimeError: Unable to load checkpoint
Solution: Use pickle instead of torch.load
import pickle
ckpt = pickle.load(open('checkpoint.pt', 'rb'))
state = ckpt.state_dict() if hasattr(ckpt, 'state_dict') else ckpt
Problem: Slow Evaluation
Solutions:
- Use GPU: ensure CUDA is available
- Reduce number of evaluation samples
- Use multiprocessing in eval.py
๐ Related Work & References
- Task Vectors @ ICLR 2023 - Foundation of task vector concept
- TIES-Merging @ ICLR 2024 - Sign-alignment based merging
- DARE @ ICML 2024 - Data-free parameter merging for large language models
- TSV-M @ CVPR 2025 - Merging via task singular vectors
- Iso-merging @ ICML 2025 - Separates shared and task-specific subspaces for merging
- STAR @ NAACL 2025 - Spectral task arithmetic with adaptive truncation and rescaling
- AdaMerging - Adaptive parameter merging
๐ Citation
If this work helps your research, please cite:
@article{SVC2026,
title={When Shared Knowledge Hurts: Spectral Over-Accumulation in Model Merging},
author={Li, Yayuan and Peng, Ze and Zhang, Jian and Guo, Jintao and Duan, Yue and Shi, Yinghuan},
journal={arXiv preprint arXiv:2602.05536},
year={2026}
}
๐ License
MIT License - See LICENSE file for details
๐ค Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request
ไธญๆ็ๆฌ
ไธๅฅ่ฏ็ฎไป๏ผSVC ๆฏไธ็งๆ ้่ฎญ็ปใๆ ้ๆฐๆฎ็ๅฅๅผๅผๆ กๅๆนๆณ๏ผ็จไบๆๅๅคไปปๅกๆจกๅ่ๅ็็จณๅฎๆงไธๆณๅๆง่ฝใ
๐ ๅฟซ้ๅฏผ่ช
้กน็ฎๆฆ่ฟฐ
SVC ๆฏไธไธชๅ ่ฟ็ๆจกๅ่ๅๆกๆถ๏ผ่ฏฅ้กน็ฎๅบไบ Task Vectors ็็ ็ฉถ๏ผๆๅบไบ ๅฅๅผๅผๆ กๅ๏ผSVC๏ผ ๆนๆณๆฅๅฎ็ฐๅคไธชๅพฎ่ฐๆจกๅ็็จณๅฎ้ซๆ่ๅใ
๐ 5 ๅ้ๅฟซ้ๅผๅง
# 1. ็ฏๅข้
็ฝฎ
conda create -n svc python=3.10 -y
conda activate svc
pip install torch torchvision transformers scipy tqdm Pillow
# 2. ไธ่ฝฝๆจกๅๆฃๆฅ็นๅฐ checkpoints/ViT-B-32/
# 3. ่ฟ่ก็ฌฌไธไธชๅฎ้ช
python main.py --model ViT-B-32 --merge TA
python main.py --model ViT-B-32 --merge TA --c # ไฝฟ็จ SVC
bash run.sh # ่ฟ่กๆๆๆนๆณ
๐ ไฝฟ็จๆๅ
python main.py [OPTIONS]
ไธป่ฆๅๆฐ๏ผ
--model: ๆจกๅๆถๆ (ViT-B-32, ViT-L-14 ็ญ)--merge: ๅๅนถๆนๆณ (TA, WA, SA, TIES, DARE, STAR, iso_c, iso_cts ็ญ)--c: ๅฏ็จๆฏๆๅ้ๆ กๅ--alpha: ๆ กๅๆ้ๅๆฐ--scaling_coef: ไปปๅกๅ้็ผฉๆพ็ณปๆฐ
๐ ๆ ธๅฟๆฆๅฟต
ไปปๅกๅ้๏ผๅพฎ่ฐๆ้ไธ้ข่ฎญ็ปๆ้็ๅทฎ๏ผ
ๅๅนถ็ฎๆ ๏ผๅฐ n ไธชไปปๅกๅ้ๅๅนถๆๅไธชๆจกๅ๏ผๅๆถไฟ็ๆๆไปปๅก็็ฅ่ฏ๏ผ
๐ง ๆฉๅฑไธๅฎๅถ
ๅฏไปฅ่ฝปๆพๆทปๅ ๆฐ็ๅๅนถๆนๆณใๆฐๆฎ้ๅๆจกๅใ่ฏฆ่งๆบ็ ๆณจ้ใ
Xet Storage Details
- Size:
- 12.8 kB
- Xet hash:
- 76a6d862e51b423f574255537c8ad70faf1f41386121d76bee7fe81abaca75a2
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.
