Ali Shahmohammadi Ph.D.
Writing Career Resume GitHub
Physics AI Series — Inverse Problems of 8

Inverse Problems
with PINNs:
Discovering Physical Parameters
from Sparse, Noisy Data

Making unknown physical constants trainable variables, recovering diffusivity, reaction rates, and material properties from 40 noisy sensor readings using physics-informed neural networks.

Jan 2026 22 min read Scientific ML Inverse Problems Notebook: 03_Advanced/07
01, Motivation

Forward vs. Inverse: The Real Engineering Question

Most introductions to PDEs present what is called the forward problem: given a governing equation with fully known coefficients and initial/boundary conditions, compute the solution field. For the 1D heat equation, this reads: given thermal diffusivity $\alpha$, solve

$$\frac{\partial u}{\partial t} = \alpha \, \frac{\partial^2 u}{\partial x^2}, \quad u(x,0) = u_0(x), \quad u(0,t) = u(1,t) = 0$$

for the temperature field $u(x,t)$. This is well-posed, and numerical methods, finite differences, finite elements, spectral methods, have been refined over decades to solve it efficiently and to guaranteed accuracy.

The inverse problem runs in the opposite direction. You have sensor measurements $\{u(x_i, t_i)\}_{i=1}^{N}$, possibly corrupted by noise, and the parameter $\alpha$ is unknown. You want to infer $\alpha$ from the data. This reversal is not merely a notational switch, it changes the problem's mathematical character entirely. Inverse problems are generically ill-posed in the sense of Hadamard: existence, uniqueness, and continuous dependence on data may all fail without additional regularization.

FORWARD PROBLEM Known α PDE solver u(x, t) Given Find Well-posed, unique solution INVERSE PROBLEM u(xᵢ, tᵢ) noisy sensors PINN +PDE Unknown α Given Find Ill-posed, needs regularization
Fig. 1, Forward vs. inverse problem structure. In the forward problem, $\alpha$ is given and $u$ is computed. In the inverse problem, noisy measurements of $u$ are used to infer the unknown $\alpha$. The PDE constraint remains central in both cases.

The inverse problem is often the real engineering question. Consider a few motivating examples:

  • Pharmaceutical dissolution: You run a USP Apparatus II paddle test and measure drug concentration at a few time points. You want the effective diffusivity $D_{eff}$ of the active pharmaceutical ingredient through the polymer matrix, a parameter that governs bioavailability and is used to design controlled-release formulations.
  • Reaction kinetics from PAT: Inline Raman spectroscopy gives you concentration-time profiles of intermediates during a synthesis step. You want the individual rate constants $k_1, k_2, k_3$ without running a full design of experiments campaign.
  • Subsurface flow: Pressure transient measurements in boreholes encode information about the permeability field $K(x,y)$ of an aquifer. Recovering $K$ from sparse pressure data is the classic groundwater inverse problem.
  • Fluid mechanics: Raissi, Yazdani, and Karniadakis (2020) demonstrated that sparse velocity measurements around a cylinder in crossflow allow recovery of the full pressure and velocity fields, including pressure gradients that are not directly measurable, "hidden fluid mechanics" [2].

In each case, the physics is not just background knowledge, it is the mechanism that makes parameter identification possible from data that would otherwise be severely underdetermined.


02, The PINN Inverse Setup

Making Parameters Trainable Variables

The key conceptual move in PINN-based inverse problems is simple but powerful: treat the unknown physical parameter as an additional trainable variable in PyTorch, optimized jointly with the network weights. The parameter is no longer a hyperparameter or an input, it is a learnable scalar that participates in the automatic differentiation graph alongside every weight and bias.

For the 1D heat equation with unknown diffusivity $\alpha^\star = 0.4$, initialized at $\alpha_{init} = 1.5$ (far from the truth), the network class becomes:

Python, PyTorch
class InversePINN(nn.Module):
    def __init__(self, alpha_init=1.5):
        super().__init__()

        # Standard network layers for u(x, t)
        self.net = nn.Sequential(
            nn.Linear(2, 64), nn.Tanh(),
            nn.Linear(64, 64), nn.Tanh(),
            nn.Linear(64, 64), nn.Tanh(),
            nn.Linear(64, 1)
        )

        # KEY: alpha as a trainable parameter, stored in log-space
        # This guarantees alpha > 0 and improves the optimization landscape
        self.log_alpha = nn.Parameter(
            torch.tensor(np.log(alpha_init), dtype=torch.float32)
        )

    def forward(self, x, t):
        inp = torch.cat([x, t], dim=1)
        return self.net(inp)

    @property
    def alpha(self):
        # Recover alpha from log-space during evaluation
        return torch.exp(self.log_alpha)

Why log-space parameterization?

Storing log(α) rather than α directly serves two purposes. First, it enforces the constraint $\alpha > 0$ unconditionally, exponentiation always returns a positive value, eliminating the need for clipping or projection steps that would break gradient flow. Second, it improves the optimization landscape. Physical parameters often span several orders of magnitude (think permeabilities from $10^{-3}$ to $10^{3}$ m²/s), and working in log-space makes the gradient-based search scale-invariant. A step of $0.1$ in log-space corresponds to a multiplicative factor of $e^{0.1} \approx 1.105$ regardless of the current magnitude of $\alpha$.

More formally, if the loss $\mathcal{L}$ is a function of $\alpha$, the gradient with respect to $\log\alpha$ is

$$\frac{\partial \mathcal{L}}{\partial \log\alpha} = \frac{\partial \mathcal{L}}{\partial \alpha} \cdot \alpha$$

This natural scaling by $\alpha$ is the continuous analog of the relative update in Adam: the effective learning rate is proportional to the current parameter value, which prevents the optimizer from taking catastrophically large absolute steps when $\alpha$ is large and tiny steps when it is small.

Sensor data and noise model

The training data consists of $N = 40$ sensor observations drawn from the true solution $u^\star(x,t)$ with additive Gaussian noise at 2% relative amplitude:

$$\tilde{u}_i = u^\star(x_i, t_i) + \epsilon_i, \quad \epsilon_i \sim \mathcal{N}\!\left(0,\, (0.02 \cdot \sigma_{u^\star})^2\right)$$

where $\sigma_{u^\star}$ is the standard deviation of the true field. This noise level is representative of high-quality inline spectroscopic measurements in a pharmaceutical manufacturing context (typically $\pm 1$–$3\%$ relative error for NIR-based concentration estimates after multivariate calibration).


03, Loss Function

Mutually Constraining Data and Physics

The combined loss has two terms that work in concert:

$$\mathcal{L}(\theta, \alpha) = \underbrace{\frac{1}{N}\sum_{i=1}^{N}\left[\hat{u}(x_i,t_i;\theta) - \tilde{u}_i\right]^2}_{\mathcal{L}_{\text{data}}} + \lambda \underbrace{\frac{1}{N_f}\sum_{j=1}^{N_f}\left[\hat{u}_t(x_j,t_j;\theta) - \alpha \,\hat{u}_{xx}(x_j,t_j;\theta)\right]^2}_{\mathcal{L}_{\text{physics}}}$$

where $\theta$ denotes all network weights and biases, $\hat{u}$ is the network output, $\hat{u}_t$ and $\hat{u}_{xx}$ are computed via automatic differentiation, and $N_f$ is the number of collocation points (typically $N_f \gg N$, here $N_f = 10{,}000$).

◆
The mutual constraint is the key insight. $\alpha$ is not just fit to match the 40 data points, it must simultaneously make those 40 points fit AND ensure that the reconstructed field $\hat{u}(x,t)$ satisfies the heat equation everywhere in the domain. These two requirements are only simultaneously satisfiable at the true parameter value $\alpha^\star$. Any other value of $\alpha$ forces a contradiction: either the physics is violated, or the data is not fitted.

