TL;DR
Task arithmetic—merging fine-tuned models by simply adding their weight updates—has achieved surprising empirical success, but lacked a rigorous theoretical explanation. This paper proves that under standard gradient descent, a single-epoch task vector is mathematically identical to a scaled negative loss gradient, reframing task arithmetic as approximate multitask learning. Because early gradients dominate training trajectories, merging models trained for just one epoch often matches the performance of merging fully converged models.
What Problem Does This Paper Address?
Fine-tuning a separate large model for every downstream task creates substantial storage and deployment overhead. Model merging offers an appealing alternative: combine multiple task-specialized models into a single checkpoint without increasing model size.
Among merging techniques, task arithmetic stands out for its simplicity: it computes task vectors ($\tau_t = \theta_t - \theta_{\text{base}}$) and adds them back to the base model. While empirical studies show task arithmetic works surprisingly well—and that "premature" or lightly trained task vectors often merge better than fully converged ones—there has been no solid theoretical framework explaining why or when this linear combination is valid.
Methods
The authors bridge this gap by analyzing the optimization dynamics of task arithmetic versus joint multitask learning (MTL) under full-batch gradient descent (GD):
- First-Epoch Equivalence: They prove that after one epoch of full-batch GD, task arithmetic matches joint multitask training exactly when the multitask learning rate is scaled by the merging coefficient $\alpha$ ($\theta_{\text{TA}}^{(1)} = \theta_{\text{MT}}^{(1)}$).
- Multi-Epoch Taylor Expansion: For $k > 1$ epochs, the authors use a perturbative expansion to show that the first-order $\mathcal{O}(\eta)$ terms cancel completely. Task arithmetic diverges from multitask learning only by a curvature-controlled second-order error term: $$\theta_{\text{TA}}^{(k)} = \theta_{\text{MT}}^{(k)} + \eta^2 C(\dots) + \mathcal{O}(\eta^3)$$
- Explicit Error Bounds: For depth-$L$ feed-forward networks with cross-entropy loss, bounded weights, and bounded activation derivatives, they derive uniform $\ell_2$-norm bounds on the curvature matrix $C$. Under ReLU activations, where second derivatives vanish almost everywhere, the bound simplifies and tightens substantially.
Datasets
The authors empirically evaluate their theoretical claims across several standard computer vision benchmarks:
- Image Classification Datasets: Cars, CIFAR-100, DTD, EuroSAT, GTSRB, MNIST, RESISC45, SUN397, and SVHN.
- Note: No new benchmarks were introduced; all experiments use standard established datasets.
Key Insights and Ideas
- Task Arithmetic is Approximate Multitask Learning: Adding task vectors is not merely an empirical heuristic—it directly approximates a gradient step on the aggregated multitask loss surface.
- Dominance of the First Epoch: Fine-tuning trajectories are largely established immediately. In practice, the first epoch accounts for the lion’s share of total gradient norm, and subsequent gradients remain highly aligned with the initial direction (cosine similarities $> 0.8$ over early epochs).
- Task Proficiency $\neq$ Mergeability: Counterintuitively, training models to full convergence hurts mergeability. As individual models train longer, they diverge deeper into specialized loss basins, accumulating second-order curvature error ($\eta^2 C$). Lightly tuned models stay close to the initial tangent space, preserving the validity of the gradient approximation.
Key Results
- 1-Epoch vs. Converged Merging: Merging models fine-tuned for only a single epoch yields competitive overall accuracy compared to merging models fine-tuned to convergence across 8 benchmark vision tasks (e.g., MNIST, SVHN, RESISC45, DTD, Cars, GTSRB, EuroSAT, SUN397).
- Gradient Distribution: Across datasets, the first epoch accounts for roughly 30% to over 60% of the cumulative normalized gradient norm over 5 epochs.
- Directional Persistence: In datasets like RESISC45, pairwise cosine similarities between the first epoch's gradient and subsequent epochs remain above $0.8$ through epoch 5.
- Trajectory Visualizations: 2D PCA projections show that taking frequent, small merging steps (iterative task arithmetic) guides the model toward distinctly lower-loss multitask regions compared to aggressive one-shot merges.
Limitations and Future Work
- Full-Batch GD Assumption: The core mathematical proofs assume full-batch Gradient Descent. In practical deep learning, models are trained with Stochastic Gradient Descent (SGD) or adaptive optimizers (e.g., Adam), where stochastic noise and variance complicate the theoretical guarantees.
- Architecture Constraints: Closed-form bounds on the second-order error term $C$ were derived specifically for standard feed-forward networks (MLPs). Extending these bounds to modern architectures like Vision Transformers (ViTs) and CNNs remains an open theoretical challenge.
- Mitigating Curvature Drift: Future work could explore methods to approximate, cancel, or minimize the curvature error term $C(\cdot)$, potentially improving multi-epoch merging techniques.
Summary updated