Median-Voter Gradient Updates for Multi-Task Learning

When one neural network is trained on several tasks at once, the tasks often pull its shared weights in opposite directions. Current fixes for this "gradient interference" search the full space of possible update directions for a good compromise. That is a multi-dimensional collective-choice problem, and such problems have a known pathology: outside one dimension there is usually no compromise that a majority of voters prefers to every alternative. In one dimension the situation is different. If each voter has a single favorite point and likes other points less the farther they are from it, the median voter's favorite beats every alternative in a head-to-head majority vote. Facility-location mechanisms depend on this property and lose it when they move from a line to a plane.

We propose to recover that one-dimensional structure inside multi-task optimization. Along any single direction in weight space, a local quadratic approximation of each task's loss is single-peaked in step size, so each task has a well-defined preferred step. The method breaks the update into a small number of nearly independent one-dimensional problems along the principal directions of the task gradients. Along each direction it takes the median of the tasks' preferred steps, which gives an update that a majority of tasks endorses direction by direction. The rest of the note asks whether this is more than a dressed-up form of gradient normalization, and when it helps.

Core Claim

Take $u_1,\dots,u_r$ to be the top right singular vectors of the $K \times D$ matrix of task gradients, where $K$ is the number of tasks and $D$ the number of shared parameters. These come from the eigenvectors of the $K\times K$ Gram matrix of pairwise gradient inner products, so no $D$-dimensional factorization is needed. Along direction $u_j$, task $k$'s local loss model is

$$L_k(\theta - t\,u_j) \approx L_k(\theta) - t\,a_{kj} + \tfrac12 t^2 h_{kj},$$

where $a_{kj} = g_k^\top u_j$ is the task gradient's projection and $h_{kj} = u_j^\top H_k u_j$ is the task's curvature along $u_j$. Whenever $h_{kj} > 0$ this is single-peaked with preferred step $t^*_{kj} = a_{kj}/h_{kj}$. The proposed update is

$$d = \sum_{j=1}^{r} \mathrm{median}_k\!\left(t^*_{kj}\right) u_j \;+\; P_{\perp}\,\bar g,$$

where $P_\perp \bar g$ is the average gradient restricted to the directions left over after the top $r$.

Two properties follow. First, along each principal direction, no majority of tasks would prefer a different step. This is the median-voter property, and it has no analogue for update rules chosen in the full space. Second, the rule is robust to magnitude imbalance. A single task with an enormous gradient can drag the average, and can dominate the CAGrad reference direction, but it cannot move a median past the other tasks.

The claim is conditional, and the conditions can be tested. The per-direction guarantee holds only if curvatures are positive along the chosen directions, and it holds only approximately to the extent that the tasks' curvatures couple different directions. We expect the method to help most when $K$ is large, as on CelebA or MT50, where a median is meaningful. We expect little gain at $K=3$.

Relation to Prior Work

