Gradient-Sign Masking for Task Vector Transport Across Pre-Trained Models

Filippo Rinaldi, Aniello Panariello, Giacomo Salici, Fengyuan Liu, Marco Ciccone +2 more
10/7/2025
4 citations
cs.LGcs.AIcs.CV

Official code: fillo-rinaldi/GradFix (8 stars, Python, MIT, last commit 2026-02-24).

Abstract

When a new release of a foundation model is published, practitioners typically need to repeat full fine-tuning, even if the same task has already been solved in the previous version. A promising alternative is to reuse the parameter changes (i.e., task vectors) that capture how a model adapts to a specific task.

Show full abstract

However, they often fail to transfer across different pre-trained models due to their misaligned parameter space. In this work, we show that the key to successful transfer lies in the sign structure of the gradients of the new model. Based on this insight, we propose GradFix, a novel method that approximates the ideal gradient sign structure and leverages it to transfer knowledge using only a handful of labeled samples. Notably, this requires no additional fine-tuning: the adaptation is achieved by computing a few gradients at the target model and masking the source task vector accordingly. This yields an update that is locally aligned with the target loss landscape, effectively rebasing the task vector onto the new pre-training. We provide a theoretical guarantee that our method ensures first-order descent. Empirically, we demonstrate significant performance gains on vision and language benchmarks, consistently outperforming naive task vector addition and few-shot fine-tuning.

View on arXivView PDF

Code Implementations(1)

MIT

GradFix is the official codebase for the ICLR 2026 paper: "Gradient-Sign Masking for Task Vector Transport Across Pre-Trained Models"

80Python, ShellFeb 10, 20269 months agoMIT

Similar Papers

Cite this paper

@article{rinaldi2025gradientsign,
  title  = {Gradient-Sign Masking for Task Vector Transport Across Pre-Trained Models},
  author = {Filippo Rinaldi and Aniello Panariello and Giacomo Salici and Fengyuan Liu and Marco Ciccone and Angelo Porrello and Simone Calderara},
  year   = {2025},
  eprint = {2510.09658},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2510.09658v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2510.09658.svg)](https://codeofpaper.com/paper/2510.09658)

Discussion