A PID Controller Approach for Stochastic Optimization of Deep Networks

Wangpeng An, Haoqian Wang, Qingyun Sun, Jun Xu, Qionghai Dai, Lei Zhang

Abstract

This paper introduces a novel optimization framework for deep neural networks by drawing a formal equivalence between stochastic gradient descent (SGD) variants and classical Proportional-Integral-Derivative (PID) control. By identifying SGD with Momentum as a PI controller, the authors propose a PID optimizer that incorporates a derivative term to mitigate overshoot and oscillations. Experimental results across standard benchmarks like CIFAR and Tiny-ImageNet demonstrate that the PID optimizer can accelerate training by up to 50% while achieving comparable or superior test accuracy.

Introduction

Training state-of-the-art deep neural networks, such as ResNet or DenseNet, is computationally intensive and time-consuming. While adaptive optimizers like Adam are popular, Stochastic Gradient Descent with Momentum (SGD-M) remains the standard for achieving peak final accuracy. However, SGD-M suffers from a fundamental flaw: overshoot.

Because momentum accumulates past gradients to smooth the optimization path, the "velocity" of weight updates can become excessive. As the optimizer approaches a local minimum, this accumulated momentum causes the weights to fly past the target, leading to oscillations and inefficient training cycles. This research seeks to apply classical control theory to provide a "braking" mechanism for deep learning optimizers.

Methods: Bridging Control Theory and Deep Learning

The core innovation of this work is reframing deep learning optimization through the lens of PID control, a cornerstone of industrial automation. A PID controller maintains a system at a desired setpoint using three components: Proportional (P) for current error, Integral (I) for accumulated past error, and Derivative (D) for predicting future error based on the rate of change.

The Mapping

The authors establish a mathematical equivalence between these control components and existing optimizers:

  • SGD functions as a simple P controller, reacting only to the current gradient.
  • SGD-Momentum and Nesterov Momentum function as PI controllers, where the momentum term serves as the integral of past gradients.
Mapping between Control Systems and Deep Model Training

The PID Optimizer

By adding the missing Derivative (D) term to the update rule, the authors create a true PID optimizer. This term tracks the change in gradients between iterations. When the gradient changes rapidly, the D-term acts as a dampener, preventing the optimizer from overshooting the valley. To simplify implementation, the authors utilize the Laplace Transform and the classic Ziegler-Nichols tuning method to derive a closed-form initialization for the derivative gain ($K_d$), minimizing the need for manual hyperparameter tuning.

Experimental Results

The PID optimizer was evaluated against SGD-Momentum on several benchmarks, including MNIST, CIFAR-10, CIFAR-100, and Tiny-ImageNet, using architectures like ResNet, ResNeXt, and DenseNet.

Performance and Speedup

The PID method consistently outperformed SGD-M in both convergence speed and final error rates:

  • Acceleration: The PID optimizer achieved a 35% to 50% training speedup. For instance, on CIFAR-10 with DenseNet-190, PID reached peak accuracy in 194 epochs, compared to 293 epochs for SGD-M.
  • Accuracy: In nearly all test cases, the PID optimizer achieved lower test error. On CIFAR-100 with ResNeXt, PID reached a 17.11% error rate, outperforming SGD-M's 17.31%.
Optimization trajectories with varying Derivative gain (Kd) showing reduced oscillation compared to SGD-M (yellow)

Stability and Trajectory

Visualizations of the loss landscape demonstrate that while SGD-M (the yellow path in Figure 6) often "zig-zags" across valleys due to accumulated momentum, the PID optimizer (the red path) follows a significantly smoother and more direct trajectory to the minimum. As the derivative gain ($K_d$) increases, the "braking" effect becomes more pronounced, effectively dampening oscillations.

Conclusion and Future Work

This research demonstrates that classical engineering wisdom remains highly relevant to modern AI challenges. By treating momentum as an integral component and adding a derivative "brake," the PID optimizer offers a more stable and efficient path to convergence. Future work may involve extending this PID logic to recurrent architectures like LSTMs or integrating it with adaptive learning rate methods like Adam to explore potential compound benefits.

Summary updated

BibTeX
@inproceedings{an2018pid,
  author = {Wangpeng An and Haoqian Wang and Qingyun Sun and Jun Xu and Qionghai Dai and Lei Zhang},
  title = {{A PID Controller Approach for Stochastic Optimization of Deep Networks}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2018},
  doi = {10.1109/cvpr.2018.00889},
}
Figure