Sounding the Black Box: Online Training of Embedded Neural Networks in Forward-Only Physical Simulators

Ruiqi Shu, Tianrun Gao, Haomin Wen, Xiaomeng HuangarXiv 2026

TL;DR

Embedding neural networks inside physics simulators lets us run fast, coarse-grid simulations while capturing fine-scale physics, provided we can train the network over multi-step trajectories. Unfortunately, the gold-standard training method requires differentiating through the simulator—a non-starter for the massive, legacy Fortran and C/C++ codebases that power real-world climate and engineering models. FORGE solves this by "sounding" black-box simulators with smart forward-only perturbations, recovering up to 98% of white-box differentiable performance without ever needing a solver gradient.

What Problem Does This Paper Address?

Simulating complex systems—like ocean currents or turbulent plasmas—at full resolution is computationally brutal. Pure neural surrogates are fast, but they often violate conservation laws. Hybrid physics–neural simulators offer the best of both worlds: run a traditional Partial Differential Equation (PDE) solver on a cheap, coarse grid to handle resolved physics, and embed a neural network (a neural closure) inside the time-stepping loop to fill in the missing subgrid details.

Here is the catch: how do you train that embedded network? If you train it offline on single-step snapshots, tiny errors compound when the network feeds back into the solver over hundreds of steps, causing the simulation to drift or blow up. You need online multi-step training.

When you have the solver's derivatives, you use Solver Backpropagation Through Time (BPTT)—unrolling the physics and differentiating right through every step. But operational workhorses in weather, climate, and engineering are usually massive, forward-only Fortran or C/C++ programs without automatic differentiation or maintained adjoints. Existing black-box workarounds fall short: zeroth-order methods (like Evolution Strategies) blindly poke millions of weights at random; Reinforcement Learning (RL) struggles with scalar rewards; and neural emulators (training a second network to mimic the solver) suffer from compounding gradient errors over long rollouts.

Methods

Instead of treating the whole hybrid rollout as a static black box, FORGE (Forward-Only Response and Gauss–Newton Estimation) exploits two things we do know: we can differentiate the neural network itself, and time-stepped physics is causal (an action at step $k$ only affects future states $t > k$).

FORGE decouples exact network derivatives from black-box simulator dynamics in a two-stage loop per training round:

  1. Stage I: Parameter-Space Warm-Up. Stage II needs the trajectory to be in a smooth, locally linear regime. Stage I gets it there by probing a tiny subspace ($M \ll p$) of weight directions. Instead of random weight noise—which mostly dies in the network's null space—FORGE uses forward-mode autodiff on the network to pick weight directions that produce orthonormal changes in the network's output. Because taking a finite step in a deep network bends away from linear predictions, FORGE applies a clever least-squares tweak to the linear final layer (readout drift compensation) before calling the solver, keeping the probe faithful. Running $2M$ forward rollouts solves a small Gauss–Newton system to warm up the trajectory.
  2. Stage II: Causal Output-Response Identification. Around the warmed-up trajectory, FORGE stops poking weights and starts poking spatial outputs directly in the simulator ($K$ paired perturbations). Watching how output nudges ripple forward in time lets FORGE fit a structured, causal linear error-propagation operator ($d_{t+1} = A_t d_t + B_t \delta a_t$) modulated by local flow states. Once fitted, FORGE inverts this operator to solve for idealized "target outputs" at each step. Suddenly, the black-box trajectory problem becomes standard supervised regression: all $p$ network weights are updated via normal backpropagation with zero extra solver calls!

Datasets

The authors introduce a five-system forward-only hybrid PDE benchmark suite, where fine-grid simulations generate ground-truth trajectories that are downsampled to test coarse-grid hybrid solvers (running in isolated processes or with autograd disabled):

Benchmark comparison showing reference fields, coarse solver errors, and FORGE error reductions across five 2D and 3D physical systems.
  • 2D Cahn–Hilliard: Phase separation ($384^2 \to 96^2$ grid).
  • 2D Gray–Scott: Reaction–diffusion fronts ($768^2 \to 96^2$ grid).
  • 2D Kolmogorov NS: Forced fluid turbulence ($256^2 \to 64^2$ grid).
  • 2D Guide-Field MHD: Magnetohydrodynamic turbulence coupling velocity and magnetic fields ($256^2 \to 64^2$ grid).
  • 3D Ocean (POM): A research-grade 3D primitive-equation ocean circulation model (Princeton Ocean Model) with 15 vertical layers, free-surface waves, and stratification.

