GradMix: Gradient-based Selective Mixup for Robust Data Augmentation in Class-Incremental Learning

Minsu Kim, Seong-Hyeon Hwang, Steven Euijong Whang

TL;DR

While data augmentation techniques like Mixup are widely used to prevent neural networks from forgetting old tasks, randomly pairing images can actually accelerate catastrophic forgetting due to conflicting gradients. To solve this, GradMix mathematically evaluates gradient directions to selectively mix only "helpful" class pairs, significantly improving accuracy in class-incremental learning without heavy computational overhead.

What Problem Does This Paper Address?

In Class-Incremental Learning (CIL), a machine learning model must learn new classes over time without forgetting previously learned ones. The gold standard for mitigating this "catastrophic forgetting" is Experience Replay (ER), which keeps a tiny buffer of old data to replay alongside new data. However, because memory constraints keep this buffer very small, the severe data imbalance between old and new tasks causes the model to heavily favor the new classes.

To fix this imbalance, researchers often turn to data augmentation like Mixup (linearly interpolating pairs of images and their labels) to artificially boost buffer diversity.

The catch? The authors discover that simply applying vanilla Mixup can actually worsen catastrophic forgetting. As shown in the paper's empirical analysis, randomly pairing samples often introduces gradients that directly conflict with the gradients needed to preserve past knowledge.

Figure 2: Comparison of task-wise accuracy over all tasks and class-wise accuracy on the last task between ER and Mixup on the MNIST and CIFAR-10 datasets.

Methods

The authors introduce GradMix, a robust data augmentation method designed to filter out these destructive training pairs.

1. The Gradient-Based Selection Criterion

Using a first-order Taylor series approximation, the authors prove that forgetting occurs when the inner product between the average gradient of the buffer data ($\bar{g}_{buf}$) and the gradient of a mixed sample ($\tilde{g}_{ij}$) is negative (i.e., the angle $\theta$ between them is greater than $90^\circ$). GradMix identifies these "detrimental" pairs and replaces them with "helpful" pairs that maximize the inner product.

Figure 1: Overview of GradMix. The gradients of the original samples and the mixed samples are denoted by 𝑔and ˜𝑔, re- spectively. Given the average gradient of buffer data (denoted as 𝑔𝑏𝑢𝑓), GradMix performs gradient-based selective mixup to mitigate catastrophic forgetting by mixing only samples from helpful class pairs (e.g., ‘Dog’–‘Deer’, where 𝜃≤90◦) and not from detrimental class pairs (e.g., ‘Dog’–‘Automobile’, where 𝜃> 90◦).

2. Making It Practical: Class-Based Grouping & Last-Layer Approximation

Computing gradients for every single pair of samples in a dataset would be computationally impossible during training. GradMix bypasses this bottleneck with two clever engineering choices:

  • Last-Layer Approximation: It only calculates gradients with respect to the weights and biases of the final linear layer, which is highly efficient yet accurately reflects the model's optimization direction.
  • Class-Based Criterion: Because samples within the same class share highly similar gradient directions, GradMix groups samples by class. Instead of a sample-to-sample optimization problem ($O(N^2)$), it solves a class-to-class problem ($O(C^2)$), calculating the optimal mixing strategy just once per epoch.

Datasets

The authors evaluated GradMix across five standard benchmarks and one large-scale dataset:

  • MNIST & Fashion-MNIST (FMNIST): Split into 5 tasks (2 classes per task).
  • CIFAR-10: Split into 5 tasks (2 classes per task).
  • CIFAR-100: Split into 10 tasks (10 classes per task).
  • Tiny ImageNet: Split into 10 tasks (20 classes per task).
  • ImageNet-1K: Used to demonstrate scalability on large-scale data, split into 10 tasks.

Key Insights and Ideas

  • The Dark Side of Random Mixup: On average, 47.3% of randomly generated mixed samples across the tested datasets actively conflict with the gradients needed to retain past knowledge.
  • The Geometry of Forgetting: Catastrophic forgetting isn't just a vague phenomenon; it can be geometrically modeled and predicted by looking at the angle between gradient vectors.
  • Semantic Similarity Helps Replay: GradMix's selective pairing naturally rediscovers semantic relationships. For example, in CIFAR-10, it frequently pairs older vehicle classes with similar new vehicle classes, showing that augmenting past knowledge with similar current knowledge yields the most stable gradients.

Key Results

GradMix consistently outperformed basic Experience Replay and all other data augmentation baselines (including Manifold Mixup, CutMix, Remix, Balanced-MixUp, and RandAugment):

  • CIFAR-100: GradMix achieved an average accuracy of 54.6%, outperforming vanilla Mixup (50.7%) and standard ER (49.1%).
  • Tiny ImageNet: GradMix reached 40.5% accuracy, compared to ER's 38.5% and Mixup's 37.1%.
  • Plug-and-Play Compatibility: GradMix was integrated into advanced CIL frameworks (like DER, FOSTER, and MEMO) and uniformly boosted their performance. For instance, adding GradMix to the FOSTER framework on CIFAR-100 raised accuracy from 61.8% to 66.1%.

Limitations and Future Work

  • Scalability to Massive Class Counts: While class-based grouping reduces overhead, the complexity still scales quadratically with the number of classes ($O(C^2)$). For datasets with thousands of classes, this could become a bottleneck. The authors suggest using Locality-Sensitive Hashing (LSH) or pre-clustering similar classes to handle this in the future.
  • Task Constraints: GradMix relies on interpolating features and labels. It may not be directly applicable to tasks where mixing inputs creates semantically nonsensical data, such as discrete symbolic features or complex semantic segmentation maps.

Summary updated

BibTeX
@inproceedings{kim2026gradmix,
  author = {Minsu Kim and Seong-Hyeon Hwang and Steven Euijong Whang},
  title = {{GradMix: Gradient-based Selective Mixup for Robust Data Augmentation in Class-Incremental Learning}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2026},
  doi = {10.1145/3770854.3780300},
}
Figure