Enhancing Transfer Learning with Flexible Nonparametric Posterior Sampling

Hyungi Lee, Giung Nam, Edwin Fong, Juho Lee

Introduction

Researchers from KAIST and the University of Hong Kong have introduced Nonparametric Transfer Learning (NPTL), a novel framework designed to improve how deep learning models adapt to new tasks. By replacing rigid, traditional parametric priors with a flexible nonparametric approach, NPTL effectively handles distribution shifts between pre-training and fine-tuning data. This results in more accurate predictions and significantly superior uncertainty quantification compared to existing Bayesian transfer learning methods.

The Rigidity Problem in Bayesian Transfer Learning

In Bayesian Deep Learning, the goal is to identify a distribution of possible model weights rather than a single point estimate. This process requires a prior—an initial assumption about weight distribution before observing new data. In transfer learning, it is standard practice to center this prior on a pre-trained model (e.g., one trained on ImageNet).

However, this approach introduces a "rigidity" problem. Standard Gaussian priors act as a tether, pulling the model back toward its pre-trained state. When a downstream task involves a significant distribution shift from the upstream task, this tethering hinders the model's ability to learn new evidence. Current Bayesian methods often fail to account for model misspecification, struggling to balance legacy knowledge with new data when they do not perfectly align.

Methodology: Nonparametric Transfer Learning (NPTL)

NPTL addresses these limitations through several key innovations:

  1. Nonparametric Learning (NPL): Instead of a fixed parametric prior, NPTL utilizes a Dirichlet Process. This allows the model to dynamically weight the importance of prior knowledge against new data without assuming the model architecture is a perfect fit for the target domain.
  2. Linear Probing for the Base Measure: To represent prior knowledge without requiring access to massive or private upstream datasets, the authors use "linear probing." They freeze the pre-trained feature extractor and train only the final layer on the new data. This probed model serves as the base measure for the nonparametric prior.
  3. Block Dirichlet Distribution: To ensure computational efficiency at deep-learning scales, the authors employ a "blocking" technique that groups data points, stabilizing the sampling process for large datasets.
  4. Parallel Posterior Sampling: Unlike traditional Markov Chain Monte Carlo (MCMC) methods, which are sequential, NPTL is "embarrassingly parallel." Multiple model versions can be trained simultaneously across different GPUs, drastically reducing wall-clock time.
  5. NPTL-Soup: For practical deployment, the authors introduce a "soup" variant that averages the weights of multiple NPTL samples into a single model. This maintains most performance gains while reducing inference time to that of a standard deterministic model.

Experimental Evaluation

The authors validated NPTL across a diverse range of benchmarks, including small-scale vision (CIFAR-10/100), large-scale vision (Caltech-101, Oxford Flowers, etc.), and Natural Language Processing (GLUE subtasks). They also tested robustness using CIFAR-10-C, which includes 15 types of image corruptions.

Table 2: Accuracy (ACC) and Negative Log-Likelihood (NLL) results for large-scale vision benchmarks. NPTL consistently outperforms baselines across various datasets.

Key Results and Insights

Superior Accuracy and Uncertainty Quantification

NPTL consistently achieved higher accuracy and lower Negative Log-Likelihood (NLL) than strong baselines like SGHMC and Deep Ensembles. As shown in the large-scale vision results, NPTL provides better-calibrated uncertainty, which is critical for safety-sensitive applications where a model must "know when it doesn't know."

Resilience to Data Corruption

A standout feature of NPTL is its performance under distribution shift. On the CIFAR-10-C benchmark, NPTL maintained its lead even as the intensity of image corruption increased. While other methods saw sharp declines in reliability, NPTL's nonparametric nature allowed it to remain robust to misspecification.

Table 3: Performance comparison on CIFAR-10-C across varying corruption intensity levels. NPTL maintains superior accuracy and lower NLL as data quality degrades.

Generalization to NLP

The benefits of NPTL are not limited to computer vision. On GLUE tasks such as CoLA and MRPC, NPTL outperformed the "Ensemble + L2SP" baseline using a RoBERTa-Base backbone, demonstrating its versatility across different model architectures and data modalities.

Conclusion and Future Work

NPTL represents a significant step forward in Bayesian transfer learning by providing a mathematically grounded yet computationally efficient way to handle model misspecification. While the method requires training multiple model copies—increasing initial compute costs—its parallelizability and the availability of the "NPTL-Soup" variant make it a viable choice for high-performance applications.

Future research may explore more sophisticated base measures beyond linear probing or investigate NPTL's efficacy in extreme few-shot learning scenarios where prior flexibility is even more critical.

Summary updated

BibTeX
@inproceedings{lee2024enhancing,
  author = {Hyungi Lee and Giung Nam and Edwin Fong and Juho Lee},
  title = {{Enhancing Transfer Learning with Flexible Nonparametric Posterior Sampling}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=vSwu81S33z},
}
Figure