Key Insights and Ideas

  • Don't waste perturbations in weight space: In deep networks, random parameter nudges barely move outputs. Using exact network autodiff to probe output-orthonormal directions—and fixing nonlinear hidden-layer drift via the final linear readout—makes low-budget black-box probing vastly more accurate.
  • Window-level response beats step-by-step emulators: Neural emulators learn single steps and unroll them over hundreds of substeps, causing small errors to snowball. Fitting a causal linear operator directly across window-level perturbations sidesteps autoregressive drift, matching true solver responses with 0.89–0.98 cosine similarity.
  • You don't need exact Jacobians to descend: The authors prove mathematically that even though Stage II's response operator is fitted from very few rollouts ($K \ll N$), damped inversion guarantees bounded targets and genuine closed-loop loss descent as long as the predicted improvement clears a modest approximation-error floor.

Key Results

Across all five benchmarks, FORGE outperforms zeroth-order (ES), ensemble (EKI), RL (PPO, Closure-RL), and Neural Emulator baselines:

  • Accuracy: Cuts coarse-solver test Mean Squared Error (MSE) by 50%–96% in 2D and 70.1% in 3D, beating the strongest forward-only baseline by 16%–69%.
  • Oracle Recovery: Without touching a single solver derivative, FORGE recovers 88%–98% of the error reduction achieved by white-box Solver BPTT.
  • Efficiency: Matches the best forward-only baseline's final accuracy using 42%–80% fewer rollouts (4.2× to 4.9× fewer), and hits the Neural Emulator's accuracy on 3D POM 2.9× faster in GPU wall-clock hours.
  • Long-Horizon Stability: Trained on 20-step windows (4 hours in 3D), FORGE stays stable out to 8×–12× the training horizon (160 steps in 2D; 48 hours in 3D), eliminating the high-frequency spectral energy pile-up that plagues coarse turbulence solvers. Remarkably, on 48-hour 3D ocean forecasts, FORGE actually beats white-box Solver BPTT on composite error because BPTT overfits the 4-hour training window and suffers slow sea-surface drift.

Limitations and Future Work

  • Local Linearity Requirement: Stage II fits a linear response operator around the current trajectory; if initial trajectories are wildly nonlinear, Stage II alone can stall—making the Stage I warm-up mandatory.
  • Structured Grid Assumptions: The causal response operator relies on grid-matched spectral or differential operators. Extending FORGE to unstructured meshes, fully coupled multi-component climate models, and sparse real-world observations (where full-field reference states aren't available at every grid point) are the primary avenues for future work.

Summary updated

Abstract

Hybrid physics-neural simulators embed neural networks in partial differential equation (PDE) solvers to model unresolved subgrid dynamics while preserving resolved physics and conservation laws. Because closure outputs feed back across time steps, single-step offline regression does not directly minimize multi-step rollout error, motivating online trajectory optimization. Solver backpropagation through time (BPTT) is the standard online solution when solver derivatives are available, yet many operational Fortran and C/C++ simulators expose only non-differentiable, forward-only interfaces. We introduce FORGE (Forward-Only Response and Gauss-Newton Estimation), an online framework that trains embedded networks from forward runs alone by decoupling exact network derivatives from black-box simulator dynamics. Stage I warms up the rollout via a low-dimensional Gauss-Newton step along output-orthonormal weight directions, canceling multi-layer feature drift via a final-layer correction. Stage II perturbs spatial output fields to fit a gain-bounded causal linear response operator across rollout steps, solves for regularized target outputs, and updates all weights via network backpropagation. Across five 2D and 3D benchmarks spanning phase separation, reaction-diffusion, fluid and MHD turbulence, and ocean circulation, FORGE outperforms gradient-free, reinforcement-learning, and emulator-based baselines, cutting coarse-solver test mean squared error (MSE) by 50%-96% in 2D and 70% in 3D, outperforming the strongest forward-only baseline by 16%-69%, and recovering 88%-98% of Solver BPTT's gains. Code is available at https://github.com/ChiyodaMomo01/FORGE.
BibTeX
@misc{shu2026sounding,
  author = {Ruiqi Shu and Tianrun Gao and Haomin Wen and Xiaomeng Huang},
  title = {{Sounding the Black Box: Online Training of Embedded Neural Networks in Forward-Only Physical Simulators}},
  year = {2026},
  eprint = {2611.31964},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.31964},
}
Figure