Skip to main content
QUICK REVIEW

[Paper Review] Hessian based analysis of SGD for Deep Nets: Dynamics and Generalization

Xinyan Li, Qilong Gu|arXiv (Cornell University)|Jul 24, 2019
Stochastic Gradient Optimization TechniquesComputer Science76 references6 citations
TL;DR

This paper presents a Hessian-based analysis of stochastic gradient descent (SGD) in deep neural networks, linking optimization dynamics and generalization through second-order information. It introduces a scale-invariant generalization bound using a thresholded Hessian-based Gaussian posterior, showing that curvature and parameter shift from initialization jointly determine generalization, with empirical validation on MNIST and CIFAR-10 under varying label noise.

ABSTRACT

While stochastic gradient descent (SGD) and variants have been surprisingly successful for training deep nets, several aspects of the optimization dynamics and generalization are still not well understood. In this paper, we present new empirical observations and theoretical results on both the optimization dynamics and generalization behavior of SGD for deep nets based on the Hessian of the training loss and associated quantities. We consider three specific research questions: (1) what is the relationship between the Hessian of the loss and the second moment of stochastic gradients (SGs)? (2) how can we characterize the stochastic optimization dynamics of SGD with fixed and adaptive step sizes and diagonal pre-conditioning based on the first and second moments of SGs? and (3) how can we characterize a scale-invariant generalization bound of deep nets based on the Hessian of the loss, which by itself is not scale invariant? We shed light on these three questions using theoretical results supported by extensive empirical observations, with experiments on synthetic data, MNIST, and CIFAR-10, with different batch sizes, and with different difficulty levels by synthetically adding random labels.

Motivation & Objective

  • Understand the relationship between the Hessian of the training loss and the second moment of stochastic gradients (SGs) in deep networks.
  • Characterize the stochastic optimization dynamics of SGD with fixed and adaptive step sizes and diagonal preconditioning using martingale difference sequences.
  • Develop a scale-invariant generalization bound that remains unchanged under reparameterization, leveraging the Hessian at minima.
  • Investigate how generalization error correlates with loss curvature and parameter shift from initialization under varying data difficulty (e.g., random labels).

Proposed method

  • Use 10,000 independent SGD training runs to empirically characterize the full distribution of loss, gradient, and Hessian dynamics.
  • Analyze alignment between the top eigenspaces of the Hessian and the second moment of SGs to assess implicit use of second-order information.
  • Model SGD dynamics as a stochastic process using martingale difference sequences, deriving large deviation bounds and convergence rates.
  • Propose a PAC-Bayesian generalization bound using anisotropic Gaussian posterior with precision matrix derived from a thresholded Hessian.
  • Establish scale invariance of the KL divergence between posterior and prior by proving invariance under diagonal parameter reparameterization.
  • Define two scale-invariant terms: effective curvature (based on thresholded Hessian) and weighted Frobenius norm of parameter shift from initialization.

Experimental results

Research questions

  • RQ1How does the Hessian of the loss relate to the second moment of stochastic gradients in deep networks?
  • RQ2How can the stochastic dynamics of SGD with fixed and adaptive step sizes be theoretically characterized using martingale difference sequences?
  • RQ3Can a scale-invariant generalization bound be constructed using the Hessian of the loss, despite the Hessian’s lack of scale invariance?
  • RQ4How do the components of the generalization bound—curvature and parameter shift—change under increasing label noise or problem difficulty?

Key findings

  • The top eigenspaces of the Hessian and the second moment of stochastic gradients show persistent alignment across training iterations and datasets, indicating implicit use of second-order information by SGD.
  • Adaptive step sizes or diagonal preconditioning can transform SGD dynamics into a super-martingale, enabling theoretical convergence guarantees under suitable assumptions.
  • The proposed generalization bound is scale-invariant: the KL divergence between the posterior and prior remains unchanged under diagonal reparameterization of the network.
  • Under random label settings, both the effective curvature and the weighted Frobenius norm of parameter shift increase, correlating with higher generalization error.
  • Empirical results on MNIST and CIFAR-10 show that the generalization bound shifts to higher values as label noise increases from 0% to 15%, validating its predictive power.
  • The diagonal elements of the Hessian increase with label noise, indicating higher local curvature, which contributes to the first term in the generalization bound.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.