Backpropagation computes gradients with respect to both $\theta$ and $\log\alpha$ simultaneously. In PyTorch, both are nn.Parameter objects registered in the same module, so the optimizer sees them as part of the same parameter group. The gradient of the physics loss with respect to $\log\alpha$ carries information about which direction to move $\alpha$ to reduce the PDE residual, this is the signal that drives parameter identification.

Python, training loop
def train_step(model, optimizer, x_data, t_data, u_data, x_f, t_f, lam=1.0):
    optimizer.zero_grad()

    # --- Data loss ---
    u_pred = model(x_data, t_data)
    loss_data = nn.MSELoss()(u_pred, u_data)

    # --- Physics loss (PDE residual) ---
    x_f.requires_grad_(True)
    t_f.requires_grad_(True)
    u_f = model(x_f, t_f)

    u_t = torch.autograd.grad(u_f.sum(), t_f, create_graph=True)[0]
    u_x = torch.autograd.grad(u_f.sum(), x_f, create_graph=True)[0]
    u_xx = torch.autograd.grad(u_x.sum(), x_f, create_graph=True)[0]

    residual = u_t - model.alpha * u_xx   # model.alpha = exp(log_alpha)
    loss_physics = (residual**2).mean()

    loss = loss_data + lam * loss_physics
    loss.backward()
    optimizer.step()

    return loss_data.item(), loss_physics.item(), model.alpha.item()

04, Why Physics Regularizes

Structural Constraint vs. Tikhonov Regularization

A natural question: why not simply fit a neural network to the 40 data points without any physics term, and then estimate $\alpha$ from the fitted function by numerical differentiation? The answer is that 40 points in a continuous domain are radically insufficient to uniquely determine a smooth function, let alone its second spatial derivative. An unconstrained network will interpolate the data and produce a $u(x,t)$ that may be arbitrarily wiggly, making $\partial^2 u / \partial x^2$ meaningless.

Classical regularization (Tikhonov, $L^2$ penalty on weights or on derivatives of $u$) enforces smoothness, it prevents the fit from being too wiggly. But smoothness is a geometric property unrelated to the physics. A smooth but physically inadmissible field can still yield a wildly wrong estimate of $\alpha$.

The physics loss enforces a structural constraint: the fitted field must belong to the solution manifold of the heat equation for some value of $\alpha$. This is a far stronger requirement than smoothness. The solution manifold of the heat equation is a much smaller subset of all smooth functions, it is parametrized by $\alpha$ (and the initial/boundary conditions), so fitting onto it simultaneously constrains both the field and the parameter.

△
Identifiability requires coverage. If all 40 sensors are at a single spatial location, the problem loses spatial gradient information and $\alpha$ becomes unidentifiable, many diffusivities produce the same time trace at a single point. This is the observability condition: the sensor layout must provide sufficient spatial and temporal coverage to distinguish the parameter from all other possible parameter values.

05, Training Results

Alpha Converges: 1.5 → 0.4 over 12,000 Epochs

The training log from notebook 07_inverse_parameter_estimation.ipynb shows the convergence trajectory. The optimizer is L-BFGS for the final phase (after an Adam warm-up for 3,000 epochs), which is standard for PINN inverse problems because L-BFGS exploits second-order information and converges much faster once the network is in a good basin.

Epoch 0 | loss: 4.2831e-01 | alpha: 1.5000 | err: 275.0% Epoch 500 | loss: 1.8743e-02 | alpha: 1.2147 | err: 203.7% Epoch 1000 | loss: 6.2104e-03 | alpha: 0.9832 | err: 145.8% Epoch 2000 | loss: 1.1045e-03 | alpha: 0.7315 | err: 82.9% Epoch 3000 | loss: 3.8812e-04 | alpha: 0.5941 | err: 48.5% Epoch 5000 | loss: 8.2017e-05 | alpha: 0.4612 | err: 15.3% Epoch 8000 | loss: 1.4203e-05 | alpha: 0.4118 | err: 2.95% Epoch 10000 | loss: 6.8740e-06 | alpha: 0.4031 | err: 0.78% Epoch 12000 | loss: 4.1293e-06 | alpha: 0.4007 | err: 0.18% Converged. True alpha: 0.4000 | Recovered alpha: 0.4007 | Relative error: 0.18%
0.40 0 3k 5k 8k 12k Epoch 1.50 1.20 0.98 0.73 Estimated α̂ Estimated α̂ True α* = 0.40 α̂₀ = 1.5 0.4007
Fig. 2, Parameter convergence trajectory. Starting at $\hat{\alpha}_0 = 1.5$, the estimate descends toward the true value $\alpha^\star = 0.4$ over 12,000 epochs. Final relative error: 0.18%. The curve is smooth because $\log\alpha$ is the actual optimization variable; the plotted $\hat{\alpha} = e^{\widehat{\log\alpha}}$ inherits this smoothness.

