Tutorials › Statistical Learning (Graduate) › Spectral Dynamics Of Gradient Flow

Interpolation and Implicit Regularization · Tutorial 952 of 989

Spectral Dynamics Of Gradient Flow

Resolve least-squares gradient flow into independent spectral coordinates and calculate how the design spectrum controls each component’s evolution over time.

Advanced 12 min read

What You'll Learn

  • Express least-squares gradient flow in the left and right singular-vector bases of the design matrix.
  • Derive the exponential solution for each coefficient coordinate and fitted response component.
  • Relate singular values to eigenvalues and identify the time scale of each mode.
  • Track the effect of nonzero initialization and nullspace components.
  • Distinguish decay of fitted residuals from residual components that the design cannot represent.
  • Check spectral dynamics with explicit calculations for full-rank and rank-deficient designs.

Why the Spectrum Describes the Dynamics

Least-squares gradient flow changes a coefficient vector continuously in the direction that most rapidly decreases squared error. In the original coordinates, the coordinates are coupled: changing one coefficient can affect several fitted values, and the gradient in one coordinate can depend on all the others. The singular vectors of the design matrix separate this motion into independent modes. In each mode, the fitted component moves exponentially toward its least-squares target, and the rate is determined by a squared singular value, equivalently an eigenvalue of the design Gram matrix.

We use a fixed design matrix \(A\in\mathbb{R}^{n\times p}\), response vector \(y\in\mathbb{R}^n\), and coefficient vector \(\beta(t)\in\mathbb{R}^p\). The scaling of the loss matters: here it is \(1/(2n)\) times the sum of squared residuals. With this convention, the eigenvalue that determines a mode’s rate is the corresponding eigenvalue of \(A^\mathsf{T}A/n\), not of \(A^\mathsf{T}A\) without the factor \(1/n\).

Definition: Least-squares gradient flow for the loss \(L(\beta)=\|A\beta-y\|_2^2/(2n)\) is the solution of the differential equation \(\dot{\beta}(t)=-\nabla L(\beta(t))\), with specified initial value \(\beta(0)=\beta_0\). If \(A=U\Sigma V^\mathsf{T}\) has rank \(r\), write its positive singular values as \(s_1,\ldots,s_r\), and corresponding left and right singular vectors as \(u_1,\ldots,u_r\) and \(v_1,\ldots,v_r\). Define \(\lambda_j=s_j^2/n\) and \(a_j=u_j^\mathsf{T}y\). The \(\lambda_j\) are the positive eigenvalues of \(A^\mathsf{T}A/n\) on the row space of \(A\), and also of \(AA^\mathsf{T}/n\) on the column space of \(A\).

Coordinate-Wise Solution

The singular-vector coordinates of the coefficients are \(z_j(t)=v_j^\mathsf{T}\beta(t)\). The corresponding fitted-response coordinate is \(u_j^\mathsf{T}A\beta(t)=s_jz_j(t)\). To find their evolution, differentiate the loss:

$$ \nabla L(\beta)=\frac{1}{n}A^\mathsf{T}(A\beta-y), \qquad \dot{\beta}(t)=-\frac{1}{n}A^\mathsf{T}(A\beta(t)-y). $$

Taking the inner product of the gradient-flow equation with \(v_j\), and using \(Av_j=s_ju_j\) and \(A^\mathsf{T}u_j=s_jv_j\), gives a scalar differential equation for each \(j\le r\). Its solution also gives the fitted component directly.

Theorem: For each positive singular value \(s_j\), the coefficient coordinate and fitted-response coordinate satisfy
$$ \dot z_j(t)=-\lambda_j\left(z_j(t)-\frac{a_j}{s_j}\right), \qquad z_j(t)=e^{-\lambda_jt}z_j(0) +\left(1-e^{-\lambda_jt}\right)\frac{a_j}{s_j}, $$
$$ u_j^\mathsf{T}A\beta(t) =e^{-\lambda_jt}s_jz_j(0) +\left(1-e^{-\lambda_jt}\right)a_j. $$

To verify the solution, let \(z_j^\star=a_j/s_j\) and solve \(\dot z_j=-\lambda_j(z_j-z_j^\star)\). Multiplying by \(e^{\lambda_jt}\) yields \(\frac{d}{dt}[e^{\lambda_jt}(z_j-z_j^\star)]=0\). Therefore \(e^{\lambda_jt}(z_j(t)-z_j^\star)=z_j(0)-z_j^\star\), which rearranges to the stated expression. Multiplication by \(s_j\) gives the fitted-response formula.

Thus each fitted component is an exponential blend of its initial value and its least-squares target. The time constant is \(1/\lambda_j=n/s_j^2\): a large eigenvalue means rapid adjustment, while a small positive eigenvalue means slow adjustment. If \(v_k\) is in the nullspace of \(A\), then \(Av_k=0\) and \(v_k^\mathsf{T}\dot\beta(t)=0\). Those coefficient coordinates remain at their initial values. They affect the coefficient vector but not the fitted response.

Worked Example: Two Independent Modes

Let \(n=p=2\), \(A=\begin{pmatrix}2&0\\0&1\end{pmatrix}\), \(y=(2,3)^\mathsf{T}\), and \(\beta(0)=0\). The singular vectors are the coordinate vectors, with singular values \(s_1=2\) and \(s_2=1\). The rates are \(\lambda_1=2^2/2=2\) and \(\lambda_2=1^2/2=1/2\). The response coordinates are \(a_1=2\) and \(a_2=3\); hence the coefficient targets are \(a_1/s_1=1\) and \(a_2/s_2=3\).

The coordinate-wise solutions are \(\beta_1(t)=1-e^{-2t}\) and \(\beta_2(t)=3(1-e^{-t/2})\). Multiplying by the respective singular values gives fitted components \(2(1-e^{-2t})\) and \(3(1-e^{-t/2})\), which tend to 2 and 3. The first fitted component reaches half its target when \(e^{-2t}=1/2\), or \(t=(\log 2)/2\). The second reaches half its target when \(e^{-t/2}=1/2\), or \(t=2\log 2\). The first mode is four times as fast because its rate \(2\) is four times \(1/2\).

Fitted Residuals and the Best Possible Fit

The full fitted vector has an especially useful form. Let \(P_A\) denote orthogonal projection onto the column space of \(A\). Within that space, the vectors \(u_1,\ldots,u_r\) form an orthonormal basis, so \(P_Ay=\sum_{j=1}^r a_ju_j\). The part of \(y\) orthogonal to that space cannot be produced by any coefficient vector.

Theorem: For any initial value \(\beta_0\), the residual and loss along gradient flow are
$$ A\beta(t)-y = -\sum_{j=1}^r e^{-\lambda_jt} \left(a_j-s_jz_j(0)\right)u_j -(I-P_A)y, $$
$$ L(\beta(t)) = \frac{1}{2n}\left[ \sum_{j=1}^r e^{-2\lambda_jt} \left(a_j-s_jz_j(0)\right)^2 +\|(I-P_A)y\|_2^2 \right]. $$

For the residual identity, subtract \(y\) from the fitted-response expansion and decompose \(y=P_Ay+(I-P_A)y\). In mode \(j\), the fitted coordinate minus the response coordinate equals \[ e^{-\lambda_jt}s_jz_j(0)+(1-e^{-\lambda_jt})a_j-a_j =-e^{-\lambda_jt}(a_j-s_jz_j(0)). \] The orthogonal component of the residual is always \(-(I-P_A)y\), since every fitted vector \(A\beta(t)\) lies in the column space of \(A\). Squaring the norm adds the squared coordinates of these mutually orthogonal components, giving the loss identity.

This identity proves that the loss decreases to \(\|(I-P_A)y\|_2^2/(2n)\), the least-squares loss. It also shows why convergence need not mean exact interpolation: exact fit is possible precisely when \(y\) lies in the column space of \(A\). Each representable residual mode decays at its own exponential rate; the unrepresentable component does not decay.

Worked Example: A Rank-Deficient Design and Initialization

Take \(A=\begin{pmatrix}1&0&1\\0&2&0\end{pmatrix}\), \(n=2\), and \(y=(4,2)^\mathsf{T}\). The two nonzero right singular vectors are \(v_1=(1,0,1)^\mathsf{T}/\sqrt2\) and \(v_2=(0,1,0)^\mathsf{T}\), with singular values \(\sqrt2\) and \(2\). Their left singular vectors are \(u_1=(1,0)^\mathsf{T}\) and \(u_2=(0,1)^\mathsf{T}\). Consequently, \(a_1=4\), \(a_2=2\), and the rates are \(\lambda_1=2/2=1\) and \(\lambda_2=4/2=2\).

Set \(\beta(0)=(2,0,0)^\mathsf{T}\). Then \(z_1(0)=v_1^\mathsf{T}\beta(0)=\sqrt2\), \(z_2(0)=0\), and the nullspace direction \(v_0=(1,0,-1)^\mathsf{T}/\sqrt2\) has initial coordinate \(v_0^\mathsf{T}\beta(0)=\sqrt2\). The first coefficient target is \(a_1/s_1=2\sqrt2\), and the second is \(a_2/s_2=1\). Thus

