Optimizing Class Distribution in Memory for Multi-Label Online Continual Learning

Yan-Shuo Liang, Wu-Jun LiarXiv 2022

Abstract

Online continual learning, especially when task identities and task boundaries are unavailable, is a challenging setting. Replay-based methods maintain a small buffer of past samples to overcome catastrophic forgetting. However, most existing methods focus on single-label problems. In multi-label settings, class distributions are typically highly imbalanced, and managing memory is difficult because changing one sample affects multiple class counts. We propose Optimizing Class Distribution in Memory (OCDM), which formulates memory management as an optimization problem. OCDM selects samples to minimize the distance between the memory's distribution and a balanced target distribution using a fast greedy algorithm. Experiments on MSCOCO and NUS-WIDE show that OCDM effectively controls memory distribution and outperforms state-of-the-art methods.

Introduction

Continual learning research has traditionally focused on single-label classification. However, real-world data is frequently multi-label, where a single instance (e.g., an image) may belong to multiple categories simultaneously. In an online setting where data arrives in a continuous stream without explicit task boundaries, models suffer from catastrophic forgetting.

Replay-based strategies mitigate this by storing a subset of past data in a memory buffer. In multi-label scenarios, this is complicated by extreme class imbalance and label interdependence. Deleting a sample to reduce the frequency of a majority class might inadvertently remove a rare instance of a minority class. Existing methods often struggle with either computational efficiency or maintaining a truly balanced memory distribution.

The OCDM Method

To address these challenges, we introduce OCDM (Optimizing Class Distribution in Memory). This method treats memory management as a formal optimization task rather than a heuristic sampling process.

The process involves three main steps:

  1. Target Distribution Definition: We define an ideal, balanced distribution for the memory, typically aiming for an equal representation of all classes encountered so far.
  2. Optimization Objective: We seek to select a subset of samples from the union of the current memory and the new data batch that minimizes the statistical distance (such as KL-divergence) to the target distribution.
  3. Greedy Deletion Strategy: Because finding the optimal subset is computationally prohibitive, OCDM employs a greedy deletion algorithm. It iteratively identifies and removes the single sample whose absence brings the remaining set closest to the target distribution.
Overview of the OCDM memory update mechanism. The process optimizes the selection of samples from the union of the current memory and new batch to match a balanced target distribution.

This approach is computationally efficient, operating in linear time, making it suitable for high-speed online data streams.

Experimental Evaluation

We evaluated OCDM on modified versions of the MSCOCO and NUS-WIDE datasets. A key contribution of our work is the introduction of the Multi-Label Ratio (MLR) metric. We observed that previous benchmarks like COCOseq were essentially "stealth" single-label problems with very low MLR. Our experimental streams utilize datasets with significantly higher MLR to provide a rigorous test for multi-label algorithms.

Performance and Efficiency

OCDM consistently outperformed state-of-the-art methods like Partition Reservoir Sampling (PRS). On the MSCOCO stream, OCDM achieved a Mean Average Precision (mAP) of 43.0%, surpassing PRS's 41.1%. The performance gain was particularly pronounced in minority classes, where OCDM often doubled the F1 scores of standard reservoir sampling.

Furthermore, OCDM is nearly twice as fast as PRS. In our tests on MSCOCO, OCDM processed 1000 steps in approximately 673 seconds, compared to 1215 seconds for PRS.

Analysis of Memory Distribution

The core strength of OCDM lies in its ability to maintain a balanced memory despite highly imbalanced input streams. As shown in the figure below, baseline methods like Random Sampling (RS) or GSS result in memory distributions that mirror the imbalance of the data stream. In contrast, OCDM produces a significantly flatter, more uniform distribution.

Comparison of class distributions in memory across different methods. OCDM (rightmost columns) maintains a significantly more balanced distribution than baselines.

This balance is the primary driver for preventing forgetting, especially for classes that appear infrequently in the stream.

Conclusion

OCDM provides a mathematically grounded and computationally efficient solution for multi-label online continual learning. By framing memory management as an optimization problem and solving it via greedy deletion, it achieves superior accuracy and balance. Future work will explore dynamic memory budgets and explicitly modeling label correlations to further enhance performance.

Summary updated

BibTeX
@misc{liang2022optimizing,
  author = {Yan-Shuo Liang and Wu-Jun Li},
  title = {{Optimizing Class Distribution in Memory for Multi-Label Online Continual Learning}},
  year = {2022},
  eprint = {2209.11469},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2209.11469},
}
Figure