ForkMerge: Overcoming Negative Transfer in Multi-Task Learning

Junguang Jiang, Baixu Chen, Junwei Pan, Ximei Wang, Dapeng Liu, Jie Jiang, Mingsheng Long · OpenReview

Abstract

Auxiliary-Task Learning (ATL) aims to improve the performance of a target task by leveraging knowledge from related auxiliary tasks. However, co-training often leads to "negative transfer" (NT), where the target task's performance degrades compared to single-task training. While previous research primarily attributed NT to gradient conflicts, this paper demonstrates that NT is fundamentally a generalization problem driven by distribution shifts. We introduce ForkMerge, a novel framework that periodically forks the model into specialized branches and merges them based on target-task validation performance. By dynamically filtering out detrimental updates, ForkMerge effectively mitigates negative transfer across diverse benchmarks, including NYUv2, DomainNet, and large-scale recommendation systems.

Introduction

In many machine learning applications, we have a primary "target" task and several "auxiliary" tasks that provide additional signals. For instance, in autonomous driving, depth estimation can serve as an auxiliary task for object detection. Ideally, these tasks share features that improve the model's robustness. In practice, however, the auxiliary task often interferes with the target task—a phenomenon known as Negative Transfer.

Traditional approaches to NT focus on "gradient surgery," attempting to resolve mathematical conflicts between task gradients during optimization. This paper argues that this perspective is insufficient. Instead, the authors investigate NT through the lens of generalization, finding that auxiliary tasks can lead the model toward a distribution that is poorly aligned with the target task's requirements.

The Root Cause: Generalization and Distribution Shift

A key insight of this work is that gradient conflict does not always imply negative transfer. For example, $L_2$ regularization technically "conflicts" with the primary loss gradient but improves generalization. Conversely, even aligned gradients can cause NT if they push the model toward a distribution shift.

Figure 4: (a) t-SNE visualizations showing how increasing the auxiliary weight λ alters the data distribution. (b) Correlation between Cross-domain Statistical Distance (CSD) and Transfer Gain (TG), illustrating that NT is driven by distribution shifts.

The authors categorize NT into two types:

  • Weak Negative Transfer (WNT): The auxiliary task is helpful at low weights but becomes harmful if weighted too heavily.
  • Strong Negative Transfer (SNT): The auxiliary task is fundamentally detrimental to the target task regardless of the weight.

The ForkMerge Framework

To address these challenges, the authors propose ForkMerge. Unlike static weighting or gradient projection, ForkMerge treats task integration as a dynamic parameter-merging problem.

Figure 5: The ForkMerge training cycle. The model periodically forks into independent optimization branches which are then merged based on target validation performance.

The process follows four main steps:

  1. Fork: The current model parameters $\theta_t$ are cloned into two branches. Branch 0 optimizes only the target loss $\mathcal{L}_{tgt}$, while Branch 1 optimizes a combination of target and auxiliary losses $\mathcal{L}_{tgt} + \mathcal{L}_{aux}$.
  2. Search: After a fixed number of steps $\Delta t$, the algorithm evaluates the performance of a linear combination of the two branches on a held-out target validation set. It searches for the optimal mixing coefficient $\lambda \in [0, 1]$.
  3. Merge: The branches are merged into a single set of parameters: $\theta_{t+\Delta t}^* = (1-\lambda)\theta_{t+\Delta t}(0) + \lambda\theta_{t+\Delta t}(1)$.
  4. Synchronize: The merged parameters become the starting point for the next cycle.

If the auxiliary task is harmful (SNT), the search step will naturally select a $\lambda$ near zero, effectively discarding the auxiliary updates. If it is helpful (WNT), it will find the optimal balance that maximizes generalization.

Experimental Evaluation

ForkMerge was tested on several major benchmarks:

  • NYUv2 (Scene Understanding): ForkMerge achieved a 4.03% average improvement over Single-Task Learning, outperforming state-of-the-art gradient-based methods like IMTL (2.10%) and PCGrad (1.18%).
  • DomainNet (Multi-domain Recognition): In a challenging setup where standard multi-task learning caused negative transfer in 23 out of 30 cases, ForkMerge successfully avoided NT in all 30 combinations.
  • AliExpress (Industrial Recommendation): On a dataset with 100 million records, ForkMerge improved target metrics by 1.30%, demonstrating its scalability and effectiveness in real-world production environments.

Conclusion

ForkMerge shifts the focus of multi-task learning from local gradient optimization to global parameter-space generalization. By using a validation-driven fork-and-merge strategy, it provides a robust defense against negative transfer. This approach is not only more effective than traditional gradient surgery but also computationally efficient, making it a practical choice for complex auxiliary-task learning scenarios.

Summary updated

BibTeX
@inproceedings{jiang2023forkmerge,
  author = {Junguang Jiang and Baixu Chen and Junwei Pan and Ximei Wang and Dapeng Liu and Jie Jiang and Mingsheng Long},
  title = {{ForkMerge: Overcoming Negative Transfer in Multi-Task Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=vZHk1QlBQW},
}
Figure