[Paper Review] Implementation of Stochastic Quasi-Newton's Method in PyTorch
This paper presents an improved implementation of the Stochastic Damped L-BFGS (SdLBFGS) optimizer in PyTorch for non-convex stochastic optimization. By initializing the Hessian approximation with an identity matrix and normalizing the search direction, the method achieves better convergence and stability than the original SdLBFGS0, outperforming first-order optimizers like SGD and Adagrad and matching or exceeding LBFGS on CIFAR10 and MNIST in test accuracy.
In this paper, we implement the Stochastic Damped LBFGS (SdLBFGS) for stochastic non-convex optimization. We make two important modifications to the original SdLBFGS algorithm. First, by initializing the Hessian at each step using an identity matrix, the algorithm converges better than original algorithm. Second, by performing direction normalization we could gain stable optimization procedure without line search. Experiments on minimizing a 2D non-convex function shows that our improved algorithm converges better than original algorithm, and experiments on the CIFAR10 and MNIST datasets show that our improved algorithm works stably and gives comparable or even better testing accuracies than first order optimizers SGD, Adagrad, and second order optimizers LBFGS in PyTorch.
Motivation & Objective
- Address the instability and non-convergence issues of the original SdLBFGS0 algorithm in deep learning optimization.
- Improve convergence and numerical stability of second-order stochastic optimization for non-convex deep neural networks.
- Enable practical deployment of quasi-Newton methods in PyTorch without requiring line search or manual learning rate tuning.
- Demonstrate that the improved SdLBFGS achieves competitive or superior test accuracy compared to widely used first- and second-order optimizers.
Proposed method
- Replaces the original Hessian initialization in SdLBFGS0 with an identity matrix at each optimization step to improve convergence.
- Introduces L2 normalization of the search direction to stabilize the optimization process and eliminate the need for line search.
- Maintains the core SdLBFGS framework using limited-memory BFGS updates with damped Hessian approximation via modified curvature pairs.
- Uses the damped update rule: $\bar{y}_{k-1} = \theta_{k-1} y_{k-1} + (1 - \theta_{k-1}) H_{k,0}^{-1} s_{k-1} $, where $\theta_{k-1}$ ensures positive semi-definiteness of the Hessian.
- Implements the L-BFGS update sequence using memory-efficient vector operations to approximate the Hessian inverse without storing full matrices.
- Integrates the improved SdLBFGS into PyTorch with end-to-end differentiable optimization, enabling use in standard deep learning training loops.
Experimental results
Research questions
- RQ1Can the original SdLBFGS0 algorithm be stabilized for practical use in deep learning without line search?
- RQ2Does initializing the Hessian approximation with an identity matrix improve convergence in non-convex optimization?
- RQ3Can direction normalization replace line search while maintaining optimization stability and convergence?
- RQ4How does the improved SdLBFGS compare in test accuracy and training stability to first-order (SGD, Adagrad) and second-order (LBFGS) optimizers on standard vision benchmarks?
Key findings
- The improved SdLBFGS achieved a final test accuracy of approximately 66% on CIFAR10, outperforming SGD and Adagrad (≈62%) and surpassing the built-in LBFGS optimizer.
- On the MNIST dataset, SdLBFGS achieved a test accuracy of approximately 98%, comparable to SGD and Adagrad, while LBFGS failed completely with only ~10% accuracy.
- SdLBFGS0 crashed after a few epochs on both CIFAR10 and MNIST, producing NaN values, while the improved SdLBFGS remained stable and converged.
- The improved SdLBFGS showed faster accuracy increase and stable loss reduction compared to all baselines under optimal learning rates.
- The method achieved comparable or better performance than LBFGS without requiring line search, demonstrating robustness to learning rate choices.
- Direction normalization and identity Hessian initialization were both critical for stability and convergence, with ablation showing failure when either was removed.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.