In the world of personalized recommendations, we often try to kill two (or ten) birds with one stone. To predict if a user will buy a product (our target task), we train models to also predict if they will click a link or add an item to their cart (auxiliary tasks). While this "multi-task learning" approach should theoretically help the model learn better features, it often backfires. One task might become a "gradient bully," dominating the model's updates and drowning out the signal from the target task we actually care about.
A new paper from researchers at Meta AI and Texas A&M University introduces MetaBalance, a clever way to keep these auxiliary tasks in check by dynamically adjusting their "volume"—or more precisely, their gradient magnitudes.
TL;DR
MetaBalance is a novel framework that improves recommendation accuracy by dynamically scaling the gradient magnitudes of auxiliary tasks to match the target task. By using a "relax factor" and moving averages, it prevents auxiliary tasks from either dominating the optimization process or being too weak to contribute, leading to an 8.34% improvement in ranking metrics over state-of-the-art baselines.
What Problem Does This Paper Address?
In recommendation systems, we usually have a primary goal (like "Purchase") and several secondary signals (like "Click" or "Add-to-Favorite"). Multi-task learning (MTL) uses these secondary signals to help the model generalize better.
However, MTL suffers from optimization imbalance. If the gradient (the signal telling the model how to change) of a "Click" task is 10x larger than the "Purchase" task, the model will prioritize getting clicks right, potentially at the expense of purchases. This imbalance is tricky because:
- It’s Dynamic: The imbalance changes throughout the training process.
- It’s Localized: A task might be dominant in the embedding layers but weak in the fully connected (MLP) layers.
- Tuning is Hard: Manually searching for the "perfect" weight for each task loss is computationally expensive and often results in sub-optimal, static weights.
Methods
The core idea of MetaBalance is to force the magnitude of auxiliary gradients to be closer to the magnitude of the target gradient.
- Magnitude Scaling: In every training iteration, the algorithm calculates the magnitudes of the target gradient ($G_{tar}$) and auxiliary gradients ($G_{aux}$). It then rescales $G_{aux}$ so its magnitude aligns with $G_{tar}$.
- The Relax Factor ($r$): The authors realized that forcing an exact match isn't always best. They introduced a "relax factor" $r \in [0, 1]$. If $r=1$, the auxiliary gradient is scaled to exactly match the target's magnitude. If $r=0$, it keeps its original size. This allows for a "moderate" balance that preserves some of the original task's importance.
- Moving Averages: To prevent the model from overreacting to noisy, high-variance gradients in a single mini-batch, MetaBalance uses a moving average of magnitudes (with a decay factor $\beta$, typically 0.9) to stabilize the scaling.
- Three Strategies: The framework allows for (A) only shrinking "strong" tasks, (B) only boosting "weak" tasks, or (C) doing both.
Datasets
The researchers evaluated MetaBalance on two massive, real-world datasets from Alibaba:
- IJCAI-2015: Contains millions of shopping logs. The target task is "Purchase," with "Click" and "Add-to-Favorite" as auxiliary tasks.
- UserBehavior-2017: Another Alibaba dataset where "Purchase" is the target, supported by "Click," "Add-to-Cart," and "Add-to-Favorite."
Key Insights and Ideas
- Magnitude vs. Direction: Most previous research focused on gradient direction (e.g., "Gradient Surgery," which masks gradients that point in opposite directions). MetaBalance argues that in recommendation scenarios, the magnitude (the "strength" of the update) is often a more significant source of imbalance than the direction.
- The "Bully" Task: The authors observed that in the Alibaba data, the "Click" task's gradient was naturally much larger than the "Purchase" task. Without MetaBalance, the model essentially becomes a click-predictor that happens to see purchase data.
- Efficiency in Hyperparameters: Unlike standard loss-weighting which requires tuning a weight for every task, MetaBalance only requires tuning one hyperparameter: the relax factor $r$. This makes it much more scalable as you add more auxiliary tasks.
Key Results
- Significant Gains: MetaBalance achieved an 8.34% improvement in NDCG@10 (a standard ranking metric) on the IJCAI-2015 dataset compared to the strongest baseline.
- Superiority over Baselines: It consistently outperformed 10 other methods, including popular ones like GradNorm, Uncertainty weighting, and MGDA.
- Optimizer Agnostic: The method was shown to work effectively across different optimizers, including Adam, Adagrad, and RMSProp.
- Ablation Success: The use of moving averages was proven critical; without them, performance dropped significantly, especially on the IJCAI dataset.
Limitations and Future Work
- Target-Centric: MetaBalance is designed for scenarios where we only care about the performance of one target task. If you need a model that performs well across all tasks simultaneously, this specific formulation might not be ideal.
- Directional Conflicts: While the authors found magnitude to be the primary issue, they noted that naively combining MetaBalance with direction-based methods (like GradSurgery) actually decreased performance. They suggest that finding a way to harmoniously balance both magnitude and direction is a promising future research path.
- Hyperparameter Sensitivity: While there is only one $r$ to tune, the optimal value varied between the two datasets (0.7 vs 0.9), meaning some validation-set tuning is still required.
Summary updated