$$ z_1(t)=2\sqrt2-\sqrt2e^{-t}, \qquad z_2(t)=1-e^{-2t}, \qquad z_0(t)=\sqrt2. $$

The fitted response is \((4-2e^{-t},\,2-2e^{-2t})^\mathsf{T}\). At the limit, the coefficient vector is \(2\sqrt2v_1+v_2+\sqrt2v_0=(3,1,1)^\mathsf{T}\), and applying \(A\) gives \((4,2)^\mathsf{T}=y\). The nullspace coordinate remained fixed; it is why the limiting coefficient vector retains a component from the initialization, even though it does not alter the fit.

Reading the Spectral Formula

The spectral solution supports several useful conclusions directly from the equations.

  • Rates are determined by squared singular values. For the chosen loss normalization, the rate is \(s_j^2/n\). Describing a mode’s rate using \(s_j\) alone misses the square and the factor \(1/n\).
  • Initialization affects the amplitude, not the rate. The initial fitted component determines \(a_j-s_jz_j(0)\), the amount of residual in that mode at time zero. Its subsequent decay rate remains \(\lambda_j\).
  • Nullspace motion is absent from the fit. A coefficient coordinate in the nullspace is constant under this gradient flow because the gradient has no component there.
  • Nonzero initialization can change an individual component’s direction of travel. If its initial fitted coordinate lies above its target, that coordinate decreases toward the target; if it lies below, it increases. In both cases its difference from the target decays exponentially.

The same rates can be seen in the prediction-space differential equation. Setting \(r(t)=A\beta(t)-y\), differentiation gives \(\dot r(t)=-AA^\mathsf{T}r(t)/n\). On the column space of \(A\), the eigenvectors are \(u_j\) and the associated eigenvalues are \(s_j^2/n\). On its orthogonal complement, \(AA^\mathsf{T}\) is zero, which accounts for the fixed residual \(-(I-P_A)y\).

Worked Example: An Unrepresentable Response Component

Let \(A=\begin{pmatrix}2&0\\0&1\\0&0\end{pmatrix}\), \(n=3\), \(y=(2,1,5)^\mathsf{T}\), and \(\beta(0)=0\). The two singular values are 2 and 1, giving rates \(4/3\) and \(1/3\). The first two response coordinates are 2 and 1; the third response coordinate is orthogonal to the column space of \(A\). Therefore the residual is \((2e^{-4t/3},\,e^{-t/3},\,5)^\mathsf{T}\).

At \(t=3\log 2\), the exponential factors are \(e^{-4t/3}=e^{-4\log 2}=1/16\) and \(e^{-t/3}=e^{-\log 2}=1/2\). The residual is therefore \((1/8,\,1/2,\,5)^\mathsf{T}\), and the loss is \[ \frac{(1/8)^2+(1/2)^2+5^2}{6} =\frac{1/64+1/4+25}{6} =\frac{1617}{384}. \] As time tends to infinity, the first two residual coordinates vanish but the third remains 5. The limiting loss is \(25/6\), not zero, because no coefficient vector can produce a nonzero third fitted coordinate.

Common Pitfall

A frequent error is to say that a singular value \(s_j\) is the rate of its mode, or that a mode with a small singular value converges faster because it has a smaller target coefficient \(a_j/s_j\). Neither claim follows. The differential equation is \(\dot z_j=-(s_j^2/n)(z_j-a_j/s_j)\): the target depends on \(1/s_j\), but the speed of approach is set by \(s_j^2/n\). The exponential factor is \(e^{-s_j^2t/n}\), so a smaller positive singular value gives slower decay of the residual in that mode. The target’s size and the rate are distinct features of the formula.

Key takeaway: In the design singular-vector basis, least-squares gradient flow separates into independent exponential modes. Each representable fitted component approaches its target at rate \(s_j^2/n\); components orthogonal to the design column space remain unfitted, and coefficient nullspace coordinates remain at their initial values.

Check Your Understanding

Use the coordinate-wise solution to answer the following questions.

  1. For the loss \(\|A\beta-y\|_2^2/(2n)\), what is the rate associated with a positive singular value \(s_j\)?
  2. If the initial fitted coordinate in a mode equals \(a_j\), what happens to that mode throughout gradient flow?
  3. Why can the residual have a nonzero limit even when gradient flow has converged?
  4. In a rank-deficient design, which part of the coefficient vector is unchanged by the flow, and why?
  5. If one positive singular value is halved while \(n\) stays fixed, how does the corresponding mode’s rate change?
Clinical Biostats