PFNs4BO: In-Context Learning for Bayesian Optimization

Samuel G. Müller, Matthias Feurer, Noah Hollmann, F. Hutter
2/12/2026

No official code found. Best implementation: automl/PFNs4BO (50 stars, Apache-2.0, last commit 2025-09-18).

Abstract

In this paper, we use Prior-data Fitted Networks (PFNs) as a flexible surrogate for Bayesian Optimization (BO). PFNs are neural processes that are trained to approximate the posterior predictive distribution (PPD) through in-context learning on any prior distribution that can be efficiently sampled from. We describe how this flexibility can be exploited for surrogate modeling in BO. We use PFNs to mimic a naive Gaussian process (GP), an advanced GP, and a Bayesian Neural Network (BNN). In addition, we show how to incorporate further information into the prior, such as allowing hints about the position of optima (user priors), ignoring irrelevant dimensions, and performing non-myopic BO by learning the acquisition function. The flexibility underlying these extensions opens up vast possibilities for using PFNs for BO. We demonstrate the usefulness of PFNs for BO in a large-scale evaluation on artificial GP samples and three different hyperparameter optimization testbeds: HPO-B, Bayesmark, and PD1. We publish code alongside trained models at github.com/automl/PFNs4BO.

View on arXivView PDF

Code Implementations(1)

automl/PFNs4BOCommunity66%
Apache-2.0

The official implementation of PFNs4BO: In-Context Learning for Bayesian Optimization

508Python, Jupyter NotebookMay 22, 20231 years agoApache-2.0

Similar Papers

Cite this paper

@article{mller2026pfnsbo,
  title  = {PFNs4BO: In-Context Learning for Bayesian Optimization},
  author = {Samuel G. Müller and Matthias Feurer and Noah Hollmann and F. Hutter},
  year   = {2026},
  eprint = {2305.17535},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2305.17535},
  journal = {ICML 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2305.17535.svg)](https://codeofpaper.com/paper/2305.17535)

Discussion