Skip to content
AI.info

Research

Multi-Trajectory Physics-Informed Neural Networks for HJB Equations with Hard-Zero Terminal Inventory: Optimal Execution on Synthetic & SPY Data

Overview Research area: Machine learning for finance / scientific computing — specifically physics-informed neural networks (PINNs) applied to Hamilton-Jacobi-Bellman (HJB) partial differential equati

Multi-Trajectory Physics-Informed Neural Networks for HJB Equations with Hard-Zero Terminal Inventory: Optimal Execution on Synthetic & SPY Data
arXiv
2512.12708
Published
2025-12-14
Authors
Anthime Valin

AI summary

Overview

Research area: Machine learning for finance / scientific computing — specifically physics-informed neural networks (PINNs) applied to Hamilton-Jacobi-Bellman (HJB) partial differential equations for optimal trade execution, tested on a synthetic closed-form benchmark and on SPY intraday data.

Technical level: Advanced. The paper assumes familiarity with stochastic optimal control, HJB equations, neural network training with automatic differentiation, and backpropagation-through-time.

Scope: One paper, one author (Anthime Valin, University College London, Department of Computer Science), presented at the NeurIPS 2025 Workshop on Generative AI in Finance (arXiv:2512.12708v1, 14 Dec 2025), proposing and evaluating a modified PINN architecture for liquidation problems with a hard-zero terminal inventory constraint.

What This Paper Is About

Optimal trade execution requires that every share be liquidated by the end of a trading horizon, which mathematically means the terminal inventory must equal exactly zero. Standard PINNs train on PDE residuals and soft boundary penalties and frequently fail to enforce this constraint, producing simulated rollouts with leftover inventory and unstable trading rates near maturity. This paper introduces a Multi-Trajectory PINN (MT-PINN) that simulates entire trading trajectories inside the training loop and penalizes terminal inventory directly, then tests it against closed-form solutions from the Gatheral-Schied single-asset execution model and against real SPY intraday data.

Key Contributions

  1. A trajectory-aware loss that enforces X_T = 0. Instead of only penalizing the PDE residual and a soft boundary penalty, MT-PINN rolls out inventory dynamics under the network-implied control using forward Euler discretization and penalizes terminal inventory across a batch of starting states and horizons, propagating the penalty back through all time steps with backpropagation-through-time (BPTT).
  2. A lightweight λ-curriculum for risk aversion. Training begins at λ = 0, where the value function is price-invariant and the state is one-dimensional, then moves through a monotone schedule toward the target risk aversion λ*, warm-starting each stage from the previous one.
  3. Synthetic plus real-market validation. The method is checked against the closed-form Gatheral-Schied control (where it matches the analytic trading rate and concentrates terminal inventory around zero) and then applied to SPY intraday data across 21 windows.
  4. A full training recipe and complexity account. The composite loss combines PDE residual, trajectory, inventory-axis condition, symmetry, and (for λ > 0) a Γ(0, 0, S) = 0 term, weighted with DWA-style adaptive weighting; the paper reports per-epoch time complexity O(J × N_dt × P) and memory complexity O(N_dt × P).

Main Findings

  • Terminal constraint enforcement (synthetic, λ = 0.10, 200 simulated price paths): MT-PINN with the λ-curriculum gives |X_T| mean 0.073 ± 0.092, a 95th percentile of 0.241, and p_ε = 0.600, where p_ε = Pr(|X_T| ≤ ε) with ε = 0.05. The vanilla PINN gives 0.777 ± 0.444, 95th percentile 1.407, p_ε = 0.055; the vanilla PINN with λ-curriculum gives 0.164 ± 0.161, 95th percentile 0.527, p_ε = 0.205.
  • Lowest path error: MT-PINN attains the lowest error along the optimal path across absolute value-function error, inventory error, and trading-rate error, outperforming both baselines over most of the horizon and tracking the analytical control without the late-maturity instability seen in the baselines.
  • Risk-neutral agreement on SPY (n = 21 windows): MT-PINN with λ = 0.00 matches TWAP on mean exposure (0.336 vs. 0.334) and mean cost (-6.37 bps vs. -6.35 bps), with cost standard deviation 12.58 bps vs. 12.56 bps for TWAP.
  • Risk-cost frontier on SPY: Raising risk aversion lowers mean exposure to 0.231 (λ = 0.05) and 0.164 (λ = 0.10) while cost moves to -5.01 bps and -3.69 bps respectively, with cost standard deviations of 11.02 bps and 9.67 bps. The paper attributes the moderate rise in average cost to the general uptrend of the SPY over the sample.
  • Falling markets favour risk aversion: MT-PINN with λ > 0 front-loads execution and outperforms TWAP in down-moves, while MT-PINN with λ = 0 and TWAP remain competitive in rising windows.
  • Compute footprint: experiments ran on 1x v6e-1 TPU using JAX/FLAX, with typical runtime between 1 minute and 4 minutes.

Methodology in Plain English

The authors treat the trading problem as finding a value function — the minimum expected cost to finish liquidating from any state — which must satisfy an HJB equation. They approximate that function with a small multilayer perceptron using smooth tanh activations, deliberately avoiding normalization layers and stochastic regularizers so that derivatives used in the PDE residuals stay stable. Automatic differentiation supplies the derivatives, and the optimal trading rate is read off analytically as one half of the network's derivative with respect to inventory.

