Singular learning theory · 02
A brief detour into singular integrals.
On empirical KL divergence, Bayesian inference, and model evidence.
Before defining the RLCT, we will take a brief detour into Bayesian statistics and Watanabe's theory of singular integrals. This will conveniently give us the opportunity to shore up necessary background in information theory and Bayesian statistics – and establish some prerequisites for exploring the fundamental theorems of singular learning theory in the future. We will seek to answer the following questions.
- In Bayesian inference, we output a distribution on the weights. How can we quantify how well the model and the prior predicted the observed dataset?
- How do KL divergence and Watanabe's singular integral show up when computing the model evidence?
Going forward, it will be essential to have some information theory basics. For that, I will default to 3b1b's excellent two-part series (Part 1: Reinventing Entropy and Part 2: But what is cross-entropy?). A central object of study in The Gray Book is the singular integral of general form:
where is a function on and is a probability density function. First, we will show that, when we set to the empirical KL divergence, is exactly computing the normalized model evidence.
Empirical Cross Entropy
For the remainder of this post, let be the input space, and let denote the space of possible outputs. Perhaps think about every as a token sequence of fixed context length and every as a possible next token with Then let denote the underlying true conditional distribution (that we are trying to model), and define a joint probability distribution on :
Similarly, let denote the conditional distribution predicted by our model with parameters and extend this to a distribution to by letting
Recall that, for two probability distributions and on a discrete sample space , the population KL divergence is defined by
Specializing to we compute that
In the case where is finite and is a uniform distribution on , this is the average of the conditional KL divergences over the inputs. The general issue with the population KL divergence, however, is that may be unknown or difficult to compute in practice. (For modeling natural language, it is arguably unknown). Therefore, we need a good empirical substitute which will converge to the population KL divergence as the number of samples goes to infinity.
Let be a dataset with examples, sampled independently according to
For future use, let be the space of all datasets with any finite number of examples. Then
and
We define the empirical KL divergence to be
It is also a common convention to flip numerator and denominator, writing:
By the law of large numbers, for each fixed it follows that
In the expression that we saw earlier for this will precisely be our choice of function
Now I should note that this actually does not fix the issue of being unable to compute due to being unknown. However, we can at least minimize the empirical KL divergence by remarking that minimizing is equivalent to minimizing the empirical cross entropy, which is given by:
The fact that this quantity does not depend on makes highly useful for training machine learning algorithms. Unfortunately though, explicitly computing is still generally not possible. However, it will be useful to consider it abstractly as an input to a singular integral.
Bayesian Posterior
Given a dataset and a set of model parameters , we define the posterior distribution with respect to some to be:
for some prior distribution There are a few ways to think about the posterior distribution. First off, it is immediately apparent that
Thus, is similar to the likelihood – except it is weighted by some prior, Then we normalize by to ensure that is a probability distribution. It is also important to remember that – under the hood – we are assuming the existence of the sample space , where the probability measure is a joint distribution constructed in two stages. First we sample from the parameters:
and then we sample from :
From this generative point of view, becomes more concrete. In the discrete case, it is the probability that the hidden parameter setting sampled in the first stage was , conditional on observing the dataset in the second stage. Remember unlike the likelihood, a large posterior (say .99) does not automatically mean that is highly predictive – only that its likelihood, weighted by the prior, is much larger than the rest of 1 The process of Bayesian inference (repeatedly updating your new prior to be the posterior, computed with new observations) will output a distribution of parameters. The likelihood tells us how predictive a single parameter setting is. But what if we wanted to average the likelihood over the prior to get a feel for the entire distribution?
In general, this is hard. But SLT to the rescue! Let's see how the singular integral that Watanabe and others have developed techniques to analyze asymptotically is actually doing something very similar in disguise.
Model evidence
Letting be the empirical KL divergence, we can simplify:
Plugging this into and taking , we obtain:
It is extremely tempting to claim that this integrand is just , but this is incorrect precisely because (in general). Instead, we note that
We often call the model evidence, and this ratio tells us roughly how well the distribution predicted , normalized by the true dataset probability. One might also remark that the evidence is exactly the likelihood averaged over , so this is a very natural thing to want to compute.
This explains Watanabe's interest in singular integrals to some extent. But this isn't all. Remember that the end goal is to produce a more precise measure of “effective dimension”. Next time, we will finally define the RLCT and relate it to via the free energy equation. Eventually we will also develop techniques for estimating using a Laplace approximation to the posterior distribution.
Notes
- Bayesian inference/statistics is its own subject that I will not begin to tackle in full detail. Check out Stanford's Bayesian analysis lecture notes for a nice lecture-based introduction.↩