Leveraging free energy in pretraining model selection for improved fine-tuning

Michael Munn, Susan Wei · OpenReview

Abstract

Recent advances in artificial intelligence have been fueled by the development of foundation models such as BERT, GPT, T5, and Vision Transformers. These models are first pretrained on vast and diverse datasets and then adapted to specific downstream tasks, often with significantly less data. However, the mechanisms behind the success of this ubiquitous pretrain-then-adapt paradigm remain underexplored, particularly the characteristics of pretraining checkpoints that enhance downstream adaptation. We introduce a Bayesian model selection criterion, called the downstream free energy, which quantifies a checkpoint's adaptability by measuring the concentration of nearby favorable parameters for the downstream task. We demonstrate that this Bayesian model selection criterion can be effectively implemented without access to the downstream data or prior knowledge of the downstream task. Furthermore, we provide empirical evidence that the criterion reliably correlates with improved finetuning performance, offering a principled approach to predicting model adaptability.

Introduction

The "pretrain-then-adapt" paradigm has become the standard for developing high-performance AI systems. Practitioners typically train a foundation model on a large-scale dataset and subsequently fine-tune it for a specific downstream application. A critical yet unresolved challenge in this workflow is identifying which checkpoint from the pretraining phase will yield the best performance on a future, often unknown, task. Current selection methods often rely on empirical heuristics, such as selecting the checkpoint with the minimum training loss, which may not accurately reflect a model's potential for generalization and adaptation.

Theoretical Framework: Downstream Free Energy

To address this, we propose a principled Bayesian approach centered on the concept of Free Energy, defined as the negative log of the marginal likelihood. We introduce Downstream Free Energy as a metric to quantify the "concentration" of high-performing parameters in the vicinity of a specific checkpoint. A lower free energy indicates a higher density of favorable parameter configurations for the downstream task, suggesting greater adaptability.

Pretraining Free Energy as a Proxy

In practice, downstream data is unavailable during pretraining. We address this by utilizing Pretraining Free Energy as a proxy. We provide theoretical justification (Proposition 5.1) showing that under specific distributional assumptions—namely that the pretraining data is sufficiently diverse—minimizing free energy on the pretraining set serves as a mathematically sound guide for minimizing it on downstream tasks.

Estimation via WBIC and SGLD

Calculating free energy involves intractable integrals. We employ the Widely Applicable Bayesian Information Criterion (WBIC) to estimate this value. The estimation is performed using Stochastic Gradient Langevin Dynamics (SGLD), a sampling technique that explores the local loss landscape around a checkpoint to measure its complexity and fit.

Experimental Results

We evaluated our proposed metric on standard benchmarks, including CIFAR-FS and mini-ImageNet, using VGG-16 architectures.

Correlation with Adaptability

Our experiments demonstrate that Pretraining Free Energy is a robust predictor of downstream performance. It exhibits a strong negative correlation with transfer accuracy, significantly outperforming other metrics such as Neural Collapse and Geometric Complexity. Specifically, we observed Pearson correlation coefficients of -0.820 for full fine-tuning and -0.890 for few-shot tasks.

Figure 1: Correlation between Pretraining Free Energy and downstream transfer accuracy (full fine-tuning and 5-shot) across various hyperparameters.

Sensitivity to Hyperparameters

The metric also captures the influence of pretraining hyperparameters. Configurations that favor "flatter" minima—such as higher learning rates, smaller batch sizes, and increased momentum—consistently result in lower pretraining free energy and superior downstream adaptation.

Beyond Training Loss

A key advantage of the free energy metric is its ability to provide a signal even when traditional metrics like training loss have plateaued. While loss may stop decreasing, the free energy (estimated via WBIC) continues to evolve, offering a more granular view of the model's evolving adaptability during the later stages of pretraining.

Figure 3: Comparison of training loss, WBIC, and transfer accuracy over iterations for different learning rates, batch sizes, and momentum.

Discussion and Limitations

While promising, the calculation of WBIC via SGLD introduces additional computational overhead compared to monitoring simple loss values. This may pose challenges for extremely large-scale models. Furthermore, the effectiveness of the proxy depends on the diversity of the pretraining data; if the pretraining and downstream distributions are entirely disjoint, the predictive power of the metric may diminish.

Conclusion

We have introduced a Bayesian framework for model selection that leverages free energy to predict the adaptability of pretrained checkpoints. By providing a principled alternative to loss-based heuristics, this approach offers a more reliable method for selecting foundation model checkpoints that generalize effectively to new domains. Future work will focus on identifying training-time "levers" that can optimize for low free energy directly, potentially reducing the need for post-hoc sampling.

Summary updated

BibTeX
@inproceedings{munn2025leveraging,
  author = {Michael Munn and Susan Wei},
  title = {{Leveraging free energy in pretraining model selection for improved fine-tuning}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=fEjktWQ5Am},
}
Figure