The novelty is what happens next. Rather than trusting the PDE residual and a soft terminal penalty, the network's own control is used to simulate many trading paths forward in time from a batch of starting inventories, prices, and horizons. At the end of each simulated path, leftover inventory is penalized with a piecewise function (absolute value for small leftovers, squared for large ones), and the resulting gradient is pushed back through every time step of the simulation. The paper contrasts this with two vanilla baselines that omit the trajectory term and instead use a quadratic terminal penalty; it notes that without either the multi-trajectory term or that quadratic penalty, the PINNs converge to sub-optimal local minima.

Training proceeds through a curriculum on the risk-aversion parameter λ, starting from the simpler risk-neutral setting and gradually increasing λ, so that the harder risk-averse problem inherits a warm start. The losses for PDE residual, the inventory-axis condition at X = 0, the model's symmetry properties, and (for λ > 0) the boundary value at Γ(0, 0, S) are combined with adaptive weighting.

On the synthetic benchmark, the horizon is fixed at T = 5.0, inventory lies in [-10, 10], price in [10, 100], volatility at σ = 0.1, permanent-impact strength at κ = 0.1, with 30,000 collocation points, 55k epochs for λ > 0, target λ* in {0, 0.05, 0.1} and five curriculum stages at multiples 0.25, 0.50, 0.75, 0.9, and 1.0 of λ*. The trajectory batch uses P = 820 initial states and horizons T/50, T/10, T/5, 2T/5, 3T/5, 4T/5, and T with 200 Euler steps.

The SPY study splits seven trading days (Feb 10 – Feb 19, 2025, excluding weekends) into three 2-hour intraday windows on 5-second intervals, excluding the first and last 15 minutes of each session, yielding 21 windows. Time is normalized so T = 0.308, inventory is normalized by the initial position to lie in [-1, 1], price is bounded in [590, 620], σ = 0.0038 (roughly 6% annualized) and κ = 0.2, with no trading fees or overnight risk assumed.

Why This Matters

Impact on research. The paper shows that embedding differentiable simulation directly into PINN training is a practical way to satisfy hard terminal constraints that soft penalties handle poorly. It connects the PINN literature to a well-studied optimal execution model with known closed-form solutions, giving a clean testbed for comparing constraint-satisfaction methods rather than only reporting residual magnitudes.

Real-world applications:

  • Execution algorithms on desks that benchmark against TWAP and need to choose an aggression schedule based on risk appetite.
  • Risk-averse liquidation of large positions, where the paper's exposure-cost frontier (exposure falling from 0.336 to 0.164 as λ rises) gives a tunable dial.
  • Scenario testing for downtrends, since risk-averse policies front-load execution and performed best in falling SPY windows.
  • Model validation and research prototyping, given the released code, configs, and scripts for reproducing figures and experiments.

Industry relevance. The risk-neutral case reproducing TWAP confirms that the learned policy collapses to the standard industry benchmark when no risk penalty is applied, which matters for trust and adoption. The risk-averse cases give a continuous trade-off rather than a single heuristic, and the negligible training cost reported on a single TPU chip (1–4 minutes) makes repeated re-fitting per window plausible.

Future Directions

  • Richer cost models. The paper explicitly names fees, nonlinear temporary impact, and frictionless-execution assumptions as limitations, so adding fee structures and nonlinear impact is a direct extension.
  • Market microstructure. Execution is modelled in a continuous-price setting without order book depth, bid-ask dynamics, or order-flow imbalance; the authors propose incorporating order-book-derived state variables to capture short-term liquidity constraints and queue dynamics.
  • Multi-asset scope. Experiments are single-asset; the paper states that cross-asset effects are not investigated, leaving portfolio-level liquidation as an open direction.
  • Scaling the trajectory penalty. The per-epoch time complexity O(J × N_dt × P) and memory complexity O(N_dt × P) beg the question of how far the approach scales when horizons, batch size, or asset count grow, and whether the reported parallelism of independent trajectories can be exploited further.

Target Audience

Quantitative researchers and machine learning practitioners working on scientific computing with neural networks, especially those applying PINNs to control problems; quantitative finance professionals and execution-algorithm developers interested in liquidation strategies and risk-cost trade-offs; and graduate students in financial engineering or applied mathematics who want a concrete, reproducible example of differentiable simulation applied to a stochastic control problem with a known analytic solution.

Authors’ abstract

We study optimal trade execution with a hard-zero terminal inventory constraint, modeled via Hamilton-Jacobi-Bellman (HJB) equations. Vanilla PINNs often under-enforce this constraint and produce unstable controls. We propose a Multi-Trajectory PINN (MT-PINN) that adds a rollout-based trajectory loss and propagates a terminal penalty on terminal inventory via backpropagation-through-time, directly enforcing zero terminal inventory. A lightweight lambda-curriculum is adopted to stabilize training as the state expands from a risk-neutral reduced HJB to a risk-averse HJB. On the Gatheral-Schied single-asset model, MT-PINN aligns closely with their derived closed-form solutions and concentrates terminal inventory tightly around zero while reducing errors along optimal paths. We apply MT-PINNs on SPY intraday data, matching TWAP when risk-neutral, and achieving lower exposure and competitive costs, especially in falling windows, for higher risk-aversion.

Read the original paper