Knowledge Composition using Task Vectors with Learned Anisotropic Scaling

Frederic Z. Zhang, Paul Albert, Cristian Rodriguez-Opazo, Anton van den Hengel, Ehsan Abbasnejad

Abstract

This paper introduces aTLAS (Anisotropic Task-vector Learned Scaling), a method that enhances model editing and transfer learning by learning independent scaling coefficients for different parameter blocks within "task vectors." By moving from uniform (isotropic) to block-wise (anisotropic) scaling, the authors demonstrate significant improvements in task arithmetic, few-shot learning, and test-time adaptation while using only a fraction of the learnable parameters required by traditional fine-tuning.

Introduction

Fine-tuning massive pre-trained models for every new task is computationally expensive and data-hungry. Recent research has pivoted toward task vectors—the weight difference between a pre-trained model and its fine-tuned version. These vectors act as "knowledge carriers" that can be added or subtracted to edit model behavior.

However, existing methods typically apply a single scaling factor to the entire task vector (isotropic scaling). This is a blunt instrument: different layers of a neural network (e.g., early layers for generic features vs. deep layers for task-specific ones) play vastly different roles. The authors address the challenge of how to more precisely compose and transfer knowledge by exploiting the modularity of these parameter blocks.

Methods

The authors propose aTLAS (Anisotropic Task-vector Learned Scaling). Instead of a single scalar $\alpha$, they learn a diagonal matrix $\Lambda$ where each entry $\lambda^{(j)}$ scales a specific "parameter block" (like a weight matrix or bias vector) independently.

Isotropic vs. Anisotropic scaling illustration.

Key technical aspects include:

  • Block-wise Optimization: The algorithm searches for the optimal linear combination of task vectors in a low-dimensional coefficient space.
  • Efficiency: Because it only learns a few coefficients per task vector, it is extremely parameter-efficient.
  • Versatility: It works with both supervised objectives (using labeled data) and unsupervised objectives (like entropy minimization for test-time adaptation).

Key Insights and Ideas

A core finding is that task vectors effectively exploit the low intrinsic dimensionality of deep networks. Empirical results show that task vectors serve as superior bases for constructing projection matrices compared to random bases.

Task vectors vs. random bases performance.
  • Disentanglement through Scaling: Anisotropic scaling allows task vectors to be "un-mixed," reducing interference when multiple tasks are combined. This leads to lower "disentanglement errors" compared to standard methods.
  • Layer-wise Sensitivity: The learned coefficients reveal that deeper layers generally require higher scaling factors, confirming that task-specific knowledge is concentrated in the later stages of the network.
  • Modularity as a Feature: Parameter blocks can function as independent knowledge carriers. The authors show that mixing the most informative blocks from different task vectors can improve performance under memory constraints.

Key Results

The study primarily uses the CLIP model as a backbone and evaluates across a diverse set of 22 image classification datasets, including standard benchmarks (ImageNet, CIFAR) and specialized domains (EuroSAT, Oxford Pets).

  • Few-Shot Superiority: In 1-shot learning scenarios, aTLAS significantly outperforms established methods like Tip-Adapter and LP++. It also shows better robustness to domain shift on OOD datasets.
  • Test-Time Adaptation (TTA): Using an unsupervised pseudo-labeling objective, aTLAS improves CLIP's accuracy by an average of 6.5 absolute points over the zero-shot baseline across 22 datasets.
  • Task Arithmetic: aTLAS achieves better results in task negation (removing unwanted biases) and task addition (creating multi-task models) than previous isotropic search methods.

Limitations and Future Work

Currently, task vectors are defined relative to a specific pre-trained model. Knowledge composition across different architectures remains an open challenge. Additionally, while parameter-efficient in terms of learnable weights, aTLAS still requires storing the original task vectors. Future research could focus on finding optimal granularity for block partitions to further optimize memory and performance.

Summary updated

BibTeX
@inproceedings{zhang2024knowledge,
  author = {Frederic Z. Zhang and Paul Albert and Cristian Rodriguez-Opazo and Anton van den Hengel and Ehsan Abbasnejad},
  title = {{Knowledge Composition using Task Vectors with Learned Anisotropic Scaling}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=G9OJUgKo4B},
}
Figure