Papers
Topics
Authors
Recent
Search
2000 character limit reached

Gradient-Aware Logit Adjustment (GALA)

Updated 10 February 2026
  • Gradient-Aware Logit Adjustment (GALA) is a loss formulation for imbalanced, long-tailed classification that dynamically adjusts logits using per-class gradient statistics.
  • It modifies training by incorporating running averages of positive and negative gradient magnitudes to counteract head-class bias in deep networks.
  • A post-hoc L1 normalization strategy further re-balances prediction scores, achieving notable top-1 accuracy improvements on benchmarks like CIFAR100-LT and iNaturalist2018.

Gradient-Aware Logit Adjustment (GALA) is a loss formulation designed for long-tailed classification, where the data distribution is highly imbalanced across classes. In such scenarios, conventional deep classifiers exhibit substantial bias toward head classes because their weights experience disproportionately large positive and negative gradients during training. GALA counters this by dynamically adjusting logits according to per-class accumulated gradient statistics, thus achieving more balanced optimization. Post-training, a test-time normalization strategy can further mitigate residual head-class bias, leading to top-1 accuracy improvements on benchmarks including CIFAR100-LT, Places-LT, and iNaturalist2018 (Zhang et al., 2024).

1. Long-Tailed Classification and Gradient Imbalance

A long-tailed classification setting is defined over CC classes, with each class ii possessing nin_i training samples. The degree of imbalance is quantified via the imbalance factor (IF):

IF=maxiniminini\text{IF} = \frac{\max_i n_i}{\min_i n_i}

Deep networks operating in this regime produce features xRdx \in \mathbb{R}^d and logits

zj=ωjTx+bj,j=1,,Cz_j = \omega_j^T x + b_j,\quad j = 1,\ldots,C

where ωj\omega_j is the jjth class vector and bjb_j is a bias.

Standard training with cross-entropy loss

LCE(x,y)=logezyj=1Cezj\mathcal{L}_{\rm CE}(x, y) = -\log \frac{e^{z_y}}{\sum_{j=1}^C e^{z_j}}

yields per-class gradients

ii0

Due to skewed sample counts, class weights for head classes accumulate much larger magnitudes of both positive gradients (from in-class samples) and negative gradients (from other classes). In contrast, tail-class weights experience overwhelming negative gradients originating from frequent head-class samples, exacerbating prediction bias.

2. GALA Loss Formulation

2.1. From Frequency-based to Gradient-based Adjustment

Prior work (Menon et al., 2021) compensates for imbalance by augmenting logits with terms proportional to ii1, the log-frequency of each class. GALA generalizes this idea: rather than relying on static class-size statistics, GALA uses dynamically accumulated gradient magnitudes for logit adjustment.

2.2. Tracking Accumulated Gradient Magnitudes

GALA maintains two momentum-driven statistics for each class ii2:

  • ii3 – running average of accumulated positive gradient magnitudes (for which ii4 is the correct label)
  • ii5 – running average of accumulated negative gradient magnitudes induced by class-ii6 samples onto all other class weights

The statistics are updated per mini-batch ii7 as follows, with momentum parameter ii8:

ii9

nin_i0

where nin_i1 is the set of samples in the current batch with label nin_i2.

2.3. Gradient-Aware Logit Adjustment

For a training sample nin_i3, unadjusted logits nin_i4 are modified per

nin_i5

where nin_i6 is a scale parameter tuned on validation data. Adjusted logits are then

nin_i7

and the GALA loss becomes

nin_i8

Adding nin_i9 to off-diagonal terms scales the negative gradient according to each class’s own positive-gradient history. Subtracting IF=maxiniminini\text{IF} = \frac{\max_i n_i}{\min_i n_i}0 diminishes the influence of negative gradients originating from the true class, counterbalancing bias from imbalanced sample contributions.

3. Algorithmic Workflow

The GALA procedure per mini-batch is as follows:

  1. Feature & Logit Computation: For each batch sample IF=maxiniminini\text{IF} = \frac{\max_i n_i}{\min_i n_i}1, compute features IF=maxiniminini\text{IF} = \frac{\max_i n_i}{\min_i n_i}2 and raw logits IF=maxiniminini\text{IF} = \frac{\max_i n_i}{\min_i n_i}3.
  2. Logit Adjustment: For each IF=maxiniminini\text{IF} = \frac{\max_i n_i}{\min_i n_i}4, set IF=maxiniminini\text{IF} = \frac{\max_i n_i}{\min_i n_i}5; IF=maxiniminini\text{IF} = \frac{\max_i n_i}{\min_i n_i}6. Set adjusted logits IF=maxiniminini\text{IF} = \frac{\max_i n_i}{\min_i n_i}7.
  3. Loss & Gradient Step: Compute