06, Sensor Placement & Identifiability

Not All Sensor Configurations Are Equally Informative

x (spatial coordinate) t (time) t = T t = 0 x=0 x=1 40 noisy sensors true field u(x,t), dark = high temperature
Fig. 3, Sensor placement in the $(x, t)$ domain. The 40 sensors are scattered across both space and time, providing coverage of the spatial gradient structure (essential for estimating diffusivity). Clustering all sensors at a single $x$ location would make $\alpha$ unidentifiable from this data alone.

Observability and the Fisher Information Matrix

The classical framework for assessing identifiability is the Fisher Information Matrix (FIM). For a parameter vector $\boldsymbol{\theta}$ given noisy observations $\mathbf{y} = \mathbf{f}(\boldsymbol{\theta}) + \boldsymbol{\epsilon}$, $\boldsymbol{\epsilon} \sim \mathcal{N}(0, \sigma^2 I)$, the FIM is

$$\mathcal{I}(\boldsymbol{\theta}) = \frac{1}{\sigma^2} \mathbf{J}^\top \mathbf{J}$$

where $\mathbf{J}_{ij} = \partial f_i / \partial \theta_j$ is the Jacobian of the model outputs with respect to parameters. A parameter is identifiable if and only if $\mathcal{I}$ is positive definite. For the single parameter $\alpha$, this reduces to asking whether $\sum_i (\partial u / \partial \alpha)^2 > 0$, i.e., whether the model output is sensitive to the parameter at the observed locations. The PINN computes this sensitivity automatically via backpropagation.

The inverse of the FIM gives the Cramér–Rao lower bound on parameter estimation variance: $\text{Var}(\hat{\alpha}) \geq 1/\mathcal{I}(\alpha)$. This bound is achievable by the maximum likelihood estimator asymptotically, and the PINN inverse problem can be interpreted as an approximate MLE when the noise is Gaussian and the physics loss is used as the likelihood rather than a penalty.


07, ODE Inverse Problems

Recovering Reaction Rate Constants from Sparse Concentrations

The inverse PINN framework extends naturally to ODE systems. Consider the consecutive reaction A → B → C with mass-action kinetics:

$$\frac{d[A]}{dt} = -k_1 [A], \qquad \frac{d[B]}{dt} = k_1 [A], k_2 [B], \qquad \frac{d[C]}{dt} = k_2 [B]$$

with initial conditions $[A](0) = 1$, $[B](0) = [C](0) = 0$. Suppose the true constants are $k_1^\star = 0.3$, $k_2^\star = 0.7$, and you have only 15 noisy concentration measurements for each species at scattered time points. The PINN inverse setup:

Python, reaction kinetics inverse problem
class KineticsInversePINN(nn.Module):
    def __init__(self, k1_init=1.0, k2_init=1.0):
        super().__init__()
        # Three networks: one per species concentration
        self.net_A = make_mlp(1, 64, 4, 1)
        self.net_B = make_mlp(1, 64, 4, 1)
        self.net_C = make_mlp(1, 64, 4, 1)

        # Both rate constants learnable, stored in log-space
        self.log_k1 = nn.Parameter(torch.tensor(np.log(k1_init)))
        self.log_k2 = nn.Parameter(torch.tensor(np.log(k2_init)))

    def physics_residuals(self, t):
        t = t.requires_grad_(True)
        A, B, C = self.net_A(t), self.net_B(t), self.net_C(t)
        k1, k2 = torch.exp(self.log_k1), torch.exp(self.log_k2)

        dA = grad(A, t)[0]; dB = grad(B, t)[0]; dC = grad(C, t)[0]

        r1 = dA + k1 * A                  # dA/dt = -k1*A
        r2 = dB - k1 * A + k2 * B         # dB/dt = k1*A - k2*B
        r3 = dC - k2 * B                  # dC/dt = k2*B
        return r1, r2, r3

The total loss is $\mathcal{L} = \mathcal{L}_{data,A} + \mathcal{L}_{data,B} + \mathcal{L}_{data,C} + \lambda(\mathcal{L}_{phys,A} + \mathcal{L}_{phys,B} + \mathcal{L}_{phys,C})$. With this setup and 4,000 L-BFGS steps, the notebook recovers $\hat{k}_1 = 0.298 \pm 0.004$ and $\hat{k}_2 = 0.703 \pm 0.006$ from 45 noisy data points, relative errors of 0.7% and 0.4% respectively.

✓
Practical implication for pharmaceutical development. This capability replaces a traditional design of experiments campaign. Recovering $k_1$ and $k_2$ classically requires 10–20 experiments across different initial concentrations and temperatures (each a batch run with full analytical workup). The PINN inverse approach recovers both parameters from a single run with inline PAT monitoring, a factor of 10–20x reduction in experimental burden, consistent with the FDA's PAT initiative objectives [7, 8].

08, Practical Considerations

Making Inverse PINNs Work in Practice

Loss scaling

The data loss and physics loss typically have very different magnitudes at initialization. If $\mathcal{L}_{physics} \gg \mathcal{L}_{data}$, the optimizer essentially ignores the data, and the network fits the PDE for the wrong parameter. A simple but effective heuristic: compute both losses at initialization and set $\lambda = \mathcal{L}_{data}^{(0)} / \mathcal{L}_{physics}^{(0)}$. This normalizes both terms to the same order of magnitude at the start of training, preventing one from dominating.

Initialization range

For inverse problems, the choice of $\alpha_{init}$ matters more than in the forward case. If $\alpha_{init}$ is too far from the truth in log-space (say, $|\log\alpha_{init} - \log\alpha^\star| > 3$), the physics loss landscape near the true parameter can be lost in a flat region, and the optimizer converges to a local minimum. A practical strategy: run a coarse grid search over 5–10 values of $\alpha_{init}$ spanning 2–3 decades, identify which gives the lowest combined loss after 500 epochs, and use that as the initialization for the full run. This is cheap because 500 epochs is fast, and it dramatically improves robustness.

Checking identifiability before running

Before committing to a full training run, estimate the sensitivity $\partial u / \partial \alpha$ at the proposed sensor locations using the analytic solution (if available) or a forward PINN with a perturbed $\alpha$. If the sensitivity is near zero everywhere, the parameter is not recoverable from those sensor positions regardless of how long you train. This pre-check takes minutes and prevents wasted computation.

Uncertainty quantification

A point estimate $\hat{\alpha}$ is insufficient for engineering decisions. Three methods are in common use:

Method Description Cost Best for
Laplace approximation Fit a Gaussian to the loss landscape at the MAP estimate using the Hessian Low (1 Hessian computation) Near-Gaussian posteriors
Ensemble PINNs Train $M$ independent networks with different random seeds; use spread of $\hat{\alpha}_m$ as uncertainty $M\times$ training cost Non-Gaussian, multimodal
Bayesian PINN (B-PINN) Treat all weights and $\alpha$ as random variables; approximate posterior via HMC or variational inference Very high Full posterior needed
MC Dropout Enable dropout at inference; average $T$ stochastic forward passes Low (one network) Quick confidence estimates

09, Pharmaceutical Applications

PAT and the Real-Time Release Testing Paradigm

