Papers › PFNs4BO: In-Context Learning for Bayesian Optimization

PFNs4BO: In-Context Learning for Bayesian Optimization

27 May 2023arXiv:2305.17535archive 2025-07-28

Samuel Müller, Matthias Feurer, Noah Hollmann, Frank Hutter

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.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2305.17535")

Code

Syntology Ran 12 of 23 code samples harvested from 3 repositories linked to this paper; 11 have no recorded run. Of those that ran: 1 ran · violated contract; 4 ran · our draft was wrong; 7 ran with no contract checked.

By repository: official repository: 8 samples from 1 repository, 7 ran; found in paper text by Syntology: 15 samples from 2 repositories, 5 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

automl/pfns4bo officialmentioned in papermentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

23 samples harvested; 12 ran; 0 honoured the contract we drafted; 11 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · violated contract
4ran · our draft was wrong
7ran
11unverified

Licence: 0 of the 23 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 3 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

SeqBN automl/pfns4bo/pfns4bo/transformer.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 75067bd5ded03a56 · report
TransformerEncoderDiffInit automl/pfns4bo/pfns4bo/transformer.py official repository ran · metamorphic tier: deterministic fingerprinted Apache-2.0 (permissive) · 0fc24036211faaaa · report
TransformerEncoderLayer automl/pfns4bo/pfns4bo/transformer.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · a5e5843ed74ae0a8 · report
bool_mask_to_att_mask automl/pfns4bo/pfns4bo/transformer.py official repository ran · violated contract fingerprinted Apache-2.0 (permissive) · 5c9aeabdd9c0592a · report
log01 automl/PFNs4BO/pfns4bo/scripts/acquisition_functions.py official repository ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 42aa387052bae4f8 · report
log01_batch automl/PFNs4BO/pfns4bo/scripts/acquisition_functions.py official repository ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 863625149dc838e6 · report
lognormed_batch automl/PFNs4BO/pfns4bo/scripts/acquisition_functions.py official repository ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 3d1bfce58b071127 · report
TransformerModel automl/pfns4bo/pfns4bo/transformer.py official repository unverified Apache-2.0 (permissive) · 726be38598e80ba6 · report
ExactGPLayer releaunifreiburg/HPO-B/methods/fsbo/fsbo_modules.py found in paper text by Syntology ran · metamorphic tier: deterministic MIT (permissive) · 63119f7d9577e6aa · report
FSBO releaunifreiburg/HPO-B/methods/fsbo/fsbo_modules.py found in paper text by Syntology ran · metamorphic tier: deterministic MIT (permissive) · a45fecfa89d66add · report
MLP releaunifreiburg/HPO-B/methods/fsbo/fsbo_modules.py found in paper text by Syntology ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · 6b43f439029eab3f · report
Metric releaunifreiburg/HPO-B/methods/fsbo/fsbo_modules.py found in paper text by Syntology ran MIT (permissive) · eef091a071004fbd · report
totorch releaunifreiburg/HPO-B/methods/fsbo/fsbo_modules.py found in paper text by Syntology ran · our draft was wrong MIT (permissive) · a6b7d679f45f2735 · report
arg_safe_str uber/bayesmark/bayesmark/experiment_launcher.py found in paper text by Syntology unverified Apache-2.0 (permissive) · d7f53b32976ced36 · report
arg_to_str uber/bayesmark/bayesmark/cmd_parse.py found in paper text by Syntology unverified Apache-2.0 (permissive) · e14ad665fb269166 · report
expected_max uber/bayesmark/bayesmark/expected_max.py found in paper text by Syntology unverified Apache-2.0 (permissive) · ebc5e6b82ad05d37 · report
expected_min uber/bayesmark/bayesmark/expected_max.py found in paper text by Syntology unverified Apache-2.0 (permissive) · 67e25bdc1919213b · report
get_expected_max_weights uber/bayesmark/bayesmark/expected_max.py found in paper text by Syntology unverified Apache-2.0 (permissive) · db39ace284e8c2b7 · report
isclose_lte uber/bayesmark/bayesmark/np_util.py found in paper text by Syntology unverified Apache-2.0 (permissive) · 48c5d2f57a53830c · report
namespace_to_dict uber/bayesmark/bayesmark/cmd_parse.py found in paper text by Syntology unverified Apache-2.0 (permissive) · 00ee81526cac814f · report
random_seed uber/bayesmark/bayesmark/np_util.py found in paper text by Syntology unverified Apache-2.0 (permissive) · aa2c8eadd32e1af0 · report
serializable_dict uber/bayesmark/bayesmark/cmd_parse.py found in paper text by Syntology unverified Apache-2.0 (permissive) · 70bd99eccb2d2020 · report
strat_split uber/bayesmark/bayesmark/np_util.py found in paper text by Syntology unverified Apache-2.0 (permissive) · a1efc44f1758e02c · report

Tasks

AutoMLBayesian OptimizationHyperparameter OptimizationIn-Context Learning

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Gaussian Process

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections