# DSLT 1. The RLCT Measures the Effective Dimension of Neural Networks

*TLDR; This is the first post of Distilling Singular Learning Theory (DSLT), an introduction to which can be read at* [*DSLT0*](https://www.lesswrong.com/posts/xRWsfGfvDAjRWXcnG/dslt-0-distilling-singular-learning-theory)*. In this post I explain how singular models (like neural networks) differ from regular ones (like linear regression), give examples of singular loss landscapes, and then explain why the Real Log Canonical Threshold (aka the learning coefficient) is the correct measure of effective dimension in singular models.*

When a model class is singular (like neural networks), the complexity of a parameter $w$ in parameter space $W \subset \mathbb{R}^d$ needs a new interpretation. Instead of being defined by the total parameters available to the model $d$, the complexity (or effective dimensionality) of $w$ is defined by a positive rational $\lambda \in  \mathbb{Q}_{>0}$ called the Real Log Canonical Threshold (RLCT), also known as the learning coefficient. The geometry of the loss $K(w)$ is fundamentally defined by the singularity structure of its minima, which $\lambda$ measures. Moreover, in regular models like linear regression the RLCT is $\lambda = \frac{d}{2}$, but in singular models it satisfies $\lambda \leq \frac{d}{2}$ in general. At its core, then, Sumio Watanabe's *Singular Learning Theory* (SLT) shows the following key insight:

> **The RLCT **$\lambda \in \mathbb{Q}_{>0}$** is the correct measure of effective dimensionality of a model **$w \in W$**.**

Watanabe shows that the RLCT $\lambda$ has strong effects on the learning process: it is the correct generalisation of model complexity in the Bayesian Information Criterion for singular models, and therefore plays a central role in the asymptotic generalisation error, thereby inheriting the name "learning coefficient". 

In this first post, after outlining the Bayesian setup of SLT, we will start by defining what a singular model is and explain what makes them fundamentally different to regular models. After examining different examples of singular $K(w)$ loss landscapes, we will define the RLCT to be the scaling exponent of the volume integral of nearly true parameters, and conclude by summarising how this quantity correctly generalises dimensionality.

Preliminaries of SLT
====================

The following section introduces some necessary technical terminology, so use it as a reference point, not necessarily something to cram into your head on a first read through. A more thorough setup can be found in \[Car21, Chapter 2\], which follows \[Wat09\] and \[Wat18\]. 

SLT is established in the Bayesian paradigm, where the Bayesian posterior on the parameter space $W$ is the primary object of focus, containing information on which parameters $w \in W$ correspond to "good" models.

Our statistical learning setup consists of the following data:

*   A dataset $D_n = \{(X_1, Y_1), \dots, (X_n, Y_n)\}$, where for $i=1,\dots, n$ each $X_i \in \mathbb{R}^N$ is an input and $Y_i \in \mathbb{R}^M$ is an output (so we are in the supervised learning setting).
*   We suppose the sequence in $D_n$ is independent and identically distributed according to a true distribution $q(y,x) = q(y|x)q(x)$. For our purposes, we assume the true distribution of inputs $q(x)$ to be known, but the true distribution of outputs $q(y|x)$ to be unknown.
*   We then choose a model class $p(y|x,w)$ defined by parameters $w$ in a compact parameter space $W \subseteq \mathbb{R}^d$ that contains the origin. We hope to find model parameters $w$ that will adequately approximate the truth, or in other words, learn how to accurately predict an output given an input. For example, a model class could be a fixed neural network architecture with Gaussian noise, as below.
*   We can select a prior distribution $\varphi(w)$ of our choosing[^2o53numu1y] that is non-zero on $W$, so $\varphi(w)>0$.

Using this data, the error of the model $w$ on the dataset $D_n$ is defined by the *empirical negative log likelihood* (NLL), $L_n(w)$, 

$$
L_n(w) = - \frac{1}{n} \sum_{i=1}^n \log p(y_i|x_i, w)\,,
$$

where $e^{-n L_n(w)} = \prod_{i=1}^n p(y_i|x_i,w)=p(D_n|w)$ is the model likelihood.  [^10wrm23xi25p]  [^492ca0emf4j]

This gives rise to the *Bayesian posterior* of $w$ defined by [^js7ilb7ecgp]

$$
p(w|D_n) := \frac{1}{Z_n} \varphi(w) e^{-n L_n(w)}
$$

where the *partition function* (or in Bayesian terms the *evidence*) is given by 

$$
Z_n = \int_W \varphi(w) e^{-n L_n(w)} dw \,.
$$

The partition function $Z_n$ measures posterior density, and thus contains a lot of macroscopic data about a system. Inspired by its role in physics, and for theoretical ease, we consider the *free energy* 

$$
F_n = - \log Z_n \,.
$$

Performing asymptotic analysis on $Z_n$ (and therefore $F_n$) is the main task of SLT. The learning goal is to find small regions of parameter space with high posterior density, and therefore low free energy.

Though we never have access to the truth in the learning procedure, for theoretical purposes we nonetheless define the *empirical entropy* of the true distribution

$$
S_n := - \frac{1}{n} \sum_{i=1}^n \log q(y_i | x_i) \,.
$$

Even though this quantity is always inaccessible in real settings, there is almost sure convergence $S_n \to S$ as $n \to \infty$ to a constant $S$ that doesn't depend on $n$, [^7csuab9hjh9]

$$
S = \mathbb{E}_{X}[-\log q(y|x)] = - \iint_{\mathbb{R}^{N+M}} q(y,x) \log q(y|x) dxdy \,,
$$

To study the posterior, we define the *Kullback-Leibler divergence* $K(w)$ between the truth and the model, 

$$
K(w) := \iint_{\mathbb{R}^{N+M}} q(y|x)q(x) \log \frac{q(y|x)}{p(y|x,w)} dx dy  \,,
$$

which is the infinite-data limit of its empirical counterpart,

$$
K_n(w) := \frac{1}{n} \sum_{i=1}^n \log \frac{q(y_i|x_i)}{p(y_i|x_i,w)} = L_n(w) - S_n \,.
$$

The KL divergence is usually thought of as a "loss metric"[^4ostmpplvnq] between the truth and and the model since 

*   $K(w) \geq 0$ for all $w \in W$, and; 
*   $K(w) =0$ if and only if $p(y|x,w) = q(y|x)$ for all $x \in \mathbb{R}^N$ and all $y \in \mathbb{R}^M$. 

As such, I will colloquially refer to $K(w)$ as the loss landscape. [^xlty7roxql] The current state of results in SLT require $K(w)$ to be an analytic function, but it seems likely that the results can be generalised to non-analytic settings with suitable hypotheses and constraints. $$

To analyse where the loss $K(w)$ is minimised, we are then lead to defining the *set of true parameters*,

$$
W_0 = \{w \in W \, | \, K(w) = 0 \} = \{w \in W \, | \, p(y|x,w) = q(y|x) \} \,.
$$

We say that the true distribution $q(y|x)$ is *realisable* by the model class $p(y|x,w)$ if $W_0$ is non empty, that is, there exists *some* $w^{(0)} \in W$ such that $q(y|x) := p(y|x, w^{(0)})$ for all $x,y$. Despite being unrealistic in real world applications, this is nonetheless an important starting point to the theory, which will then generalise to the set of optimal parameters in DSLT2. 

We are going to restrict our attention to a particular kind of model: neural networks with Gaussian noise. We will formally define a neural network $f(x,w)$ in a following chapter of this sequence, but for now it suffices to say that it is a function $f: \mathbb{R}^N \times W \to \mathbb{R}^M$ with $N$ inputs and $M$ outputs defined by some parameter $w \in W$. Then our model density is going to be given by 

$$
p(y|x,w) = \frac{1}{(2\pi)^{\frac{M}{2}}} \exp \left( -\frac{1}{2} \|y - f(x,w)\|^2 \right) \,.
$$

From here on in, we will assume we are working with a (model, truth, prior) triple $(p(y|x,w), q(y|x), \varphi(w))$ as specified in this section.

### Loss in our setting

To put these technical quantities into perspective, let me make clear two key points:

*   Under the regression model, the NLL is equivalent to the mean-squared error of the neural network $f(x,w)$ on the dataset $D_n$ (up to a constant), 

$$
L_n(w) = \frac{M}{2} \log 2\pi + \frac{1}{n} \sum_{i=1}^n \frac{1}{2} \|y_i - f(x_i, w)\|^2 \,.
$$

*   In the realisable case where $q(y|x) = p(y|x,w^{(0)})$, the KL divergence is just the euclidean distance between the model and the truth adjusted for the prior measure on inputs, 

$$
K(w) = \frac{1}{2} \int_{\mathbb{R}^N} \|f(x,w) - f(x,w^{(0)})\|^2 q(x) dx \,.
$$

Singular vs Regular Models
==========================

What is a singular model?
-------------------------

The key quantity that distinguishes regular and singular models is the Fisher information matrix $I(w)$, whose entries are defined by

$$
I_{j,k}(w) = \iint_{\mathbb{R}^{N+M}}\left( \frac{\partial}{\partial w_j} \log p(y|x,w) \right) \left( \frac{\partial}{\partial w_k} \log p(y|x,w) \right) p(y|x,w)q(x) dx dy \,.
$$

It can be shown that when evaluated at a point on the set of true parameters $w^{(0)} \in W_0$, the Fisher information matrix $I(w)$ is simply the Hessian of $K(w)$, so 

$$
I_{j,k}(w^{(0)}) = \frac{\partial^2}{\partial w_j \partial w_k} K(w) \Biggr|_{w = w^{(0)}} \,.
$$

A *regular* statistical model class is one which is identifiable (so $p(y|x,w_1) = p(y|x,w_2)$ implies that $w_1 = w_2$), and has positive definite Fisher information matrix $I(w)$ for all $w \in W$. Regular model classes, such as standard linear regression, are the backbone of classical statistics for which all pre-exisiting literature on Bayesian statistics applies. But, from the point of view of SLT, regular model classes are... boring.

If a model class is not regular, then it is *strictly* *singular*. The non-identifiability condition can be easily dealt with, but it is the degeneracy of the Fisher information matrix that fundamentally changes the nature of the posterior and its asymptotics. We will say a model defined by a fixed $w^{(0)} \in W$ (not necessarily a true parameter) is strictly singular if the Fisher information at the point, $I(w^{(0)})$, is degenerate, meaning

*    $\mathrm{rank}(I(w^{(0)})) < d$, where $d$ is the number of dimensions in parameter space $W \subset \mathbb{R}^d$, or equivalently; 
*   $\det I(w^{(0)}) = 0$. 

Then the model class is strictly singular if there exists a $w^{(0)} \in W$ such that $I(w^{(0)})$ is degenerate. A *singular* model class can be either regular or strictly singular - Watanabe's theory thus generalises regular models, regardless of the model non-identifiability or degenerate Fisher information. 

It can be easily shown that, under the regression model, $I(w^{(0)})$ is degenerate if and only the set of derivatives

$$
\left\{ \frac{\partial}{\partial w_j} f(x,w) \right\}_{j=1}^d
$$

is linearly dependent. 

In regular models, the set of true parameters $W_0$ consists of one point. But in singular models, the degeneracy of the Fisher information matrix means $W_0$ is not restricted to being one point, or even a set of isolated points - in general, these local minima of $K(w)$ are connected together in high-dimensional structures [^s2swxvx27w]. In strictly singular models, the true parameters are degenerate singularities [^ru2y4ipi0g] of $K(w)$, and thus $K(w)$ cannot be approximated by a quadratic form near these points. This is the fundamental reason the classical theory of Bayesian statistics breaks down.

![The set of true parameters in singular models looks like the left, whereas regular models look like the right. In singular models (left),   \(W_0\)   can be curve, but in regular models (right),   \(W_0\)   is a point.](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/5caeeb8bbbcb70c40b00b0a6fd4034199e36f14005c79886.png)

In singular models (left), $W_0$ can be a curve, but in regular models (right), $W_0$ is a point.

Watanabe states that "in singular statistical models, the knowledge or grammar to be discovered corresponds to singularities in general" \[Wat09\]. With this in mind, it is unsurprising that the following widely used models are all examples of singular models: 

*   Layered neural networks
*   Gaussian, binomial, multinomial and other mixture models
*   Reduced rank regression
*   Boltzmann machines
*   Bayes networks
*   Hidden Markov models

Singular models are characterised by features like: having hierarchical structure, being made of superposition of parametric functions, containing hidden variables, etc., all in the service of obtaining hidden knowledge from random samples. 

Classical Bayesian inference breaks down for singular models
------------------------------------------------------------

There are two key properties of regular models that are critical to Bayesian inference as $n \to \infty$:

*   **Asymptotic normality:** The posterior of regular models converges in distribution to a $d$-dimensional normal distribution centred at the maximum likelihood estimator $w^{(0)}$ \[Vaa07\]:

$$
p(w|D_n) \to \mathcal{N}_d\left(w^{(0)}, \frac{1}{n} I(w^{(0)})^{-1} \right) \,.
$$

*   **Bayesian Information Criterion (BIC):** The free energy of regular models asymptotically looks like the BIC as $n \to \infty$, where $L_n(w^{(0)}) = \min_{w \in W} L_n(w)$ and $d$ is the dimension of parameter space $W \subseteq \mathbb{R}^d$:

$$
F_n \approx n L_n(w^{(0)}) + \frac{d}{2} \log n = \mathrm{BIC} \,.
$$

At the core of both of these results is an asymptotic expansion that strongly depends on the Fisher information matrix $I(w)$ being non-degenerate at true parameters $w^{(0)} \in W_0$. It's instructive to see why this is, so let's derive the BIC to see where $I(w)$ shows up.

### Deriving the Bayesian Information Criterion only works for regular models

For the sake of this calculation, let us assume $W = \mathbb{R}^d$. Taking our cues from \[Kon08\], suppose $w^{(0)} \in W_0$ (thus is a maximum likelihood estimator and satisfies $L_n(w^{(0)}) = \min_{w \in W} L_n(w)$ ). We can Taylor expand the NLL as 

$$
L_n(w) = L_n(w^{(0)}) + (w-w^{(0)})^T \frac{\partial L_n(w)}{\partial w} \Big|_{w = w^{(0)}} + \frac{1}{2}(w-w^{(0)})^T J(w^{(0)}) (w-w^{(0)}) + \dots
$$

 where $J(w^{(0)}) =\frac{\partial^2 L_n(w)}{\partial w \partial w^T} \Bigr|_{w=w^{(0)}}$ is the Hessian. Since we are analysing the asymptotic limit $n \to \infty$, we can relate this Hessian to the Fisher information matrix, 

$$
\begin{aligned} J(w^{(0)}) &= \frac{\partial^2 L_n(w)}{\partial w \partial w^T}\Bigr|_{w=w^{(0)}} \ &= \frac{\partial^2 (K_n(w) + S_n)}{\partial w \partial w^T}\Bigr|_{w=w^{(0)}} \ &\approx \frac{\partial^2 K(w)}{\partial w \partial w^T}\Bigr|_{w=w^{(0)}} \quad \text{as} \, n \to \infty \ &= I(w^{(0)}) \,. \end{aligned}
$$

By definition $w^{(0)}$ is a minimum of $L_n(w)$, so $\frac{\partial L_n(w)}{\partial w} \Bigr|_{w=w^{(0)}}=0$, so we can expand the partition function as 

$$
\begin{aligned} Z_n &= \int_W  e^{-n L_n(w)} \varphi(w) dw \ &= \int_W \exp\left( -nL_n(w^{(0)}) - \frac{n}{2} (w - w^{(0)})^T I(w^{(0)})(w-w^{(0)}) + \dots \right) \ &\quad \times \left[ \varphi(w^{(0)}) + (w - w^{(0)})^T \frac{\partial \varphi(w)}{\partial w}\Biggr|_{w = w^{(0)}} + \dots \right] dw \,. \end{aligned}
$$

Here's the crux: *if* $I(w^{(0)})$ is non-degenerate (so the model is regular), then we can perform this integral in good-faith knowing that it will always exist. In that case, the second term involving $\frac{\partial \varphi(w)}{\partial w}$ vanishes since it is the first central moment of a normal distribution, so we have 

$$
\begin{aligned} Z_n &\approx \exp(-nL_n(w^{(0)})) \varphi(w^{(0)}) \int_W \exp\left(- \frac{n}{2} (w - w^{(0)})^T I(w^{(0)})(w-w^{(0)}) \right) dw \ &= \frac{\exp(-nL_n(w^{(0)})) \varphi(w^{(0)}) (2\pi)^{\frac{d}{2}}}{ n^{\frac{d}{2}} \sqrt{\det I(w^{(0)})}} \end{aligned}
$$

 since the integrand is the integral of a $d$-dimensional multivariate Gaussian $\mathcal{N}_d\left(w^{(0)}, \frac{1}{n} I(w^{(0)})^{-1} \right)$. Notice here that this is the same distribution that arises in the asymptotic normality result, a theorem that has the same core, but requires more rigorous probability theory to prove. If $I(w^{(0)})$ is degenerate, then it is non-invertible, meaning the above formulas cannot hold. 

The free energy of this ensemble is thus 

$$
F_n = - \log Z_n  = nL_n(w^{(0)}) + \frac{d}{2} \log n - \log \varphi(w^{(0)}) - \frac{d}{2} \log 2\pi  + \frac{1}{2} \det I(w^{(0)}) \,,
$$

and so ignoring terms less than $O(1)$ in $n$, we arrive at the Bayesian Information Criterion 

$$
\mathrm{BIC} = nL_n(w^{(0)}) + \frac{d}{2} \log n \,.
$$

This quantity can be understood as an accuracy-complexity tradeoff, where the complexity of the model class is defined by $d$. We will elaborate on this more in DSLT2 but for now, you should just believe that the Fisher information $I(w)$ is a big deal. Generalising this procedure (and therefore the BIC) for singular models, is the heart of SLT.

Examples of Singular Loss Landscapes
====================================

In essence, the Fisher information matrix $I(w)$ describes something about the *effective dimensionality* or *complexity* of a model $w$. When a model class is regular, the effective dimensionality of every point is simply $d$, the number of parameters available to the model. But in the singular case, a new notion of effective dimensionality is required to adequately describe the complexity of a model. We're now going to look at two cases of singular models [^3eongh14olg] \- or more precisely, loss landscapes that correspond to singular models - to motivate this generalisation. We'll start with the easier case where one or more parameters are genuinely "free".

Sometimes singularities are just free parameters
------------------------------------------------

**Example 1.1:** Suppose we have $d=2$ parameters afforded to a model such that $K(w_1, w_2) = w_1^2$, which has a Hessian given by 

$$
J(w) = \frac{\partial^2}{\partial w^T \partial w} K(w) = \begin{pmatrix} 2 & 0 \ 0 & 0 \end{pmatrix}\,.
$$

Taking the critical point $w^{(0)} = (0,0)$, we have $I(w^{(0)}) = J(w^{(0)}) = J(w)$ and so $\det I(w^{(0)})=0$, thus the model is singular. In this case, since $K(0,w_2)=0$ for all $w_2$, we could simply throw out the free parameter $w_2$ and define a regular model with $d_1=1$ parameters that has identical geometry $K(w_1) = w_1^2$, and therefore defines the same input-output function, $f(x,(w_1,w_2)) = f(x,w_1)$.

![Minimally singular case](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/25de18523a8eaa3556507257a39706f19bbdc84a6d0326c4.png)

The KL divergence for the minimally singular case in Example 1.1 looks like a flat valley.

This example is called a *minimally singular* case. Suppose $W \subseteq \mathbb{R}^d$ with integers $d_1, d_2 >0$ such that $d_1 + d_2 = d$, and after some change of basis[^j67t9005wbj] we may write a *local* expansion of $K(w)$ as the sum of $d_1$ squares, 

$$
K(w) = \sum_{i=1}^{d_1} c_i w_i^2 \,,
$$

where $c_1, c_2, \dots, c_{d_1} >0$ are positive coefficients. Then the Fisher information matrix has the form 

$$
I(w^{(0)}) = \begin{pmatrix} c_1 & \dots & 0 & 0 \ \vdots & \ddots & \vdots & \vdots \ 0 & \dots & c_{d_1} & 0 \ 0 & 0 & 0 & \mathbf{0}_{d_2} \end{pmatrix}
$$

where $\mathbf{0}_{d_2}$ is the square $d_2 \times d_2$ zero matrix. Perhaps then we could define the "effective dimensionality" of $w^{(0)}$ as being $\mathrm{rank}(I(w^{(0)}))=d_1$, which is the number of tangent directions in parameter space in which the model changes - the number of "non-free" parameters - and just discard the $d_2$ "free" parameters that are normal to $W_0\,.$

Sure! We can do that, and if we did, our BIC derivation would carry out fine and we would just replace $d$ by $d_1$ in the final formula. So the minimally singular case is easy to handle.

But this doesn't always work.

But not *all* singularities are free parameters
-----------------------------------------------

Defining the effective dimensionality at $w^{(0)}$ as $\mathrm{rank}(I(w^{(0)}))$ seems nice in theory, but turns out to give nonsensical answers pretty quickly - it is not a full enough description of the actual geometry at play. 

**Example 1.2:** Suppose instead that $K(w_1, w_2) = \frac{1}{2} w_1^2 w_2^2$. Then the Hessian is 

$$
J(w) = \begin{pmatrix} w_2^2 & 2 w_1 w_2 \ 2 w_1 w_2 & w_1^2 \end{pmatrix} \,.
$$

 At the critical point $w^{(0)} = (0,0)$ the Fisher information is 

$$
I(w^{(0)}) = H(w^{(0)}) = \begin{pmatrix} 0 & 0  \ 0 & 0 \end{pmatrix} \,,
$$

 which is obviously degenerate. 

![Zero effective dimensionality](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/12ddca10147a2cbf12e30b73e3be15bcfb4924c156d45773.png)

The KL divergence for Example 2.2 with $\mathrm{rank}(I(w^{(0)})) = 0$ looks like the intersection of multiple flat valleys.

If we used our notion of effective dimensionality from before, we would say the model defined by $w^{(0)}$ had effective dimension of $\mathrm{rank}(I(w^{(0)}))=0$. But this would be ridiculous - clearly there are more than zero "effective dimensions" in this model, a term that would intuitively imply $K(w)$ was identically zero, which it clearly is not. Thus, we need a different way of thinking about effective dimensionality. 

The Real Log Canonical Threshold (aka the Learning Coefficient)
===============================================================

In this section we are going to explain the key claim of this post: that effective dimensionality in singular models is measured by a positive rational number called the Real Log Canonical Threshold, also known as the learning coefficient. 

Dimensionality as a volume co-dimension
---------------------------------------

Taking inspiration from Weyl's famous [Volume of Tubes](http://www.math.uchicago.edu/~shmuel/AAT-readings/Data%20Analysis%20/Tubes/Weyl,%20volume%20of%20tubes.pdf) paper, we can reframe dimensionality in terms of a scaling exponent of the volume of "nearly" true parameters. To explain this, we will generalise the minimally singular case above. The following discussion follows \[Wei, 22\].

Assume we have a partition as before with $d_1,d_2 \in \mathbb{N}_{\geq 0}$ such that $d_1+d_2=d$, where $d_1$ is the number of non-free parameters and $d_2$ is the number of free parameters. For any $\varepsilon>0$ we can consider the set of almost true parameters centred at $w^{(0)}$ (which, without loss of generality, we will take to be $w^{(0)} = 0$), 

$$
W_{\varepsilon} = \{ w \in W | K(w) < \varepsilon\}
$$

 and an associated volume function 

$$
V(\varepsilon) = \int_{W_{\varepsilon}} \varphi(w) dw \,.
$$

![Volume integral](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/31e78972626991cde489497b9eaff9284be8037ea137d02f.png)

 $V(\varepsilon)$ for $K(w) = \frac{1}{2}w_1^2w_2^2$ for different $\varepsilon$ level sets.

As long as the prior $\varphi(w)$ is non-zero on $W_0$ it does not affect the relevant features of the volume, so we may assume that it is a constant $C$ in the first $d_1$ directions and is a normal distribution in the remaining $d_2$. Then since $K(w) \approx \sum_{i=1}^{d_1} c_i w_i^2$, we can write 

$$
V(\varepsilon) = \int_{\{w \in W | \sum_{i=1}^{d_1} c_i w_i^2 <\varepsilon  \}} C dw_1 \dots dw_{d_1}  \int_{\mathbb{R}^{d_2}} e^{-\frac{1}{2} (w_{d_1+1}^2 + \dots + w_{d}^2)} dw_{d_1 + 1} \dots dw_d \,.
$$

The right integrand is some constant $A$ that doesn't depend on $\varepsilon$, and for the left we can make the substitution $u_i =  \sqrt{\frac{c_i}{\varepsilon}}w_i$, hence 

$$
V(\varepsilon) = AC \int_{\{u \in U | \sum_{i=1}^{d_1} u_i^2 < 1\}} \sqrt{\frac{\varepsilon}{c_1}} \dots \sqrt{\frac{\varepsilon}{c_{d_1}}} du_1 \dots du_{d_1} \,.
$$

Recognising the integrand as the volume of the $d_1$-ball, a constant $B$ that does not depend on $\varepsilon$, we see that 

$$
V(\varepsilon) \propto  \frac{\varepsilon^{\frac{d_1}{2}}}{\sqrt{c_1 \dots c_{d_1}}} \,.
$$

Then the dimension $d_1$ arises as the scaling exponent of $\varepsilon^{\frac{1}{2}}$, which can be extracted via the following ratio of volumes formula for some $a \in (0,1)$: 

$$
d_1 = 2 \lim_{\varepsilon \to 0} \frac{ \log(V(a\varepsilon) / V(\varepsilon))}{\log a} \,.
$$

This scaling exponent, it turns out, is the correct way to think about dimensionality of singularities. 

Watanabe shows in Theorem 7.1 of \[Wat09\] that in general, for any singular model defined by $w^{(0)}$, the volume integral centred at $w^{(0)}$ has the form 

$$
V(\varepsilon) = c \varepsilon^{\lambda} + o(\varepsilon^{\lambda})
$$

where $\lambda \in \mathbb{Q}_{>0}$ is a positive rational number called the *Real Log Canonical Threshold* (RLCT) associated to the "most singular point" in $W_0$. *This* is the quantity that generalises the dimensionality of a singularity. What's more, different singularities in $W_0$ can have *different RLCT values*, and thereby different "effective dimensionalities". As suggested above, the RLCT can then be defined by this volume formula: 

$$
\lambda = \lim_{\varepsilon \to 0} \frac{ \log(V(a\varepsilon) / V(\varepsilon))}{\log a} \,.
$$

An example of fractional dimension
----------------------------------

**Example 1.3:** To build intuition for what a "fractional dimension" is, consider a model with $d=1$ parameters with KL divergence given by $K(w)=w^4$, which is singular since $\frac{\partial^2 K}{\partial w^2} \bigr|_{w = 0} = 0$. A simple calculation shows that for this KL divergence, 

$$
V(\varepsilon) \propto \varepsilon^{\frac{1}{4}}
$$

meaning $\lambda = \frac{1}{4}$ and so the "effective dimensionality" is $2\lambda = \frac{1}{2}$.

Meanwhile, in the $K(w)=w^2$ case, $V(\varepsilon)\propto \varepsilon^{\frac{1}{2}}$, so the effective dimensionality is 1.

![Effective dimension from a volume integral](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/2ca29c6400cdea0eae84fcd12f20c1bd3768a7a3a95c1619.png)

Comparing the effective dimensionality as the scaling exponent of $\varepsilon$ for different models.

The RLCT can be read off when $K(w)$ is in normal crossing form
---------------------------------------------------------------

I may have presented the previous section suggesting that the RLCT is trivial to calculate. In general, this couldn't be further from the truth. But in one special case, it is. For this discussion we will ignore the prior, i.e. we will set it to be uniform on $W$.

### One dimensional case

As we just saw in Example 1.3, in the one dimensional case where $K(w)=w^{2k}$ for some $k\geq 1$, the RLCT is simply $\lambda = \frac{1}{2k}$. In fact, if we can express $K(w)$ in the form

$$
K(w) = (w-c_1)^{2k_1}\dots(w-c_J)^{2k_J}
$$

$$for non-negative integers $k_1, \dots, k_j$ and unique $c_1,\dots,c_j \in \mathbb{R}$, then the RLCT associated to each singularity $c_j$ is simply $\lambda_j = \frac{1}{2k_j}$. But, Watanabe shows that it is the *smallest* local RLCT (and thus the highest exponent in $K(w)$) that dominates the free energy, thus defining the *global RLCT* $\lambda$ where

$$
\lambda = \min_{j=1,\dots,J} \left(\frac{1}{2k_{j}} \right) \,.
$$

**Example 1.4** This example is going to be very relevant in DSLT2. If we have 

$$
K(w) = (w+1)^{2}w^4 \,,
$$

with true parameters $w_{-1}^{(0)}=-1$ and $w_{1}^{(0)}=1$, then the local RLCT associated to each singularity is 

$$
\lambda_{-1} = \frac{1}{2} \quad \text{and} \quad \lambda_{1} = \frac{1}{4} \,.
$$

The global RLCT is thus $\lambda=\lambda_1 \,.$

### Multidimensional case

Suppose now that $d>1$ so $K(w)=K(w_1, \dots, w_d)$. Suppose without loss of generality that $w^{(0)}=0$ is a true parameter for $K(w)$. If we can write the KL divergence in *normal crossing form* near $w^{(0)}$,

$$
K(w) = w_1^{2k_1} \dots w_d^{2k_d}
$$

then the RLCT is given by 

$$
\lambda = \min_{j=1,\dots,d} \left(\frac{1}{2k_{j}} \right) \,.
$$

The multiplicity $m_j$ of each coordinate is the number of elements in $\{k_1,\dots,k_d\}$ that equal $k_j.$$$

This generalises this above case in the following sense:

$$**Example 1.5** Suppose now that we have a two dimensional KL divergence of the form

$$
K(w_1,w_2) = (w_1+1)^2 w_1^4 w_2^2 \,.
$$

$$Then, in a neighbourhood of the singularity $w^{(0)}_0=(0,0)$, the KL divergence is approximately 

$$
K(w) \propto w_1^4 w_2^2 \,.
$$

Thus, the RLCT associated to $w^{(0)}_0$ is

$$
\lambda_0 = \frac{1}{4} \,,
$$

with multiplicity $m_0=1.$ 

On the other hand, near the singularity $w_{-1}^{(0)}=(-1,0)$ the KL divergence is, up to a prefactor, approximately 

$$
K(w) \approx (w_1+1)^2 w_2^2
$$

so the RLCT associated to $w_{-1}^{(0)}$ is

$$
\lambda_{-1} = \frac{1}{2}
$$

with multiplicity $m_{-1} = 2$. So, in this case the global RLCT is $\lambda=\lambda_0$, which we will see in DSLT2 means that the posterior is most concentrated around $$the singularity $w_{0}^{(0)}$. 

Resolution of Singularities
---------------------------

In *Algebraic Geometry and Statistical Learning Theory*, Watanabe shows that algebraic geometry plays a central role in governing the behaviour of statistical models, and a highly non-trivial one in singular models especially. This rich connection between these two deep mathematical fields is, in my eyes, both profound and extremely beautiful. 

The remarkable insight of Watanabe is that in fact *any* KL divergence, under appropriate hypotheses (such as analyticity), can be written in normal crossing form near a singularity of $K(w)$. To do so, he invokes one of the fundamental theorems of algebraic geometry: Hironaka's [Resolution of Singularities.](https://en.wikipedia.org/wiki/Resolution_of_singularities) The content of this theorem and its implications go well beyond the scope of this sequence. But, I will briefly mention its role in the theory as it relates to the RLCT. For a more detailed introduction to this part of the story, see \[Wat09, Section 1.4\].   

The theorem guarantees the existence of a $d$-dimensional analytic manifold $\mathcal{M}$ and a real analytic map

$$
g : \mathcal{M} \ni u \mapsto w \in W
$$

such that for each coordinate $\mathcal{M}_{\alpha}$ of $\mathcal{M}$ one can write 

$$
\begin{aligned} K(g(u)) &= u_1^{2k_1} \dots u_d^{2k_d} \ \text{and} \quad \varphi(g(u))|g'(u)| &= \phi(u) |u_1^{h_1} \dots u_d^{h_d}| \end{aligned}
$$

where each $k_1,\dots,k_d$ and $h_1,\dots, h_d$ are non-negative integers, $|g'(u)|$ is the Jacobian determinant of $w = g(u)$ and $\phi(u)>0$ is a real analytic function. The global RLCT is then defined by 

$$
\lambda = \min_{\alpha} \min_{j=1,\dots,d} \left( \frac{h_j+1}{2k_j} \right) \,,
$$

and the global multiplicity is the maximum multiplicity over $\alpha$.

From this point on in the sequence, when you see the word "desingularise", what you should think is "put $K(w)$ into normal crossing form near a singularity". 

The RLCT measures the effective dimensionality of a model
---------------------------------------------------------

Succinctly, the RLCT $\lambda \in \mathbb{Q}_{>0}$ of a singularity $w^{(0)} \in W_0 \subseteq W \subseteq \mathbb{R}^d$ generalises the idea of dimension because:

*   If a model defined by $w^{(0)}$ is **regular**, then 

$$
\lambda = \frac{d}{2} \,.
$$

*   If a model defined by $w^{(0)}$ is **minimally singular** where $d_1<d$ is the number of non-free parameters, then 

$$
\lambda = \frac{d_1}{2} \,.
$$

*   **In general**, for any singular model the RLCT satisfies (by Theorem 7.2 of \[Wat09\])  

$$
\lambda \leq \frac{d}{2} \,.
$$

*   In particular, if there are $d_1<d$ non-free parameters then 

$$
\lambda \leq \frac{d_1}{2} \,.
$$

In order to find the asymptotic form of the free energy $F_n$ as $n \to \infty$, Watanabe desingularises $K(w)$ near each singularity using the Resolution of Singularities. The RLCT then directly substitutes into the place of $\frac{d}{2}$ in the BIC formula, which gives rise to the Widely Applicable Bayesian Information Criterion (WBIC) 

$$
\mathrm{WBIC} := n L_n(w^{(0)}) + \lambda \log n\,.
$$

In DSLT2, we will explain the implications of the WBIC and what it tells us about the profound differences between regular and singular models. 

Appendix 1 - The other definition of the RLCT
=============================================

In this post we have defined the RLCT as the scaling exponent of the volume integral of nearly true parameters. This result, whilst the most intuitive, is presented in the reverse order to how Watanabe originally defines the RLCT in \[Wat09\]. Alternatively, we can consider the zeta function 

$$
\zeta(z) = \int_W K(w)^z \varphi(w) dw \,,
$$

 and show that it has a Laurent series given by 

$$
\zeta(z) = \zeta_0(z) + \sum_{k=1}^{\infty} \sum_{m=1}^{m_k} \frac{c_{km}}{(z+\lambda_k)^m}
$$

where $\zeta_0(z)$ is a holomorphic function, $c_{km} \in \mathbb{C}$ are coefficients, each $\lambda_k \in \mathbb{Q}_{>0}$ is ordered such that $0<\lambda_1<\lambda_2<\dots$, and $m_k \in \mathbb{N}$ is the largest order of the pole $\lambda_k$.

Then the *Real Log Canonical Threshold* of our (model, truth, prior) triple is $\lambda=\lambda_1$ with multiplicity $m=m_1$.

This $\zeta(z)$ is a key piece of machinery in using distribution theory to expand the partition function $Z_n$. In the end, the smallest $\lambda_1$ and its multiplicity $m_1$ are the dominant terms in the expansion, and a further calculation in \[Wat09, Theorem 7.1\] shows how $V(\varepsilon) \propto \varepsilon^{\lambda}$. 

To see why $\zeta(z)$ is necessary, and why this definition of the RLCT matters to the free energy formula proof, see the sketch of the proof in \[Wat09, pg31-34\]. 

References
==========

\[Car21\] - Liam Carroll, [Phase Transitions in Neural Networks](http://therisingsea.org/notes/MSc-Carroll.pdf) (thesis)

\[Wat09\] - Sumio Watanabe, [Algebraic Geometry and Statistical Learning Theory](https://doi.org/10.1017/CBO9780511800474) (book)

\[Wat18\] - Sumio Watanabe, [Mathematical Theory of Bayesian Statistics](https://www.lesswrong.com/posts/xRWsfGfvDAjRWXcnG/%5Bhttps://doi.org/10.1201/9781315373010%5D(https://doi.org/10.1201/9781315373010)) (book)

\[KK08\] - Konishi, Kitagawa, [Information Criteria and Statistical Modelling](https://doi.org/10.1007/978-0-387-71887-3) (book)

\[Vaa07\] - van der Vaart, [Asymptotic Statistics](https://doi.org/10.1017/CBO9780511802256) (book) 

\[Wei22\] - Susan Wei, Daniel Murfet et al., [Deep Learning is Singular, and That's Good](https://www.suswei.com/publication/wei-2022-singular/wei-2022-singular.pdf) (paper)

* * *

[^2o53numu1y]: In the finite \(n\) case, the choice of prior \(\varphi(w)\) is a philosophical matter, as well as a mathematical tractability matter. But as \(n \to \infty\), most results in Bayesian statistics show \(\varphi(w)\) to be irrelevant so long as it satisfies some reasonable conditions. This is also true in SLT. ↩︎ 

[^10wrm23xi25p]: This should remind you of the Gibbs ensemble from statistical physics - not coincidentally, either. ↩︎ 

[^492ca0emf4j]: For theoretical, philosophical, and computational purposes, we also define the tempered posterior to be \[p^{\beta}(w|D_n) := \frac{1}{Z_n^{\beta}} \varphi(w) e^{-n\beta L_n(w)}\,, \quad    \text{where} \quad Z_n^{\beta} = \int_W \varphi(w) e^{-n\beta L_n(w)} dw\,.\] where \(\beta>0\) is the inverse temperature. This \(\beta\) plays an important role in deriving the free energy formula and can be thought of as controlling the "skinniness" of the posterior. In our regression model below, it is actually the inverse variance of the Gaussian noise. ↩︎ 

[^js7ilb7ecgp]: By Bayes' rule we have \(p(w|D_n) = \frac{p(D_n|w) \varphi(w)}{p(D_n)}\). The form written here follows from some simplification of terms and redefinitions, see page 10 of the thesis.  

[^7csuab9hjh9]: We can define an expectation over the dataset \(D_n\) for some function \(g(X,Y)\) as \[\mathbb{E}_X[g(X,Y)] = \iint_{\mathbb{R}^{N+M}} g(x,y) q(y,x) dxdy\] In particular, we define the entropy of the true conditional distribution to be \[S = \mathbb{E}_{X}[-\log q(y|x)] = - \iint_{\mathbb{R}^{N+M}} q(y,x) \log q(y|x) dxdy \,,\] and the (non-empirical) negative log loss to be \[L(w) = \mathbb{E}_{X}[-\log p(y|x,w)] = - \iint_{\mathbb{R}^{N+M}} q(y,x) \log p(y|x,w) dxdy \,.\]It is easy to show that \(\mathbb{E}_X[S_n] = S\) and \(\mathbb{E}_X[L_n(w)] = L(w)\), and so by the law of large numbers there is almost sure convergence \(S_n \to S\) and \(L_n(w) \to L(w)\). Analogous definitions show \[K_n(w) = L_n(w) - S_n \to L(w) - S = K(w) \,.\] 

[^4ostmpplvnq]: Though it isn't a true metric due to its asymmetry in \(p\) and \(q\), and since it doesn't satisfy the triangle inequality. ↩︎ 

[^xlty7roxql]: Note here that since \(K(w) = L(w)-S\), we can reasonably call both \(K(w)\) and \(L(w)\) the loss landscape since they differ only by a constant \(S\) (as \(n \to \infty\)). 

[^s2swxvx27w]: Or more precisely, a real analytic set.  

[^ru2y4ipi0g]: Since \(K(w^{(0)})=0\), and \(\nabla K(w^{(0)})=0\), and \(I(w^{(0)})\) is degenerate. ↩︎ 

[^3eongh14olg]: Based on \(K(w) = \frac{1}{2} \int_W \|f(x,w) - f(x,w^{(0)}\|^2 q(x) dx\), it is relatively easy to reconstruct a model that genuinely yields a given \(K(w)\) function, so we may happily pretend we have said model when we pull such a loss function from thin air. ↩︎ 

[^j67t9005wbj]: Which is guaranteed to exist since the Hessian is a real symmetric matrix (and thus so is \(I(w^{(0)})\)), so it can be diagonalised. ↩︎