Tutorials › Statistical Learning (Graduate) › Stochastic Gradient Descent And Interpolating Solutions

Interpolation and Implicit Regularization · Tutorial 956 of 989

Stochastic Gradient Descent And Interpolating Solutions

See why full-batch and stochastic gradient descent can select the same interpolator while following different paths, and derive a step-size condition that ensures SGD convergence.

Advanced 11 min read

What You'll Learn

  • Define the full-batch and single-example stochastic gradients for squared loss
  • Derive the sampling variance away from an interpolating solution
  • Explain why stochastic-gradient noise vanishes at exact interpolation
  • Prove mean-square convergence of SGD under a sufficient step-size bound
  • Relate initialization and update directions to the interpolator SGD can select

Why the Optimization Path Matters

When there are more coefficients than observations, a linear model can fit the observed responses exactly in many different ways. The training loss alone does not identify which interpolating coefficient vector an algorithm will return. The update rule, step size, sampling scheme, and initialization all matter to the path; together, they determine what can be selected when the algorithm converges.

For a consistent underdetermined linear problem, full-batch gradient descent and single-example stochastic gradient descent have a useful common feature: when initialized at zero, their updates stay in the row space of the design matrix. If they converge to an interpolator, that row-space constraint makes the limit the minimum-Euclidean-norm interpolator. But their paths are different. Stochastic updates fluctuate away from a solution, and a step size that is too large can prevent convergence.

Setup: A Consistent Underdetermined Problem

Let \(X\) be an \(n\times p\) design matrix with rows \(x_i^\top\), where \(p>n\), and let \(y\in\mathbb{R}^n\). Assume \(X\) has full row rank and the responses are exactly consistent with the linear model: there is at least one \(\theta\in\mathbb{R}^p\) such that \(X\theta=y\). Full row rank ensures that every \(y\in\mathbb{R}^n\) is in the range of \(X\), so consistency is automatic under this assumption.

Definition: The full-batch squared loss is \(F(\theta)=\frac{1}{2n}\sum_{i=1}^n(x_i^\top\theta-y_i)^2\). The single-example loss is \(f_i(\theta)=\frac12(x_i^\top\theta-y_i)^2\). A vector \(\theta\) is an interpolator if \(X\theta=y\), equivalently \(f_i(\theta)=0\) for every \(i\). The minimum-norm interpolator is the interpolator with smallest Euclidean norm.

Write \(H=X^\top X/n\), and let \(\mathcal{R}\) be the row space of \(X\), with \(\mathcal{N}\) its null space. Since \(p>n\) and \(X\) has full row rank, \(\mathcal{N}\) has positive dimension. The minimum-norm interpolator, denoted \(\theta^\dagger\), lies in \(\mathcal{R}\); every other interpolator is of the form \(\theta^\dagger+v\) for some \(v\in\mathcal{N}\). Define \(\mu>0\) and \(L>0\) as the smallest and largest positive eigenvalues of \(H\), respectively, and set \(R^2=\max_i\|x_i\|^2\).

Worked Example: The Interpolating Set and Its Minimum-Norm Member

Take \(n=2\), \(p=3\), \(x_1=(1,0,0)^\top\), \(x_2=(1,1,0)^\top\), and \(y=(1,2)^\top\). The interpolation equations are \(\theta_1=1\) and \(\theta_1+\theta_2=2\). Thus every interpolator is \((1,1,c)^\top\) for an arbitrary real number \(c\).

Its squared norm is \(1^2+1^2+c^2=2+c^2\), which is minimized at \(c=0\). Therefore \(\theta^\dagger=(1,1,0)^\top\). The null space is spanned by \((0,0,1)^\top\), while both data vectors have zero third coordinate.

The row norms are \(\|x_1\|^2=1\) and \(\|x_2\|^2=1^2+1^2=2\), so \(R^2=2\). This value will give the sufficient SGD step-size condition \(\eta<2/R^2=1\), not \(\eta<2\).

Full-Batch and Stochastic Updates

Full-batch gradient descent uses every observation at each step:

$$ \nabla F(\theta)=H\theta-\frac{1}{n}X^\top y,\qquad \theta_{t+1}=\theta_t-\eta\nabla F(\theta_t). $$

For \(0<\eta<2/L\), the positive-eigenvalue components of the error contract, while the null-space component is unchanged. In particular, starting from zero gives a limit in \(\mathcal{R}\); if that limit interpolates, it must be \(\theta^\dagger\). This is the deterministic gradient-descent selection property.

Single-example SGD samples an index \(i_t\) uniformly from \(\{1,\ldots,n\}\), independently at each iteration, and updates

$$ \theta_{t+1}=\theta_t-\eta_t\nabla f_{i_t}(\theta_t) =\theta_t-\eta_t x_{i_t}(x_{i_t}^\top\theta_t-y_{i_t}). $$

