Physics-informed neural networks
How physics-informed neural networks embed governing differential equations into the training loss, solving forward problems and inferring unknown parameters from sparse, noisy data.
What it is
A physics-informed neural network (PINN) is a neural network trained not only to fit data but also to satisfy the governing equations of a physical system, usually partial differential equations (PDEs) such as the Navier–Stokes, heat or Schrödinger equation. The network takes coordinates, such as position x and time t, and outputs the solution u(x, t). The equation is enforced by adding to the training loss a residual term, evaluated with automatic differentiation, that is zero when the network satisfies the PDE. The method was popularized by Raissi, Perdikaris and Karniadakis (2019), and it provides a mesh-free way to solve differential equations and to combine physics with measurements. PINNs are used for fluid and heat transfer problems, solid mechanics, subsurface flow, electromagnetics, biomedical flows and material parameter identification.
It answers questions such as: What is the solution of this PDE with these boundary conditions, without building a mesh? Given a few noisy sensor readings and known physics, what is the full field? What are the unknown parameters (viscosity, conductivity, a source term) that explain the measurements (an inverse problem)? How can physical consistency be imposed on a data-driven model? For standard forward problems, however, classical solvers are usually faster and more accurate.
Fundamentals
The PINN loss
Consider a PDE ut + N[u; λ] = 0 on a domain, with initial and boundary conditions and possibly parameters λ. A neural network uθ(x, t) with weights θ approximates u. The total loss is a weighted sum: L(θ) = wdata Ldata + wpde Lpde + wbc Lbc + wic Lic. Here Ldata is the mean squared error against any measurements, Lic and Lbc penalize deviations from initial and boundary conditions, and Lpde = (1/Nr) Σ |uθ,t + N[uθ]|² at Nr collocation points scattered in the domain. The derivatives ut, ux, uxx of the network output with respect to its inputs are computed exactly by automatic differentiation in frameworks such as PyTorch, TensorFlow or JAX, so no finite-difference grid is needed. The classic example is Burgers’ equation, ut + u ux − ν uxx = 0, with ν = 0.01/π, which develops a sharp shock that PINNs can capture with a few thousand collocation points. Smooth activation functions (tanh, sine) are used because the residual needs higher derivatives, which ReLU cannot provide.
Forward and inverse problems
In a forward problem, the equation, parameters and boundary conditions are known, and the network learns the solution with only Lpde, Lbc and Lic, so no solution data are needed. In an inverse problem, some parameters λ are unknown, and they are treated as trainable variables optimized together with θ against measurements, so the method can recover coefficients such as thermal conductivity, viscosity or reaction rates, or even infer unobserved fields (for example pressure from velocity measurements in a flow). This ability to blend sparse, noisy data with physical laws is the main advantage over both pure data-driven learning, which can violate physics and extrapolate poorly, and classical solvers, which struggle with ill-posed problems and missing boundary conditions. Related approaches include learning unknown terms of an equation (see symbolic regression and sparse identification), Bayesian PINNs that quantify uncertainty, and neural operators (DeepONet, Fourier Neural Operator) that learn the mapping from inputs (initial conditions, coefficients) to solutions across many cases and then evaluate in a single pass.
Training difficulties and remedies
PINNs are harder to train than they look. The loss mixes terms of different magnitudes, and the optimizer can satisfy the boundary condition while ignoring the PDE, or the reverse, so loss balancing matters: adaptive weights (gradient-norm balancing, self-adaptive weights, neural tangent kernel analysis). Networks show spectral bias, learning low-frequency components first, which hampers high-frequency and multiscale solutions, so Fourier feature embeddings and domain scaling help. Stiff equations, shocks, chaotic dynamics and long time horizons can lead to failure modes in which the network converges to a trivial or wrong solution, and causal training, or time-marching in short windows, enforces that early times are learned before later ones. Other tools: hard constraints that build boundary and initial conditions into the network’s output form so they hold exactly, domain decomposition (XPINNs and conservative PINNs) with separate networks per subdomain, adaptive sampling of collocation points where the residual is large, a variational formulation that lowers derivative order, and optimization with Adam followed by L-BFGS.
Validation, software and comparison with classical solvers
Because a low loss does not guarantee a correct solution, PINNs must be validated: compare with a reference (analytical or high-fidelity numerical) solution using the relative L2 error, ‖uθ − uref‖2/‖uref‖2, check conservation laws and residual maps, test several random seeds and network sizes. Compared with the finite element and finite volume methods (see finite element analysis), PINNs are flexible for irregular geometries and inverse problems but typically slower and less accurate for well-posed forward problems, with errors of 10−3 to 10−2 common, rather than machine precision. They are best viewed as a tool for data assimilation and parameter estimation, and a complement, not a replacement.
Typical applications and limits
Limits: slow and fragile training, difficulty with multiscale and turbulent flow, sensitivity to hyperparameters, and no guarantee of correctness without validation.
Basic operation
- State the physics. Write the PDE, domain, boundary and initial conditions, and note unknown parameters.
- Collect data. Gather any measurements, with noise levels, and decide what is known.
- Build the network. Use a fully connected network with tanh activations and scaled inputs.
- Define the loss. Add data, PDE residual, boundary and initial terms with initial weights.
- Sample collocation points. Choose points in the domain and on the boundaries, and refine adaptively.
- Train. Use Adam, then L-BFGS, and watch each loss term.
- Validate. Compare with a reference solution or independent measurements.
- Collect the output. You obtain a continuous solution field and estimated parameters; loss balancing and failure modes are covered in the video.
Good practice
- Nondimensionalize the problem. Scaled variables ease training.
- Monitor each loss term. One term may dominate and hide failure.
- Validate against a reference. Low loss alone is not proof.
- Start simple. Test the method on a case with a known solution first.
- Compare with classical solvers. Use PINNs where they add value.
- Do not rely on PINNs alone for safety. For structural, medical or process-safety decisions, confirm results with validated numerical methods and measurements, and report uncertainty.
Key terms
- Residual — the amount by which the network output fails to satisfy the PDE.
- Collocation points — locations where the physics equation is enforced.
- Automatic differentiation — exact computation of derivatives of the network output.
- Inverse problem — inferring unknown parameters or fields from observed data.
- Spectral bias — the tendency of networks to learn smooth components before fine detail.
- Neural operator — a model that learns a mapping between function spaces.
- Hard constraint — building boundary conditions exactly into the network’s form.
Video coming soon
About five minutes on Physics-informed neural networks: how it works in detail, how the data is acquired, and how it is analyzed.
More in 4.3 AI and Machine Learning
- Regularized linear models
- Decision trees and random forests
- Gradient boosting (XGBoost)
- Support vector machines
- k-NN
- k-means
- Gaussian processes
- Neural networks
- CNNs
- RNN/LSTM
- Transformers
- Autoencoders
- GANs
- Diffusion models
- Graph neural networks
- Reinforcement learning
- Transfer learning
- Federated learning
- Explainable AI (SHAP, LIME)
- Physics-informed neural networks
- Bayesian optimization
- Active learning
- Symbolic regression
- Genetic algorithms and particle swarm optimization
- Dimensionality reduction (t-SNE, UMAP)
- NLP and large language models
- Retrieval-augmented generation
- Computer vision (detection, segmentation)
- Anomaly detection
- Machine-learned interatomic potentials
- AutoML
