Kernel Identification Through Transformers

Fergus Simpson, Ian Davies, Vidhi Lalchand, Alessandro Vullo, Nicolas Durrande, Carl Edward Rasmussen

Gaussian Processes (GPs) are a gold standard for Bayesian regression due to their principled uncertainty estimates. However, a GP's performance relies heavily on its kernel (covariance function), which defines the model's inductive biases, such as smoothness, periodicity, or noise levels.

In high-dimensional spaces, selecting the right kernel is notoriously difficult. Traditional "Automatic Statistician" approaches use greedy tree searches to find the best combination of primitive kernels. These searches are computationally expensive, often taking minutes or hours, and scale poorly as datasets grow.

To address this, researchers introduce KITT (Kernel Identification Through Transformers). KITT reframes GP kernel selection as a sequence-to-sequence translation task—similar to image captioning—using a Transformer to "read" a dataset and "write" a custom kernel recommendation in milliseconds.

Methodology: Kernel Selection as Translation

KITT replaces slow, iterative search with a single forward pass of a neural network. The model uses an encoder-decoder Transformer architecture that takes a raw dataset $\mathcal{D} = \{x_i, y_i\}_{i=1}^N$ as input.

KITT Architecture
  • Double Permutation Invariance: The encoder is uniquely designed to be invariant to both the order of the data points (rows) and the input dimensions (columns). This ensures the model's recommendation remains consistent regardless of how features or samples are shuffled.
  • Kernel Vocabulary: KITT treats kernel selection as a language task. It utilizes a vocabulary of 34 tokens, including primitive kernels (e.g., RBF, Matern, Periodic) and their products.
  • The Decoder: The decoder iteratively constructs a "caption" (e.g., Matern 1/2 + RBF x Matern 3/2) that describes the recommended kernel structure.
  • Shifted Linear Kernel: The authors also introduce a novel variant of the linear kernel that includes a "shift" parameter, allowing the model to better handle heteroscedastic noise (noise that varies across the input space).

Training and Generalization

KITT was trained entirely on 200,000 synthetic datasets generated by sampling from GP priors using various kernels from the model's vocabulary. This amortized inference approach means that while training the Transformer takes hours, generating predictions takes milliseconds.

Despite being trained exclusively on idealized synthetic data, KITT successfully generalizes to real-world data. The model was evaluated on 8 UCI regression benchmarks (ranging from 4 to 14 dimensions), proving its ability to identify underlying structures in messy, real-world datasets.

Key Results: Speed and Accuracy

The most significant advantage of KITT is its speed. KITT generates high-quality kernel recommendations in under 0.1 seconds.

Inference Time Comparison

As shown above, traditional tree-search methods become exponentially slower ($t \propto N^3$) as the number of data points increases. In contrast, KITT's inference time remains nearly constant (around 0.022 seconds), regardless of dataset size. On the UCI benchmarks, KITT consistently outperformed other deep-learning baselines and remained competitive with exhaustive, computationally heavy tree-search algorithms.

Limitations and Future Work

While KITT represents a massive leap in efficiency, it has a few limitations:

  • Simple Grammar: The current vocabulary is limited to additions and products of at most two primitive kernels. It cannot yet generate deeply nested, highly complex kernels.
  • Hyperparameter Tuning: KITT recommends the structure of the kernel. Specific hyperparameters (like lengthscales) still require optimization using standard methods (e.g., BFGS) after the recommendation.
  • Single-Output Focus: The current architecture is restricted to one-dimensional outputs. Extending it to multi-output regression or classification is a logical next step.

Ultimately, KITT demonstrates the massive representational power of Transformers for mathematical model selection. Future work could pair KITT's structural recommendations with hyperparameter-predicting networks to create a fully automated, instantaneous GP pipeline.

Summary updated

BibTeX
@inproceedings{simpson2021kernel,
  author = {Fergus Simpson and Ian Davies and Vidhi Lalchand and Alessandro Vullo and Nicolas Durrande and Carl Edward Rasmussen},
  title = {{Kernel Identification Through Transformers}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=gnK_DqxYmv},
}
Figure