One Pass ImageNet

Huiyi Hu, Ang Li, Daniele Calandriello, Dilan Gorur

TL;DR

Standard deep learning assumes models can take dozens of passes over static datasets, but real-world streaming data makes storing everything impossible. This paper introduces the One Pass ImageNet (OPIN) benchmark to study streaming learning under strict storage and compute limits, showing that a naive single-pass ResNet-50 plummets from 76.9% to 30.6% accuracy. By introducing an Error-Prioritized Replay (EPR) strategy, the authors recover accuracy to 65.0% while slashing both compute and required data storage by 90%.

What Problem Does This Paper Address?

State-of-the-art vision models typically rely on multi-epoch training: a standard ResNet-50 reviews ImageNet’s 1.2 million images 90 times. In production and streaming environments—such as continuous data ingestion where privacy constraints or storage costs prevent hoarding data—iterating over a full dataset multiple times is impossible.

When a model only observes each sample once in a stream, it suffers from two major challenges:

  1. The cold-start problem: Early in training, random representations make learning slow and noisy.
  2. The forgetting problem: The model gradually forgets earlier concepts as training progresses, even without explicit domain shift.

The authors propose the One Pass ImageNet (OPIN) problem to formalize this setting, evaluating models as a multi-objective trade-off across three metrics: Top-1 Accuracy, Data Storage, and Compute (number of backpropagation steps), both normalized against standard 90-epoch training.

Methods

To tackle OPIN, the authors propose Error-Prioritized Replay (EPR), adapting experience replay from continual learning:

  • Biased Reservoir Sampling: As the stream arrives, a small memory buffer retains past examples. To balance past and recent samples, the insertion probability uses a biased reservoir sampling rule ($p(n, m) = \beta m / n$ with $\beta = 1.5$, where $m$ is buffer size and $n$ is total seen samples).
  • JPEG Storage Trick: Instead of holding uncompressed image tensors in memory, the buffer stores raw JPEG-encoded bytes. This provides a $\sim 3\times$ reduction in footprint and allows standard data augmentations (random flips and crops) to be applied on the fly when replaying.
  • Error-Based Priority: Samples are retrieved from the replay buffer with probability proportional to their predictive error (loss): $$P(x, y) = 1 - \alpha e^{-\ell(x, y; \theta)}$$ A cosine schedule smooths the parameter $\alpha$ over time ($0 \to 1$), ensuring the model doesn't over-rely on unreliable predictions during the early cold-start phase.

  • Importance Weighting: To prevent sampling bias from distorting the gradient updates, replayed samples are weighted inversely to their sampling probability ($w(x) \propto 1/P(x)$).

  • Compute Budget Scaling: For every new incoming batch, the model samples and trains on $k$ replay batches, corresponding to $k + 1$ effective epochs of compute.

Datasets

  • ImageNet (ILSVRC 2012): Evaluated strictly as a stream of 1.2M images across 1,000 classes. Unlike class-incremental continual learning benchmarks, OPIN enforces no artificial class orderings or explicit domain splits; data arrives in a uniform random stream across 10 random seeds.

Key Insights and Ideas

  • A tiny buffer yields huge returns: Storing just 1% of ImageNet (about 100 mini-batches) bridges most of the performance collapse, boosting single-pass accuracy from 30.6% to 59.3% when combined with replay steps.
  • Online priority updating is counterproductive: Intuitively, one might want to update a sample's priority score after replaying it. Surprisingly, testing showed that updating priorities yielded 58.8% accuracy compared to 58.9% when leaving priorities untouched—saving computational overhead with zero performance penalty.
  • Uniform replay is a tough baseline: Vanilla uniform replay attained 64.7% top-1 accuracy (at 10% storage and 8 replay steps), trailing the error-prioritized method (65.0%) by only 0.3%. While prioritization helps, simple uniform replay remains remarkably strong.
  • Correcting distribution shift is necessary: Omitting the importance weights ($w(x)$) dropped accuracy by roughly 1.0%, demonstrating that sampling hard examples changes the effective training distribution enough to hurt test generalization if uncorrected.

Key Results

All experiments use a ResNet-50 trained with SGD, Nesterov momentum, and a cosine learning rate decay:

Method Top-1 Accuracy (%) Storage (%) Compute (%)
Multi-epoch (90 epochs) 76.9 100 100
Naive One-Pass (1 epoch) 30.6 0 1.1
One-Pass (EPR, $k=1$, 1% buffer) 44.7 1 2.2
One-Pass (EPR, $k=8$, 1% buffer) 59.3 1 10.0
One-Pass (EPR, $k=8$, 10% buffer) 65.0 10 10.0
Multi-epoch baseline (matched 9 epochs) 68.2 100 10.0

EPR achieves within 3.2% of a model trained over the full dataset for 9 epochs, while storing only a tenth of the data.

Limitations and Future Work

  • Data Ordering: OPIN assumes an i.i.d. random arrival order. Real-world streams frequently contain temporal correlations, seasonal shifts, and non-stationary label distributions.
  • Architecture Exploration: Experiments were restricted exclusively to ResNet-50; exploring Vision Transformers (ViTs) or lightweight architectures remains unexplored.
  • Remaining Accuracy Gap: While EPR cuts resources by 90%, it still lags 11.9% behind full 90-epoch training (65.0% vs. 76.9%), leaving ample room for better prioritization schemes, distillation, or self-supervised representations in stream settings.

Summary updated

BibTeX
@inproceedings{hu2021one,
  author = {Huiyi Hu and Ang Li and Daniele Calandriello and Dilan Gorur},
  title = {{One Pass ImageNet}},
  booktitle = {ImageNet PPF @ NeurIPS},
  year = {2021},
  url = {https://openreview.net/forum?id=mEgL92HSW6S},
}
Figure