Conditional on the current iterate, the stochastic gradient is unbiased: \(E[\nabla f_{i_t}(\theta_t)\mid\theta_t]=\nabla F(\theta_t)\). Unbiasedness does not mean each realized update equals the full-batch update. The sampled gradient can point in a different direction, so the path can depend strongly on which observations are drawn and in what order.

Worked Example: Sampling Variance Away from Interpolation

Use the design and responses from the previous example, and evaluate the stochastic gradient at \(\theta=0\). For observation 1, \(\nabla f_1(0)=-y_1x_1=(-1,0,0)^\top\). For observation 2, \(\nabla f_2(0)=-y_2x_2=(-2,-2,0)^\top\). Each has probability \(1/2\).

The mean stochastic gradient is \((-3/2,-1,0)^\top\). To calculate its covariance, the average outer product of the two gradients is \[ \frac12 \begin{pmatrix}1&0&0\\0&0&0\\0&0&0\end{pmatrix} +\frac12 \begin{pmatrix}4&4&0\\4&4&0\\0&0&0\end{pmatrix} = \begin{pmatrix}5/2&2&0\\2&2&0\\0&0&0\end{pmatrix}. \] The outer product of their mean is \[ \begin{pmatrix}9/4&3/2&0\\3/2&1&0\\0&0&0\end{pmatrix}. \] Subtracting gives the covariance matrix \[ \begin{pmatrix}1/4&1/2&0\\1/2&1&0\\0&0&0\end{pmatrix}. \] Thus the stochastic gradient has nonzero sampling variance at this iterate, even though its expectation is the full-batch gradient.

Why Sampling Noise Disappears at an Interpolator

The stochastic gradient can be written as the observation-specific residual multiplied by the corresponding data vector. At any interpolator, every residual is zero. Consequently, every observation-specific gradient is zero—not merely their average. This is different from a problem whose optimum has nonzero residuals, where individual stochastic gradients may remain random at the optimum.

Result: If \(\theta\) interpolates the data, then \(\nabla f_i(\theta)=0\) for every \(i\), and hence the conditional covariance of the sampled gradient is zero at \(\theta\). Away from interpolation, that covariance need not be zero.

Worked Example: Zero Gradient Noise at the Solution

For the example with \(\theta^\dagger=(1,1,0)^\top\), observation 1 has fitted value \(x_1^\top\theta^\dagger=1\), and observation 2 has fitted value \(x_2^\top\theta^\dagger=1+1=2\). These match \(y_1=1\) and \(y_2=2\).

Therefore \(\nabla f_1(\theta^\dagger)=x_1(1-1)=0\) and \(\nabla f_2(\theta^\dagger)=x_2(2-2)=0\). A sampled update at this point is zero whichever observation is selected. In particular, the nonzero covariance calculated at \(\theta=0\) does not persist at the interpolator.

A Step-Size Bound for Mean-Square Convergence

The vanishing of noise at a solution is helpful, but it does not ensure that arbitrary step sizes reach one. The following result gives a sufficient fixed-step condition. Its assumptions make the sampling scheme and the space in which convergence is claimed explicit.

Theorem: Suppose \(X\) has full row rank, the problem is consistent, and at every iteration an observation is sampled independently and uniformly with replacement. Let \(\theta^\dagger\) be the minimum-norm interpolator. If the initial iterate is in \(\mathcal{R}\) and \(0<\eta<2/R^2\), then constant-step-size SGD satisfies \[ E\|\theta_t-\theta^\dagger\|^2 \leq \left[1-\mu(2\eta-\eta^2R^2)\right]^t \|\theta_0-\theta^\dagger\|^2. \] The factor in brackets is strictly less than one and nonnegative, so SGD converges to \(\theta^\dagger\) in mean square, and therefore in probability.

Proof. Every update is a multiple of \(x_{i_t}\), which belongs to \(\mathcal{R}\). Thus an iterate initialized in \(\mathcal{R}\) remains there. Let \(e_t=\theta_t-\theta^\dagger\). Since \(X\theta^\dagger=y\), the residual for observation \(i\) at \(\theta_t\) is \(x_i^\top e_t\), and the update gives \[ e_{t+1}=e_t-\eta x_{i_t}x_{i_t}^\top e_t. \] Conditioning on \(e_t\), expanding the squared norm, and using uniform sampling yields

$$ E[\|e_{t+1}\|^2\mid e_t] =\|e_t\|^2-2\eta e_t^\top H e_t +\eta^2\frac1n\sum_{i=1}^n(x_i^\top e_t)^2\|x_i\|^2. $$

Since \(\|x_i\|^2\leq R^2\), the final term is at most \(\eta^2R^2 e_t^\top H e_t\). Hence

