TL;DR
Deep kernel learning combines a Gaussian process with a deep network. The network first maps each input to a learned feature vector, and a kernel then compares those features, so the model's notion of similarity is learned. The network weights and the kernel parameters are trained together by maximising the Gaussian process marginal likelihood, and scalable approximations let the model run on data with up to two million examples.
Builds on: Gaussian Process Regression, Marginal Likelihood, Feedforward Neural Network, Spectral Mixture Kernel · Leads to: Bayesian Optimization, which needs calibrated uncertainty from the same kind of model
Why it mattered
Gaussian processes give calibrated uncertainty, but a standard kernel on raw pixels measures similarity poorly, and exact inference costs time that grows with the cube of the number of training points. Deep networks learn good features, but they give point predictions with no principled error bar. This paper showed that the two can be combined in a single closed-form model, trained by one objective, and scaled to large data. Its experiments include face orientation from image patches and regression on about two million rows, where the model beat stand-alone deep networks on the same architectures.
The problem
A Gaussian process is defined by a mean and a kernel. The kernel says how strongly two inputs should move together. Standard kernels such as the radial basis function (RBF) measure distance in the raw input space, so two images of faces at similar angles can look far apart if their pixels differ. Learning better kernels had been tried with hand-designed families, but those families still rely on Euclidean distance.
Two costs also limit the classical model. Exact inference solves a linear system with an matrix, which takes time of order and storage of order . The paper's aim is a model that keeps the non-parametric flexibility of a Gaussian process, scales linearly in , and learns the kernel's inputs from data rather than fixing them.
How it works
The model is a pipeline: transform the inputs, apply a base kernel, build the covariance matrix, and score the result by the marginal likelihood. Here is one tiny instance with a one-number input and a network that is just a scaling, so the effect of learning is easy to see.
- Start with a raw input. Take the input . The network is , a single weight . Check: with the network maps 1 to 2.
- Map the inputs to features. Map two inputs, and , through the network. With they become and . Check: the features are two numbers, and the gap between them is 2.
- Apply the base kernel to the features. Use the RBF base kernel with length scale 1, . The kernel value between the two features is . Check: the inputs are only weakly related because their features are far apart.
- Change the weight and recompute. With the features become and . The kernel is . Check: the same raw inputs are now strongly related. The network changed the metric without changing the kernel.
- Score the weight. The marginal likelihood says how well each weight explains the observed targets, with a penalty for complexity. Gradient descent moves toward the value that scores best. Check: this step is the one that makes the features learnable, and it is where the paper's joint training happens.
The figure below shows the whole pipeline and where the approximation enters.
flowchart LR X[Raw inputs x] --> N[Deep network g x w] N --> B[Spectral mixture base kernel on features] B --> I[Inducing grid with local interpolation M] I --> C[Covariance K approximately M K_UU M transpose] C --> L[Log marginal likelihood] L --> U[Update network weights w and kernel parameters theta] U --> N
The paper trains in three stages. It first trains a deep network with ordinary stochastic gradient descent on a squared loss, then fits a scalable Gaussian process on the network's top-layer features, and finally trains everything jointly through the marginal likelihood. The joint stage is what makes it a single model.
The math
Definition
Let be a base kernel with hyperparameters , and let be a deep network with weights . The deep kernel is
All trainable parameters are .
Step 1 in symbols: transform the inputs
The network replaces the raw input by a feature vector . In the walkthrough this was . The base kernel is then applied to features, not inputs, so every weight in the network changes the metric the kernel uses.
Step 2 in symbols: the spectral mixture base kernel
The paper uses a spectral mixture base kernel with components:
Here is the mixture weight, holds the bandwidths (inverse length scales), and holds the frequencies. The Gaussian envelope and the cosine are the ones from Spectral Mixture Kernel. The normalising factor is a constant that the paper keeps for completeness.
Step 3 in symbols: the Gaussian process prediction
Given training data and noise variance , the predictive mean and covariance at test inputs are
Every is built from the deep kernel, so the network enters the prediction through the matrices. This is the form from Gaussian Process Regression.
Step 4 in symbols: the marginal likelihood
The log marginal likelihood, up to the constant term the paper omits, is
The first term rewards fitting the data. The second penalises complexity, which is why the paper says the model's complexity is calibrated automatically, without a separate regulariser.
Step 5 in symbols: joint training and the approximation
Training maximises the log marginal likelihood with respect to . The derivative with respect to the data covariance is , and the chain rule carries it back through the kernel into the network by backpropagation.
For scale, the paper replaces by . Here is a grid of inducing points in feature space, is a sparse interpolation matrix with 4 nonzero entries per row, and is a Kronecker product of Toeplitz matrices. Matrix-vector products with that structure are fast, so the solves use conjugate gradients rather than a Cholesky factor. The paper reports training cost of order and prediction cost of order 1 per test point after training.
Worked examples
- Network with . Inputs and give features and .
- Base kernel: . The feature gap is .
- Kernel value: .
- Compare with the raw inputs, which have gap 1: .
- Interpretation: the network moved the two inputs closer in feature space, so the deep kernel treats them as more related than the plain kernel does.
Use the same network and kernel, with , so the features of the training inputs and are and . Their kernel value is . Set noise variance , and targets . Predict at the test input , whose feature is .
- Training matrix: , since each diagonal entry is .
- Determinant: .
- Solve for . The inverse is , so .
- Test-to-training kernel values: the feature is away from both and , so both values are .
- Predictive mean: .
- Predictive variance: the prior variance is 1. The subtracted term is , so the variance is about .
- Interpretation: the test point sits between the two training points, so the mean is between their targets and the variance is small. Out past the data, the variance would grow back toward 1.
On the MNIST digit magnitude task, the paper reports RMSE of 1.25 for a Gaussian process with an RBF kernel on raw pixels, 0.59 for a convolutional network, and 0.53 for deep kernel learning with the same convolutional architecture. Lower RMSE is better.
- Reduction against the plain Gaussian process: .
- Relative reduction: .
- Reduction against the convolutional network: .
- Relative reduction: .
- Interpretation: most of the gain over the plain kernel comes from learning the features. The gain over the convolutional network alone is smaller, about a tenth, but the deep kernel also supplies a posterior with uncertainty, which the network does not.
Try it: on the paper's Olivetti face task, the Gaussian process with an RBF kernel scores 16.33 and the deep kernel scores 6.07. What is the relative reduction in RMSE? Answer: , so about 63 percent lower.
Results
UCI regression (Table 1). The paper compares 16 regression datasets with between about 2,500 and 2,049,280 training points. For most datasets, deep kernel learning with a spectral mixture base kernel gives the lowest test RMSE among the Gaussian process methods, and the paper reports that combining the deep network with the scalable Gaussian process beats the stand-alone deep network on all 16 datasets. The extra runtime over the deep network is about 10 percent in the paper's measurements.
Olivetti faces (Table 2). The task is to predict face orientation from 28 by 28 patches. The Gaussian process with an RBF kernel scores RMSE 16.33, the deep belief network with a Gaussian process scores 6.42, the convolutional network scores 6.34, and deep kernel learning scores 6.07. The model was trained on 12,000 instances using all labels, where the deep belief network approach was limited to 1,000 labelled images.
MNIST digit magnitude (Table 2). The RMSE values are 1.25 for the Gaussian process, 1.03 for the deep belief network with a Gaussian process, 0.59 for the convolutional network, and 0.53 for deep kernel learning.
Scaling. Training time grows roughly linearly in with a slope of about 1 on a log-log plot, as the paper's Figure 3 shows.
Limits. The spectral mixture base kernel gives notable additional gains over the RBF base kernel in the paper's tables. The method also depends on the approximation being accurate, which the paper supports with a large number of inducing points, close to the number of training points. Many parameters are fitted by the marginal likelihood, so the model's complexity is set by data that may be limited.
Reading guide
Read the paper in this order, with the lessons it needs.
- Section 2 (related work) surveys earlier combinations of networks and Gaussian processes. Use Gaussian Process Regression for the models being compared.
- Section 3 (Gaussian processes) uses the predictive equations and the marginal likelihood. Use Marginal Likelihood and Multivariate Gaussian for the joint distribution.
- Section 4 (deep kernel learning) introduces the deep kernel and the spectral mixture base kernel. Use Feedforward Neural Network and Spectral Mixture Kernel. The scaling argument uses the approximations in Cholesky Decomposition only as the baseline it avoids.
- Section 5 (experiments) uses Convolutional Neural Network architectures and Stochastic Gradient Descent for pretraining, and Backpropagation for the joint gradient.
Read next: Bayesian Optimization, which uses Gaussian processes whose uncertainty drives the search.