Logit Attenuating Weight Normalization

Aman Gupta, Rohan Ramanath, Jun Shi, Anika Ramachandran, Sirou Zhu, Mingzhou Zhou, Sathiya KeerthiICLR 2021

Abstract

Over-parameterized deep networks trained using gradient-based optimizers are a popular choice for solving classification and ranking problems. Without appropriately tuned $\ell_2$ regularization or weight decay, such networks have the tendency to make output scores (logits) and network weights large, causing training loss to become too small and the network to lose its adaptivity (ability to move around) in the parameter space. Although regularization is typically understood from an overfitting perspective, we highlight its role in making the network more adaptive and enabling it to escape more easily from weights that generalize poorly. To provide such a capability, we propose a method called Logit Attenuating Weight Normalization (LAWN), that can be stacked onto any gradient-based optimizer. LAWN controls the logits by constraining the weight norms of layers in the final homogeneous sub-network. Empirically, we show that the resulting LAWN variant of the optimizer makes a deep network more adaptive to finding minimas with superior generalization performance on large-scale image classification and recommender systems. While LAWN is particularly impressive in improving Adam, it greatly improves all optimizers when used with large batch sizes.

Introduction: The Problem of Loss Flattening

In modern deep learning, over-parameterized models—those with significantly more parameters than training samples—are the norm. When trained with standard losses like cross-entropy, these models tend to push their output scores (logits) toward infinity to minimize training loss. While this drives the loss toward zero, it induces a phenomenon known as loss flattening.

As logits grow, the gradients and the Hessian (curvature) of the loss surface vanish. This leads to a loss of adaptivity: the model becomes "stuck" in its current parameter region. If this region is a sharp minimum with poor generalization, the optimizer lacks the necessary noise or gradient signal to escape. This issue is exacerbated when using large batch sizes, which naturally provide less exploratory stochastic noise.

Methodology: Logit Attenuating Weight Normalization (LAWN)

To restore adaptivity, we propose LAWN, a two-phase training strategy that can be integrated with any standard optimizer (e.g., SGD, Adam, LAMB).

  1. Phase 1 (Free Training): The model undergoes standard training for a specified number of epochs ($E_{free}$), allowing it to establish a general direction in the parameter space.
  2. Phase 2 (Constrained Training): At epoch $E_{free}$, the Euclidean norms of the weights for each layer in the "final homogeneous sub-network" (layers where scaling weights directly scales output, such as Linear or ReLU layers) are calculated and subsequently fixed.

During Phase 2, the optimizer is restricted to moving weights along the surface of a hypersphere, changing their direction but not their magnitude. This is implemented via projected gradients: the standard gradient is projected onto the tangent plane of the weight-norm sphere, followed by a re-normalization step. By capping weight growth, LAWN prevents logits from exploding, ensuring the loss surface remains curved and the optimizer remains active.

Figure 1: Training dynamics showing the transition to LAWN at the dotted line. The constraints on weight norms lead to a recovery in performance and margin, preventing the loss from flattening.

Experimental Evaluation

We evaluated LAWN across diverse tasks including image classification (CIFAR-10/100, ImageNet) and recommendation systems (MovieLens, Pinterest).

Closing the "Adam Gap"

A significant finding is LAWN's ability to close the performance gap between adaptive optimizers like Adam and standard SGD in vision tasks. On ImageNet, standard Adam typically struggles, achieving ~71% accuracy. With LAWN (Adam-L), performance jumps to 76.18%, matching or exceeding state-of-the-art results.

Robustness to Large Batch Sizes

Typically, increasing batch sizes leads to a drop in generalization performance. LAWN makes this degradation significantly more "graceful." As shown in our experiments, Adam-LAWN maintains stable performance even as batch sizes scale up to 10k or more, whereas standard Adam's performance degrades sharply.

Figure 4: Test performance across various datasets (CIFAR-10, CIFAR-100, MovieLens-1M, ImageNet) as a function of batch size. Adam-LAWN (red) demonstrates superior stability and generalization compared to vanilla Adam (blue) as batch size increases.

Key Results and Insights

  • ImageNet: LAWN variants of SGD, Adam, and LAMB consistently outperformed their base versions. Most notably, Adam-L reached 76.18% accuracy compared to 71.16% for standard Adam.
  • Recommendation Systems: On the Pinterest dataset (10k batch size), Adam-L achieved a Hit Ratio@10 of 86.61%, surpassing standard Adam (85.97%).
  • Implicit Bias: LAWN effectively forces the model to maximize the "margin" (the gap between the correct class score and others), which is a known driver for better generalization.

Conclusion

LAWN provides a simple yet effective mechanism to maintain optimizer adaptivity in over-parameterized networks. By preventing weight explosion and loss flattening, it enables models to find flatter, better-generalizing minima, particularly in large-batch settings and for adaptive optimizers in computer vision.

Summary updated

BibTeX
@inproceedings{gupta2021logit,
  author = {Aman Gupta and Rohan Ramanath and Jun Shi and Anika Ramachandran and Sirou Zhu and Mingzhou Zhou and Sathiya Keerthi},
  title = {{Logit Attenuating Weight Normalization}},
  booktitle = {International Conference on Learning Representations},
  year = {2021},
  url = {https://openreview.net/forum?id=DFuurT3g-BY},
}
Figure