CAFE: Learning to Condense Dataset by Aligning Features

Kai Wang, Bo Zhao, Xiangyu Peng, Zheng Zhu, Shuo Yang, Shuo Wang, Guan Huang, Hakan Bilen, Xinchao Wang, Yang You

Introduction

Training modern deep neural networks requires staggering amounts of data and computational power. Dataset condensation aims to mitigate this by creating a tiny "synthetic" dataset (e.g., just 1 or 10 images per class) that can train a model to nearly the same accuracy as the full original dataset.

Existing methods primarily rely on "Gradient Matching," which attempts to align the gradients of synthetic data with those of real data. However, gradients are often dominated by a small number of "hard" samples or noise, causing synthetic data to overfit to outliers and fail to capture the global data distribution. This leads to poor generalization when the synthetic data is used to train different neural network architectures.

The CAFE Framework

To address these limitations, the authors propose CAFE (Condensing dataset by Aligning FEatures). This framework shifts the focus from matching noisy gradients to matching representative features across multiple scales.

Comparison of Gradient-Based methods vs. CAFE. CAFE captures a more representative distribution of real images, leading to semantically richer synthetic samples.

Core Methodology

CAFE is built upon three main pillars:

  1. Layer-wise Feature Alignment (LFA): Instead of matching only the final output, CAFE ensures that synthetic data produces similar average feature maps to the real data at every convolutional layer. This forces synthetic images to capture representative patterns ranging from simple edges to complex shapes.
  2. Discrimination Loss (DL): To ensure synthetic images are effective for classification, the framework treats synthetic feature centers as a classifier. It calculates a loss based on how well these centers categorize real-world samples.
  3. Dynamic Bi-level Optimization: Unlike standard methods that use fixed optimization steps, CAFE introduces an adaptive "inner-loop." It monitors performance on a query set and dynamically adjusts training, preventing under- or over-fitting while improving computational efficiency.
The CAFE architecture featuring Category-Wise Feature Averaging (CWFA) and the Dynamic Bi-level Optimization Module.

Experimental Results

The researchers evaluated CAFE on five standard computer vision benchmarks, including MNIST, SVHN, and CIFAR-10/100. CAFE consistently outperformed previous state-of-the-art (SOTA) methods:

  • SVHN Breakthrough: On the SVHN dataset with only 1 image per class, CAFE achieved 42.6% accuracy, a significant leap over the previous SOTA of 31.2%.
  • Cross-Architecture Generalization: When synthetic data generated on a simple ConvNet was tested on ResNet18, CAFE outperformed the previous best method by 4.42% on CIFAR-10.
  • Efficiency: The Dynamic Bi-level Optimization allowed CAFE to reach these results faster than traditional methods (e.g., ~367 minutes vs. ~460 minutes for CIFAR-10).

Key Insights and Conclusion

The primary innovation of CAFE is the realization that gradients are a biased proxy for data distribution. By matching features instead, CAFE captures the "bulk" of the data distribution rather than just noisy extremes. Visually, the synthetic images produced by CAFE are semantically richer and more recognizable (e.g., distinct "frogs" or "trucks") compared to the abstract patterns generated by gradient-matching.

While dataset condensation is currently limited to lower-resolution images (32x32), CAFE represents a major step toward making synthetic datasets a portable and efficient alternative for large-scale AI training.

Summary updated

BibTeX
@inproceedings{wang2022cafe,
  author = {Kai Wang and Bo Zhao and Xiangyu Peng and Zheng Zhu and Shuo Yang and Shuo Wang and Guan Huang and Hakan Bilen and Xinchao Wang and Yang You},
  title = {{CAFE: Learning to Condense Dataset by Aligning Features}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2022},
  doi = {10.1109/cvpr52688.2022.01188},
}
Figure