Introduction
In mainstream deep learning, stochastic first-order methods like ADAM or SGD are the gold standard, primarily due to their simplicity and ability to navigate the noisy loss landscapes of discrete data. However, Scientific Machine Learning (SciML) presents a different challenge: learning continuous physical fields and operators governed by Partial Differential Equations (PDEs). In these "highly informative data regimes," the stochastic noise that helps ADAM generalize can become a hindrance.
This work introduces PETScML, a lightweight Python bridge that integrates the high-performance second-order optimization solvers of the PETSc library into deep learning frameworks like PyTorch and JAX. By leveraging classical optimization techniques—specifically Trust Region methods with Gauss-Newton approximations—PETScML achieves significantly higher accuracy and lower computational costs for SciML regression tasks compared to standard first-order methods.
Implementation and Methods
PETScML is built on top of petsc4py, the Python interface for the Portable and Extensible Toolkit for Scientific computation. It exposes three primary types of deterministic second-order solvers: Limited-memory Broyden–Fletcher–Goldfarb–Shanno (L-BFGS), Inexact Newton with line-search (LS), and Trust Region (TR) methods.
A critical technical component is the choice of Hessian approximation. While the Exact Hessian is computationally expensive, the Gauss-Newton (GN) approximation provides second-order benefits with memory requirements comparable to standard gradients. To ensure fair comparison across hardware backends, the authors utilize an "oracle call" metric, where an objective evaluation counts as 1 call, a gradient as 2, and a Gauss-Newton product as 2.
Experimental Setup
The researchers evaluated PETScML across a diverse range of SciML regression benchmarks representing surrogate modeling tasks:
- Fourier Neural Operator (FNO): Learning mappings for 1D Burgers’ and 2D Navier-Stokes equations.
- DeepONet: Learning implicit operators for 1D nonlinear reaction-diffusion and 1D advection equations.
- GreenLearning: Discovering Green’s functions for the 2D Poisson equation.
Key Results and Insights
The "Smoothness" Advantage
Because SciML regression tasks typically deal with continuous functions, the loss landscape is smoother than in classification. This allows second-order methods to take larger, more confident steps toward the minimum. The Trust Region method with Gauss-Newton approximation (TR-GN) consistently emerged as the optimal choice, balancing accuracy and computational cost.
Generalization and Efficiency
Surprisingly, second-order methods did not just reach lower training errors; they significantly improved generalization on unseen data. In the Burgers' equation test, TR-GN improved accuracy by nearly two orders of magnitude over a tuned ADAMW baseline. Furthermore, for the FNO Navier-Stokes case, TR-GN halved the error reported in previous literature. From an efficiency standpoint, TR-GN often proved "cheaper" in terms of total oracle calls than first-order reference solvers while requiring significantly less hyper-parameter tuning.
Conclusion
PETScML demonstrates that second-order methods are highly effective for the smooth loss landscapes characteristic of SciML regression. While memory constraints remain a consideration for very large models, the Gauss-Newton approximation offers a viable path forward. Future work will focus on the design of better preconditioners to further reduce iteration counts and exploring the applicability of these solvers to non-regression tasks like image classification.
Summary updated