Efficient Computation of Hessian Matrices in TensorFlow
This work addresses computational bottlenecks for researchers and practitioners in deep learning who need Hessian matrices for optimization and analysis, but it is incremental as it builds on existing methods in TensorFlow.
The paper tackles the problem of efficiently computing Hessian matrices for deep learning models in TensorFlow, presenting methods for exact and approximate Hessian computation and reducing quadratic space complexity through approximate eigendecompositions.
The Hessian matrix has a number of important applications in a variety of different fields, such as optimzation, image processing and statistics. In this paper we focus on the practical aspects of efficiently computing Hessian matrices in the context of deep learning using the Python scripting language and the TensorFlow library. We define a general feed-forward neural network model and show how to efficiently compute two quantities: the cost function's exact Hessian matrix, and the cost function's approximate Hessian matrix, known as the Outer Product of Gradients (OPG) matrix. Furthermore, as the number of parameters (weights and biases) in deep learning usually is very large, we show how to reduce the quadratic space complexity by an efficient implementation based on approximate eigendecompositions.