\section{Introduction}

Despite the numerous empirical successes of deep learning, much of the underlying theory remains poorly understood. One promising direction forward to an interpretable account of deep learning is in the study of the relationship between deep neural networks and kernel machines. Several studies in recent years have shown that gradient flow on infinitely wide neural networks with a certain parameterization gives rise to linearized dynamics in parameter space \citep{Lee2019WideNN, liu_belkin} and consequently a kernel regression solution with a kernel known as the neural tangent kernel (NTK) in function space \citep{Jacot2018NeuralTK, Arora2019OnEC}. Kernel machines enjoy firmer theoretical footing than deep neural networks, which allows one to accurately study their training and generalization \citep{RasmussenW06, Scholkopf2002}. Moreover, they share many of the phenomena that overparameterized neural networks exhibit, such as interpolating the training data \citep{zhang_rethinking, liang_rahklin_interpolate, belkin_deep_kernel_understand}. However, the exact equivalence between neural networks and kernel machines breaks for finite width networks.
Further, the regime with approximately static kernel, also referred to as the lazy training regime \citep{Chizat2019OnLT}, cannot account for the ability of deep networks to adapt their internal representations to the structure of the data, a phenomenon widely believed to be crucial to their success.

In this present study, we pursue an alternative perspective on the NTK, and ask whether a neural network with an NTK that changes significantly during training can ever be a kernel machine for a {\it data-dependent} kernel: i.e. does there exist a kernel function $K$ for which the final neural network function $f$ is $f(\bm x) \approx \sum_{\mu=1}^P \alpha^\mu K(\bm x,\bm x^\mu)$ with coefficients $\alpha^\mu$ that depend only on the training data? We answer in the affirmative: that a large class of neural networks at small initialization trained on approximately whitened data are accurately approximated as kernel regression solutions with their final, data-dependent NTKs up to an error dependent on initialization scale.
Hence, our results provide a further concrete link between kernel machines and deep learning which, unlike the infinite width limit, allows for the kernel to be shaped by the data.

The phenomenon we study consists of two training phases. In the first phase, the kernel starts off small in overall scale and quickly aligns its eigenvectors toward task-relevant directions. In the second phase, the kernel increases in overall scale, causing the network to learn a kernel regression solution with the final NTK. We call this phenomenon the \textit{silent alignment effect} because the feature learning happens before the loss appreciably decreases.
Our contributions are the following
\begin{enumerate}[leftmargin=*]
    \item In Section \ref{sec:silent_align_theory}, we demonstrate the silent alignment effect by considering a simplified model where the kernel evolves while small and then subsequently increases only in scale. We theoretically show that if these conditions are met, the final neural network is a kernel machine that uses the final, data-dependent NTK. A proof is provided in Appendix \ref{app:kernel_ev_scale}.
    \item In Section \ref{sec:two_layer_linear}, we provide an analysis of the NTK evolution of two layer linear MLPs with scalar target function with small initialization. If the input training data is whitened, the kernel aligns its eigenvectors towards the direction of the optimal linear function early on during training while the loss does not decrease appreciably. After this, the kernel changes in scale only, showing this setup satisfies the requirements for silent alignment discussed in Section \ref{sec:silent_align_theory}.
    \item In Section \ref{sec:deep_linear}, we extend our analysis to deep MLPs by showing that the time required for alignment scales with initialization the same way as the time for the loss to decrease appreciably. Still, these time scales can be sufficiently separated to lead to the silent alignment effect for which we provide empirical evidence. We further present an explicit formula for the final kernel in linear networks of any depth and width when trained from small initialization, showing that the final NTK aligns to task-relevant directions.

    \item In Section \ref{sec:nonlinear_anisotropy}, we show empirically that the silent alignment phenomenon carries over to nonlinear networks trained with ReLU and Tanh activations on isotropic data, as well as linear and nonlinear networks with multiple output classes. For anisotropic data, we show that the NTK must necessarily change its eigenvectors when the loss is significantly decreasing, destroying the silent alignment phenomenon. In these cases, the final neural network output deviates from a kernel machine that uses the final NTK.
\end{enumerate}

\subsection{Related Works}

\cite{Jacot2018NeuralTK} demonstrated that infinitely wide neural networks initialized with an appropriate parameterization and trained on mean square error loss evolve their predictions as a linear dynamical system with the NTK at initalization.
A limitation of this kernel regime is that the neural network internal representations and the kernel function do not evolve during training. Conditions under which such lazy training can happen is studied further in \citep{Chizat2019OnLT,liu_belkin}. \citet{domingos2020model} recently
showed that every model, including neural networks, trained with gradient descent leads to a kernel model with a path kernel and coefficients $\alpha^\mu$ that depend on the test point $\bm x$. This dependence on $\bm x$ makes the construction not a kernel method in the traditional sense that we pursue here (see Remark 1 in \citep{domingos2020model}).

Phenomenological studies and models of kernel evolution have been recently invoked to gain insight into the difference between lazy and feature learning regimes of neural networks. These include analysis of NTK dynamics which revealed that the NTK in the feature learning regime aligns its eigenvectors to the labels throughout training, causing non-linear prediction dynamics \citep{fort2020deep, Baratin2021ImplicitRV, shan2021rapid, woodworth, chen2020labelaware, GEIGER20211, bai2020taylorized}.  Experiments have shown that lazy learning can be faster but less robust than feature learning \citep{Flesch} and that the generalization advantage that feature learning provides to the final predictor is heavily task and architecture dependent \citep{lee2020finite}. \cite{fort2020deep} found that networks can undergo a rapid change of kernel early on in training after which the network's output function is well-approximated by a kernel method with a data-dependent NTK. Our findings are consistent with these results.

\cite{stoger2021small} recently obtained a similar multiple-phase training dynamics involving an early alignment phase followed by spectral learning and refinement phases in the setting of low-rank matrix recovery. Their results share qualitative similarities with our analysis of deep linear networks. The second phase after alignment, where the kernel's eigenspectrum grows, was studied in linear networks in \citep{jacot2021deep}, where it is referred to as the saddle-to-saddle regime.

Unlike prior works \citep{Dyer2020Asymptotics, Aitken2020OnTA, Andreassen2020AsymptoticsOW}, our results do not rely on perturbative expansions in network width. Also unlike the work of \cite{Saxe14exactsolutions}, our solutions for the evolution of the kernel do not depend on choosing a specific set of initial conditions, but rather follow only from assumptions of small initialization and whitened data.

\section{The Silent Alignment Effect and Approximate Kernel Solution}\label{sec:silent_align_theory}

Neural networks in the overparameterized regime can find many interpolators: the precise function that the network converges to is controlled by the time evolution of the NTK. As a concrete example, we will consider learning a scalar target function with mean square error loss through gradient flow. Let $\bm x \in \mathbb{R}^D$ represent an arbitrary input to the network $f(\bm x)$ and let $\{ \bm x^\mu, y^\mu\}_{\mu=1}^P$ be a supervised learning training set. Under gradient flow the parameters $\bm \theta$ of the neural network will evolve, so the output function is time-dependent and we write this as $f(\bm x,t)$. The evolution for the predictions of the network on a test point can be written in terms of the NTK $K(\bm x,\bm x',t) = \frac{\partial f(\bm x,t)}{\partial \bm \theta} \cdot \frac{\partial f(\bm x',t)}{\partial \bm\theta}$ as
\begin{align}
    \frac{d}{dt} f(\bm x,t) = \eta \sum_{\mu} K(\bm x,\bm x^\mu, t) (y^\mu - f(\bm x^\mu,t)),
\end{align}
where $\eta$ is the learning rate.
If one had access to the dynamics of $K(\bm x,\bm x^\mu,t)$ throughout all $t$, one could solve for the final learned function $f^*$ with integrating factors under conditions discussed in Appendix \ref{app:integrating_factor}
\begin{align}\label{eq:integ_factor}
    f^*(\bm x) = f_0(\bm x) +  \sum_{\mu \nu} \int_{0}^{\infty} dt \ \bm k_t(\bm x)^\mu \left[\exp\left( - \eta \int_{0}^{t} \bm K_{t'}\, dt'  \right) \right]_{\mu \nu} \left( y^\nu - f_0(\bm x^\nu) \right).
\end{align}
Here, $\bm k_t(\bm x)^{\mu} = K(\bm x,\bm x^\mu,t)$, $[\bm K_t]_{\mu,\nu} = K(\bm x^\mu,\bm x^{\nu},t )$, and $y^\mu - f_0(\bm x^\mu)$ is the initial error on point $\bm x^\mu$.  We see that the final function has contributions throughout the full training interval $t \in (0,\infty)$.  The seminal work by \cite{Jacot2018NeuralTK} considers an infinite-width limit of neural networks, where the kernel function $K_t(\bm x,\bm x')$ stays constant throughout training time. In this setting where the kernel is constant and $f_0(\bm x^\mu) \approx 0$, then we obtain a true kernel regression solution $f(\bm x) = \sum_{\mu, \nu} \bm k(\bm x)^\mu \bm K^{-1}_{\mu \nu} y^\nu$ for a kernel $K(\bm x,\bm x')$ which does not depend on the training data.

Much less is known about what happens in the rich, feature learning regime of neural networks, where the kernel evolves significantly during time in a data-dependent manner. In this paper, we consider a setting where the initial kernel is small in scale, aligns its eigenfunctions early on during gradient descent, and then increases only in scale monotonically. As a concrete phenomenological model, consider depth $L$ networks with homogenous activation functions with weights initialized with variance $\sigma^2$. At initialization $K_0(\bm x,\bm x') \sim O(\sigma^{2L-2}) , f_0(\bm x) \sim O(\sigma^L)$ (see Appendix \ref{app:kernel_ev_scale}). We further assume that after time $\tau$, the kernel only evolves in scale in a constant direction
\begin{align}
    K(\bm x,\bm x',t) = \begin{cases}
      \sigma^{2L-2} \tilde K(\bm x,\bm x',t) & t \leq \tau \\
      g(t) K_{\infty}(\bm x,\bm x') & t > \tau
   \end{cases},
\end{align}
where $\tilde K(\bm x,\bm x',t)$ evolves from an initial kernel at time $t=0$ to $K_{\infty}(\bm x,\bm x')$ by $t = \tau$ and $g(t)$ increases monotonically from $\sigma^{2L-2}$ to $1$. In this model, one also obtains a kernel regression solution in the limit where $\sigma \to 0$ with the final, rather than the initial kernel: $f(\bm x) = \bm k_{\infty}(\bm x) \cdot \bm K_{\infty}^{-1} \bm y + O(\sigma^{L})$. We provide a proof of this in the Appendix \ref{app:kernel_ev_scale}.

The assumption that the kernel evolves early on in gradient descent before increasing only in scale may seem overly strict as a model of kernel evolution. However, we analytically show in Sections \ref{sec:two_layer_linear} and \ref{sec:deep_linear}  that this can happen in deep linear networks initialized with small weights, and consequently that the final learned function is a kernel regression with the final NTK. Moreover, we show that for a linear network with small weight initialization, the final NTK depends on the training data in a universal and predictable way.

We show empirically that our results carry over to nonlinear networks with ReLU and tanh activations under the condition that the data is whitened. For example, see Figure \ref{fig:relu_demo_silent_alignment}, where we show the silent alignment effect on ReLU networks with whitened MNIST and CIFAR-10 images. We define alignment as the overlap between the kernel and the target function $\frac{\bm y^\top \bm K \bm y}{\|\bm K\|_F |\bm y|^2}$, where $\bm y \in \mathbb{R}^P$ is a vector of the target values, quantifying the projection of the labels onto the kernel, as discussed in \citep{cortes2012algorithms}. This quantity increases early in training but quickly stabilizes around its asymptotic value before the loss decreases. Though \Eqref{eq:integ_factor} was derived under assumption of gradient flow with constant learning rate, the underlying conclusions can hold in more realistic settings as well. In Figure \ref{fig:relu_demo_silent_alignment} (d) and (e) we show learning dynamics and network predictions for Wide-ResNet \citep{zagoruyko2017wide} on whitened CIFAR-10 trained with the Adam optimizer \citep{kingma2014adam} with learning rate $10^{-5}$, which exhibits silent alignment and strong correlation with the final NTK predictor. In the unwhitened setting, this effect is partially degraded, as we discuss in Section \ref{sec:nonlinear_anisotropy} and Appendix \ref{app:res_net_experiment}. Our results suggest that the final NTK may be useful for analyzing generalization and transfer as we discuss for the linear case in Appendix \ref{app:transfer_theory}.

\begin{figure}[t]
    \centering

    \subfigure[Whitened Data MLP Dynamics]{\includegraphics[width=0.32\linewidth]{figures/loss_kernel_whitened_relu2.pdf}}
    \subfigure[Prediction MNIST]{\includegraphics[width=0.32\linewidth]{figures/prediction_comp_whitened_relu.pdf}}

    \subfigure[Prediction CIFAR-10]{\includegraphics[width=0.32\linewidth]{figures/cifar_prediction_comp_whitened_relu.pdf}}
    \subfigure[Wide Res-Net Dynamics]{\includegraphics[width=0.32\linewidth]{figures/resnet_loss_alignment_curve_whitened.pdf}}
    \subfigure[Prediction Res-Net]{\includegraphics[width=0.32\linewidth]{figures/cifar_prediction_comp_whitened_resnet_more_data.pdf}}
    \caption{A demonstration of the Silent Alignment effect. (a) We trained a 2-layer ReLU MLP on $P = 1000$ MNIST images of handwritten $0$'s and $1$'s which were whitened. Early in training, around $t \approx 50$, the NTK aligns to the target function and stay fixed (green). The kernel's overall scale (orange) and the loss (blue) begin to move at around $t=300$. The analytic solution for the maximal final alignment value in linear networks is overlayed (dashed green), see Appendix \ref{app:NTK_final_deep_linear}. (b)  We compare the predictions of the NTK and the trained network on MNIST test points. Due to silent alignment, the final learned function is well described as a kernel regression solution with the final NTK $K_{\infty}$. However, regression with the initial NTK is not a good model of the network's predictions. (c) The same experiment on $P =1000$ whitened CIFAR-10 images from the first two classes. Here we use MSE loss on a width $100$ network with initialization scale $\sigma=0.1$. (d) Wide-ResNet with width multiplier $k=4$ and blocksize of $b=1$ trained with $P=100$ training points from the first two classes of CIFAR-10. The dashed orange line marks when the kernel starts growing significantly, by which point the alignment has already finished. (e) Predictions of the final NTK are strongly correlated with the final NN function.  }
    \label{fig:relu_demo_silent_alignment}
\end{figure}

\section{Kernel Evolution in 2 Layer Linear Networks}\label{sec:two_layer_linear}

We will first study shallow linear networks trained with small initialization before providing analysis for deeper networks in Section \ref{sec:deep_linear}. We will focus our discussion in this section on the scalar output case but we will provide similar analysis in the multiple output channel case in a subsequent section.  We stress, though we have systematically tracked the error incurred at each step, we have focused on transparency over rigor in the following derivation. We demonstrate that our analytic solutions match empirical simulations in Appendix \ref{subsec:solns_to_full_training}.

We assume the $P$ data points $\bm x^\mu \in \mathbb{R}^{D}, \mu = 1, \dots, P$ of zero mean with correlation matrix $\bm\Sigma = \frac1P \sum_{\mu=1}^P \bm x^\mu {\bm x^\mu}^\top$. Further, we  assume that the target values are generated by a linear teacher function $y^\mu = s \bm { \beta}_T \cdot \bm x^{\mu}$ for a unit vector $\bm{ \beta}_T$. The scalar $s$ merely quantifies the size of the supervised learning signal: the variance of $|\bm y|^2 = s^2 \bm\beta^\top_T \bm\Sigma \bm \beta_T$. We define the two-layer linear neural network with $N$ hidden units as $f(\bm x) = \bm a^\top \bm W \bm x$. Concretely, we initialize the weights with standard parameterization $a_i \sim\mathcal{N}(0,\sigma^2/N), W_{ij} \sim\mathcal{N}(0,\sigma^2/D)$. Understanding the role of $\sigma$ in the dynamics will be crucial to our study. We analyze gradient flow dynamics on MSE cost $L = \frac{1}{2 P} \sum_{\mu} \left( f(\bm x^\mu) - y^\mu  \right)^2$.

Under gradient flow with learning rate $\eta = 1$, the weight matrices in each layer evolve as
\begin{align}
    \frac{d}{dt} \bm a = - \frac{\partial L}{\partial \bm a} = \bm W \bm \Sigma \left( s \bm\beta_T - \bm W^\top \bm a \right), \quad
    \frac{d}{dt} \bm W = - \frac{\partial L}{\partial \bm W} =  \bm a \left( s \bm \beta_T - \bm W^\top \bm a \right)^\top \bm \Sigma.
\end{align}
The NTK takes the following form throughout training.
\begin{align}\label{eq:kernel_evolution}
    K(\bm x, \bm x'; t) = \bm x^\top \bm W^\top  \bm W \bm x' + |\bm a|^2 \bm x^\top \bm x'.
\end{align}
Note that while the second term, a simple isotropic linear kernel, does not reflect the nature of the learning task, the first term $\bm x^\top \bm W^\top \bm W \bm x'$ can evolve to yield an anisotropic kernel that has learned a representation from the data.

\subsection{Phases of Training in Two Layer Linear Network}

We next show that there are essentially two phases of training when training a two-layer linear network from small initialization on whitened-input data.
\begin{itemize}[leftmargin=*]
    \item Phase I: An alignment phase which occurs for $t \sim \frac{1}{s}$. In this phase the weights align to their low rank structure and the kernel picks up a rank-one term of the form $\bm x^\top \bm \beta \bm \beta^\top \bm x'$. In this setting, since the network is initialized near $\bm W, \bm a = \bm 0$, which is a saddle point of the loss function, the gradient of the loss is small. Consequently, the magnitudes of the weights and kernel evolve slowly.
    \item Phase II: A data fitting phase which begins around $t \sim \frac{1}{s} \log(s  \sigma^{- 2} )$. In this phase, the system escapes the initial saddle point $\bm W, \bm a =  0$ and loss decreases to zero. In this setting both the kernel's overall scale and the scale of the function $f(\bm x,t)$ increase substantially.
\end{itemize}
If Phase I and Phase II are well separated in time, which can be guaranteed by making $\sigma$ small, then the final function solves a kernel interpolation problem for the NTK which is only sensitive to the geometry of gradients in the final basin of attraction. In fact, in the linear case, the kernel interpolation at every point along the gradient descent trajectory would give the final solution as we show in Appendix \ref{app:all_ntk_learn_same}. A visual summary of these phases is provided in Figure \ref{fig:phase_one_two_visual}.

\begin{figure}
    \centering
    \subfigure[ Initialization]{\includegraphics[width=0.23\linewidth]{figures/kernel_contour_init.pdf}}
    \subfigure[Phase 1]{\includegraphics[width=0.23\linewidth]{figures/kernel_contour_transition.pdf}}
    \subfigure[Phase 2]{\includegraphics[width=0.23\linewidth]{figures/kernel_contour_final.pdf}}
    \caption{The evolution of the kernel's eigenfunctions happens during the early alignment phase for $t_1 \approx \frac{1}{s}$, but significant evolution in the network predictions happens for $t > t_2 = \frac{1}{2}\log( s \sigma^{-2})$. (a) Contour plot of kernel's norm for linear functions $f(\bm x) = \bm\beta \cdot \bm x$. The black line represents the space of weights which interpolate the training set, ie $\bm X^\top \bm\beta = \bm y$. At initialization, the kernel is isotropic, resulting in spherically symmetric level sets of RKHS norm. The network function is represented as a blue dot. (b) During Phase I, the kernel's eigenfunctions have evolved, enhancing power in the direction of the min-norm interpolator, but the network function has not moved far from the origin. (c) In Phase II, the network function $\bm W^\top \bm a$ moves from the origin to the final solution.}
    \label{fig:phase_one_two_visual}
\end{figure}

\subsubsection{Phase I: Early Alignment for Small Initialization}

In this section we show how the kernel aligns to the correct eigenspace early in training.
We focus on the whitened setting, where the data matrix $\bm X$ has all of its nonzero singular values equal. We let $\bm\beta$ represent the normalized component of $\bm\beta_T$ in the span of the training data $\{ \bm x^\mu \}$. We will discuss general $\bm\Sigma$ in section \ref{sec:unwhite_two_layer}.  We approximate the dynamics early in training by recognizing that the network output is small due to the small initialization.  Early on, the dynamics are given by:
\begin{align}
    \frac{d}{dt} \bm  a = s \bm W \bm\beta + O(\sigma^3)  \ , \quad
    \frac{d}{dt} \bm  W =  s \bm a \bm \beta^\top + O(\sigma^3).
\end{align}
Truncating terms order $\sigma^3$ and higher, we can solve for the kernel's dynamics early on in training
\begin{align}\label{eq:approx_align}
    K(\bm x,\bm x';t) = q_0 \cosh(2\eta st) \ \bm x^\top \left[ \bm\beta \bm\beta^\top +  \bm I \right] \bm x' +  O(\sigma^2), \quad t \ll s^{-1} \log(s/\sigma^2).
\end{align}
where $q_0$ is an initialization dependent quantity, see Appendix \ref{app:two_layer_phase_one}. The bound on the error is obtained in Appendix \ref{sec:phase_one_error}. We see that the kernel picks up a rank one-correction $\bm\beta \bm\beta^\top$ which points in the direction of the task vector $\bm \beta$, indicating that the kernel evolves in a direction sensitive to the target function $y = s \bm\beta_T \cdot \bm x$. This term grows exponentially during the early stages of training, and overwhelms the original kernel $K_0$ with timescale $1/s$. Though the neural network has not yet achieved low loss in this phase, the alignment of the kernel and learned representation has consequences for the transfer ability of the network on correlated tasks as we show in Appendix \ref{app:transfer_theory}.

\subsubsection{Phase II: Spectral Learning}

We now assume that the weights have approached their low rank structure, as predicted from the previous analysis of Phase I dynamics, and study the subsequent NTK evolution. We will show that, under the assumption of whitening, the kernel only evolves in overall scale.

First, following \citep{fukumizu1998effect, arora_cohen_linear_acc,Du2018AlgorithmicRI}, we note the following conservation law $\frac{d}{dt} \left[ \bm a(t) \bm a(t)^\top - \bm W(t) \bm W(t)^\top \right] = 0$ which holds for all time. If we assume small initial weight variance $\sigma^2$, $\bm a \bm a^\top - \bm W \bm  W^\top = O(\sigma^2) \approx 0$ at initialization, and stays that way during the training due to the conservation law. This condition is surprisingly informative, since it indicates that $\bm W$ is rank-one up to $O(\sigma)$ corrections. From the analysis of the alignment phase, we also have that $\bm W^\top \bm W \propto \bm \beta \bm \beta^\top$. These two observations uniquely determine the rank one structure of $\bm W$ to be $\bm a \bm \beta^\top+O(\sigma)$. Thus, from \eqref{eq:kernel_evolution} it follows that in Phase II, the kernel evolution takes the form
\begin{align}
    K(\bm x,\bm x';t) = u(t)^2 \bm x^\top  \left[ \bm\beta \bm\beta^\top + \bm I \right] \bm x' + O(\sigma),
\end{align}
where $u(t)^2 = |\bm a|^2$. This demonstrates that the kernel only changes in overall scale during Phase II.

Once the weights are aligned with this scheme, we can get an expression for the evolution of $u(t)^2$ analytically, $u(t)^2 = s e^{2st} (e^{2st} - 1 + s / u_0^2)^{-1}$, using the results of \citep{fukumizu1998effect,Saxe14exactsolutions} as we discuss in \ref{subsec:phase2}. This is a sigmoidal curve which starts at $u_0^2$ and approaches $s$. The transition time where active learning begins occurs when $e^{st} \approx s/u_0^2 \implies t \approx s^{-1} \log( s/\sigma^2)$. This analysis demonstrates that the kernel only evolves in scale during this second phase in training from the small initial value $u_0^2 \sim O(\sigma^2)$ to its asymptote.

Hence, kernel evolution in this scenario is equivalent to the assumptions discussed in Section \ref{sec:silent_align_theory}, with $g(t) = u(t)^2$, showing that the final solution is well approximated by kernel regression with the final NTK. We stress that the timescale for the first phase $t_1 \sim 1/s$, where eigenvectors evolve, is independent of the scale of the initialization $\sigma^2$, whereas the second phase occurs around $t_2 \approx t_1 \log(s/\sigma^2)$. This separation of timescales $t_1 \ll t_2$ for small $\sigma$ guarantees the silent alignment effect.   We illustrate these learning curves and for varying $\sigma$ in Figure \ref{fig:two_layer_theory_expt}.

\subsection{Unwhitened data}\label{sec:unwhite_two_layer}
When data is unwhitened, the right singular vector of $\bm W$ aligns with $\bm\Sigma \bm \beta$ early in training, as we show in Appendix \ref{app:two_layer_unwhitened}. This happens since, early on, the dynamics for the first layer are $\frac{d}{dt} \bm W \sim \bm a(t) \bm\beta^\top \bm\Sigma$. Thus the early time kernel will have a rank-one spike in the $\bm \Sigma \bm \beta$ direction. However, this configuration is not stable as the network outputs grow. In fact, at late time $\bm W$ must realign to converge to $\bm W \propto \bm a \bm \beta^\top$ since the network function converges to the optimum and $f = \bm a^\top \bm W \bm x = s \bm\beta \cdot \bm x$, which is the minimum $\ell_2$ norm solution (Appendix \ref{app:inductive_deep_linear}). Thus, the final kernel will always look like $K_{\infty}(\bm x,\bm x') = s \bm x^\top \left[\bm \beta \bm\beta^\top +  \bm I \right] \bm x'$. However, since the realignment of $\bm W$'s singular vectors happens \textit{during the Phase II spectral learning}, the kernel is not constant up to overall scale, violating the conditions for silent alignment. We note that the learned function still is a kernel regression solution of the final NTK, which is a peculiarity of the linear network case, but this is not achieved through the silent alignment phenomenon as we explain in Appendix \ref{app:two_layer_unwhitened}.

\section{Extension to Deep Linear Networks}\label{sec:deep_linear}
We next consider scalar target functions approximated by deep linear neural networks and show that many of the insights from the two layer network carry over. The neural network function $f : \mathbb{R}^{D} \to \mathbb{R}$ takes the form $f(\bm x) = {\bm w^{L}}^\top \bm W^{L-1} ... \bm W^{1} \bm x$. The gradient flow dynamics under mean squared error (MSE) loss become
\begin{align}
    \frac{d}{dt} \bm W^{\ell} = - \eta \frac{\partial L}{\partial \bm W^{\ell}} = \eta \left( \prod_{\ell' > \ell} \bm W^{\ell'} \right)^{\top} \left( s \bm \beta - \bm{\tilde{w}} \right)^\top \bm \Sigma \left( \prod_{\ell' < \ell} \bm W^{\ell' } \right)^\top,
\end{align}
where $\bm{\tilde{w}} = \bm W^{1 \top} \bm W^{2 \top} ... \bm w^{L } \in \mathbb{R}^{D}$ is shorthand for the effective one-layer linear network weights.
Inspired by observations made in prior works \citep{fukumizu1998effect,arora_cohen_linear_acc, Du2018AlgorithmicRI}, we again note that the following set of conservation laws hold during the dynamics of gradient descent $\frac{d}{dt} \left[  \bm W^{\ell} \bm W^{\ell \top} -  \bm W^{\ell+1 \top} \bm W^{\ell + 1} \right] = 0$. This condition indicates a balance in the size of weight updates in adjacent layers and simplifies the analysis of linear networks. This balancing condition between weights of adjacent layers is not specific to MSE loss, but will also hold for any loss function, see Appendix \ref{app:other_loss_fns}. We will use this condition to characterize the NTK's evolution.

\subsection{NTK Under Small Initialization}\label{sec:small_init}
We now consider the effects of small initialization. When the initial weight variance $\sigma^2$ is sufficiently small, $\bm W^{\ell} \bm W^{\ell \top} - \bm W^{\ell+1 \top} \bm W^{\ell + 1} = O(\sigma^2 ) \approx 0$ at initialization.\footnote{Though we focus on neglecting the $O(\sigma^2)$ initial weight matrices in the main text, an approximate analysis for wide networks at finite $\sigma^2$ and large width is provided in Appendix \ref{app:refined_balance}, which reveals additional dependence on relative layer widths.}
This conservation law implies that these matrices remain approximately equal throughout training. Performing an SVD on each matrix and inductively using the above formula from the last layer to the first, we find that all matrices will be approximately rank-one $\bm w^{L} =  u(t) \bm r_{L}(t) \ , \ \bm W^{\ell} = u(t) \bm r_{\ell+1}(t) \bm r_{\ell}(t)^\top$, where $\bm r_{\ell}(t)$ are unit vectors. Using only this balancing condition and expanding to leading order in $\sigma$, we find that the NTK's dynamics look like
\begin{align}
    K(\bm x, \bm x', t) &=  u(t)^{2(L-1)} \bm x^\top \left[ (L-1) \bm r_1(t) \bm r_1(t)^\top +  \bm I \right] \bm x'  + O(\sigma).
\end{align}
We derive this formula in the Appendix \ref{app:ntk_formula_deep_linear}. We observe that the NTK consists of a rank-$1$ correction to the isotropic linear kernel $\bm x \cdot \bm x'$ with the rank-one spike pointing along the $\bm r_{1}(t)$ direction. This is true dynamically throughout training under the assumption of small $\sigma$. At convergence $\bm r(t) \to \bm\beta$, which is the unique fixed point reachable through gradient descent. We discuss evolution of $u(t)$ below. The alignment of the NTK with the direction $\bm\beta$ increases with depth $L$.

\subsubsection{Whitened Data vs Anisotropic Data}\label{sec:white_vs_unwhite}

We now argue that in the case where the input data is whitened, the trained network function is again a kernel machine that uses the final NTK. The unit vector $\bm r_1(t)$ quickly aligns to $\bm\beta$ since the first layer weight matrix evolves in the rank-one direction $\frac{d}{dt} \bm W^{1} = \bm v(t) \bm \beta^\top$ throughout training for a time dependent vector function $\bm v(t)$. As a consequence, early in training the top eigenvector of the NTK aligns to $\bm\beta$. Due to gradient descent dynamics,  $\bm W^{1 \top} \bm W^1$ grows only in the $\bm\beta \bm\beta^\top$ direction. Since the $\bm r_1$ quickly aligns to $\bm\beta$ due to $\bm W^1$ growing only along the $\bm\beta$ direction, then the global scalar function $c(t) = u(t)^L$ satisfies the dynamics $\dot{c}(t)= c(t)^{2-2/L} \left[ s- c(t) \right]$ in the whitened data case, which is consistent with the dynamics obtained when starting from the orthogonal initialization scheme of \citet{Saxe14exactsolutions}. We show in the Appendix \ref{app:deep_linear_dynamics_ct} that spectral learning occurs over a timescale on the order of $t_{1/2} \approx \frac{L}{s (L-2)} \sigma^{-L+2}$, where $t_{1/2}$ is the time required to reach half the value of the initial loss. We discuss this scaling in detail in Figure \ref{fig:time_to_align_learn_deep}, showing that although the timescale of alignment shares the same scaling with $\sigma$ for $L > 2$, empirically alignment in deep networks occurs faster than spectral learning. Hence, the silent alignment conditions of Section 2 are satisfied. In the case where the data is unwhitened, the $\bm r_1(t)$ vector aligns with $\bm\Sigma \bm \beta$ early in training. This happens since, early on, the dynamics for the first layer are $\frac{d}{dt} \bm W^1 \sim \bm v(t) \bm\beta^\top \bm\Sigma$ for time dependent vector $\bm v(t)$. However, for the same reasons we discussed in Section \ref{sec:unwhite_two_layer} the kernel must realign at late times, violating the conditions for silent alignment.

\begin{figure}
    \centering
    \subfigure[ODE Time to Learn]{\includegraphics[width=0.29\linewidth]{figures/deep_time_to_half_loss.pdf}}
    \subfigure[$L=3$ Dynamics]{\includegraphics[width=0.32\linewidth]{figures/depth_3_time_to_align.pdf}}
    \subfigure[Time To Learn $L=3$]{\includegraphics[width=0.32\linewidth]{figures/depth_3_learn_time_scaling.pdf}}
    \caption{Time scales are not strongly separated for deep networks ($L \geq 3$), but alignment is consistently achieved  before loss decreases. (a) Time to half loss scales in a power law with $\sigma$ for networks with $L \geq 3$: $t_{1/2} \sim \frac{L}{(L-2)} \sigma^{-L+2}$ (black dashed) is compared with numerically integrating the dynamics $\dot{c}(t) = c^{2-2/L}(s-c)$ (solid). The power law scaling of $t_{1/2}$ with $\sigma$ is qualitatively different than what happens for $L =2$, where we identified logarithmic scaling $t_{1/2} \sim \log(\sigma^{-2})$. (b) Linear networks with $D=30$ inputs and $N=50$ hidden units trained on synthetic whitened data with $|\bm\beta|=1$. We show for a $L=3$ linear network the cosine similarity of $\bm W^{1 \top} \bm W^1$ with $\bm \beta \bm \beta^\top$ (dashed) and the loss (solid) for different initialization scales. (c) The time to get to $1/2$ the initial loss and the time for the cosine similarity of $\bm W^{1\top} \bm W^1$ with $\bm \beta \bm\beta^\top$ to reach $1/2$ both scale as $\sigma^{-L+2}$, however one can see that alignment occurs before half loss is achieved.  }
    \label{fig:time_to_align_learn_deep}
\end{figure}

\subsection{Multiple Output Channels}

We next discuss the case where the network has multiple $C$ output channels. Each network output, we denote as $f_c(\bm x')$ resulting in $C^2$ kernel sub-blocks $K_{c,c'}(\bm x,\bm x') = \nabla f_c(\bm x) \cdot \nabla f_{c'}(\bm x')$. In this context, the balanced condition $\bm W^{\ell} \bm W^{\ell \top} \approx \bm W^{\ell +1 \top} \bm W^{\ell+1}$ implies that each of the weight matrices is rank-$C$, implying a rank-$C$ kernel. We give an explicit formula for this kernel in Appendix \ref{app:multi-class}. For concreteness, consider whitened input data $\bm\Sigma = \bm I$ and a teacher with weights $\bm\beta \in \mathbb{R}^{C \times D}$. The singular value decomposition of the teacher weights $\bm\beta = \sum_{\alpha} s_{\alpha} \bm z_{\alpha} \bm v_{\alpha}^\top$ determines the evolution of each mode \citep{Saxe14exactsolutions}. Each singular mode begins to be learned at $t_{\alpha} = \frac{1}{s_\alpha} \log\left( s_{\alpha} u_0^{-2} \right)$. To guarantee silent alignment, we need all of the Phase I time constants to be smaller than all of the Phase II time constants. In the case of a two layer network, this is equivalent to the condition $\frac{1}{s_{min}} \ll \frac{1}{s_{max}} \log\left( s_{max} u_0^{-2} \right)$ so that the kernel alignment timescales are well separated from the timescales of spectral learning. We see that alignment precedes learning in Figure \ref{fig:multi-class} (a). For deeper networks, as discussed in \ref{sec:white_vs_unwhite}, alignment scales in the same way as the time for learning.

\section{Silent Alignment on Real Data and ReLU nets}\label{sec:nonlinear_anisotropy}

In this section, we empirically demonstrate that many of the phenomena described in the previous sections carry over to the nonlinear homogenous networks with small initialization provided that the data is not highly anisotropic. A similar separation in timescales is expected in the nonlinear $L$-homogenous case since, early in training, the kernel evolves more quickly than the network predictions. This argument is based on a phenomenon discussed by  \citet{Chizat2019OnLT}. Consider an initial scaling of the parameters by $\sigma$. We find that the relative change in the loss compared to the relative change in the features has the form $\frac{|\frac{d}{dt} \nabla f| }{|\nabla f|} \frac{\mathcal L}{|\frac{d}{dt} \mathcal L|} \approx O(\sigma^{-L})$ which becomes very large for small initialization $\sigma$ as we show in Appendix \ref{app:laziness}. This indicates, that from small initialization, the parameter gradients and NTK evolve much more quickly than the loss. This is a necessary, but not sufficient condition for the silent alignment effect. To guarantee the silent alignment, the gradients must be finished evolving except for overall scale by the time the loss appreciably decreases. However, we showed that for whitened data that nonlinear ReLU networks do in fact enjoy the separation of timescales necessary for the silent alignment effect in Figure \ref{fig:relu_demo_silent_alignment}. In even more realistic settings, like ResNet in Figure \ref{fig:relu_demo_silent_alignment} (d), we also see signatures of the silent alignment effect since the kernel does not grow in magnitude until the alignment has stabilized.

We now explore how anisotropic data can interfere with silent alignment. We consider the partial whitening transformation: let the singular value decomposition of the data matrix be $\bm X = \bm U \bm S \bm V^\top$ and construct a new partially whitened dataset $\bm X_{\gamma} = \bm U \bm S^{\gamma} \bm V^\top$, where $\gamma \in (0,1)$. As $\gamma \to 0$ the dataset becomes closer to perfectly whitened. We compute loss and kernel aligment for depth 2 ReLU MLPs on a subset of CIFAR-10 and show results in Figure \ref{fig:cifar_anisotropy_partial_whiten}. As $\gamma \to 0$ the agreement between the final NTK and the learned neural network function becomes much closer, since the kernel alignment curve is stable after a smaller number of training steps. As the data becomes more anisotropic, the kernel's dynamics become less trivial at later time: rather than evolving only in scale, the alignment with the target function varies in a non-trivial way while the loss is decreasing. As a consequence, the NN function deviates from a kernel machine with the final NTK.

\begin{figure}[ht]
    \centering
    \subfigure[Input Spectra]{\includegraphics[width=0.3\linewidth]{figures/cifar_singularvals_vary_gamma.pdf}}
    \subfigure[Train Loss]{\includegraphics[width=0.3\linewidth]{figures/cifar_loss_vary_gamma.pdf}}
    \subfigure[Test Error]{\includegraphics[width=0.3\linewidth]{figures/cifar_test_loss_vary_gamma.pdf}}
    \subfigure[Kernel Norm]{\includegraphics[width=0.3\linewidth]{figures/cifar_kernel_norm_vary_gamma.pdf}}
    \subfigure[Phase I alignment]{\includegraphics[width=0.3\linewidth]{figures/cifar_kernel_alignment_vary_gamma.pdf}}
    \subfigure[Predictor Comparison]{\includegraphics[width=0.3\linewidth]{figures/cifar_estimation_NTK_vary_gamma.pdf}}
    \caption{Anisotropy in the data introduces multiple timescales which can interfere with the silent alignment effect in a ReLU network. Here we train an MLP to do two-class regression using Adam at learning rate $5\times 10^{-3}$. (a) We consider the partial whitening transformation on the 1000 CIFAR-10 images $\lambda_k \to \lambda_k^{\gamma}$ for $\gamma \in (0,1)$ for covariance eigenvalues $\bm\Sigma \bm v_k = \lambda_k \bm v_k$. (b) The loss dynamics for unwhitened data have a multitude of timescales rather than a single sigmoidal learning curve. As a consequence, kernel alignment does not happen all at once before the loss decreases and the final solution is not a kernel machine with the final NTK. (c) The test error on classification.  (d) Anisotropic data gives a slower evolution in the kernel's Frobenius norm. (e) The kernel alignment very rapidly approaches an asymptote for whitened data but exhibits a longer timescale for the anisotropic data. (f) The final NTK predictor gives a better predictor for the neural network when the data is whitened, but still substantially outperforms the initial kernel even in the anisotropic case.  }
    \label{fig:cifar_anisotropy_partial_whiten}
\end{figure}

\section{Conclusion}

We provided an example of a case where neural networks can learn a kernel regression solution while in the rich regime. Our silent alignment phenomenon requires a separation of timescales between the evolution of the NTK's eigenfunctions and relative eigenvalues and a separate phase where the NTK grows only in scale. We demonstrate that, if these conditions are satisfied, then the final neural network function satisfies a representer theorem for the final NTK. We show analytically that these assumptions are realized in linear neural networks with small initialization trained on approximately whitened data and observe that the results hold for nonlinear networks and networks with multiple outputs. We demonstrate that silent alignment is highly sensitive to anisotropy in the input data.

Our results demonstrate that representation learning is not necessarily at odds with the learned neural network function being a kernel regression solution; i.e. a superposition of a kernel function on the training data. While we provide one mechanism for a richly trained neural network to learn a kernel regression solution through the silent alignment effect, perhaps other temporal dynamics of the NTK could also give rise to the neural network learning a kernel machine for a data-dependent kernel. Further, by asking whether neural networks behave as kernel machine for some data-dependent kernel function, one can hopefully shed light on their generalization properties and transfer learning capabilities \citep{ bordelon_icml_learning_curve, Canatar2021SpectralBA,loureiro_lenka_feature_maps, GEIGER20211} and see Appendix \ref{app:transfer_theory}.

\subsubsection*{Acknowledgments}
CP acknowledges support from the Harvard Data Science Initiative. AA acknowledges support from an NDSEG Fellowship and a Hertz Fellowship. BB acknowledges the support of the NSF-Simons Center for Mathematical and Statistical Analysis of Biology at Harvard (award \#1764269) and the Harvard Q-Bio Initiative. We thank Jacob Zavatone-Veth and Abdul Canatar for helpful discussions and feedback.