This post contains an update on our program to use eigenanalysis of the empirical NTK (eNTK) for mechanistic interpretability, which may be of interest to people working in this space. In previous work (see paper here and distillations here and here), we found a striking alignment of eNTK eigendirections with Fourier feature directions in a model trained on modular arithmetic. This observation, along with evidence that some eNTK eigendirections appear interpretable in a 270M-parameter language model, led us to conjecture that perhaps eNTK eigenanalysis could provide a new tool to find features for mechanistic interpretability.
Given the relative simplicity of the eNTK <> modular arithmetic result, we wondered if we could theoretically understand it using mean-field theory (MFT) techniques. Specifically, we hoped to test whether two phenomena observed in the modular arithmetic case study might generalize more broadly across other situations: that (1) the eNTK spectrum developed a gap after (Fourier sum) features were learned, and that (2) the eNTK eigenvectors rotated to align with said features during learning.
In the course of attempting this, we distilled an earlier equilibrium mean-field analysis of a model trained to do modular arithmetic with Langevin dynamics, and performed a new dynamical mean-field analysis of a model trained on modular arithmetic with gradient flow. Both are presented below.
as a general rule, insofar as we can engineer situations where these things come apart. This gives a theoretical reason to downgrade the eNTK <> feature learning hypothesis. In a separate post, my colleague Julian Schulz will explain that rather than being used for feature identification, the eNTK may find its proper mech interp application as a data-efficient method for model steering, for which he's found some interesting preliminary results.
Review of eNTK results that we wanted to explain
The empirical NTK (eNTK)
,
where are output/class indices, is a kernel formed from contracting two copies of a model’s Jacobian evaluated on arguments , along the parameter space direction. See the posts (1, 2) for context on why this object may be interesting for mechanistic interpretability.
In earlier work (see paper here for details), we found that when we compute top eigendirections of the eNTK for a MLP with the architecture
trained on modular arithmetic in the setup of Gromov,
The eNTK traced over class indices develops two size "cliffs” in its spectrum at the end of training. The eigendirections contained in the first cliff overlap with the span of input Fourier features, and those contained in the second cliff overlap with the span of sum and difference Fourier features at all Fourier frequencies.
The second cliff appears at the same time as grokking.[1] Moreover, the alignment of the corresponding eigenspace with sum Fourier modes increases rapidly from early times through the end of grokking.
These results led us to wonder if grokking might be more broadly related to the emergence of gaps in the eNTK spectrum, and feature learning to the rotation of eNTK eigendirections. We set out to explore these conjectures with mean field theory, and instead ended up with counterexamples leading us to rethink our research agenda.
Why MFT?
Mean field theory is a technique to analyze systems with many interacting components by separating the system into a macroscopic background generated by the components and a microscopic typical component living self-consistently in the background. In a deep learning context, we replace neurons , weights etc. in a large-width model with densities , for the statistical behavior of a typical member of the ensemble. Self-consistency equations then arise when each neuron/weight/… is treated as moving in a background generated by the population, that in turn has to match the statistics provided by the typical neuron/weight/… This sometimes yields closed equations that one can solve for . [2]
Why could MFT potentially help us understand the origin of our eNTK results? Since eNTKs are a known function of a model’s neurons and weights, and MFT can in principle hand us a closed-form expression for the distribution of a typical neuron or weight in a model layer, the rough hope is that we can plug in MFT results for the latter to get a closed-form expression for a layer-averaged eNTK in the appropriate large-width scaling limit. We’ll see how this works out precisely in concrete examples below.
Equilibrium mean-field analysis of the Gromov model decouples eNTK spectral separation from feature learning
We first build on an earlier paper by Rubin et al. who studied the Gromov model in an equilibrium mean-field theory. These authors showed that in a certain scaling limit, one can self-consistently obtain and solve equations describing the equilibrium distribution of a typical layer-1 weight vector in a 1L quadratic MLP trained with Langevin dynamics to do modular arithmetic mod p. Their main result was that the equilibrium solution undergoes a first-order phase transition as one tunes a combination of hyperparameters, that can be interpreted as an equilibrium analog of grokking. I review their work in sections 1.1 and 1.2 of an attached write-up here.
In this setting, we can identify conditions for the eNTK eigenspectrum to develop an analog of the “second cliff” in the finite-width experiment. We perform this analysis in section 1.3 of the write-up. We find that in this case, the eNTK spectrum does develop an analog of the “second cliff” for a range of hyperparameters which correspond to the equilibrium analog of the model being on the cusp of the grokking phase transition. However, the cliff then disappears, flattening out as we push the hyperparameters into the range corresponding to late times/the post-grokking phase at finite width.
This setting thus provides a counterexampleto a strong, population-level hypothesis that spectral gaps in the eNTK always accompany feature learning across deep learning situations, as a (somewhat artificial/formal) example where we think the model still learns something morally like the Gromov solution with Fourier features, but the Fourier sum modes are not spectrally privileged by the eNTK.
Dynamical mean-field analysis decouples eNTK eigenvector rotation from feature learning and spectral separation
Next, we apply the dynamical mean-field (DMFT) equations of Bordelon and Pehlevan to the Gromov model. Those authors found a set of mean-field equations that self-consistently describe the evolution of MLPs trained with gradient flow in a certain scaling limit. We specialize their theory to a 1L quadratic MLP trained on the dataset of all unique data points to do modular arithmetic mod p, and partly solve and analyze the resulting system of equations. This work is carried out in section 2.2 of our write-up here.
Analyzing the eNTK, we find that this example decouples feature learning and eNTK spectral evolution from eNTK eigenvector rotation. Namely, this setup exhibits feature learning in the sense of task-dependent evolution of the hidden-layer activations. The eNTK spectrum evolves in time as well. However, the Fourier features in this case are eigenvectors of the eNTK at all times, so there is no silent-alignment-like rotation of the eNTK eigenspace to align with feature directions. Instead, feature learning occurs precisely through selective reweighing of already-available kernel eigendirections.
Next steps
As mentioned at the start, we believe this analysis gives a theoretical update against earlier hopes that eNTK eigenanalysis might play a privileged role in feature identification, by ruling out a strong claim that the phenomena found in the modular arithmetic experiment might generalize across all deep learning settings. The analysis doesn’t exclude the possibility that the observed phenomena might broadly hold across realistic models, but since experiments also suggest that other use cases of the eNTK may be more promising, we’ve currently set aside this framing. We will explain the potential next steps for the eNTK in a separate post.
On a personal level, the work discussed here was a nice chance for me to learn to use mean-field techniques. I’m now using MFT to study toy models of learning dynamics, unrelated to the eNTK. I’ll post an update on this direction as well in the near future.
See this post, early sections of this review article by Bordelon-Pehlevan, and Czejdo et al.’s notes from the ILIAD intensive for introductions to mean-field techniques in deep learning theory.
This post contains an update on our program to use eigenanalysis of the empirical NTK (eNTK) for mechanistic interpretability, which may be of interest to people working in this space. In previous work (see paper here and distillations here and here), we found a striking alignment of eNTK eigendirections with Fourier feature directions in a model trained on modular arithmetic. This observation, along with evidence that some eNTK eigendirections appear interpretable in a 270M-parameter language model, led us to conjecture that perhaps eNTK eigenanalysis could provide a new tool to find features for mechanistic interpretability.
Given the relative simplicity of the eNTK <> modular arithmetic result, we wondered if we could theoretically understand it using mean-field theory (MFT) techniques. Specifically, we hoped to test whether two phenomena observed in the modular arithmetic case study might generalize more broadly across other situations: that (1) the eNTK spectrum developed a gap after (Fourier sum) features were learned, and that (2) the eNTK eigenvectors rotated to align with said features during learning.
In the course of attempting this, we distilled an earlier equilibrium mean-field analysis of a model trained to do modular arithmetic with Langevin dynamics, and performed a new dynamical mean-field analysis of a model trained on modular arithmetic with gradient flow. Both are presented below.
Our main finding is that
Feature learning ≠ eNTK spectral separation ≠ eNTK eigenvector rotation
as a general rule, insofar as we can engineer situations where these things come apart. This gives a theoretical reason to downgrade the eNTK <> feature learning hypothesis. In a separate post, my colleague Julian Schulz will explain that rather than being used for feature identification, the eNTK may find its proper mech interp application as a data-efficient method for model steering, for which he's found some interesting preliminary results.
Review of eNTK results that we wanted to explain
The empirical NTK (eNTK)
where are output/class indices, is a kernel formed from contracting two copies of a model’s Jacobian evaluated on arguments , along the parameter space direction. See the posts (1, 2) for context on why this object may be interesting for mechanistic interpretability.
In earlier work (see paper here for details), we found that when we compute top eigendirections of the eNTK for a MLP with the architecture
trained on modular arithmetic in the setup of Gromov,
These results led us to wonder if grokking might be more broadly related to the emergence of gaps in the eNTK spectrum, and feature learning to the rotation of eNTK eigendirections. We set out to explore these conjectures with mean field theory, and instead ended up with counterexamples leading us to rethink our research agenda.
Why MFT?
Mean field theory is a technique to analyze systems with many interacting components by separating the system into a macroscopic background generated by the components and a microscopic typical component living self-consistently in the background. In a deep learning context, we replace neurons , weights etc. in a large-width model with densities , for the statistical behavior of a typical member of the ensemble. Self-consistency equations then arise when each neuron/weight/… is treated as moving in a background generated by the population, that in turn has to match the statistics provided by the typical neuron/weight/… This sometimes yields closed equations that one can solve for . [2]
Why could MFT potentially help us understand the origin of our eNTK results? Since eNTKs are a known function of a model’s neurons and weights, and MFT can in principle hand us a closed-form expression for the distribution of a typical neuron or weight in a model layer, the rough hope is that we can plug in MFT results for the latter to get a closed-form expression for a layer-averaged eNTK in the appropriate large-width scaling limit. We’ll see how this works out precisely in concrete examples below.
Equilibrium mean-field analysis of the Gromov model decouples eNTK spectral separation from feature learning
We first build on an earlier paper by Rubin et al. who studied the Gromov model in an equilibrium mean-field theory. These authors showed that in a certain scaling limit, one can self-consistently obtain and solve equations describing the equilibrium distribution of a typical layer-1 weight vector in a 1L quadratic MLP trained with Langevin dynamics to do modular arithmetic mod p. Their main result was that the equilibrium solution undergoes a first-order phase transition as one tunes a combination of hyperparameters, that can be interpreted as an equilibrium analog of grokking. I review their work in sections 1.1 and 1.2 of an attached write-up here.
In this setting, we can identify conditions for the eNTK eigenspectrum to develop an analog of the “second cliff” in the finite-width experiment. We perform this analysis in section 1.3 of the write-up. We find that in this case, the eNTK spectrum does develop an analog of the “second cliff” for a range of hyperparameters which correspond to the equilibrium analog of the model being on the cusp of the grokking phase transition. However, the cliff then disappears, flattening out as we push the hyperparameters into the range corresponding to late times/the post-grokking phase at finite width.
This setting thus provides a counterexample to a strong, population-level hypothesis that spectral gaps in the eNTK always accompany feature learning across deep learning situations, as a (somewhat artificial/formal) example where we think the model still learns something morally like the Gromov solution with Fourier features, but the Fourier sum modes are not spectrally privileged by the eNTK.
Dynamical mean-field analysis decouples eNTK eigenvector rotation from feature learning and spectral separation
Next, we apply the dynamical mean-field (DMFT) equations of Bordelon and Pehlevan to the Gromov model. Those authors found a set of mean-field equations that self-consistently describe the evolution of MLPs trained with gradient flow in a certain scaling limit. We specialize their theory to a 1L quadratic MLP trained on the dataset of all unique data points to do modular arithmetic mod p, and partly solve and analyze the resulting system of equations. This work is carried out in section 2.2 of our write-up here.
Analyzing the eNTK, we find that this example decouples feature learning and eNTK spectral evolution from eNTK eigenvector rotation. Namely, this setup exhibits feature learning in the sense of task-dependent evolution of the hidden-layer activations. The eNTK spectrum evolves in time as well. However, the Fourier features in this case are eigenvectors of the eNTK at all times, so there is no silent-alignment-like rotation of the eNTK eigenspace to align with feature directions. Instead, feature learning occurs precisely through selective reweighing of already-available kernel eigendirections.
Next steps
As mentioned at the start, we believe this analysis gives a theoretical update against earlier hopes that eNTK eigenanalysis might play a privileged role in feature identification, by ruling out a strong claim that the phenomena found in the modular arithmetic experiment might generalize across all deep learning settings. The analysis doesn’t exclude the possibility that the observed phenomena might broadly hold across realistic models, but since experiments also suggest that other use cases of the eNTK may be more promising, we’ve currently set aside this framing. We will explain the potential next steps for the eNTK in a separate post.
On a personal level, the work discussed here was a nice chance for me to learn to use mean-field techniques. I’m now using MFT to study toy models of learning dynamics, unrelated to the eNTK. I’ll post an update on this direction as well in the near future.
The alignment of the first cliff with input Fourier features follows from symmetries at initialization.
See this post, early sections of this review article by Bordelon-Pehlevan, and Czejdo et al.’s notes from the ILIAD intensive for introductions to mean-field techniques in deep learning theory.