$\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}
}
Metadata
Release files for AlphaPFN 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| alphapfn-0.0.2.tar.gz | 52.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| alphapfn-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 112.6 kB
Release files / alphapfn-0.0.2.tar.gz
| Download URL | alphapfn-0.0.2.tar.gz |
|---|---|
| Size | 52.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bcf9ddbf53a4cb7f1d1101d4adb03cde8751c8c1e3e145bbebb1911a7bfda038
|
|
BLAKE2b-256 checksum How to use checksums |
51b9136b697d2d280b94952e48478a6ea11ad725ebb080eb263ceead77d27559
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.13
|
Release files / alphapfn-0.0.2-py3-none-any.whl
| Download URL | alphapfn-0.0.2-py3-none-any.whl |
|---|---|
| Size | 60.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3db91b7e063f21fbc5487ba693b583691ffcf43f0dcda022dd666ac080f738d9
|
|
BLAKE2b-256 checksum How to use checksums |
51632d2909d581e15d64735f39d53e3572db59d1914967745471985088ca969e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.13
|