- Home
- Library
- Computational Quantum Field Theory
- Solving Boundary and Evolution Equations
- Physics-Informed Residual Minimization
Physics-Informed Residual Minimization
A neural network can satisfy a differential equation at its training points and still miss the field between them. What extra information turns a residual into evidence about the physical solution? A small sourced scalar problem lets us answer this with an exact solution, a conventional collocation method and actual trained networks.
Preparation: Boundary-value discretization, spectral collocation and gradients with respect to model parameters. The example is a dimensionless classical response problem. No quantum expectation value or path-integral sampling is involved.
A positive scalar response with boundary layers
The static limit of the mostly-minus scalar equation has the positive sign pattern . After choosing length, field and source units, consider
Here measures the boundary-layer thickness relative to the interval. Restoring a constant source gives . The integrated response is
This source convention follows the scalar conventions: a positive source appears on the right of the field equation and contributes to the static energy.
The homogeneous equation has exponentials . Adding a particular solution and enforcing the two endpoints yields
For computation it is better to use the equivalent expression
Evaluating the factors with the exponential-minus-one function preserves their accuracy near an endpoint. The derivative and response are
When , the interior approaches , while two thin boundary layers reduce the response by approximately . The continuum answer is known before choosing any training or validation points.
Residuals and boundary conditions are different requirements
Let be a differentiable neural trial. Its differential residual is
A continuum residual loss would be . Actual training replaces that integral by weighted evaluations. Boundary conditions require their own treatment; a source term in the equation does not impose them.
For soft enforcement, use a free trial and minimize
The interior uses interval measure; the two boundary values use a separately specified counting measure. Everything has been made dimensionless before the terms are added. In our calculation is a fixed optimization choice. It is neither a physical coupling nor a general prescription for balancing losses.
For hard enforcement, set
Both endpoint values then vanish for every parameter vector. Only the residual term remains in the loss. This is a boundary-adapted trial space, not exact enforcement of the differential equation. The construction is an instance of the boundary-satisfying decomposition in Lagaris, Likas and Fotiadis, §2, Eqs. (3)–(4).
The raw network here has one hidden layer,
Writing gives
The coordinate map supplies factors of and for first and second derivatives. The hard trial also needs the product rule:
Differentiating the residual loss requires mixed derivatives with respect to and the parameters. For example,
The companion uses explicit derivatives and checks them against independent directional differences. Automatic differentiation could provide these derivatives, but would not remove the need to check the boundary map and coordinate factors.
A fixed experiment, including its failures
The reproducible companion retains the scientific source, fitted parameters and selected outputs in the repository's neural-solvers examples. It uses , hence parameters, and , and . Three prescribed random initializations are reused across the methods. All primary losses use a fixed -point Gauss–Legendre rule. These nodes define deterministic quadrature, so they carry no iid Monte Carlo standard error.
Training uses L-BFGS-B with at most accepted iterations and a strict guard of objective-and-gradient evaluations. The guard returns the last accepted state if a line search asks for another evaluation; it does not promote an unaccepted trial to a result. The weights have declared finite bounds. The optimizer's function-decrease stop, its projected-gradient stop and the independent field-error target are reported separately. The precise options and all starts are retained.
Every returned network is evaluated on new Gauss rules of orders and and on a -point uniform grid. The designated start-zero models also receive adaptive integration. Validation never changes the fit. The following entries are the designated start-zero results, with relative error defined by and .
| Boundary treatment | Relative error | Maximum endpoint error | ||
|---|---|---|---|---|
| Hard | ||||
| Soft | ||||
| Hard | ||||
| Soft | ||||
| Hard | ||||
| Soft |
An integral can be accurate through cancellation while the field remains less accurate. At the smallest , the soft fit has the smaller response error but the larger field error. Neither a small boundary mismatch nor a small response error determines the full solution.
Independent field errors for the prescribed start-zero residual fits. Each panel uses its own vertical scale; the thin-layer case is harder. The conventional curve is the degree- collocation polynomial. All curves are evaluated after fitting, on points that are not the training quadrature.
The initialization dependence is also retained. For , the three hard-fit relative errors range from to , and the soft-fit errors range from to . Several parameters reach their bounds. All six miss the predeclared relative-error target .
Across the residual fits, six stop at the iteration cap. Only four satisfy the separately reported projected-gradient target . A function-decrease stop can occur while the gradient or field error is still too large. Optimization difficulties from differential residuals are a central subject of Krishnapriyan et al., §4.1; their experiments concern other equations, so their measured errors are not evidence for this example.
A conventional solve provides an independent comparison
On Chebyshev nodes, construct the full first-derivative matrix , form , and only then remove the two zero boundary unknowns. The interior system is
This order matters: squaring a matrix after discarding endpoints does not produce the same second derivative. The calculation reuses the checked differentiation kernel from spectral collocation, with a new local polynomial and coordinate-scaling check.
At , the degree- polynomial has relative error ; degree gives and degree gives . These are independent-point errors, not the residual of the solved linear system. Further refinement does not keep improving binary64 accuracy: the degree- result is . At , increasing the degree also reveals a roundoff floor rather than a monotone improvement.
The small one-dimensional linear problem strongly favors the conventional solve. Parameter counts alone would conceal the repeated nonlinear optimization work. Neural methods become a different proposition when one representation amortizes many problems; that requires the explicit offline and online accounting in reduced-basis and surrogate models.
When a residual really bounds a field error
For a hard-boundary trial , put . Then and . Integration by parts gives
Poincaré's inequality on the unit interval gives
Combining this with Cauchy–Schwarz, , proves
Because the interval has length one, also bounds the response error. The hypotheses are essential: the correct operator, the correct boundary space, sufficient regularity and the continuum residual norm.
For the hard start-zero fit, the independently integrated residual norm is , giving an estimated bound of . The actual absolute error is about . This is consistent with the theorem. The residual bound need not be sharp.
A finite quadrature estimate of is not automatically an upper bound on that norm. The companion records refinement and adaptive-integration diagnostics instead of claiming rigorous interval integration. The fitted integral quantities agree under the prescribed refinements; some sampled reflection maxima change because the observation nodes change. Such extrema are explicitly sampled quantities, not certified suprema.
Soft boundaries need a correction. With
the function is admissible and . Applying the theorem to and then adding gives
Dropping the boundary term would certify the wrong problem. In particular, has zero differential residual everywhere but violates both zero boundary conditions.
Summary
A residual network is a differentiable trial function trained on a discrete objective. Hard construction can impose the endpoints exactly; soft penalties leave a measurable boundary error. Independent points, integral observables and conventional solves expose errors that the training loss can miss. A coercive operator converts a genuine continuum residual norm into an error bound, but neither quadrature nor optimizer success supplies that bound automatically.
Exercises
1. A boundary-aware residual estimate
Suppose and . Derive the lifting estimate above and write its boundary contribution explicitly. Also give the energy-norm version.
Solution
Take . Since , . Therefore has zero endpoints and residual . The hard-boundary theorem and triangle inequality give
The boundary contribution follows by integrating the square of the affine function. Its energy norm is
Thus
These estimates retain both the derivative and value contributions of the lift. An endpoint penalty is useful only insofar as it actually controls the measured .
2. Zero training residual with arbitrarily large error
Let be distinct interior training points. Construct smooth functions with the correct zero endpoints and zero residual at every , but arbitrarily large field error relative to .
Solution
Define
At every training node, the triple zero implies . Also , and is not identically zero. For any real ,
therefore has zero boundary error and zero residual at all training points. Yet
is unbounded as increases. This construction disproves a universal certificate based only on finitely many residual values. The functions are unrestricted by the network parameter bounds used in the experiment. Controlling a specified trial class, the integration error and the operator stability supplies additional information that this counterexample deliberately omits.
References
- A. S. Krishnapriyan, A. Gholami, S. Zhe, R. M. Kirby and M. W. Mahoney, “Characterizing possible failure modes in physics-informed neural networks,” Advances in Neural Information Processing Systems 34 (2021), arXiv:2109.01050v2. Consulted §1, §§3.1–3.2 and §4.1.
- I. E. Lagaris, A. Likas and D. I. Fotiadis, “Artificial neural networks for solving ordinary and partial differential equations,” IEEE Transactions on Neural Networks 9, 987–1000 (1998), doi:10.1109/72.712178; arXiv:physics/9705023v1. Consulted §§2–2.1, including the hard-boundary trial and mixed derivatives.
- SciPy developers, L-BFGS-B options, SciPy 1.13.1. The companion adds an explicit hard evaluation guard; SciPy's function-decrease and projected-gradient stopping rules remain distinct.
Scrollable formula. Use Left and Right arrow keys to reveal hidden content.
Scrollable table. Use Left and Right arrow keys to reveal hidden columns.
Scrollable figure. Use Left and Right arrow keys to reveal hidden content.