Scalable Multitask Learning Using Gradient-based Estimation of Task Affinity

Dongyue Li, Aneesh Sharma, Hongyang R. Zhang

TL;DR

This paper introduces GRAD-TAG, a novel algorithm that dramatically speeds up multitask learning by efficiently estimating task affinities. Instead of retraining models for every task combination, GRAD-TAG uses a gradient-based linearization technique on a single pre-trained "base" model, achieving near-accurate affinity estimates with a fraction of the computational cost. This enables more effective task grouping and ultimately leads to better multitask model performance with significantly reduced training time.

What Problem Does This Paper Address?

Training a single model to perform multiple tasks simultaneously (multitask learning) is a powerful technique that can improve performance and efficiency. However, tasks can sometimes interfere with each other, leading to negative transfer. To mitigate this, researchers often group similar tasks together and train separate models for each group. A crucial step in this process is determining "task affinity" – how well tasks work together. Traditionally, calculating task affinity involves training models on numerous combinations of tasks, which becomes computationally prohibitive as the number of tasks grows. This paper tackles the challenge of making task affinity estimation scalable and efficient, enabling more effective task grouping even for a large number of tasks.

Methods

The core of GRAD-TAG lies in its two main components:

  1. GRAD-TAE (Gradient-based Task Affinity Estimation): This method bypasses the need for repeated full model training. It starts by training a single "base" model on all tasks. Then, it leverages a linearization property of neural networks: the loss of a fine-tuned model on a specific task subset can be approximated using a first-order Taylor expansion around the base model's parameters. Specifically, it computes gradients of the base model and uses them as features in a logistic regression to predict task outcomes for different task combinations. To handle the high dimensionality of gradients, it employs a Johnson-Lindenstrauss random projection for dimension reduction. An ensemble averaging step further improves robustness.
  2. Task Affinity Based Grouping: Once task affinities are estimated, GRAD-TAG uses a novel clustering algorithm based on a Semi-Definite Programming (SDP) relaxation. This algorithm aims to partition tasks into k groups by maximizing the average density within each group. The SDP formulation is convex and efficiently solvable, and its solution is then rounded to obtain the final task clusters. The authors argue this SDP approach is more robust than spectral or Lloyd's clustering for task affinity matrices, which may not satisfy metric properties.

Datasets

The paper evaluates GRAD-TAG on a variety of datasets across different domains:

  • Graph-based Multi-label Classification: Four social network datasets (Amazon, YouTube, DBLP, LiveJournal) from SNAP, with up to 100 labeling tasks per graph. A large-scale Orkut graph with 21 million edges and 500 labeling tasks was also used.
  • Instruction Fine-tuning of Language Models: Two text classification datasets from SuperGLUE (RTE and WiC), each with 100 instructions (tasks).
  • Other Text and Image Datasets: RTE and DomainNet were used to demonstrate cross-modal applicability.

Key Insights and Ideas

  • Linearization as a Shortcut: The key insight is that the fine-tuning process for a neural network on a specific task subset, starting from a well-trained meta-initialization, behaves locally like a linear model. This allows for efficient approximation of task affinities without full retraining.
  • Gradients as Features: Using gradients of the pre-trained model as features in a logistic regression is a surprisingly effective way to estimate task outcomes for unseen task combinations.
  • SDP for Robust Clustering: Traditional clustering methods can struggle with task affinity matrices that don't adhere to metric properties. The SDP relaxation provides a more robust approach to grouping tasks based on these affinities.
  • Scalability is Achieved: The combination of gradient-based estimation and SDP clustering allows the method to scale to hundreds or even thousands of tasks, a significant improvement over previous approaches.

Key Results

  • Efficiency: GRAD-TAE reduces the computational cost of estimating task affinities by up to 32x (for higher-order affinity) and 45x (for pairwise affinity) compared to full model training, while using only 3% of the FLOPs. For the largest graph with 500 tasks, it achieved estimates within 5% error using only 112 GPU hours, compared to over 8000 GPU hours for full training.
  • Accuracy: Task affinity estimates are within 2.7% distance to true affinities on average.
  • Downstream Performance: GRAD-TAG achieves comparable or improved downstream accuracy to existing multitask learning baselines on graph classification and language model fine-tuning tasks. For example, it uses 32.8x fewer FLOPs and 5.2x less GPU hours than the closest baseline on graph tasks.
  • Correlation: The estimated task affinities show a high correlation (up to 0.96) with true affinities, explaining why the task grouping performs well.

Limitations and Future Work

  • Approximation Error: While the method is highly efficient, there is still an approximation error in the task affinity estimates. The paper provides theoretical bounds on this error, showing it can be controlled by the projection dimension d.
  • Future Work: The authors suggest exploring novel dimension reduction and clustering methods tailored to specific downstream applications. They also propose investigating the application of their method to branching neural networks and continual learning settings, potentially without backpropagation. Examining Taylor's expansion up to the Hessian for potentially higher accuracy is also mentioned as future work.

Summary updated

BibTeX
@inproceedings{li2024scalable,
  author = {Dongyue Li and Aneesh Sharma and Hongyang R. Zhang},
  title = {{Scalable Multitask Learning Using Gradient-based Estimation of Task Affinity}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2024},
  url = {https://openreview.net/forum?id=kU4hToMJZg},
}

Loading related content...

Figure