$\alpha$-PFN: Fast Entropy Search via In-Context Learning

Herilalaina Rakotoarison, Steven Adriaensen, Tom Julian Viering, Carl Hvarfner, Samuel Müller, Frank Hutter, Eytan Bakshy

Introduction

Bayesian Optimization (BO) is the gold standard for tuning expensive "black-box" functions, such as the hyperparameters of large neural networks. To decide where to sample next, BO relies on an acquisition function. Among the most theoretically elegant of these are Entropy Search (ES) variants—such as Predictive Entropy Search (PES), Max-value Entropy Search (MES), and Joint Entropy Search (JES). These methods aim to maximize the information gained about the location or value of the global optimum.

However, Entropy Search has a major computational bottleneck. Because there is no simple analytical formula for "information gain" in a standard Gaussian Process (GP), researchers must rely on complex, slow Monte Carlo (MC) approximations. This computational overhead makes ES impractical for many real-world tasks where optimizer speed is critical.

To solve this, researchers introduce $\alpha$-PFN, a method that performs high-performance Entropy Search without the crippling computational overhead. By using a two-stage transformer-based approach to learn acquisition functions, $\alpha$-PFN achieves speedups of over 50x while maintaining—and sometimes exceeding—the optimization performance of traditional, hand-crafted GP methods.

The $\alpha$-PFN Methodology

The core innovation of $\alpha$-PFN relies on Prior-data Fitted Networks (PFNs). PFNs are transformer models trained on millions of synthetic datasets to approximate Bayesian inference in a single forward pass.

The authors propose a novel two-stage amortization strategy to learn the acquisition function:

  1. Stage 1 (Base PFN): A transformer is trained to predict the posterior distribution of a function. Crucially, the model is sometimes conditioned on the location of the optimum ($x^*$) or the maximum value ($f^*$). This allows the model to learn the behavior of a function when its optimum is known.
  2. Stage 2 ($\alpha$-PFN): A second transformer is trained to directly predict the expected information gain (the acquisition value). During training, this model observes the difference in entropy between the "unconditioned" and "conditioned" predictions generated in Stage 1.

At test time, the Base PFN is discarded, and only the $\alpha$-PFN is used. It takes the current observations and a candidate point as input context. In one rapid forward pass, it outputs the acquisition value—bypassing MC sampling and complex approximations entirely.

Experimental Evaluation

The models were pre-trained on millions of synthetic datasets generated from Gaussian Process priors using Random Fourier Features (RFF). The researchers evaluated $\alpha$-PFN across several rigorous benchmarks:

  • Synthetic Benchmarks: Classic test functions including Branin (2D), Hartmann (4D/6D), and Ackley (5D/8D).
  • LCBench: 7D surrogate tasks based on real-world hyperparameter optimization for neural networks.
  • HPO-B: A large-scale benchmark for black-box optimization, testing search spaces from 8D up to 16D.

Key Results

  • Massive Speedups: $\alpha$-PFN is consistently over 50x faster than standard GP-MCMC implementations. On certain HPO-B tasks, the speedup exceeded 70x.
  • Competitive Performance: Despite the dramatic reduction in computational overhead, $\alpha$-PFN matches or outperforms state-of-the-art ES implementations across both synthetic and real-world benchmarks.
  • Robustness: The model generalizes well to higher dimensions (up to 16D) and larger iteration counts than it encountered during training. It also handles out-of-distribution noise gracefully, degrading at a rate similar to traditional GP baselines.

Key Insights

  • Amortization is the Future: By shifting the heavy mathematical lifting to a pre-training phase, $\alpha$-PFN removes the computational burden from the end-user during active optimization.
  • "In-Context" Bayesianism: The transformer does not require retraining or fine-tuning for specific problems. It learns the logic of Bayesian Optimization during pre-training and applies it directly to the data points provided in its input context.
  • Handling the "Fully Bayesian" Case: Traditional GPs struggle when kernel hyperparameters (like lengthscale) are uncertain. $\alpha$-PFN handles this naturally by training across a wide distribution of hyperparameters, effectively integrating them out during the forward pass.
  • Fixing Domain Shift: Neural-network-based optimizers often fail when they encounter "clustered" data as the optimizer homes in on a peak. To make the model robust to this domain shift, the authors introduced a specialized clustering sampling strategy during training.

Limitations and Future Directions

While $\alpha$-PFN represents a significant leap forward for Bayesian Optimization, it has a few limitations. First, the model is tied to the prior it was trained on (e.g., a specific GP kernel). Utilizing a radically different prior, such as a Bayesian Neural Network, would require retraining the model. Second, there is a dimensionality ceiling; while it performs well up to 16D, scaling the pre-training phase to very high-dimensional spaces (e.g., 100D+) remains computationally expensive.

Looking forward, the same amortization framework could potentially be applied to other complex, non-analytical acquisition functions, paving the way for even broader applications of in-context learning in optimization.