On Task Vectors and Gradients

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Zhou, Luca, Solombrino, Daniele, Crisostomi, Donato, Bucarelli, Maria Sofia, D'Inverno, Giuseppe Alessio, Silvestri, Fabrizio, Rodolà, Emanuele
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915562653745152
author Zhou, Luca
Solombrino, Daniele
Crisostomi, Donato
Bucarelli, Maria Sofia
D'Inverno, Giuseppe Alessio
Silvestri, Fabrizio
Rodolà, Emanuele
author_facet Zhou, Luca
Solombrino, Daniele
Crisostomi, Donato
Bucarelli, Maria Sofia
D'Inverno, Giuseppe Alessio
Silvestri, Fabrizio
Rodolà, Emanuele
contents Task arithmetic has emerged as a simple yet powerful technique for model merging, enabling the combination of multiple finetuned models into one. Despite its empirical success, a clear theoretical explanation of why and when it works is lacking. This paper provides a rigorous theoretical foundation for task arithmetic by establishing a connection between task vectors and gradients of the task losses. We show that under standard gradient descent, a task vector generated from one epoch of finetuning is exactly equivalent to the negative gradient of the loss, scaled by the learning rate. For the practical multi-epoch setting, we prove that this equivalence holds approximately, with a second-order error term that we explicitly bound for feed-forward networks. Our empirical analysis across seven vision benchmarks corroborates our theory, demonstrating that the first-epoch gradient dominates the finetuning trajectory in both norm and direction. A key implication is that merging models finetuned for only a single epoch often yields performance comparable to merging fully converged models. These findings reframe task arithmetic as a form of approximate multitask learning, providing a clear rationale for its effectiveness and highlighting the critical role of early training dynamics in model merging.
format Preprint
id arxiv_https___arxiv_org_abs_2508_16082
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle On Task Vectors and Gradients
Zhou, Luca
Solombrino, Daniele
Crisostomi, Donato
Bucarelli, Maria Sofia
D'Inverno, Giuseppe Alessio
Silvestri, Fabrizio
Rodolà, Emanuele
Machine Learning
Artificial Intelligence
Task arithmetic has emerged as a simple yet powerful technique for model merging, enabling the combination of multiple finetuned models into one. Despite its empirical success, a clear theoretical explanation of why and when it works is lacking. This paper provides a rigorous theoretical foundation for task arithmetic by establishing a connection between task vectors and gradients of the task losses. We show that under standard gradient descent, a task vector generated from one epoch of finetuning is exactly equivalent to the negative gradient of the loss, scaled by the learning rate. For the practical multi-epoch setting, we prove that this equivalence holds approximately, with a second-order error term that we explicitly bound for feed-forward networks. Our empirical analysis across seven vision benchmarks corroborates our theory, demonstrating that the first-epoch gradient dominates the finetuning trajectory in both norm and direction. A key implication is that merging models finetuned for only a single epoch often yields performance comparable to merging fully converged models. These findings reframe task arithmetic as a form of approximate multitask learning, providing a clear rationale for its effectiveness and highlighting the critical role of early training dynamics in model merging.
title On Task Vectors and Gradients
topic Machine Learning
Artificial Intelligence
url https://arxiv.org/abs/2508.16082