Introduction
Adapting large-scale pre-trained models to specific downstream tasks via full fine-tuning is computationally prohibitive. In response, "task vectors"—the element-wise difference between a fine-tuned model's weights and its pre-trained state—have emerged as a powerful paradigm for Parameter-Efficient Fine-Tuning (PEFT). By performing linear arithmetic on these vectors, practitioners can merge multiple tasks (addition) or remove unwanted behaviors (negation/unlearning).
Despite their empirical success, the theoretical justification for task arithmetic has remained elusive. Previous attempts to explain these phenomena often relied on the Neural Tangent Kernel (NTK) regime, which treats neural networks as linearized models. However, such assumptions fail to capture the nonlinear feature-learning dynamics inherent in modern Transformers. This paper provides the first theoretical generalization guarantees for task vectors in nonlinear Transformers, characterizing the conditions under which task arithmetic succeeds or fails.
Theoretical Framework: Nonlinear Feature Learning
To analyze task arithmetic without relying on linearization, the authors study a one-layer, single-head nonlinear Transformer. They define a data model where binary classification tasks are determined by the presence of "discriminative tokens" versus "confusion tokens."
By analyzing the training dynamics of Stochastic Gradient Descent (SGD), the study characterizes how task vectors are formed. Crucially, the effectiveness of these vectors is shown to be a function of task correlation. The authors categorize task relationships into three types:
- Irrelevant Tasks: Tasks with zero correlation. These represent the "sweet spot" where task addition works perfectly for multi-task learning, and task negation allows for clean unlearning without damaging unrelated knowledge.
- Aligned Tasks: Tasks with positive correlation. While these are conducive to multi-task learning, they are problematic for unlearning. Subtracting an aligned task vector often inadvertently removes shared features, severely degrading performance on the retained task.
- Contradictory Tasks: Tasks with negative correlation. These are difficult to merge for multi-task learning but are highly responsive to unlearning via task negation.
Structural Properties: Sparsity and Low-Rankness
A significant contribution of this work is the mathematical justification for why task vectors are often sparse and low-rank. The analysis shows that during fine-tuning, weight updates are concentrated on a small subset of neurons that respond to specific discriminative patterns. This provides a theoretical foundation for popular compression and merging techniques such as TIES, DARE, and Low-Rank Adaptation (LoRA), proving that these methods are not just empirical heuristics but are rooted in the underlying dynamics of nonlinear feature learning.
Empirical Validation
The authors validated their theoretical findings through experiments on both image classification and natural language processing.
Image Classification (Colored-MNIST)
Using a ViT-Small/16 model, the authors controlled task correlations by linking digit parity with specific colors. The results mirrored the theory: for contradictory tasks, task negation successfully reduced target task accuracy to approximately 5% while maintaining the retained task at 94%. Conversely, for aligned tasks, unlearning the target task caused a catastrophic drop in the retained task's performance.
Large Language Models (Phi-1.5 & Phi-3)
To test unlearning in a real-world setting, the authors used Phi-1.5 (1.3B) and Phi-3-small (7B) models. They attempted to unlearn "Harry Potter 1" (HP1) using task negation. Because "Harry Potter 2" (HP2) is highly aligned with HP1 (sharing characters, setting, and style), its performance dropped by 34.71% when HP1 was negated. In contrast, the less-aligned "Pride and Prejudice" (PP) only saw a 15.13% drop. These results confirm that task alignment is a primary factor in the "collateral damage" observed during machine unlearning.
Conclusion
This research bridges the gap between the empirical utility of task vectors and our theoretical understanding of nonlinear Transformers. By proving that task correlation dictates the success of model editing, the authors provide a roadmap for more predictable and efficient model adaptation. Future work remains to extend these proofs to deeper, multi-layer architectures and to develop automated methods for selecting optimal scaling factors in task arithmetic.
Summary updated