Learning from measurements and physical laws
A temperature sensor records what happened at one place and one time. A heat equation describes how temperature can change everywhere in the domain. Physics-informed machine learning uses both kinds of knowledge in one model. Measurements constrain the model where they exist, and the physics limits what it may predict in between.
That physics can take several forms. It may be a differential equation, a conservation law, a symmetry, a known boundary value, or a constraint such as positivity. It can enter through the training data, the network architecture, or the training objective. A network built to respect rotational symmetry and a network trained on an equation residual are both physics-informed, although they use physical knowledge in different places.
The motivation is practical. Measurements are often sparse or expensive, and a flexible model can fit every one of them while predicting physically impossible behaviour elsewhere. A correct physical model removes many of those candidate solutions.
From a neural network to a differential-equation solver
A physics-informed neural network, or PINN, represents an unknown physical field by a trainable function. For a time-dependent problem the inputs are usually position and time, and the output is the field itself, for example a temperature or a velocity component.
The parameters are the weights and biases of the network. An ordinary supervised model would learn only from coordinates paired with measured values. A PINN also evaluates the governing equation at coordinates where the solution is unknown. These collocation points carry no labels. They only test whether the prediction is consistent with the equation.
Two different derivatives are involved. Automatic differentiation applies the chain rule through the network to obtain derivatives of the output with respect to the inputs, and these enter the equation residual. Training then differentiates the loss with respect to to update the parameters.
Raissi, Perdikaris and Karniadakis introduced this formulation for solving and identifying nonlinear partial differential equations. In the standard forward problem, the coefficients and the initial and boundary conditions are known, and the network is trained for that single problem. Changing a coefficient usually means training again. Methods that learn a map from problem inputs to solutions belong to operator learning, which is set up differently.
A concrete example: diffusion along a rod
Consider a one-dimensional rod whose ends are held at zero temperature relative to a reference. With dimensionless position and time, a positive diffusion coefficient and a sine-shaped initial temperature, the problem is
Position and time both run from zero to one. Diffusion smooths the profile and carries heat out through the cold ends. This problem has the exact solution
An exact solution is useful for teaching and testing, because every PINN prediction can be compared with it. The figure below shows this analytic solution.
A PINN replaces the unknown temperature by the network output. Substituting that output into the heat equation gives the residual
The residual is zero wherever the network satisfies the equation exactly. A nonzero residual measures how strongly the equation is violated at that point. It is a different quantity from the temperature error, and the two need not have similar magnitudes.
Building the loss function
Training can use four kinds of information: the equation in the interior, the initial state, the boundary values and any measurements. The usual soft-constraint formulation adds them with weights,
and for the rod the individual terms are
Each term is a mean over its own set of points. Residual points lie inside the space-time domain, initial points at time zero and boundary points at the two ends of the rod, where the target temperature is zero. Observation points carry measured temperatures .
The weights set how much each term contributes. Choosing them is harder than it looks, because residuals, boundary errors and data errors can differ by orders of magnitude. Rescaling the variables to order one helps. Equal weights do not give the terms equal influence on the parameter gradients.
In a forward problem with all conditions specified, the observation term is optional and can be dropped. In an inverse problem, measurements are also used to estimate unknown coefficients such as . Whether a coefficient can be recovered depends on how informative the measurements are, so a small data misfit alone does not show that the estimate is unique.
Soft penalties and exact constraints
A penalty term pushes the network towards a condition without enforcing it. For the rod, the initial profile and the zero boundary values can instead be built into the representation:
The second term vanishes at and at and for any bounded network output, so both conditions hold exactly. This construction works because the conditions here are simple and compatible. Other geometries and boundary operators need their own constructions, and removing some loss terms can make the remaining optimization better or worse conditioned.
Why the equation alone is insufficient
The zero temperature field satisfies the heat equation and the zero boundary conditions. It fails only the initial condition. A network that collapses to zero therefore has zero residual everywhere and still solves the wrong problem.
With the observation term omitted, the zero field and the true solution vary solely in the initial-condition loss. Monitoring each loss term during training, alongside their sum, shows which condition a candidate violates.
What happens during training?
- Define the physical problem: the fields, the domain, the equation and compatible initial and boundary conditions. Rescale the variables and decide which coefficients are known.
- Choose the network and decide which conditions, if any, to impose exactly. The residual of a second-order equation needs second derivatives of the output, so smooth activations such as are a common choice.
- Sample interior, initial, boundary and observation points. Keep a separate set of points for validation.
- Evaluate the network and its coordinate derivatives, and compute each residual and mismatch.
- Differentiate the weighted loss with respect to and take an optimizer step. Repeat until the individual loss terms stop decreasing.
- Validate against data the network never saw, such as an analytic solution or a trusted numerical solver.
Video description
- The rod starts with a sine-shaped temperature profile. The analytic solution decays by diffusion while both ends remain at zero temperature.
- The network maps position and time to a field prediction. Collocation points need no known solution values.
- Automatic differentiation with respect to the coordinates gives the equation residual. The weighted loss combines the residual with initial, boundary and, when observations are available, data mismatches.
- The loss gradient with respect to the parameters guides the network update. The video shows a gradient-descent step as an example. The cycle repeats.
- Validation compares predictions with an analytic solution or a trusted numerical solver on points separate from training. A small residual does not guarantee a small solution error.
For the rod, validation can use the relative discrete error on an independent space-time grid:
This number summarizes the error on the chosen grid only. The maximum error and the boundary mismatch are worth reporting too, since a small average can hide a large local error. Repeating training with different random seeds and point samples shows how reproducible the result is.
Where physics-informed learning helps
A trained PINN is a differentiable function that can be evaluated at any point of the domain. This makes it convenient for problems that mix equations with incomplete data: inverse problems, data assimilation and design under physical constraints. The same loss can contain a control objective, which is how PINNs are used for optimal control.
Applications include flows reconstructed from sparse velocity measurements, transport coefficients estimated from temperature data, controlled quantum dynamics, and coupled field equations and eigenvalue problems in relativistic physics. Each needs its own choice of representation, sampling and reference checks.
For well-posed forward problems, classical finite-difference, finite-volume, finite-element and spectral solvers are the baseline to beat, and they often win on accuracy and cost. A fair comparison counts training time as well as evaluation time, and states the hardware and the accuracy reached.
Limitations that matter in practice
Training can fail even when the network is expressive enough to represent the solution. The loss terms may compete with one another, and the differential operator can make the optimization badly conditioned. Krishnapriyan and colleagues documented such failures for convection, reaction and reaction–diffusion problems, and showed that curriculum regularization and sequence-to-sequence training can recover accurate solutions.
Sharp fronts, shocks, multiscale behaviour and long time horizons are hard for the standard formulation. At a discontinuity the classical derivative does not exist, so a pointwise residual loses its meaning. While weak formulations, domain decomposition, and conservative schemes can be beneficial, their applicability hinges on the specific equation and the nature of the discontinuity.
There are also costs and blind spots. Higher-order derivatives through automatic differentiation are expensive for large batches of collocation points. A sparse sample can miss a narrow region where the error is large. If the governing equation is wrong, the physics term biases the prediction instead of correcting it. A standard deterministic PINN does not inherently offer an uncertainty estimate.
Connections to my research
The works below apply these ideas to harder problems than a diffusing rod. They solve evolution equations, learn control protocols and find eigenvalues, and each required a formulation adapted to its physics.
Gradient-annihilated PINNs for solving Riemann problems: Application to relativistic hydrodynamics
2024 · Journal article · Computer Methods in Applied Mechanics and Engineering
Introduces a weighted physics loss that reduces the influence of steep gradients when learning discontinuous solutions. Tests on relativistic Riemann problems assess how well the method captures shocks and other fluid discontinuities.
Addressing the gravitational collapse of a massless scalar field with physics-informed neural networks
2026 · Journal article · Machine Learning: Science and Technology
Compares neural architectures for scalar-field dispersion and gravitational collapse, including the threshold of black-hole formation. The study examines how network design and adaptive sampling affect accuracy and stability.
Physics-informed neural networks for an optimal counterdiabatic quantum computation
2024 · Journal article · Machine Learning: Science and Technology
Learns counterdiabatic controls from physical constraints to suppress unwanted transitions during quantum computation. A two-qubit molecular example demonstrates the joint design of control schedules and adiabatic gauge potentials.
Physics-Informed Neural Networks for Maximizing Quantum Fisher Information in Time-Dependent Many-Body Systems
2026 · Preprint · arXiv:2604.18506
Uses physics-informed neural networks to design control protocols that increase quantum Fisher information in driven spin systems. The work connects quantum dynamics and control with improved sensitivity for parameter estimation.
Kerr Quasinormal Modes without Variable Separation: A Two-Dimensional Hyperboloidal Teukolsky Solver with Physics-Informed Neural Networks
2026 · Preprint · arXiv:2608.19774
Computes the oscillation frequencies of rotating black holes with physics-informed neural networks. A two-dimensional solver preserves the coupled radial-angular structure without separating variables.
A practical starting point
Start with a problem whose solution you can check independently, such as the rod above. Write down the units, the domain and every condition before choosing a network. Track each loss term on its own, and measure the error on points that were not used for training. Sparse data, unknown coefficients and harder equations can follow once this baseline works.