Scaling Up Dataset Distillation to ImageNet-1K with Constant Memory

Justin Cui, Ruochen Wang, Si Si, Cho-Jui Hsieh · OpenReview

Abstract

Dataset distillation methods aim to compress a large dataset into a small set of synthetic samples, such that when being trained on, competitive performances can be achieved compared to regular training on the entire dataset. Among recently proposed methods, Matching Training Trajectories (MTT) achieves state-of-the-art performance on CIFAR-10/100, while having difficulty scaling to ImageNet-1k dataset due to the large memory requirement when performing unrolled gradient computation through back-propagation. Surprisingly, we show that there exists a procedure to exactly calculate the gradient of the trajectory matching loss with constant GPU memory requirement (irrelevant to the number of unrolled steps). With this finding, the proposed memory-efficient trajectory matching method can easily scale to ImageNet-1K with 6x memory reduction while introducing only around 2% runtime overhead than original MTT. Further, we find that assigning soft labels for synthetic images is crucial for the performance when scaling to larger number of categories (e.g., 1,000) and propose a novel soft label version of trajectory matching that facilities better aligning of model training trajectories on large datasets. The proposed algorithm (TESLA) not only surpasses previous SOTA on ImageNet-1K under extremely low IPCs (Images Per Class), but also for the first time enables us to scale up to 50 IPCs on ImageNet-1K. Our method achieves 27.9% testing accuracy, a remarkable +18.2% margin over prior arts.

Introduction

Training modern AI requires massive datasets, which are expensive to store and slow to process. Dataset Distillation (DD) attempts to solve this by creating a tiny "synthetic" version of a dataset (e.g., just 10 or 50 images per class) that can train a model to nearly the same accuracy as the original.

The current gold standard for this is Matching Training Trajectories (MTT), which works by making a "student" model mimic the parameter path taken by a "teacher" model trained on real data. However, MTT has a significant flaw: to calculate gradients, it must "unroll" and store the entire optimization path in GPU memory. For large-scale datasets like ImageNet-1K, this memory requirement becomes prohibitive, preventing scaling beyond a few images per class even on high-end hardware.

Methodology

To break this bottleneck, the authors introduce TESLA (TrajEctory matching with Soft Label Assignment), which features two primary innovations:

  1. Constant Memory Trajectory Matching: The researchers mathematically rearranged the trajectory matching loss function. They discovered that by caching a running sum of gradients, they could compute the exact same result as the original MTT while storing only one computational graph at a time. This shifts the memory complexity from $O(T)$ (linear with steps) to $O(1)$ (constant).
  2. Soft Label Assignment (SLA): In datasets with many classes, using "hard" labels is often too restrictive. TESLA uses the teacher model to generate "soft" labels (probability distributions) for synthetic images. Crucially, these labels are generated from the specific point in the teacher's training trajectory being matched, capturing the "dark knowledge" of inter-class relationships as they evolve during learning.
The TESLA framework architecture, illustrating the teacher model, soft label assignment (SLA), and the constant memory computation loop.

Experimental Results

TESLA was evaluated on CIFAR-10/100 and ImageNet-1K (resized to 64x64). The method demonstrates exceptional efficiency, achieving a 6x reduction in memory footprint on ImageNet-1K compared to standard MTT implementations, with a negligible 2% increase in runtime.

Comparison of GPU memory usage between standard MTT and TESLA (Ours) as the number of matching steps increases. TESLA maintains constant memory usage.

Performance Milestones

  • New State-of-the-Art: On ImageNet-1K with 50 images per class (IPC), TESLA achieved 27.9% accuracy. This represents an 18.2% absolute gain over the previous best method (FrePo).
  • Scaling Success: TESLA is the first method to successfully scale to 10 and 50 IPC on ImageNet-1K using a single GPU.
  • Cross-Architecture Generalization: Synthetic datasets created by TESLA using a simple ConvNet were shown to work effectively when training more complex architectures like ResNet18 and Vision Transformers (ViT).

Conclusion

TESLA demonstrates that the memory bottleneck in trajectory matching is not a fundamental constraint but a computational one that can be bypassed through algebraic rearrangement. By achieving constant memory complexity and utilizing time-synced soft labels, TESLA enables high-fidelity dataset distillation at a scale previously thought impossible. Future work may focus on eliminating the need for pre-trained teacher trajectories and scaling to full-resolution ImageNet (224x224).

Summary updated

BibTeX
@inproceedings{cui2023scaling,
  author = {Justin Cui and Ruochen Wang and Si Si and Cho-Jui Hsieh},
  title = {{Scaling Up Dataset Distillation to ImageNet-1K with Constant Memory}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=ccwSdYv1GI},
}
Figure