II · THE IDEA · ARTIFICIAL INTELLIGENCE
Gradient Surgery for Multi-Task Learning
▶ Listen · narrated
Multi-task models share parameters, so their losses share a gradient. When those gradients conflict, ordinary optimisers average the damage. A surgical step removes the conflicting component before the step is taken.
At a glance
- What it is
- A training-time fix that reshapes task gradients before the shared update
- The problem
- Negative interference when task gradients point in opposing directions
- The move
- Project a gradient to remove components that conflict with another task
- Where it acts
- On gradients during optimisation, not on the model architecture
Think of two people trying to push the same trolley. If both push the same way, it moves. If one pushes forward and the other pushes back, a lot of effort cancels out and the trolley barely moves—or jerks the wrong way for one of them.
In multi-task learning, each task “pushes” the shared model by sending a gradient: a direction and strength for how the weights should change. When two gradients point against each other, ordinary training partly averages those pushes, so some of the useful signal is cancelled. Gradient surgery watches for that fight. Before the model steps, it alters one of the gradients—projecting away the part that directly opposes the other task—so the remaining pushes no longer cancel as badly. The tasks keep their own goals; only the conflicting part of the update is removed.
In multi-task optimisation with shared parameters θ, each task i supplies a gradient g_i = ∇_θ L_i. A standard joint step uses a combination such as the sum or mean of the g_i. When ⟨g_i, g_j⟩ < 0, the gradients are in conflict: a step along g_i is a first-order increase in L_j.
Gradient surgery (in the PCGrad-style family associated with the cited multi-task work) de-conflicts before the parameter update. If g_i and g_j conflict, one gradient is replaced by its projection onto the half-space compatible with the other—equivalently, the component of g_i parallel to g_j in the opposing sense is subtracted:
g_i ← g_i − (⟨g_i, g_j⟩ / ‖g_j‖²) g_j
when ⟨g_i, g_j⟩ < 0 (and left unchanged otherwise). Non-conflicting pairs are untouched. The optimiser then applies an update built from the modified gradients. The intervention does not change the network architecture or the task losses; it only edits gradient directions at the combination stage. Limitations follow from that design: results depend on task sampling order, which pairs are projected, and whether conflict in gradient space fully captures harmful interference in non-convex deep nets. It is a geometric correction to negative transfer, not a guarantee that every task multi-objective problem becomes easy.
Look closer
Conflict is a geometric fact
In multi-task learning, each task produces a gradient with respect to the shared parameters. If two of those vectors form an obtuse angle, a step that helps one task moves against the other. Ordinary averaging does not resolve that geometry; it simply blends the opposing pulls into a single, often weaker, direction. Gradient surgery treats the conflict as something to detect and edit in vector space, task pair by task pair, before the optimiser applies the update.
Projection, not reweighting
The editorial idea is not to scale losses up or down, but to change the direction of a gradient that has already been computed. The conflicting component—the part of one task’s gradient that points against another—is removed by projection into a subspace treated as compatible with the other task. What remains is still informative for the first task, yet no longer directly degrades the second. The shared parameters then receive an update assembled from these altered vectors rather than from the raw ones.
Surgery sits inside the training loop
The method does not redesign the network and does not require a new loss. After per-task gradients are computed and before the parameter step, those gradients are inspected for conflict and, where needed, projected. The rest of training—forward pass, backward pass, optimiser state—continues as usual. The intervention is local to the gradient combination stage, which is why it can be described as surgery on the update rather than as a change of model or objective.
The story
Multi-task learning asks one set of shared parameters to serve several objectives at once. That arrangement is efficient when tasks agree about how the shared weights should move. It is fragile when they do not. Each task contributes a gradient; the training step is somehow assembled from those gradients; and if two gradients pull in opposing directions, progress on one objective can undo progress on another. That failure mode is often called negative interference: the joint update is not merely a compromise, but an active source of harm to at least one task.
Gradient surgery, as framed in the work under discussion, attacks the problem at the point where interference is most visible—in the gradients themselves. Instead of accepting the raw task gradients and hoping a weighted sum will behave, the method examines pairs of gradients for conflict and, when conflict is present, projects one gradient so that its component opposing the other is reduced or removed. The surviving vector still carries information about its own task, but it has been forced into a direction treated as compatible with its neighbour. The optimiser then steps using these modified gradients rather than the originals.
The geometry is straightforward even if the implementation details vary. Two gradients conflict when their inner product is negative: a step along one decreases loss for its task while increasing loss for the other. Projection removes the component of the first gradient that lies along the second in the opposing sense, leaving a residual that is no longer anti-aligned. Compatible gradients—those whose angle is acute—can be left alone. The shared update is therefore assembled from a set of vectors that have been de-conflicted where necessary, rather than from a simple average of adversaries.
This is deliberately a training-time intervention. The architecture need not change; the loss definitions need not change; only the path the parameters take through weight space is altered. That locality is part of the appeal. Multi-task systems already compute per-task gradients in many setups; surgery inserts a corrective step between those gradients and the optimiser. The model that results is still a conventional shared network; what differs is that its shared weights were not repeatedly yanked in irreconcilable directions during learning.
The editorial angle follows directly. Negative interference is not treated as an inevitable tax on sharing, nor only as a matter of loss weighting. It is treated as a directional problem that can be alleviated by projecting gradients into subspaces that no longer fight each other. Whether that projection is applied symmetrically, in a fixed task order, or under further heuristics is a design choice within the same family of ideas. The core claim remains geometric: if conflicting components are removed before the step, multi-task optimisation need not encode multi-task cancellation.
Why it mattered then
As multi-task learning spread across vision, language and reinforcement learning, practitioners repeatedly met the same obstacle: adding a second objective sometimes made the first worse, even when both tasks seemed related. Loss weighting and task scheduling offered partial relief, but they did not address the underlying vector conflict. Gradient surgery mattered in that moment because it named the failure mode in geometric terms and proposed a fix that sat inside the existing optimisation loop. It gave researchers a concrete alternative to accepting negative transfer as the price of parameter sharing, and it framed multi-task progress as something that could be recovered by editing gradients rather than only by redesigning architectures or curating task sets.
Why it matters now
Shared backbones, multi-objective fine-tuning and joint training of heterogeneous heads remain standard practice. Wherever one model serves several losses, conflicting gradients can still cancel useful signal. The surgical idea—detect anti-aligned updates and project them into compatible subspaces—continues to inform how people think about gradient surgery variants, PCGrad-style methods and related de-confliction tricks. Even when a codebase does not implement the original procedure exactly, the habit of inspecting task-gradient angles and refusing to average pure opposition remains a practical diagnostic and a design lever in multi-task and multi-objective training.
The surprising detail
The decisive operation is not a new layer or a clever loss. It is a projection performed on gradients that have already been computed—surgery on the update, not on the network. Two tasks can keep their original objectives unchanged, yet stop actively harming each other’s parameter steps, because the conflict was removed in vector space before the optimiser moved.
What is disputed
The supplied sources establish the gradient-surgery framing for multi-task learning; precise gains depend on task mix, model, and how pairs are selected for projection. This lesson describes the geometric intervention, not a universal performance claim.
Remember this
When task gradients point against each other, average them and you average the damage; project out the conflict and the shared step can help one task without directly undoing the other.
Test yourself
Two tasks produce gradients g₁ and g₂ for the same shared weights. Their inner product is negative. In ordinary gradient averaging, what goes wrong on the next step, and what does gradient surgery change before that step is taken?
A step along g₁ reduces loss for task 1 while increasing loss for task 2 (and vice versa), so a simple average still contains opposing components and can degrade at least one task. Gradient surgery detects that conflict and projects one gradient to remove the component that anti-aligns with the other, so the update applied to the shared parameters is assembled from de-conflicted directions rather than from raw opposing pulls.
Go deeper
- [2001.06782] Gradient Surgery for Multi-Task Learning · arxiv.org
- [2006.12885] Sterile neutrino self-interactions: $H_0$ tension and short-baseline anomalies · arxiv.org
Image: Original diagram, The Daily Triptych. Licence: Original work. Source.