Abstract
Deep neural networks are a promising approach towards multi-task learning because of their capability to leverage knowledge across domains and learn general purpose representations. Nevertheless, they can fail to live up to these promises as tasks often compete for a model's limited resources, potentially leading to lower overall performance. In this work we tackle the issue of interfering tasks through a comprehensive analysis of their training, derived from looking at the interaction between gradients within their shared parameters. Our empirical results show that well-performing models have low variance in the angles between task gradients and that popular regularization methods implicitly reduce this measure. Based on this observation, we propose a novel gradient regularization term that minimizes task interference by enforcing near orthogonal gradients. Updating the shared parameters using this property encourages task specific decoders to optimize different parts of the feature extractor, thus reducing competition. We evaluate our method with classification and regression tasks on the multiDigitMNIST, NYUv2 and SUN RGB-D datasets where we obtain competitive results.
Introduction
Multi-task learning (MTL) aims to train a single model to perform multiple tasks simultaneously, such as object detection and depth estimation. While this approach is efficient and can lead to robust representations, it often suffers from "task interference." This occurs when different objectives compete for the same model resources—for instance, when Task A requires a shared parameter to move in one direction while Task B requires it to move in another. This conflict can lead to "negative transfer," where joint performance is worse than training individual models.
While previous research has focused on balancing the magnitudes of task losses, this paper argues that the direction of the gradients is equally critical. The authors propose managing the angles between task gradients to improve joint optimization.
Methodology: Cosine Regularization (CosReg)
The authors focus on a hard parameter sharing architecture consisting of a common encoder followed by task-specific decoders. To mitigate interference, they introduce CosReg (Cosine Regularization).
- Metric: Task interaction is measured using the cosine similarity of gradients with respect to shared encoder parameters.
- Penalty: A regularization term is added to the total loss that minimizes the squared cosine between task gradients. Squaring the cosine pushes gradients toward orthogonality (0), regardless of whether they were originally similar or opposing.
- Multi-Task Scaling: For more than two tasks, the squared Frobenius norm of the cosine distance matrix is used to ensure the penalty remains bounded and symmetric.
- Efficiency: To maintain training speed, the regularization is applied only to the gradients of the final layer of the shared encoder.
Datasets
The method was evaluated on three benchmarks:
- MultiDigitMNIST: A custom dataset where two digits are placed side-by-side. Task 1 classifies the left digit (even numbers), and Task 2 classifies the right digit (odd numbers).
- NYUv2: An indoor scene dataset for semantic segmentation, depth estimation, and surface normal prediction.
- SUN RGB-D: A large indoor dataset testing highly correlated tasks (coarse vs. fine-grained segmentation) alongside depth estimation.
Key Insights
- Implicit Orthogonalization: Popular techniques like Dropout and Batch Normalization naturally act as implicit gradient orthogonalizers. Models using these techniques exhibit lower variance in gradient angles, contributing to their success in MTL.
- The "Early Bird" Effect: High gradient variance is most destructive during the early stages of training. Enforcing orthogonality early guides the model into stable regions of the search space.
- Orthogonality vs. Alignment: Unlike continual learning, which often seeks gradient alignment to prevent forgetting, simultaneous MTL benefits from orthogonality as it maximizes the representational capacity of the shared encoder.
- Parameter Decorrelation: By forcing orthogonal gradients, the model encourages different task decoders to utilize distinct features within the shared encoder, reducing parameter "tug-of-war."
Results
- MultiDigitMNIST: CosReg combined with Batch Normalization achieved a harmonic mean accuracy of 92.5%, outperforming standard Batchnorm (91.3%) and unregularized models (90.7%).
- NYUv2: CosReg outperformed state-of-the-art balancing methods like GradNorm in semantic segmentation (0.646 1-mIoU).
- SUN RGB-D: Despite high task correlation, CosReg successfully pushed gradients toward orthogonality, achieving superior results on both coarse and fine segmentation tasks.
Conclusion and Future Work
CosReg provides a principled way to reduce task interference by enforcing gradient orthogonality. While effective, the method introduces a hyperparameter $\alpha$ that requires manual tuning and adds some computational overhead due to per-task gradient calculations. Future work will explore dynamic scaling of the regularization term and using initial cosine variance as a predictor for MTL architecture performance.
Summary updated