Skip to content
BIASED

Bayesian deep learning

Block 1 of 8~3 min

Why put uncertainty in the weights

The topic Black-box variational inference and the VAE gave us an ELBO gradient for any differentiable model: write the sample as w=μ+σ⊙εw = \mu + \sigma \odot \varepsilon and backpropagate through it. The VAE spent that trick on the latent code of each object. This last topic points the same tools at the weights of a neural network, where the course's question is hardest: millions of uncertain parameters and no closed form for anything.

An ordinary trained network is a point estimate. Training with weight decay λ∥w∥2\lambda \lVert w \rVert^2 is MAP with a Gaussian prior (the topic The Bayesian approach), so the network is w^MAP\hat w_{\text{MAP}} and nothing more. Give a regression network two outputs, a mean f(x;w)f(x; w) and a noise variance σ2(x;w)\sigma^2(x; w), and fit it to noisy observations of y=sin⁡xy = \sin x on two intervals with a gap between them. In the gap and beyond the data it still answers with one curve and roughly the noise level it learned on the data. It has no way to say "I have not seen this".

The Bayesian answer is the posterior predictive, the same object that gave 4/54/5 for the coin:

p(y∣x,D)=∫p(y∣x,w) p(w∣D) dw≈1T∑t=1Tp(y∣x,wt),wt∼p(w∣D).p(y \mid x, D) = \int p(y \mid x, w)\, p(w \mid D)\, dw \approx \frac{1}{T} \sum_{t=1}^{T} p(y \mid x, w_t), \qquad w_t \sim p(w \mid D).

Its variance splits by the law of total variance, with both moments taken over w∼p(w∣D)w \sim p(w \mid D):

Var⁡[y∣x,D]=Ew[σ2(x;w)]+Var⁡w[f(x;w)].\operatorname{Var}[y \mid x, D] = \mathbb E_{w}\big[\sigma^2(x; w)\big] + \operatorname{Var}_{w}\big[f(x; w)\big].

The first term is aleatoric uncertainty, noise in the data itself. The second is epistemic uncertainty, disagreement between networks that all explain the data. For Bayesian linear regression the same split was 1/β+ϕ(x)⊤SNϕ(x)1/\beta + \phi(x)^\top S_N \phi(x) (the topic Bayesian linear regression). For a network neither term has a closed form, because p(w∣D)p(w \mid D) has none.

The rest of the topic is four ways to approximate p(w∣D)p(w \mid D), plus a fifth that does not try to. Each reuses a tool from this course.

Answers are saved on the server and tied to this browser until you sign in.