The FDA's Process Analytical Technology (PAT) guidance (2004) [7] defines PAT as "a system for designing, analyzing, and controlling manufacturing through timely measurements of critical quality and performance attributes of raw and in-process materials and processes, with the goal of ensuring final product quality." This is precisely the problem class that PINN inverse methods are designed to address.

Modern PAT installations include inline NIR and Raman spectrometers, focused beam reflectance measurement (FBRM) for particle size, and inline HPLC. These instruments generate high-frequency concentration-time profiles with a precision of $\pm 1$–$3\%$ relative error. The PINN inverse framework can exploit this data to recover kinetic parameters in near-real-time, closing the loop between measurement and process understanding.

The pharmaceutical development context under ICH Q8(R2) [8] requires a Design Space to be established for critical process parameters (CPPs). Traditionally, this requires a formal DoE, a resource-intensive campaign that may require 16–50 batch runs at varied process conditions. Using PINN-based parameter estimation, a process engineer can recover the kinetic model parameters from a single batch run (with sufficient PAT coverage) and then use the calibrated mechanistic model to compute the Design Space analytically. This is a fundamentally different paradigm: model-enabled rather than empirically enumerated Design Space.

◆
Historical note: Psichogios and Ungar (1992). The use of neural networks to identify parameters in mechanistic ODE models was proposed over 30 years ago by Psichogios and Ungar [9], who embedded neural networks as unknown rate terms inside biochemical reactor ODEs. PINN inverse problems are the natural extension of this "hybrid semi-parametric" approach, instead of replacing an unknown kinetic term with a neural network, the entire field $u(x,t)$ is represented by the network, and the physics provides the constraint that drives parameter identification.

References

Bibliography

[1]Raissi, M., Perdikaris, P., & Karniadakis, G.E. (2019). Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational Physics, 378, 686–707.
[2]Raissi, M., Yazdani, A., & Karniadakis, G.E. (2020). Hidden fluid mechanics: Learning velocity and pressure fields from flow visualizations. Science, 367(6481), 1026–1030.
[3]Tartakovsky, A.M., Marrero, C.O., Perdikaris, P., Tartakovsky, G.D., & Barajas-Solano, D. (2020). Physics-informed deep neural networks for learning parameters and constitutive relationships in subsurface flow problems. Water Resources Research, 56(5), e2019WR026731.
[4]Hadamard, J. (1902). Sur les problèmes aux dérivées partielles et leur signification physique. Princeton University Bulletin, 49–52.
[5]Bard, Y. (1974). Nonlinear Parameter Estimation. Academic Press, New York.
[6]Yang, L., Meng, X., & Karniadakis, G.E. (2021). B-PINNs: Bayesian physics-informed neural networks for forward and inverse PDE problems with noisy data. Journal of Computational Physics, 425, 109913.
[7]U.S. Food and Drug Administration. (2004). Guidance for Industry: PAT, A Framework for Innovative Pharmaceutical Development, Manufacturing, and Quality Assurance. FDA, Rockville, MD.
[8]International Council for Harmonisation. (2009). ICH Q8(R2): Pharmaceutical Development. ICH Harmonised Tripartite Guideline.
[9]Psichogios, D.C. & Ungar, L.H. (1992). A hybrid neural network–first principles approach to process modeling. AIChE Journal, 38(10), 1499–1511.
[10]Rackauckas, C., Ma, Y., Martensen, J., Warner, C., Zubov, K., Supekar, R., Skinner, D., & Ramadhan, A. (2020). Universal differential equations for scientific machine learning. arXiv:2001.04385.
Notebook — Inverse Parameter Estimation View notebook on GitHub Open in Colab

← Previous: Burgers & Reaction PDEs Next: Adaptive Sampling & Training Strategies →

Ali Shahmohammadi, Ph.D.

Associate Director, Applied AI Engineering & Scientific Data

Writing Career Resume GitHub LinkedIn
© 2026 Ali Shahmohammadi, Ph.D. Back to top ↑