Gradient Descent Maximizes the Margin of Homogeneous Neural Networks

Kaifeng Lyu, Jian Li

In deep learning, we often train models far beyond the point where they achieve 100% training accuracy. Surprisingly, this "overtraining" often leads to better generalization on test data. This phenomenon is attributed to the implicit bias of gradient descent (GD)—the algorithm's tendency to prefer certain types of solutions over others, even when many solutions could fit the data perfectly.

While it was already known that GD maximizes the margin for simple linear models (like logistic regression), it remained a mystery whether this property held for deep, non-linear neural networks. This paper bridges that gap by analyzing homogeneous neural networks, a broad class of models where scaling the weights by a factor $c$ scales the output by $c^L$ (where $L$ is the number of layers). The authors prove that GD implicitly maximizes the "margin" of these networks when minimizing logistic or cross-entropy loss, providing a theoretical link between long training times, increased margins, and improved model robustness.

Theoretical Foundations and Methods

The authors employ a rigorous mathematical analysis of both Gradient Flow (gradient descent with an infinitesimal step size) and discrete Gradient Descent. Key technical contributions include:

  • Smoothed Normalized Margin: They define a "smoothed" version of the margin that is mathematically easier to track, proving this margin is monotonically non-decreasing during training.
  • KKT Convergence: They demonstrate that the direction of the weight vector converges to a Karush-Kuhn-Tucker (KKT) point of a constrained optimization problem designed to maximize the margin.
  • Non-Smooth Analysis: Since ReLU activations are not differentiable at zero, the authors use Clarke’s subdifferential to ensure their proofs hold for modern, non-smooth architectures.
  • Loss-Based Learning Rate Scheduler: To validate their theory experimentally, they developed a heuristic scheduler that speeds up training by adjusting the learning rate based on the current loss, allowing them to observe margin growth that would otherwise take millions of epochs.

Key Insights and Results

The theoretical findings were validated using standard datasets like MNIST and CIFAR-10, focusing on Convolutional Neural Networks (CNNs) both with and without bias terms.

The "Aha" Moment on Margin Growth: Even after the training loss is effectively zero, the direction of the weights continues to refine itself. The "normalized margin" (the margin divided by the weight norm) keeps increasing, albeit slowly. The mathematical property of homogeneity allows the authors to decompose the gradient into "radial" (changing the weight norm) and "tangential" (changing the weight direction) components. They show that the tangential component is what drives the model toward a max-margin solution.

Comparison of training loss and normalized margin for constant vs. loss-based learning rates, with and without bias terms.

Experimental Confirmation: On MNIST, the authors showed that using their loss-based scheduler, the normalized margin increased significantly faster than with a constant learning rate. Furthermore, models trained longer (up to 10,000 epochs) showed a measurable increase in robust accuracy against $L_2$ perturbations on both training and test sets. This confirms the theoretical link between margin and robustness: training for longer isn't just about squeezing out a tiny bit more accuracy—it actually makes the model more resistant to small perturbations.

Convergence Rates: The authors derived tight asymptotic rates. For a network of order $L$, the loss decreases at a rate of $O(1/(t(\log t)^{2-2/L}))$, and the weight norm grows as $O((\log t)^{1/L})$.

Limitations and Future Work

While a significant step forward, the paper notes a few limitations:

  • Bias Terms: The core theory assumes the model is homogeneous, which requires removing bias terms. While experiments show that models with bias terms behave similarly (as seen in the figures), a rigorous proof for the non-homogeneous case remains an open challenge.
  • KKT vs. Global Optimum: The paper proves convergence to a KKT point, which is a "first-order" stationary point. In highly non-convex landscapes, this doesn't strictly guarantee a global maximum margin.
  • Generalization Gap: While the margin increases, the authors noted that test accuracy only changed slightly in their experiments, suggesting that the relationship between margin-based bounds and actual generalization error needs further investigation.

Summary updated

BibTeX
@inproceedings{lyu2020gradient,
  author = {Kaifeng Lyu and Jian Li},
  title = {{Gradient Descent Maximizes the Margin of Homogeneous Neural Networks}},
  booktitle = {International Conference on Learning Representations},
  year = {2020},
  url = {https://openreview.net/forum?id=8jr16MizXY},
}
Figure