IF=maxiniminini\text{IF} = \frac{\max_i n_i}{\min_i n_i}8

and update IF=maxiniminini\text{IF} = \frac{\max_i n_i}{\min_i n_i}9 via standard SGD.

  1. Compute Batch Gradient Statistics:
    • xRdx \in \mathbb{R}^d0average xRdx \in \mathbb{R}^d1 over xRdx \in \mathbb{R}^d2 with xRdx \in \mathbb{R}^d3
    • xRdx \in \mathbb{R}^d4 average over xRdx \in \mathbb{R}^d5 with xRdx \in \mathbb{R}^d6 of xRdx \in \mathbb{R}^d7
  2. Update Running Stats:

( \theta_j \leftarrow \mu\theta_j + (1-\mu) g+_j,\quad \phi_j \leftarrow \mu\phi_j + (1-\mu) g-_j )

Key hyperparameters are the momentum xRdx \in \mathbb{R}^d8 (e.g., 0.99) and the logit-adjustment scale xRdx \in \mathbb{R}^d9.

4. Post-hoc Prediction Re-balancing

Despite GALA training, models may retain a head-class prediction bias. A post-hoc normalization procedure is applied to test-set probability predictions zj=ωjTx+bj,j=1,,Cz_j = \omega_j^T x + b_j,\quad j = 1,\ldots,C0 (size zj=ωjTx+bj,j=1,,Cz_j = \omega_j^T x + b_j,\quad j = 1,\ldots,C1):

Columns zj=ωjTx+bj,j=1,,Cz_j = \omega_j^T x + b_j,\quad j = 1,\ldots,C2 for each class zj=ωjTx+bj,j=1,,Cz_j = \omega_j^T x + b_j,\quad j = 1,\ldots,C3 are re-scaled:

zj=ωjTx+bj,j=1,,Cz_j = \omega_j^T x + b_j,\quad j = 1,\ldots,C4

where zj=ωjTx+bj,j=1,,Cz_j = \omega_j^T x + b_j,\quad j = 1,\ldots,C5 (temperature) interpolates between raw predictions (zj=ωjTx+bj,j=1,,Cz_j = \omega_j^T x + b_j,\quad j = 1,\ldots,C6) and zj=ωjTx+bj,j=1,,Cz_j = \omega_j^T x + b_j,\quad j = 1,\ldots,C7-normalized columns (zj=ωjTx+bj,j=1,,Cz_j = \omega_j^T x + b_j,\quad j = 1,\ldots,C8). Predictions are finalized as zj=ωjTx+bj,j=1,,Cz_j = \omega_j^T x + b_j,\quad j = 1,\ldots,C9 per test example.

When ωj\omega_j0, all classes are assigned equal total prediction mass; at ωj\omega_j1, there is no adjustment.

5. Empirical Performance

GALA and its prediction re-balancing variant are evaluated against other methods, notably the gradient-corrective loss (GCL), on established long-tailed benchmarks. The experimental results are as follows:

Dataset Imbalance Factor Baseline (CE) GCL GALA GALA + Post-norm
CIFAR100-LT 100 38.43% 48.71% 52.10% 52.30%
Places-LT ~498 40.64% 41.00% 41.40%
iNaturalist2018 ~500 72.10% 71.20% 73.30%
ImageNet-LT 54.8% 55.0%

GALA outperforms GCL by margins of up to 3.59% on CIFAR100-LT and 1.20% on iNaturalist2018. This indicates that per-class accumulated gradient statistics for logit adjustment and subsequent post-hoc normalization lead to improved top-1 accuracy on severely imbalanced datasets (Zhang et al., 2024).

6. Context within Long-Tailed Learning Research

GALA extends frequency-based logit adjustment strategies by harnessing signal from gradient statistics generated during optimization, enabling dynamic correction of gradient imbalance that is not captured by static sample counts. The approach operates entirely within the standard classification architecture and training regime, requiring only per-class momentum variables and no architectural modifications.

A key observation is that, even with adaptive logit adjustment, prediction bias toward head classes may persist post-training—necessitating the introduction of the post-hoc ωj\omega_j2-based normalization strategy. This suggests that sources of bias in long-tailed recognition may remain partially unaddressed by loss reweighting or margin-based methods alone.

GALA’s empirical performance across multiple long-tailed benchmarks provides evidence supporting gradient-aware mechanisms as a valuable direction for future long-tailed and imbalanced learning research.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Gradient-Aware Logit Adjustment (GALA).