Multi-Task Learning and Loss Weighting
Training one network to predict several things at once — say, next-day return and next-day volatility — means combining several losses into one number, and how you weight them determines which task the shared network actually ends up good at.
Prerequisites: Loss Functions for Regression
Suppose one network shares its early layers across two prediction heads: one forecasting next-day return, another forecasting next-day volatility. Training it means combining the return loss and the volatility loss into a single number to backpropagate — but return might be measured in loss units of order 0.0001 and volatility in loss units of order 10, purely because of how each target happens to be scaled. Add them with equal weight and the optimizer effectively ignores the return task entirely, chasing whichever loss happens to have the larger numbers, regardless of which task actually matters more.
The analogy: splitting a manager's attention across two reports
A manager grading two employees on a combined score, one measured in dollars of revenue and one measured in percentage points of customer satisfaction, can't just add the raw numbers — a $50,000 swing dwarfs a 2-point swing in scale, even if the 2-point swing is the more important signal. The manager has to consciously decide how many "points" a percentage-point swing is worth relative to a dollar, or the combined score is meaningless. Combining loss functions of different scale and different intrinsic difficulty requires exactly the same deliberate weighting decision.
The formula
For tasks with individual losses , the simplest combination is a weighted sum:
In words: multiply each task's loss by a weight before adding them together, so the gradient contribution of each task can be controlled independently of its raw numeric scale. A more principled approach, from Kendall, Gal & Cipolla, treats each as a learned parameter tied to that task's uncertainty — a task the model is inherently less certain about (noisier target) automatically gets down-weighted:
In words: divide each task's loss by twice its learned variance — a noisier task gets a smaller effective weight — and add a penalty term that stops the model from trivially setting to infinity to make every loss disappear.
Worked example 1: fixed weights fixing a scale mismatch
Return loss (mean squared error on returns of order 1%), volatility loss (mean squared error on volatility measured in variance-like units). Unweighted sum: — the gradient from contributes essentially nothing; is dominated almost entirely by the volatility head. Setting instead gives — now both tasks contribute comparably-sized gradients, and the shared layers actually receive useful signal from both.
Worked example 2: learned uncertainty weighting adjusting automatically over training
Early in training, suppose for return and for volatility. Weight on : . Weight on : . Later, once the model has gotten much more confident about volatility ( shrinks to ) while return stays hard ( unchanged): weight on becomes , a roughly 36-fold increase given to the now-easier, more-precisely-known task — the weighting shifts automatically as training progresses, without hand-retuning .
Multi-task losses are combined as a weighted sum ; because raw loss scales differ arbitrarily between tasks, the weights — whether hand-set or learned via task uncertainty — determine which task the shared network actually optimizes for, independent of which task the practitioner intended to prioritize.
What this means in practice
Multi-task setups are common wherever one shared feature extractor feeds several forecasting heads (return, volatility, regime classification from the same market data), because sharing representations across related tasks can act as a useful regularizer and is cheaper than training separate models. The learned-uncertainty scheme above is a reasonable default when tasks' relative importance isn't known in advance; when it is known (say, return prediction is the only thing that will ever be traded on, volatility is just an auxiliary signal to help training), fixed weights that explicitly encode that priority are simpler and more predictable.
The common confusion is assuming that adding losses "fairly" means adding them with equal weight (coefficient 1 each). Equal coefficients do not produce equal influence unless the losses already happen to be on comparable numeric scales — which is rarely true by accident. A loss combination should always be checked by comparing gradient magnitudes contributed by each task, not by eyeballing whether the weights themselves look balanced.
Related concepts
Practice in interviews
Further reading
- Kendall, Gal & Cipolla, Multi-Task Learning Using Uncertainty to Weigh Losses (2018)