$$ E[\|e_{t+1}\|^2\mid e_t] \leq \|e_t\|^2-(2\eta-\eta^2R^2)e_t^\top H e_t. $$

For \(e_t\in\mathcal{R}\), the positive eigenvalues of \(H\) are at least \(\mu\), so \(e_t^\top H e_t\geq\mu\|e_t\|^2\). The step-size condition makes \(2\eta-\eta^2R^2>0\), giving the one-step bound with factor \(q=1-\mu(2\eta-\eta^2R^2)\). Also \(\mu\leq R^2\), because the largest eigenvalue of \(H\) is at most \(\operatorname{tr}(H)=n^{-1}\sum_i\|x_i\|^2\leq R^2\). The function \(2\eta-\eta^2R^2\) is at most \(1/R^2\), so \(q\geq 1-\mu/R^2\geq0\); and \(q<1\). Taking expectations and iterating the one-step inequality proves the displayed bound. Its right side tends to zero, establishing mean-square convergence. \(\square\)

The theorem gives a sufficient bound, not a necessary one: some datasets and sampling schedules may converge with larger steps. It also describes convergence only when the iterate starts in the row space. If \(\theta_0\) has a null-space component, every update leaves that component unchanged, because \(x_i^\top v=0\) for \(v\in\mathcal{N}\). Under the theorem's other conditions, the corresponding limit is \(\theta^\dagger+P_{\mathcal{N}}\theta_0\), where \(P_{\mathcal{N}}\) is orthogonal projection onto \(\mathcal{N}\). In particular, zero initialization removes this dependence.

Worked Example: Checking Stability for a Particular Observation

In the running example, the largest squared row norm is \(R^2=2\). The theorem's sufficient condition is therefore \(\eta<2/2=1\). Choose \(\eta=0.75\), which satisfies the condition. If observation 2 is sampled, its residual \(r_2=x_2^\top\theta-y_2\) changes after the update to \[ r_2'=x_2^\top(\theta-\eta x_2r_2)-y_2 =(1-\eta\|x_2\|^2)r_2 =(1-0.75\cdot2)r_2=-0.5r_2. \] The residual changes sign but its magnitude is halved in this particular update.

Now choose \(\eta=1.2\). This violates the sufficient bound because \(1.2\) is not less than \(1\). For the same observation, the residual multiplier is \(1-1.2\cdot2=-1.4\), so a repeated update using observation 2 increases the magnitude of that residual by a factor of \(1.4\). This calculation shows why a step-size bound based on the largest row norm matters; it does not claim that every random sampling sequence with this step size must diverge.

What the Algorithms Select—and What They Do Not

Under the theorem's assumptions, SGD does not select a different row-space interpolator from full-batch gradient descent: there is only one interpolator in the row space, namely \(\theta^\dagger\). Sampling changes the route to that solution and the rate or stability of progress, rather than the limit, when convergence holds and initialization is zero. The updates can still vary substantially across runs because their sampled directions differ.

The null-space component is a separate source of solution dependence. No data-gradient update can change it. Thus a nonzero initialization can leave a null-space component in the final interpolator even if the row-space part converges perfectly. This distinction is useful: stochastic sampling variability and initialization-dependent null-space variation are not the same phenomenon.

Common Pitfall

  • Wrong reasoning: “SGD has sampling noise, so its gradient must keep fluctuating even after it reaches an interpolator.”
  • Correction: For exact interpolation under squared loss, each individual residual is zero, so every individual gradient is zero. Sampling creates gradient variance away from the solution, but not at it.
  • Another mistake: Treating \(2/R^2\) as \(2\) when \(R^2=2\). The bound is \(2/2=1\), and the sufficient condition is strict: \(\eta<1\).
  • Overstating the result: The bound is sufficient, not necessary; violating it means the theorem no longer guarantees convergence, not that every trajectory must diverge.
Key takeaway: With consistent squared loss, uniform single-example SGD has zero gradient noise at any interpolator. From zero initialization, its updates stay in the row space, and a sufficiently small step ensures convergence to the same minimum-norm interpolator as full-batch gradient descent. Sampling affects the path; null-space initialization affects which interpolator can be reached.

Check Your Understanding

Answer each question using the assumptions and notation defined above.

  1. Why does zero initialization ensure that both full-batch and single-example updates remain in the row space of \(X\)?
  2. At an interpolator, what are the individual stochastic gradients, and what does that imply about their sampling covariance?
  3. For \(R^2=5\), what strict step-size condition does the theorem require?
  4. Why can a null-space component in the initial parameter vector remain in the final solution?
  5. Does violating the sufficient step-size bound prove that SGD diverges? Explain the distinction.
Clinical Biostats