The mechanism comes from Direction 2, and so does its main constraint. Facility Location with Minimax Envy builds truthful left-right-median mechanisms on the line and reports that they break in the plane and on networks because single-peakedness is lost. We keep the mechanism by working only in one-dimensional slices. Facility Location Games with Scaling Effects shows that single-peakedness on an interval holds only under a slope condition ($q(y)\ge|q'(y)|$). Our analogue is the requirement $h_{kj}>0$, and we treat directions where it fails as a case to detect, not assume away. Dispersing points on intervals, where the one-dimensional problem is linear-time and the planar one NP-hard, and the comparison theorems of Backward doubly stochastic differential equations with weak assumptions on the coefficients, which rely on scalar ordering, both motivate the broader bet that ordering-based tools should be applied on lines rather than lifted to vectors.

The closest multi-task work falls into three groups.

Dual and aggregation methods. Conflict-Averse Gradient Descent (CAGrad) shows that the optimal constrained update lies in the span of the task gradients and solves a $K$-dimensional dual. We use the same span and the same Gram matrix, but we replace the worst-case improvement objective with per-direction majority agreement. Fantastic Multi-Task Gradient Updates and How to Find Them In a Cone (CONICGRAD) swaps CAGrad's ball for a cone around the mean gradient. It therefore inherits the mean's sensitivity to large gradients, and it degenerates when the mean is near zero, which is exactly the regime where medians differ most from means. From Gradient Volume to Shapley Fairness (SVFair) measures all-task conflict through the Gram determinant and allocates updates with Monte Carlo Shapley values. We also avoid pairwise comparisons, but through an exact order statistic rather than sampled values.

Order-dependent surgery. Gradient Surgery for Multi-Task Learning (PCGrad) projects gradients pairwise in a random order. The median needs no ordering of tasks, because the order it uses is the natural order of real numbers along a line.

Spectral and subspace methods. Scalable Multi-Task Low-Rank Model Adaptation (mtLoRA) finds that 89.4% of inter-task alignment sits in the top 10% of singular components. That finding motivates restricting the median step to a few principal directions. mtLoRA uses it to regularize adapters, whereas we use it to aggregate gradients. RotoGrad rotates a 1024-dimensional feature subspace to align tasks. That supports the view that conflict is low-dimensional, but RotoGrad learns rotations rather than choosing a basis in which aggregation is one-dimensional. None of these methods offers a majority-agreement guarantee.

Research Program

We will build the update as a drop-in replacement for the CAGrad aggregation step, so that its per-step cost is the Gram computation that CAGrad already pays.

The basis $u_j$ comes from the Gram eigendecomposition. The number of principal directions $r$ is chosen by a spectral energy threshold. Curvature $h_{kj}$ is estimated in one of three ways, and all three are compared:

  1. set $h_{kj}=1$ for every task, so the preferred step equals the projection;
  2. use a diagonal proxy from the optimizer's second-moment estimates;
  3. use exact Hessian-vector products along the $r$ directions, on a subset of steps.

For even $K$, where the median is an interval, we take the endpoint closest to the mean. When some tasks have $h_{kj}\le 0$ along a direction, the method falls back to a trimmed mean along that direction and logs the event.

The analysis has two parts. First, we will prove that the per-direction median is a majority winner when the directions decouple the tasks' quadratics. We will then bound how much the guarantee degrades as the off-diagonal curvature coupling between directions grows. Second, we will characterize the failure mode we consider most serious: a persistent minority task that is outvoted in every direction and starves. For that case we will study a quantile variant that shifts from the median toward the minority task's side when that task's loss stalls.

Baselines

The naive reference points are linear scalarization with equal weights, and independent single-task models as a ceiling where they are available. CAGrad reports MT50 success rates of 0.36 for multi-task SAC and 0.52 for CAGrad, and a NYUv2 $\Delta m\%$ of 0.20% for CAGrad.

The strongest existing competitors are CONICGRAD and SVFair. The file reports CONICGRAD at $\Delta m\% = -5.13\%$ on NYUv2 and 0.89 success on MT10. It reports SVFair at $\Delta m\% = -0.63\%$ on CelebA with 40 tasks and 0.97 success on MT10. These are the strongest numbers in the file, but they come from different papers and possibly different setups. We will therefore rerun CAGrad, CONICGRAD, SVFair and PCGrad in one codebase. All methods will share the same backbone, training steps and data order. Each method's own hyperparameter (cone angle, ball radius $c$, temperature $\tau$, or our $r$) gets an equal tuning budget of the same number of trials, tuned on validation splits.

Beating the baselines means lower $\Delta m\%$ and better worst-task performance than the best rerun baseline on CelebA and MT50, with confidence intervals over at least five seeds that do not overlap. On NYUv2 we would count parity as success.

Four ablations isolate the key ingredient:

  • Mean in the same basis. Same directions, mean instead of median. This tests whether the median matters.
  • Coordinate-wise median. Median taken in raw parameter coordinates. This tests whether the principal basis matters.
  • Random orthonormal basis. Median taken in a random basis spanning the same subspace.
  • Magnitude-normalized mean. Every task gradient is rescaled to unit length before averaging.

Why not just…?

Why not just normalize task gradient magnitudes and average? This is the most serious threat. Much of the median's robustness may come simply from ignoring gradient magnitude. The magnitude-normalized-mean ablation settles it. If that ablation matches the median on CelebA and MT50, the voting interpretation adds nothing and we will report that. The median should differ where directions are contested: normalized averaging still lets many weakly disagreeing tasks cancel a direction a majority wants. We will measure how often the two rules' signs differ per direction, and whether the gains concentrate in those directions.

Why not just take a coordinate-wise median of the raw gradients? It is cheaper and needs no Gram matrix. Its result, however, depends on how the parameters happen to be laid out, and raw coordinates are not directions along which tasks conflict. The single-peaked, majority-winner argument holds along any line, but the directions must also be nearly uncoupled for the per-direction answers to combine well. The principal basis is our best cheap guess at such directions. The coordinate-basis and random-basis ablations test this directly.

Why not just use CAGrad or CONICGRAD with a tuned radius or angle? These methods optimize the worst-off task relative to the mean gradient. They are strong, and at $K=3$ we expect them to be as good as our method. Their weakness is the reference direction: when conflicts nearly cancel the mean, the constraint around it carries little information, as the CONICGRAD analysis itself notes. Our prediction is specific: the advantage over them should grow with $K$ and with how often the mean gradient has small norm. We will plot the gap against both quantities.

Why not just tune static loss weights? Exact Pareto Optimal Search for Multi-Task Learning shows that linear scalarization cannot reach non-convex parts of the Pareto front. The MT50 gap between 0.36 and 0.52 reported by CAGrad suggests the practical cost is large. We include tuned-weight scalarization under the same tuning budget, so this is checked rather than assumed.

Proposed Experiments and Decisive Checks

We will evaluate on NYUv2 (segmentation, depth and surface normals, $K=3$), CelebA ($K=40$), and Meta-World MT10 and MT50. We will add the massively parallel MTBench suite (MTBench, from Benchmarking Massively Parallelized Multi-Task Reinforcement Learning for Robotics Tasks) to test the $K$ trend at scale. Metrics are $\Delta m\%$, mean rank, success rate, and worst-task performance, and we will record wall-clock overhead relative to CAGrad.

Three checks decide whether the idea holds.

The premise. Along the chosen $u_j$, we will run line scans of each task's true loss to measure how often single-peakedness actually holds. We will also estimate the cross-direction curvature coupling with Hessian-vector products. If single-peakedness routinely fails, the guarantee is empty and the method reduces to a heuristic.

The social-choice diagnosis. At sampled training steps, we will count how often a majority of tasks would locally prefer some other candidate update, drawn from perturbations and from the competing methods' updates, to the mean, CAGrad and median updates. The median should have the lowest violation rate. If it does not, the one-dimensional decomposition is not delivering its promised property.

The attribution test. The median must beat both the mean-in-the-same-basis and the magnitude-normalized-mean ablations on CelebA and MT50. We will also check that the minority-starvation failure mode does not appear as a collapsing worst-task curve. If both hold, the gain can be attributed to one-dimensional majority aggregation. If not, we will report the negative result that interference is a magnitude problem rather than an aggregation problem.