Fast Entropy Search via In-Context Learning (PFN-based amortized acquisition functions for Bayesian Optimization)
Project description
$\alpha$-PFN: Fast Entropy Search via In-Context Learning
$\alpha$-PFN is a Prior-Fitted Network that amortizes information-theoretic acquisition functions. Supported acquisition functions: Predictive Entropy Search (PES), Max-value Entropy Search (MES), and Joint Entropy Search (JES).
To reproduce our ICML 2026 paper experiments, see branch
icml2026.
Install
pip install AlphaPFN
Or from source:
git clone https://github.com/automl/AlphaPFN
cd AlphaPFN
uv sync
Pretrained checkpoints (~20 MB) download automatically on the first from_pretrained call and cache under ~/.cache/alphapfn/.
Quick start
A self-contained 6D BO loop on Hartmann, using botorch.optim.optimize_acqf. Requires the [botorch] extra — pip install "AlphaPFN[botorch]":
import torch
from botorch.optim import optimize_acqf
from botorch.test_functions import Hartmann
from alphapfn import AlphaPFN
# 1. Objective on the unit cube (α-PFN maximizes — `negate=True` flips Hartmann's sign).
hartmann = Hartmann(dim=6, negate=True)
# 2. Initial design.
torch.manual_seed(0)
d, n_init, num_steps = 6, 6, 30
X = torch.rand(n_init, d, dtype=torch.double)
y = hartmann(X)
bounds = torch.stack([torch.zeros(d), torch.ones(d)]).double()
# 3. Load the pretrained acquisition; checkpoints download on first call.
acqf = AlphaPFN.from_pretrained(acquisition="JES")
# 4. BO loop.
for step in range(num_steps):
acqf.fit(X, y) # fit() standardizes y internally
X_next, _ = optimize_acqf(acqf, bounds=bounds, q=1,
num_restarts=10, raw_samples=128)
y_next = hartmann(X_next.squeeze(0))
X = torch.cat([X, X_next.detach().double()])
y = torch.cat([y, y_next.detach().double().reshape(1)])
print(f"step {step+1:>2}: best so far = {y.max().item():.4f}")
Runnable version: examples/bo_with_optimize_acqf.py
or open the Colab notebook.
API
AlphaPFN.from_pretrained(
acquisition: str | None = None, # "PES" (default), "MES", or "JES"
version: str = "v1",
*,
load_base_model: bool = False,
ucb_beta: float = 2.0,
strict: bool = True, # pass strict=False to skip input checks
)
Before fitting, prepare your data so that:
- You are maximizing. To minimize instead, negate your objective. This is NOT checked, so forgetting it silently gives wrong results.
- Each input feature lies in
[0, 1]. Rescale your search space accordingly.
fit() standardizes targets internally (standardize_y=True by default) — pass raw $y$. Pass standardize_y=False if you have already standardized. strict=True (default) validates the unit-cube contract on every fit/forward; pass strict=False to skip.
Cite
@inproceedings{
rakotoarison2026alphapfn,
title={{$\alpha$}-PFN: Fast Entropy Search via In-Context Learning},
author={Rakotoarison, Herilalaina and Adriaensen, Steven and Viering, Tom and Hvarfner, Carl and M{\"u}ller, Samuel and Hutter, Frank and Bakshy, Eytan},
booktitle={Forty-third International Conference on Machine Learning},
year={2026},
url={https://openreview.net/forum?id=7Oonij8oLU}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file alphapfn-0.0.2.tar.gz.
File metadata
- Download URL: alphapfn-0.0.2.tar.gz
- Upload date:
- Size: 52.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcf9ddbf53a4cb7f1d1101d4adb03cde8751c8c1e3e145bbebb1911a7bfda038
|
|
| MD5 |
13ce75b0f6d7b9ebd86ee883b77dd247
|
|
| BLAKE2b-256 |
51b9136b697d2d280b94952e48478a6ea11ad725ebb080eb263ceead77d27559
|
File details
Details for the file alphapfn-0.0.2-py3-none-any.whl.
File metadata
- Download URL: alphapfn-0.0.2-py3-none-any.whl
- Upload date:
- Size: 60.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3db91b7e063f21fbc5487ba693b583691ffcf43f0dcda022dd666ac080f738d9
|
|
| MD5 |
8ab30c777695b9503a4bb1235c97134b
|
|
| BLAKE2b-256 |
51632d2909d581e15d64735f39d53e3572db59d1914967745471985088ca969e
|