stable-pretraining-v1: Foundation Model Research Made Simple

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

TL;DR

This paper introduces stable-pretraining, a new Python library designed to simplify and accelerate research on foundation models and self-supervised learning (SSL). By providing a modular, extensible, and performance-optimized framework that unifies essential SSL utilities, it aims to lower the barrier to entry for researchers and foster more rapid innovation in this complex field.

What Problem Does This Paper Address?

The rapid advancement of foundation models and self-supervised learning (SSL) has been a double-edged sword. While these models power breakthroughs across AI, the research process itself has become incredibly challenging. This is due to several factors:

  • Complex Codebases: Existing research often relies on massive, monolithic codebases that are difficult to extend or modify.
  • Redundant Implementations: Researchers frequently re-implement common SSL components like data augmentation pipelines, training loops, and evaluation metrics, leading to bugs and inconsistencies.
  • Heavy Engineering Burden: Setting up large-scale training, monitoring, and debugging for SSL experiments requires significant engineering effort, diverting focus from core research questions.
  • Lack of Unified Tools: While general-purpose deep learning frameworks exist (PyTorch, Lightning, Hugging Face), they often lack the specific, integrated utilities needed for cutting-edge SSL research, such as specialized probes, collapse detection metrics, and fine-grained monitoring.

This situation creates a bottleneck, hindering rapid exploration of new ideas and limiting the community to incremental improvements.

Methods

stable-pretraining tackles these challenges by offering a unified, modular, and extensible library built on top of established tools like PyTorch, Lightning, Hugging Face, and TorchMetrics. Key methodological aspects include:

  • Modular Design: The library is composed of reusable components for data handling, model definition, training loops, and evaluation.
  • Dictionary-First Interface: All components, from datasets to modules, communicate using dictionaries. This uniform interface simplifies integration and makes components easily swappable.
  • DataModule and Module Abstractions: DataModule encapsulates data loading, while Module bundles PyTorch components and orchestrates their interaction through a single forward function. This consolidates logic and removes the need for separate training_step, validation_step, etc., as seen in PyTorch Lightning.
  • "Logging Everything" Ethos: A core principle is to log every aspect of training and evaluation in a fine-grained and structured manner. This provides deep visibility into training dynamics, crucial for debugging, monitoring, and ensuring reproducibility.
  • Plug-and-Play Callbacks: The library offers a suite of ready-to-use callbacks for monitoring SSL performance, including:
  • Probes: Linear, non-linear, and k-NN probes for evaluating representation quality.
  • Collapse Detection: Metrics like RankMe and LiDAR to identify training collapse.
  • Extensible Evaluation: A framework for custom evaluation routines.
  • Manager: A lightweight controller that works with Lightning's Trainer to orchestrate the entire pipeline, handling infrastructure details like checkpointing and environment-specific settings.

Datasets

The paper uses the following datasets for evaluation and demonstration:

  • ImageNet-100: Used for depth-wise representation probing.
  • CIFAR-10: Used for demonstrating SimCLR training.
  • DiffusionDB-2M: A synthetic image dataset used for CLIP degradation experiments.

No new benchmarks were introduced; instead, the library is designed to work with existing datasets.

Key Insights and Ideas

  • Simplifying Complex Research: The primary insight is that a well-designed, modular library can drastically reduce the engineering overhead associated with foundation model research, allowing researchers to focus on novel ideas rather than boilerplate code.
  • "Logging Everything" for Transparency: The emphasis on comprehensive logging provides unprecedented visibility into training, making debugging and understanding model behavior much more tractable.
  • Flexibility Over Rigidity: Unlike some prior toolkits that focus narrowly on reproducing existing methods, stable-pretraining prioritizes flexibility and iteration speed, enabling rapid experimentation with new architectures and techniques.
  • Accelerating Discovery: By lowering the barrier to entry and streamlining complex tasks like representation probing, the library can accelerate the pace of discovery in SSL.

Key Results

  • Depth-wise Representation Probing (ImageNet-100): The library enabled straightforward depth-wise probing of representations from various state-of-the-art SSL models. Results showed expected trends (later layers yield better performance) and highlighted specific model strengths (MetaCLIP excelling in early/intermediate layers, DINOv2-3 in later layers).
  • CLIP Degradation Under Synthetic Data Fine-tuning: Using stable-pretraining, the authors demonstrated that fine-tuning a frozen CLIP model on synthetic data (DiffusionDB-2M) led to a sharp degradation in representation quality, with Top-1 accuracy on ImageNet-100 dropping by 19% after just one epoch. This highlights the utility of the framework for quickly investigating the impact of data quality.
  • Reproducibility of SOTA Performance: The library is shown to be capable of reproducing state-of-the-art performance, as indicated by the linear probe accuracies presented in Table 1.

Limitations and Future Work

  • Current Version: The paper presents stable-pretraining-v1, implying that future versions will likely expand its capabilities.
  • Focus on Vision SSL: While the principles are general, the examples and demonstrations primarily focus on vision-based self-supervised learning. Future work could extend its applicability to other domains like NLP or multimodal learning.
  • Community Adoption: The success of the library will depend on its adoption and contribution from the research community.

The authors aim to accelerate discovery and expand the possibilities of foundation model research, suggesting that the library's future development will be driven by community needs and emerging research trends.

Summary updated

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