In the effort to bridge the gap between deep learning and the physical sciences, researchers have traditionally relied on "soft" constraints. In standard Physics-Informed Neural Networks (PINNs), physical laws like the conservation of mass or energy are added as penalty terms to the loss function. While intuitive, this approach forces the model to perform a difficult balancing act: it must minimize the error against data while simultaneously trying to satisfy differential equations. Often, the optimization process compromises on the physics to fit the noise in the data.
A growing body of research is shifting this paradigm toward hard architectural constraints. Instead of asking the model to learn to obey physics, researchers like Chuizheng Meng and Yan Liu argue for embedding physical laws directly into the neural network's structure. By making physical violations mathematically impossible within the architecture itself, these models achieve a level of consistency and stability that soft-penalty methods cannot match.
The Problem with Soft Penalties
When physical laws are enforced via loss functions, they act as mere suggestions. During training, the gradient descent process may prioritize the data-fitting term over the physics term, leading to "physically impossible" predictions—such as mass appearing out of nowhere or energy disappearing in a closed system.
Furthermore, as Geoffrey Négiar points out, balancing these competing loss components requires extensive hyperparameter tuning. If the physics penalty is too weak, the model ignores the laws; if it is too strong, the model fails to learn from the data. Hard constraints eliminate this "optimization tug-of-war" by restricting the model’s hypothesis space to only those functions that are physically valid from the outset.
Baking Physics into the Architecture
The core intuition behind this research direction is to design layers that are "physically consistent by construction." This is achieved through several distinct mechanisms:
- Divergence-Free Kernels: To enforce mass conservation in fluid dynamics, Kim Bente and Fabio Ramos developed divergence-free neural networks (dfNNs). By using specific mathematical structures in the output layer, the model is forced to produce vector fields where the divergence is zero to machine precision, ensuring that "what goes in must come out."
- Thermodynamic Manifolds: In multi-physics systems, Muhammad Zakwan and Loris Di Natale introduced PC-NODEs. These models leverage the Irreversible port-Hamiltonian Systems (IPHS) framework to ensure that energy conservation and entropy growth are hard-coded into the state-space transitions.
- Symmetry and Invariance: Atiyo Ghosh and Mario Dagrada developed Harmonic Neural Networks that use complex-differentiable activation functions. This architectural choice ensures the model's output satisfies Laplace’s equation by design, making it impossible for the network to represent a non-harmonic function.
Why Hard Constraints Work: The Manifold Intuition
To understand why this works, imagine the space of all possible functions a neural network could represent. A standard network can explore this entire "universe." A PINN with a soft penalty tries to pull the model toward a small "physical" region within that universe, but it can still wander off.
Hard constraints, such as those used in the Riemann Tensor Neural Networks (RTNNs) by Anas Jnini and Flavio Vella, effectively build a "rail" or a manifold. The model is mathematically incapable of leaving this manifold. Because the search space is significantly smaller and strictly physical, the model requires far less data to find the correct solution. Han Wan and Hao Sun demonstrated this in PeSANet, where their architecture achieved high accuracy with as few as two training trajectories.
Stability in Long-Term Forecasting
One of the most significant advantages of this approach is stability. In spatiotemporal systems, small physical errors in a "soft" model can accumulate over time, leading to "explosions" or unphysical drift in long-term simulations.
By using "hard-encoded" structures like the $\Pi$-blocks in Hao Sun’s PeRCNN (Hard Encoding of Physics for Learning Spatiotemporal Dynamics), the model maintains physical integrity across thousands of time steps. Similarly, Fabricio Arend Torres showed that Lagrangian Flow Networks maintain mass conservation even as the dimensionality of the problem increases, a scenario where soft constraints typically fail.
Conclusion
The shift from Physics-Informed Machine Learning as an optimization problem to an architectural design problem represents a fundamental maturation of the field. By treating physical laws as "hard" structural requirements, researchers are creating AI models that don't just mimic the appearance of physical systems but are governed by the same immutable laws as the reality they simulate.