In the first post of this series we built a many-body expansion of computation, and in the second we showed that it extends to more or less any model and loss we care about. However, throughout these posts we kind of just ignored a thing which is actually rather important for the theory. In those posts we treated the distribution over programs as uniform, which is fine mathematically but not really the thing we actually care about at the end of the day, as it is not really a natural probability distribution a learner really sees. While the previous posts were sort of just building the foundation, this post starts to build some of the first real results. The best way to think about this post is as describing the basis of a quantum chemistry-like foundation for computation.
The TLDR
This post is a bit dense so we think it's probably beneficial to TLDR it. In the previous posts we treated the the dot product as a uniform average over all programs, which was fine for the purposes of those posts, but doing this basically means we recover structures that aren't tied to a specific program/model instance of interest, which is not really what we want as we are actually concerned with what parts of a model cause what behaviors. To remediate this, we construct a local version by replacing the uniform measure with a local measure concentrated on the program of interest. We then generalize the atomic orbitals from the previous post using a trick where we generalize the graph Laplacian using random walks on a graph. Not all bases are equally useful, though. The natural ones are those where each parameter can move independently of the others. These correspond to product measures, and they allow us to write correlations between parameters in a way that actually respects the natural notion of parameter in our system. This is almost exactly what is done in quantum chemistry where there are many possible ways of representing your basis but the natural ones keep the electrons as independent entities and study the interactions between them.
The natural measure to investigate correlations is the (local) Bayesian posterior, as it tells you how parameters are correlated to encode a function. We then show that if we are operating in a product measure basis, then there exists an overlap matrix which describes how parameters are correlated under the posterior. There are two natural product measure bases we examine. The first is the marginals of the posterior, which captures every single-parameter statistic exactly so all the correlation sits in how groups of parameters move together (that is, if I move one parameter how other parameters must move to compensate for it). The second is the mean-field (variational Bayes) approximation where each parameter only feels the average effect of all the others which is not exact. This is effectively Hartree-Fock vs. natural orbitals in quantum chemistry. This construction is important for the work that will follow this post.
Fixing the dot product
Think all the way back to the first post, where in proposition one we had that for each input and reference program we wrote
The problem was that the monomials were not orthogonal under the uniform dot product, so we moved to spins and took
with the expectation over all programs. However, this is an average over every program, so it has no idea where is. We did this early on because it allowed us to build the basic idea of "orbitals". However, we generally care about the structure of our reference program so we would like something more local that we can investigate to study this. The first thing we need is the following simple definition:
Definition (Local dot product). Given a program , choose a distribution on concentrated near . For any two functions of the program, define
so what we have now are like fields over parameter space.
This is all well and good, but it does mean we have to confront some stuff about the graph Laplacian. In Part 2 the atomic orbitals were eigenfunctions of the graph Laplacian , orthonormal under the uniform measure. Now we want them to be orthonormal under a local measure instead, but this is actually not straightforward. is a symmetric matrix, which means it is self-adjoint with respect to the the standard counting measure type dot product. Its eigenvectors are generally not orthogonal under arbitrary measure weighted dot product, so we need to somehow repair the construction to be useful locally.
The trick to this is to consider as defining a random walk on the graph. That is, if we are walking along the graph we can consider evolving under . That is, let each edge fire at rate 1, so the walker leaves vertex at total rate . Then a distribution evolves by
and the expected value evolves by
It turns out that the important thing about the uniform measure that is important for making it self-adjoint (which is what we want) is that it obeys detailed balance when generating the random walk. That is, as much probability flows from to as from to (there is no directional current). If we want to generalize this, we pick a local measure on , concentrated near the atom's reference value (its value in ), and jump rates along the edges of satisfying detailed balance,
The generator is then self-adjoint in , with
The eigenfunctions of are orthonormal in , with , and these are the local orbitals. Taking the product measure and letting each atom move independently, the generator of the whole program is , its eigenfunctions are the products
and its eigenvalues are sums. So the construction from Part 2 goes through essentially unchanged.
Correlations and the posterior
We want to be able to talk about how different parts of the model are coupled in a way which allows them to perform some computation. The (local) Bayesian posterior is that natural measure to start with here. Take a prior over decoded programs and condition on the data. For any of the exponential-family losses from Part (modulo the zero-one loss), the negative log-likelihood of the data is so the (tempered) posterior is
However even if the prior is a nice product measure like , the posterior is not. We can see this since with , so every mode with mixes the atoms of the system.
The previous section didn't really need the measure to factorize as effectively any measure will have walks on the product graph that satisfy detailed balance with respect to it. For instance we can take , where is with atom set to and is any symmetric edge rate on . The eigenfunctions of such a walk are orthonormal in . However, we lose the kind of factorization we want as the rate at which atom moves now depends on where all the other atoms sit, so the pieces of the generator no longer act on separate atoms, and the don't split into products of atomic orbitals. In physics language this is the difference between a non-interacting and an interacting Hamiltonian. Conjugating the generator by gives a symmetric operator with ground state , which is a product state precisely when is a product measure. Importantly they don't carry the multi-index from the earlier post which tells us exactly which parameters a mode involves, which is ultimately what we want. How then do we deal with this?
The natural basis measures
To handle this we keep a product basis and simply change the inner product, as this actually will still give us the correlational structure we care about. That is, we pick a product reference measure , build its local orbitals as in the previous section, and measure everything in . This lets us keep whatever the natural notion of a parameter is in our system and measure interactions between them.
Considering the Bayesian posterior, there are two natural choices of product measure. Let denote the reference product measure. The first choice for this are the marginals. Take to be the marginal of on atom . This is the product measure minimizing . Every single-atom statistic is then exact. The other option is what we will call the mean field. Take to be the product measure minimizing , i.e. the variational Bayes approximation (the classical, Gibbs–Bogoliubov, version of Hartree, applied to the energy ). We start by looking at the mean field version.
The Bayesian mean field
First we write out the posterior. For the exponential-family losses of Part 2, each example's likelihood can be written as , where depends only on the label. Since the likelihood of the whole dataset can be written like . Tempering by and normalizing gives
where the label-only constants have been absorbed into . With a product prior , taking logs turns the prior into a sum over atoms,
Note as well that does not depend on . We can now expand . Since is a product measure we can factor . Each and depends only on , so averaging over integrates out the remaining atoms. The loss keeps the full expectation, and is a constant. This gives
Now we freeze every factor except . Because is a product, we can take the expectation of as a weighted sum like
Now we denote
so we can then take
The physics interpretation of this is like the per-site free energy,
So then the term is the effective single-site potential
Now writing the single site partition function like we get . The KL divergence vanishes only when its two arguments agree, so the best choice of (with everything else held fixed is)
A mean-field fixed point is then simply a product measure where this holds for every at once. The KL is not convex over product measures, so there are generally many fixed points, and these generally show up in singular models. It is worth noting that ff the prior is not a product we get in place of . Below we give a simple proposition which just expands the posterior in the atomic basis we have chosen.
Proposition 3 (Mean field absorbs the single-atom couplings).
Let be a mean-field fixed point for with a product, and expand in the local orbitals of . Then
Proof: Every non-constant orbital has mean zero under its atom's measure, so averaging over all atoms except kills it unless . Hence , and so . Dividing by this leaves exactly the terms.
We should go over what this actually says because it is kind of one of the main points here. A local orbital is a function of a single parameter. On their own the orbitals are just coordinates for each parameter. A product with . A product with is like a joint relative coordinate. The coefficient is then how posterior relates these two objects. If we write this out in full
Atoms and are conditionally independent under the posterior, given all the other atoms, if and only if the coefficient for every whose support contains both of the atoms and . So the supports of the nonzero couplings are the edges given by the posterior's interaction graph between parameters. So, even though we use the product basis we can still recover the interaction graph of the posterior.
Marginals vs. Mean Field
Why start with the mean field case above? Well it turns out that the marginals are sort of the corrections on top of the mean field. Start from Proposition 3, , and sum out every atom except . Since is a product, comes straight out of the sum, and what is left is an average of over the other atoms. Or, more formally:
Proposition 4 (Marginals are corrected mean field). Let be a mean-field fixed point and the residual interaction of Proposition 3. Then the posterior marginal of atom is
and expanding in cumulants,
where is the -th cumulant of under with held fixed. There is no term.
Proof: The first line is Proposition 3 summed over , and the second is the cumulant expansion of . For the missing first-order term, every mode in has , so it touches some atom , and averages to zero under . So .
So mean field is the zeroth-order term of the marginal. Furthermore, the first correction is second order in the couplings. Grouping the modes of by what they do on the other atoms and using orthonormality, the second-order term is
This is non-negative, and it is largest at the values of most strongly coupled to the rest of the program. Those are exactly the values where the other atoms can move to compensate to avoid breaking the algorithm. This also kind of gives some nice intuition on what makes singular models cursed. In a regular model every direction, including every joint one, sharpens at the same rate as grows, so the couplings tend to fixed partial correlations and mean field misses only an amount of free energy. In a singular model the posterior keeps spreading along a set of parameters that compensate for one another, and the product measure itself would need to adjust individually along each direction, so you get the higher order corrections there.
Atomic correlations
Now that we kind of know what product measures are as close to as a product can be, we take one of of these and build the basis . Doing this, we then change the inner product to be over the distribution we want, then expand everything in the orbitals of . This lets us keep whatever the natural notion of a parameter is in our system and measure how the parameters interact.
Formalizing this, the are still a valid basis for all functions of the program, so the expansion is valid regardless of our choice of measure. We can then build the table is the same as before (Part 2's , computed under the reference). All that really changes that the basis is no longer orthonormal under this dot product. The thing that quantifies how not orthonormal this basis is is the mode covariance
as this tells us exactly how modes interact/overlap under the posterior. Because of this interaction the data coupling picks up this overlap like
If were itself the product , then and we would be back to Part 2. The off-diagonal entries of describe how the posterior mixes modes together.
To really see what does is we can treat the modes as random variables. Draw which gives the vector . Each output is then a linear combination of these vectors, , so the outputs are a random variable too, and their joint covariance is
The top-left block is how the posterior couples parameters, and the bottom-right block, , is how it couples data points. The off-diagonal block is the how these two things relate as it is how much each output moves with each mode. The table does not care about the measure we pick, so all of the correlation structure lives in , and the data coupling is just pushed forward through . If you have seen Gaussian processes, this might look familiar. is the covariance over weights, the rows of are the features, and is the kernel they induce.
We can now look quickly at how our choice of product measures differ. With the marginals, if and are both supported on the same single atom , then . So the ways in which differs from the identity involves interactions between least two atoms. With the mean field measure, the single-atom blocks of are not quite the identity, as each feels the other atoms only through their average, so it misses the indirect influence that comes through their correlated fluctuations, and is not quite the true marginal.
Conclusion
The core idea here we have presented is that if we want to study the interactions between parameters, we construct a product measure that gives us a basis which is as close the orthonormal as possible while retaining our natural notion of parameters, but that allows us to look at a distribution which correlates parameters so we can interpret them. We then showed how this provides such an object via atomic correlations. In the next post, we are going to look at how we can use this ideas to understand intermediary steps in the computation.
Introduction
In the first post of this series we built a many-body expansion of computation, and in the second we showed that it extends to more or less any model and loss we care about. However, throughout these posts we kind of just ignored a thing which is actually rather important for the theory. In those posts we treated the distribution over programs as uniform, which is fine mathematically but not really the thing we actually care about at the end of the day, as it is not really a natural probability distribution a learner really sees. While the previous posts were sort of just building the foundation, this post starts to build some of the first real results. The best way to think about this post is as describing the basis of a quantum chemistry-like foundation for computation.
The TLDR
This post is a bit dense so we think it's probably beneficial to TLDR it. In the previous posts we treated the the dot product as a uniform average over all programs, which was fine for the purposes of those posts, but doing this basically means we recover structures that aren't tied to a specific program/model instance of interest, which is not really what we want as we are actually concerned with what parts of a model cause what behaviors. To remediate this, we construct a local version by replacing the uniform measure with a local measure concentrated on the program of interest. We then generalize the atomic orbitals from the previous post using a trick where we generalize the graph Laplacian using random walks on a graph. Not all bases are equally useful, though. The natural ones are those where each parameter can move independently of the others. These correspond to product measures, and they allow us to write correlations between parameters in a way that actually respects the natural notion of parameter in our system. This is almost exactly what is done in quantum chemistry where there are many possible ways of representing your basis but the natural ones keep the electrons as independent entities and study the interactions between them.
The natural measure to investigate correlations is the (local) Bayesian posterior, as it tells you how parameters are correlated to encode a function. We then show that if we are operating in a product measure basis, then there exists an overlap matrix which describes how parameters are correlated under the posterior. There are two natural product measure bases we examine. The first is the marginals of the posterior, which captures every single-parameter statistic exactly so all the correlation sits in how groups of parameters move together (that is, if I move one parameter how other parameters must move to compensate for it). The second is the mean-field (variational Bayes) approximation where each parameter only feels the average effect of all the others which is not exact. This is effectively Hartree-Fock vs. natural orbitals in quantum chemistry. This construction is important for the work that will follow this post.
Fixing the dot product
Think all the way back to the first post, where in proposition one we had that for each input and reference program we wrote
The problem was that the monomials were not orthogonal under the uniform dot product, so we moved to spins and took
with the expectation over all programs. However, this is an average over every program, so it has no idea where is. We did this early on because it allowed us to build the basic idea of "orbitals". However, we generally care about the structure of our reference program so we would like something more local that we can investigate to study this. The first thing we need is the following simple definition:
Definition (Local dot product). Given a program , choose a distribution on concentrated near . For any two functions of the program, define
so what we have now are like fields over parameter space.
This is all well and good, but it does mean we have to confront some stuff about the graph Laplacian. In Part 2 the atomic orbitals were eigenfunctions of the graph Laplacian , orthonormal under the uniform measure. Now we want them to be orthonormal under a local measure instead, but this is actually not straightforward. is a symmetric matrix, which means it is self-adjoint with respect to the the standard counting measure type dot product. Its eigenvectors are generally not orthogonal under arbitrary measure weighted dot product, so we need to somehow repair the construction to be useful locally.
The trick to this is to consider as defining a random walk on the graph. That is, if we are walking along the graph we can consider evolving under . That is, let each edge fire at rate 1, so the walker leaves vertex at total rate . Then a distribution evolves by
and the expected value evolves by
It turns out that the important thing about the uniform measure that is important for making it self-adjoint (which is what we want) is that it obeys detailed balance when generating the random walk. That is, as much probability flows from to as from to (there is no directional current). If we want to generalize this, we pick a local measure on , concentrated near the atom's reference value (its value in ), and jump rates along the edges of satisfying detailed balance,
The generator is then self-adjoint in , with
The eigenfunctions of are orthonormal in , with , and these are the local orbitals. Taking the product measure and letting each atom move independently, the generator of the whole program is , its eigenfunctions are the products
and its eigenvalues are sums. So the construction from Part 2 goes through essentially unchanged.
Correlations and the posterior
We want to be able to talk about how different parts of the model are coupled in a way which allows them to perform some computation. The (local) Bayesian posterior is that natural measure to start with here. Take a prior over decoded programs and condition on the data. For any of the exponential-family losses from Part (modulo the zero-one loss), the negative log-likelihood of the data is so the (tempered) posterior is
However even if the prior is a nice product measure like , the posterior is not. We can see this since with , so every mode with mixes the atoms of the system.
The previous section didn't really need the measure to factorize as effectively any measure will have walks on the product graph that satisfy detailed balance with respect to it. For instance we can take , where is with atom set to and is any symmetric edge rate on . The eigenfunctions of such a walk are orthonormal in . However, we lose the kind of factorization we want as the rate at which atom moves now depends on where all the other atoms sit, so the pieces of the generator no longer act on separate atoms, and the don't split into products of atomic orbitals. In physics language this is the difference between a non-interacting and an interacting Hamiltonian. Conjugating the generator by gives a symmetric operator with ground state , which is a product state precisely when is a product measure. Importantly they don't carry the multi-index from the earlier post which tells us exactly which parameters a mode involves, which is ultimately what we want. How then do we deal with this?
The natural basis measures
To handle this we keep a product basis and simply change the inner product, as this actually will still give us the correlational structure we care about. That is, we pick a product reference measure , build its local orbitals as in the previous section, and measure everything in . This lets us keep whatever the natural notion of a parameter is in our system and measure interactions between them.
Considering the Bayesian posterior, there are two natural choices of product measure. Let denote the reference product measure. The first choice for this are the marginals. Take to be the marginal of on atom . This is the product measure minimizing . Every single-atom statistic is then exact. The other option is what we will call the mean field. Take to be the product measure minimizing , i.e. the variational Bayes approximation (the classical, Gibbs–Bogoliubov, version of Hartree, applied to the energy ). We start by looking at the mean field version.
The Bayesian mean field
First we write out the posterior. For the exponential-family losses of Part 2, each example's likelihood can be written as , where depends only on the label. Since the likelihood of the whole dataset can be written like . Tempering by and normalizing gives
where the label-only constants have been absorbed into . With a product prior , taking logs turns the prior into a sum over atoms,
Note as well that does not depend on . We can now expand . Since is a product measure we can factor . Each and depends only on , so averaging over integrates out the remaining atoms. The loss keeps the full expectation, and is a constant. This gives
Now we freeze every factor except . Because is a product, we can take the expectation of as a weighted sum like
Now we denote
so we can then take
The physics interpretation of this is like the per-site free energy,
So then the term is the effective single-site potential
Now writing the single site partition function like we get . The KL divergence vanishes only when its two arguments agree, so the best choice of (with everything else held fixed is)
A mean-field fixed point is then simply a product measure where this holds for every at once. The KL is not convex over product measures, so there are generally many fixed points, and these generally show up in singular models. It is worth noting that ff the prior is not a product we get in place of . Below we give a simple proposition which just expands the posterior in the atomic basis we have chosen.
Proof: Every non-constant orbital has mean zero under its atom's measure, so averaging over all atoms except kills it unless . Hence , and so . Dividing by this leaves exactly the terms.
We should go over what this actually says because it is kind of one of the main points here. A local orbital is a function of a single parameter. On their own the orbitals are just coordinates for each parameter. A product with . A product with is like a joint relative coordinate. The coefficient is then how posterior relates these two objects. If we write this out in full
Atoms and are conditionally independent under the posterior, given all the other atoms, if and only if the coefficient for every whose support contains both of the atoms and . So the supports of the nonzero couplings are the edges given by the posterior's interaction graph between parameters. So, even though we use the product basis we can still recover the interaction graph of the posterior.
Marginals vs. Mean Field
Why start with the mean field case above? Well it turns out that the marginals are sort of the corrections on top of the mean field. Start from Proposition 3, , and sum out every atom except . Since is a product, comes straight out of the sum, and what is left is an average of over the other atoms. Or, more formally:
Proof: The first line is Proposition 3 summed over , and the second is the cumulant expansion of . For the missing first-order term, every mode in has , so it touches some atom , and averages to zero under . So .
So mean field is the zeroth-order term of the marginal. Furthermore, the first correction is second order in the couplings. Grouping the modes of by what they do on the other atoms and using orthonormality, the second-order term is
This is non-negative, and it is largest at the values of most strongly coupled to the rest of the program. Those are exactly the values where the other atoms can move to compensate to avoid breaking the algorithm. This also kind of gives some nice intuition on what makes singular models cursed. In a regular model every direction, including every joint one, sharpens at the same rate as grows, so the couplings tend to fixed partial correlations and mean field misses only an amount of free energy. In a singular model the posterior keeps spreading along a set of parameters that compensate for one another, and the product measure itself would need to adjust individually along each direction, so you get the higher order corrections there.
Atomic correlations
Now that we kind of know what product measures are as close to as a product can be, we take one of of these and build the basis . Doing this, we then change the inner product to be over the distribution we want, then expand everything in the orbitals of . This lets us keep whatever the natural notion of a parameter is in our system and measure how the parameters interact.
Formalizing this, the are still a valid basis for all functions of the program, so the expansion is valid regardless of our choice of measure. We can then build the table is the same as before (Part 2's , computed under the reference). All that really changes that the basis is no longer orthonormal under this dot product. The thing that quantifies how not orthonormal this basis is is the mode covariance
as this tells us exactly how modes interact/overlap under the posterior. Because of this interaction the data coupling picks up this overlap like
If were itself the product , then and we would be back to Part 2. The off-diagonal entries of describe how the posterior mixes modes together.
To really see what does is we can treat the modes as random variables. Draw which gives the vector . Each output is then a linear combination of these vectors, , so the outputs are a random variable too, and their joint covariance is
The top-left block is how the posterior couples parameters, and the bottom-right block, , is how it couples data points. The off-diagonal block is the how these two things relate as it is how much each output moves with each mode. The table does not care about the measure we pick, so all of the correlation structure lives in , and the data coupling is just pushed forward through . If you have seen Gaussian processes, this might look familiar. is the covariance over weights, the rows of are the features, and is the kernel they induce.
We can now look quickly at how our choice of product measures differ. With the marginals, if and are both supported on the same single atom , then . So the ways in which differs from the identity involves interactions between least two atoms. With the mean field measure, the single-atom blocks of are not quite the identity, as each feels the other atoms only through their average, so it misses the indirect influence that comes through their correlated fluctuations, and is not quite the true marginal.
Conclusion
The core idea here we have presented is that if we want to study the interactions between parameters, we construct a product measure that gives us a basis which is as close the orthonormal as possible while retaining our natural notion of parameters, but that allows us to look at a distribution which correlates parameters so we can interpret them. We then showed how this provides such an object via atomic correlations. In the next post, we are going to look at how we can use this ideas to understand intermediary steps in the computation.