NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Automatic Data Curation for Self-Supervised Learning: A Clustering-Based Approach

Huy V. Vo, Vasil Khalidov, Timothée Darcet, Théo Moutakanni, Nikita Smetanin, Marc Szafraniec, Hugo Touvron, camille couprie, Maxime Oquab, Armand Joulin, Herve Jegou, Patrick Labatut, Piotr Bojanowski

Abstract

Self-supervised features are the cornerstone of modern machine learning systems. They are typically pre-trained on data collections whose construction and curation typically require extensive human effort. This manual process has some limitations similar to those encountered in supervised learning, e.g., the crowd-sourced selection of data is costly and time-consuming, preventing scaling the dataset size. In this work, we consider the problem of automatic curation of high-quality datasets for self-supervised pre-training. We posit that such datasets should be large, diverse and balanced, and propose a clustering-based approach for building ones satisfying all these criteria. Our method involves successive and hierarchical applications of $k$-means on a large and diverse data repository to obtain clusters that distribute uniformly among data concepts, followed by a hierarchical, balanced sampling step from these clusters. Extensive experiments on three different data domains including web-based images, satellite images and text show that features trained on our automatically curated datasets outperform those trained on uncurated data while being on par or better than ones trained on manually curated data. Our code is publicly available at https://github.com/facebookresearch/ssl-data-curation.

Introduction: The Data Curation Bottleneck

Self-supervised learning (SSL) has revolutionized machine learning by enabling models to learn from billions of unlabeled images or documents. However, the common assumption that "more data is better" is often undermined by the quality of raw internet scrapes. These datasets are typically "ill-curated," characterized by a long-tailed distribution where a few "head" concepts dominate, while rare "tail" concepts are underrepresented.

Training on such imbalanced data leads to models with significant biases and poor generalization to out-of-distribution cases. While manual curation (e.g., ImageNet) remains the gold standard, it is prohibitively expensive and impossible to scale to the trillion-token or billion-image regimes required by modern foundation models. This work introduces an automated pipeline to select a large, diverse, and balanced subset from uncurated data pools.

Methods: Hierarchical Clustering and Sampling

The proposed solution centers on a Hierarchical $k$-means with Resampling algorithm designed to "flatten" the data distribution.

The proposed hierarchical k-means and sampling pipeline for data curation.

The Algorithm

  1. Hierarchical $k$-means: Standard $k$-means tends to follow data density, creating more clusters for frequent concepts. To counteract this, the authors apply $k$-means successively, clustering data and then clustering the resulting centroids to build a hierarchy.
  2. Resampling: At each level, the algorithm selects points closest to cluster centroids. This process mathematically shifts the distribution of selected points toward a uniform distribution over the semantic space.
  3. Balanced Sampling: Once the cluster tree is established, data is sampled in a top-down, balanced manner. This ensures that major branches (e.g., "Animals") and minor branches (e.g., "Rare Tools") contribute equally to the final training set.

This method is domain-agnostic, requiring only an initial embedding space (e.g., DINOv2 for images or SBERT for text) to represent the data.

Experimental Results

The authors evaluated their approach across three distinct domains: web-based images (743M unique images), text (CCNet for LLMs), and satellite imagery (18M patches).

Performance comparison across web-based images, text, and satellite imagery.

Key Findings

  • Robustness and Generalization: On ImageNet-A, a benchmark of "hard" images, the curated dataset improved accuracy from 46.9% to 66.4%. In many benchmarks, this automated curation outperformed manually curated datasets like ImageNet-22k.
  • Cross-Domain Versatility:
    • Text: 7B-parameter LLMs trained on curated CCNet showed significant gains in common-sense reasoning, such as a 3.2-point increase on the ARC-Challenge.
  • Satellite: The method achieved a 20% relative improvement in $R^2$ scores for tree canopy height estimation, particularly in out-of-distribution geographical regions.
  • Impact of Imbalance: Controlled experiments confirmed that as dataset imbalance increases, model accuracy drops sharply, validating the necessity of the balancing step.

Conclusion

This research demonstrates that automatic data curation via hierarchical clustering can effectively replace or augment manual curation for SSL. By prioritizing diversity and balance, the proposed pipeline enables the creation of high-quality pre-training datasets at scale. Future work may explore integrating explicit quality filters and scaling the approach to even larger "trillion-scale" data repositories.

Summary updated

BibTeX
@article{vo2024automatic,
  author = {Huy V. Vo and Vasil Khalidov and Timothée Darcet and Théo Moutakanni and Nikita Smetanin and Marc Szafraniec and Hugo Touvron and camille couprie and Maxime Oquab and Armand Joulin and Herve Jegou and Patrick Labatut and Piotr Bojanowski},
  title = {{Automatic Data Curation for Self-Supervised Learning: A Clustering-Based Approach}},
  journal = {Accepted by TMLR},
  year = {2024},
  url = {https://openreview.net/forum?id=G7p8djzWOl},
}
Figure