Formulations and scalability of neural network surrogates in nonlinear optimization problems

Robert B. Parker, Oscar Dowson, Nicole LoGiudice, Manuel Garcia, Russell BentarXiv 2024 · DOI

Abstract

Integrating high-fidelity neural network (NN) surrogates into nonlinear optimization is essential for managing systems with complex, non-analytical physics, such as power grids. This study evaluates three embedding strategies: Full-space, Reduced-space, and a novel Gray-box approach. While traditional Full-space and Reduced-space methods encounter severe modeling and linear algebra bottlenecks at modest scales, the Gray-box formulation—which offloads derivative computations to deep learning frameworks like PyTorch—scales to models with 592 million parameters. When combined with GPU acceleration and Hessian approximations, this approach enables real-time optimization with minimal overhead.

Introduction

Engineers frequently optimize systems governed by complex physical laws. When these models are computationally expensive or lack analytical derivatives, neural network surrogates offer a fast, differentiable alternative. However, embedding large-scale NNs (millions of parameters) into standard optimization solvers presents a significant challenge. Solvers typically expect symbolic equations, and representing a massive NN as a list of scalar equations often leads to memory exhaustion or prohibitive pre-processing times. This paper explores the architectural bottlenecks of different embedding strategies to identify a scalable path for surrogate-based optimization.

Methodological Formulations

The researchers compared three distinct mathematical formulations for embedding NNs into a nonlinear program (NLP):

  1. Full-space: Treats every neuron and layer as individual variables and constraints. This results in a large, sparse problem where the number of variables grows with the network size.
  2. Reduced-space: Represents the entire NN as a single, deeply nested mathematical expression, keeping the variable count low but increasing expression complexity significantly.
  3. Gray-box: Treats the NN as an external entity for value evaluation but utilizes deep learning frameworks (via the MathOptAI.jl package) to provide gradients and Hessians. This allows the solver to remain agnostic to the NN's internal complexity.
Problem size comparison across formulations.

Scalability and Bottlenecks

The study identified two primary bottlenecks that limit traditional methods:

  • The Modeling Bottleneck: In the Reduced-space approach, modeling languages like JuMP struggle to "scalarize" vector operations, leading to massive memory consumption during the problem construction phase.
  • The Linear Algebra Bottleneck: The Full-space approach generates a gargantuan KKT matrix. Even with sparsity, the sheer dimensions cause solver failures once models exceed approximately 7 million parameters.

In contrast, the Gray-box formulation keeps the solver's internal data structures small and constant. By offloading the heavy lifting of derivative calculation to hardware-accelerated frameworks, it bypasses these structural limitations.

Performance Results

The formulations were tested on a Security-Constrained Alternating Current Optimal Power Flow (SCOPF) problem using a 37-bus synthetic grid. The surrogates predicted transient frequency stability.

Performance metrics and scalability limits for different formulations and platforms.

Key findings include:

  • Massive Scalability: Gray-box successfully integrated a 592-million parameter surrogate, whereas other methods failed at much smaller scales (e.g., Full-space failed at 7M parameters).
  • GPU Acceleration: Moving exact Hessian calculations for the 592M model from CPU to an NVIDIA H100 GPU resulted in a 50x speedup, dropping solve time from 748 seconds to just 15 seconds.
  • Real-time Potential: Using Hessian approximations (quasi-Newton) and GPUs, the stability-constrained problem was solved in just 1 second, representing only a 2.5x overhead compared to the base problem without surrogates.

Conclusion

The Gray-box formulation represents a significant advancement for local optimization involving large-scale surrogates. While it is currently unsuitable for global optimization—which requires the explicit algebraic forms of the Full-space or Reduced-space methods—it provides a robust framework for high-dimensional engineering problems. Future work may involve specialized linear solvers for Full-space methods or improving vector-handling in modeling environments to make Reduced-space approaches more viable.

Summary updated

BibTeX
@misc{parker2024formulations,
  author = {Robert B. Parker and Oscar Dowson and Nicole LoGiudice and Manuel Garcia and Russell Bent},
  title = {{Formulations and scalability of neural network surrogates in nonlinear optimization problems}},
  year = {2024},
  eprint = {2412.11403},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.11403},
}
Figure