Abstract
Gradient Centralization (GC) is a simple yet effective optimization technique for Deep Neural Networks (DNNs). By centralizing gradient vectors to have zero mean, GC operates directly on the gradients rather than weights or activations. This paper demonstrates that GC can be implemented with a single line of code and integrated into existing optimizers like SGD and Adam. Theoretical analysis reveals that GC acts as a projected gradient descent method, smoothing the optimization landscape and regularizing the weight space. Extensive experiments across various computer vision tasks, including image classification and object detection, show that GC consistently accelerates training and improves generalization performance.
Introduction
Optimization is the heartbeat of deep learning. While we’ve seen massive success with techniques like Batch Normalization (BN) and Weight Standardization (WS), most of these methods focus on normalizing activations or weights. Researchers from The Hong Kong Polytechnic University and Alibaba’s DAMO Academy propose a different path: Gradient Centralization (GC). By operating directly on the gradients, GC offers a remarkably simple way to make training faster, more stable, and more accurate.
The Gradient Centralization Mechanism
The core idea of Gradient Centralization is elegantly simple: for any weight vector, you calculate the mean of its gradient and subtract that mean from the gradient vector. This ensures the gradient has a zero mean.
In practice, this looks like a simple projection operation. If $\nabla_w \mathcal{L}$ is your gradient, GC transforms it into a "centralized" version before the optimizer uses it to update the weights. GC isn't a new optimizer; it's a plugin. You can embed it into Stochastic Gradient Descent with Momentum (SGDM) or Adam. As shown in the figure above, for a fully-connected layer, the mean is calculated across columns, while for a convolutional layer, it is calculated across slices.
Theoretical Insights: GC as Projected Gradient Descent
The authors show that GC can be viewed as a projected gradient descent method. By centralizing the gradient, you are effectively optimizing the loss function under a specific constraint on the weight space. Specifically, the gradient is projected onto a hyperplane where the sum of the gradient components is zero.
This geometric property leads to several key advantages:
- Optimization Landscape Smoothing: GC improves the "Lipschitzness" of the loss function, making the optimization landscape smoother and less "jagged." This allows the optimizer to take more confident steps without overshooting.
- Weight Space Regularization: By constraining the gradients, GC implicitly constrains the weights, reducing the likelihood of overfitting.
- Gradient Explosion Suppression: GC naturally keeps gradient magnitudes in check, acting as a built-in version of gradient clipping, which leads to much more stable training.
Experimental Evaluation
The authors conducted an extensive "stress test" using several standard benchmarks, including ImageNet, CIFAR100, and COCO. The results across the board show that GC is a "free lunch" for performance:
- Speed and Convergence: On Mini-ImageNet, models using GC converged significantly faster and reached lower training losses than those using standard BN or WS.
- Accuracy Boosts: On CIFAR100, GC improved the accuracy of various architectures (ResNet, VGG, DenseNet) by 0.5% to 2%. On the large-scale ImageNet dataset, GC reduced the Top-1 error rate by up to 1.2%.
- Fine-tuning and Detection: GC excelled at fine-tuning pre-trained models on fine-grained datasets, outperforming standard SGDM by 1.1% to 2.1%. On the COCO benchmark, adding GC to the backbone provided a consistent boost of 0.3% to 0.9% in Average Precision (AP).
Conclusion
Gradient Centralization is a rare find in deep learning research: a theoretically grounded technique that is incredibly easy to use and provides a consistent performance boost across the board. While future work may explore its efficacy in NLP or Reinforcement Learning, its current success in Computer Vision makes it a powerful tool for any deep learning practitioner's arsenal.
Summary updated