stable-pretraining: Foundation Model Research Made Simple

Randall Balestriero, Hugues Van Assel, Sami BuGhanem, Lucas Maes

TL;DR

This paper introduces stable-pretraining, a new Python library designed to simplify and accelerate research in foundation models and self-supervised learning (SSL). It addresses the complexity and redundancy in current SSL research by providing a modular, extensible, and performance-optimized framework that unifies essential utilities, making experimentation more accessible and reproducible.

What Problem Does This Paper Address?

The field of foundation models and self-supervised learning (SSL) is booming, but research is hampered by several challenges. These include:

  • Complex Codebases: Existing research often relies on massive, monolithic codebases that are difficult to extend and modify.
  • Redundant Implementations: Researchers frequently re-implement common SSL components (like data augmentation, training loops, and evaluation metrics), leading to bugs and inconsistencies.
  • Heavy Engineering Burden: Scaling SSL experiments requires significant engineering effort, creating a bottleneck for innovation and rapid exploration of new ideas.
  • Lack of Unified Tools: While some libraries exist, they often focus narrowly on reproducing existing results, are not actively maintained, or separate core SSL functionality from training utilities, leaving researchers to build much of the infrastructure themselves.

This situation makes it difficult for researchers to quickly iterate on new ideas and explore novel research directions in foundation models.

Methods

stable-pretraining is a library built on top of established frameworks like PyTorch, PyTorch Lightning, Hugging Face, and TorchMetrics. Its core design principles are:

  • Modularity and Extensibility: The library is composed of reusable components that can be easily swapped or extended.
  • Dictionary-First Design: All components, from datasets to modules, communicate using dictionaries, simplifying data flow and making components interchangeable.
  • Unified DataModule and Module: A DataModule encapsulates data loading, and a Module consolidates PyTorch components (backbone, projector, loss, etc.) with a single forward method that handles training, validation, and testing logic. This replaces the need for separate training_step, validation_step, etc., in PyTorch Lightning.
  • "Logging Everything" Ethos: A central design principle is to log all aspects of training and evaluation, providing fine-grained visibility for debugging, monitoring, and ensuring reproducibility.
  • Plug-and-Play Callbacks: The library offers a suite of ready-to-use callbacks for monitoring and evaluation, including linear/non-linear probes, k-NN probes, and collapse detection metrics (RankMe, LiDAR). These callbacks leverage a shared-memory queue for efficient computation.
  • Manager: A lightweight controller that works with PyTorch Lightning's Trainer to orchestrate the entire training pipeline, handling tasks like checkpointing and environment-specific details.

Datasets

The paper uses the following datasets for evaluation:

  • ImageNet-100: Used for depth-wise representation probing and CLIP degradation analysis.
  • CIFAR-10: Used in the code snippet example for SimCLR training.
  • DTD, aircraft, cars, cifar100, flowers102, food101, galaxy10, pets: Used in Table 1 for linear probe accuracy comparisons.

No new benchmarks are introduced; rather, existing datasets are used to showcase the library's capabilities.

Key Insights and Ideas

  • Simplifying Complex Research: The primary insight is that by unifying common SSL utilities and abstracting away engineering complexities, stable-pretraining significantly lowers the barrier to entry for foundation model research.
  • Accelerating Iteration: The modular design and "logging everything" principle enable rapid experimentation and debugging, allowing researchers to test hypotheses much faster.
  • Unlocking New Research Avenues: The library's flexibility allows for straightforward exploration of research questions that would be cumbersome with existing tools, such as analyzing representation quality at different network depths or understanding the impact of synthetic data.
  • Reproducibility as a First-Class Citizen: By standardizing logging and providing a coherent framework, the library inherently promotes reproducible research.

Key Results

  • Depth-wise Representation Probing (Figure 2): The library facilitated a demonstration showing that MetaCLIP excels at earlier and intermediate layers of a network, while DINOv2-3 dominates the final layer on ImageNet-100. This experiment, which would typically be complex, was reduced to a few lines of configuration.
  • CLIP Degradation Analysis (Table 2): Using stable-pretraining, the authors showed that fine-tuning a frozen CLIP ViT-B/32 model on the synthetic DiffusionDB-2M dataset for just 8 epochs led to a significant degradation in representation quality, with Top-1 accuracy on ImageNet-100 dropping by 19% after the first epoch.
  • Linear Probe Accuracy (Table 1): The paper includes a table comparing linear probe accuracies of various methods (I-JEPA, DINO, DINOv2) across multiple datasets, demonstrating the library's ability to reproduce and compare SOTA results.

Limitations and Future Work

  • Limitations: The paper does not explicitly detail limitations of the library itself, but it implicitly acknowledges that it is a new tool and its adoption will depend on community engagement. The focus is on simplifying existing research paradigms rather than introducing entirely novel SSL algorithms.
  • Future Work: The authors aim to accelerate discovery and expand the possibilities of foundation model research by lowering entry barriers and supporting large-scale experimentation. While not explicitly stated as future work, the library's design suggests potential for integrating more advanced SSL techniques, new probe types, and enhanced monitoring tools as the field evolves.

Summary updated

BibTeX
@inproceedings{balestriero2025stable,
  author = {Randall Balestriero and Hugues Van Assel and Sami BuGhanem and Lucas Maes},
  title = {{stable-pretraining: Foundation Model Research Made Simple}},
  booktitle = {UniReps @ NeurIPS},
  year = {2025},
  url = {https://openreview.net/forum?id=VHY2q436Z9},
}
Figure