NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Mitigating Dataset Bias by Using Per-Sample Gradient

Sumyeong Ahn, Seongyoon Kim, Se-Young Yun

Introduction

Deep learning models often "cheat" by learning shortcuts or dataset biases—such as associating the concept of a "camel" strictly with a "desert" background—rather than learning the actual target features. When these models are deployed in the real world, they frequently fail on examples that break these learned rules.

To address this, researchers have introduced Per-sample Gradient-based Debiasing (PGD). This novel method uses the magnitude of a sample's gradient to identify and upweight rare, "bias-conflicting" examples during training. By doing so, PGD achieves state-of-the-art performance without requiring expensive, manual bias labels from humans.

The Problem: Lazy Neural Networks

Neural networks are notoriously "lazy" learners. If a training dataset contains a strong but unintended correlation—for instance, if 95% of "bird" images feature a blue sky background—the model will likely learn to classify a "bird" based on the sky color rather than the animal's physical shape.

In this context, samples that follow the shortcut are considered bias-aligned, while the rare ones that break the rule (e.g., a bird in a dense green forest) are bias-conflicting.

Examples of bias-conflicting samples in Colored MNIST, where the digit color does not match the heavily correlated bias.

Standard training regimes often ignore these rare bias-conflicting samples, leading to models that fail when the shortcut no longer applies. While previous methods have attempted to fix this using model outputs like loss or logits, these scalar values often lack the high-dimensional detail needed to truly understand and counteract complex biases.

The PGD Method

The authors propose a three-step algorithm to automatically discover and mitigate bias:

  1. Train a Biased Model: First, the researchers intentionally train a model ($f_b$) to be extra biased. They utilize a "Generalized Cross-Entropy" (GCE) loss, which amplifies the model's focus on easy-to-learn shortcuts.
  2. Compute Gradient-based Importance: For every sample in the dataset, the algorithm calculates the norm (magnitude) of the gradient with respect to the last layer's parameters. The core intuition is that bias-conflicting samples are "difficult" for the heavily biased model to process, which naturally results in larger gradients.
  3. Train the Debiased Model: Finally, a new model ($f_d$) is trained from scratch (or initialized from the biased model) using importance sampling. Samples with higher gradient norms are sampled more frequently during training, forcing the model to learn the robust features that actually matter.

To maintain computational efficiency, gradients are only calculated for the final fully connected (FC) layer rather than the entire network.

Key Insights

  • Gradients > Output Space: Most prior work looked at a model's "loss" to find hard samples. However, gradients are significantly more informative. They provide high-dimensional information about how the model needs to change to fix an error, rather than just signaling that an error occurred.
  • The Fisher Information Connection: The paper provides a rigorous mathematical backbone for PGD. The authors demonstrate that debiasing can be framed as a min-max problem, and that PGD acts as an optimizer minimizing the "trace of the inverse Fisher Information"—a statistical measure of how much information the data provides about the model's parameters.
  • Simplicity is Strength: Unlike many debiasing methods, PGD doesn't require humans to define the bias (e.g., "ignore the background") or provide extra annotations. It discovers the bias automatically through training dynamics.

Key Results

PGD was evaluated on a mix of synthetic benchmarks (Colored MNIST, Multi-bias MNIST, Corrupted CIFAR) and real-world datasets (Biased Action Recognition, Biased FFHQ, CelebA, and CivilComments-WILDS). It consistently outperformed existing state-of-the-art methods like LfF and Disen.

Performance comparison of PGD against baseline methods across real-world (table) and synthetic (charts) datasets.
  • Colored MNIST: On the most severe version of the dataset (where only 0.5% of samples are bias-conflicting), PGD achieved 96.88% accuracy. This is a massive improvement over the vanilla model's 60.94% and beats the previous best method by over 2%.
  • Multi-bias MNIST: In complex scenarios involving up to eight different attributes, PGD showed even greater dominance, outperforming competitors by over 35% in certain cases.
  • Generality: The method is architecture-agnostic. It successfully improved performance on the CivilComments NLP task, proving its efficacy with Transformer architectures as well as CNNs.

Limitations and Future Work

While highly effective, PGD does present a few challenges. Even though it only uses the last layer's gradients, calculating per-sample gradients makes training roughly 1.5x to 2x slower than standard regimes. Additionally, the current theory assumes a dataset without "noisy" (incorrect) labels. In messy real-world data, a high gradient might point to a mislabeled sample rather than a valid bias-conflicting one.

Future work will explore "release approximations" to accelerate gradient calculations and investigate how PGD can be adapted to handle corrupted or poisoned datasets.

Summary updated

BibTeX
@inproceedings{ahn2023mitigating,
  author = {Sumyeong Ahn and Seongyoon Kim and Se-Young Yun},
  title = {{Mitigating Dataset Bias by Using Per-Sample Gradient}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=7mgUec-7GMv},
}
Figure