Operator learning
A PINN (Physics-Informed Neural Network) solves one equation. A neural operator learns the whole solver — give it a new input and it returns the solution in milliseconds.
A function takes a number and returns a number. An operator takes a whole function and returns another function. The map "heat source in a rod ↦ temperature profile" is an operator: the input is a curve, the output is a curve. Operator learning trains a network on many (input, solution) pairs produced by a classical solver, so that afterwards it can predict the solution for new inputs without running the solver.
- what an operator is, and the solution operator of a PDE (Partial Differential Equation);
- how a linear solution operator is a matrix (the Green's function) that can be learned from data;
- the DeepONet (Deep Operator Network) and Fourier neural operator architectures;
- where surrogate models pay off, and their limits.
An operator takes a whole function and returns a function. Take the rod problem $-u'' = f$ with $u(0) = u(1) = 0$, and the simplest input, a constant heat source $f(x) = c$. The solution is the parabola $$u(x) = \frac{c}{2}\,x(1 - x) \qquad (\text{check: } u'' = -c).$$ So the solution operator turns the flat line $f = c$ into a parabola with peak $c/8$. Double the heating and the temperature doubles; add two heat sources and the temperatures add. Such an operator is linear, and that is exactly why a matrix (Section 2) can learn it. A neural operator learns maps like $f \mapsto u$ for far more complicated, nonlinear problems.
1. Operators and solution operators

Let $\mathcal U$ and $\mathcal V$ be spaces of functions (e.g. continuous functions on $[0,1]$). An operator is a map $\mathcal G: \mathcal U \to \mathcal V$, $f \mapsto \mathcal G(f)$. It is linear if $\mathcal G(\alpha f + \beta g) = \alpha\mathcal G(f) + \beta\mathcal G(g)$.
Kreyszig, Introductory Functional Analysis with Applications, Wiley (1978), chapter 2.Examples: differentiation $f \mapsto f'$; integration $f \mapsto \int_0^x f$; and, most importantly here, the solution operator of a PDE. For $$-u'' = f \ \text{on } (0,1), \qquad u(0) = u(1) = 0,$$ the solution operator is $\mathcal G: f \mapsto u$. It has an explicit form, $$u(x) = \mathcal G(f)(x) = \int_0^1 G(x, y)\,f(y)\,dy, \qquad G(x,y) = \min(x,y)\,\big(1 - \max(x,y)\big),$$ where $G$ is the Green's function: the response at $x$ to a unit point source at $y$.
Evans, Partial Differential Equations, 2nd ed., AMS (2010), chapter 2.2.4 "Green's function"; Stakgold & Holst, Green's Functions and Boundary Value Problems, 3rd ed., Wiley (2011).In a reservoir, the permeability field $k(x)$ is uncertain. Engineers run thousands of simulations for different $k$ to quantify risk or match production history. The map $k \mapsto p$ (permeability ↦ pressure, from $-\nabla\cdot(k\nabla p) = f$) is a nonlinear operator. A neural operator trained on a few thousand simulations can then evaluate new permeability fields almost instantly — the benchmark "Darcy flow" problem of the FNO (Fourier Neural Operator) paper, and the idea behind surrogates for CO₂ storage (Wen et al., "U-FNO", Adv. Water Resour. 163, 2022, 104180).
2. Learning a solution operator from data
On a grid with $n$ points, a linear solution operator is just an $n\times n$ matrix $W$ with $\mathbf u = W\mathbf f$ (for our problem $W$ is the inverse of the finite-difference matrix of Chapter 4). If we collect training pairs $(\mathbf f_m, \mathbf u_m)$ from a solver, we can find $W$ by least squares: $$\min_W \sum_{m=1}^{M}\big\|W\mathbf f_m - \mathbf u_m\big\|^2.$$ With enough varied examples, $W$ becomes the discrete Green's function — the operator itself has been learned from data. Try it:
Real problems are nonlinear and the inputs live in high dimensions, so the matrix is replaced by a neural network that maps functions to functions. Two architectures dominate.
3. Operator explorer: learn the solver from examples
Here is operator learning with nothing hidden. On a grid of 41 points, the solution operator of $-u'' = f$, $u(0)=u(1)=0$, is just a $39\times39$ matrix $G$ — a discrete Green's function. We pretend not to know it. We generate $N$ random forcings $f_k$, compute their solutions $u_k$ once with a classical solver, and fit the matrix by least squares: $G \approx \arg\min \sum_k \|G f_k - u_k\|^2$. Then we test the learned operator on forcings it never saw.
For linear problems a matrix is enough. For nonlinear problems ($-u'' + u^3 = f$, Navier–Stokes, reservoirs), the map $f \mapsto u$ is nonlinear, and DeepONet and the Fourier neural operator replace the matrix by neural networks — the next two sections.
4. DeepONet
Let $\sigma$ be a continuous non-polynomial function, $V$ a compact set of continuous functions on a compact set $K_1$, and $\mathcal G$ a continuous (possibly nonlinear) operator from $V$ into continuous functions on a compact set $K_2$. For every $\varepsilon > 0$ there exist sensors $x_1,\dots,x_m \in K_1$ and constants such that $$\Big|\mathcal G(f)(y) - \sum_{k=1}^{p}\underbrace{\sum_{i=1}^{n} c_i^k\,\sigma\Big(\sum_{j=1}^{m}\xi_{ij}^k f(x_j) + \theta_i^k\Big)}_{\text{branch: depends on } f}\ \underbrace{\sigma(\mathbf w_k\cdot y + \zeta_k)}_{\text{trunk: depends on } y}\Big| < \varepsilon$$ for all $f \in V$ and $y \in K_2$.
Chen & Chen, "Universal approximation to nonlinear operators by neural networks with arbitrary activation functions and its application to dynamical systems", IEEE Trans. Neural Networks 6(4) (1995) 911–917.DeepONet turns this theorem into an architecture: a branch net reads the input function at $m$ sensors and outputs $p$ coefficients $b_k(f)$; a trunk net reads the query location $y$ and outputs $p$ basis functions $t_k(y)$; the prediction is their dot product $$\mathcal G_\theta(f)(y) = \sum_{k=1}^{p} b_k\big(f(x_1),\dots,f(x_m)\big)\; t_k(y) + b_0.$$
Lu, Jin, Pang, Zhang & Karniadakis, "Learning nonlinear operators via DeepONet based on the universal approximation theorem of operators", Nature Machine Intelligence 3 (2021) 218–229.5. Fourier neural operator
The FNO stacks layers that act on whole functions. Each layer lifts the current function $v(x)$ to $$v_{\ell+1}(x) = \sigma\Big(W v_\ell(x) + \mathcal F^{-1}\big(R_\ell \cdot \mathcal F(v_\ell)\big)(x)\Big),$$ where $\mathcal F$ is the Fourier transform (computed with the FFT), $R_\ell$ is a learned complex weight applied to the lowest $k_{\max}$ Fourier modes, and $W$ is a pointwise linear map. Multiplying in Fourier space is a global convolution — exactly how Green's functions act on translation-invariant problems.
Li, Kovachki, Azizzadenesheli, Liu, Bhattacharya, Stuart & Anandkumar, "Fourier neural operator for parametric partial differential equations", ICLR 2021; Kovachki, Li, Liu, Azizzadenesheli, Bhattacharya, Stuart & Anandkumar, "Neural operator: learning maps between function spaces with applications to PDEs", JMLR 24(89) (2023) 1–97.| PINN | DeepONet | FNO | |
|---|---|---|---|
| Learns | one solution $u$ | operator $f \mapsto u$ | operator $f \mapsto u$ |
| Needs solver data? | no (equation only) | yes, usually | yes |
| Input format | coordinates | values at fixed sensors | values on a regular grid |
| Cost of a new case | retrain | one forward pass | one forward pass |
| Strength | inverse problems, sparse data | flexible query points | resolution-independent, fast with FFT |
The two ideas combine: physics-informed DeepONets add the PDE residual to the operator loss so that fewer solver runs are needed (Wang, Wang & Perdikaris, Science Advances 7(40), 2021, eabi8605), and physics-informed neural operators do the same for FNO (Li et al., ACM/JMS J. Data Sci. 1(3), 2024). Large neural operators are now used for weather forecasting (Pathak et al., "FourCastNet", arXiv:2202.11214, 2022).
A surrogate is only as good as its training data: it may fail silently on inputs unlike those it saw (as in the simulation). Training needs many solver runs, so it pays off only when the operator will be evaluated many more times — optimisation, uncertainty quantification, real-time control. Always validate against a trusted solver.
6. Code you can run
5.1 Learning the Green's function by least squares (runs here)
import numpy as np
import matplotlib.pyplot as plt
# Learn the solution operator of -u'' = f, u(0)=u(1)=0 from examples (f, u).
n = 63; h = 1 / (n + 1); x = np.linspace(h, 1 - h, n)
K = (2 * np.eye(n) - np.eye(n, k=1) - np.eye(n, k=-1)) / h**2 # finite-difference matrix
solve = lambda f: np.linalg.solve(K, f) # the "expensive" solver
rng = np.random.default_rng(0)
def random_forcing(): # smooth random f
k = np.arange(1, 33)
return (rng.normal(size=32) / k) @ np.sin(np.pi * np.outer(k, x))
M = 200 # training pairs
Fs = np.array([random_forcing() for _ in range(M)]) # (M, n)
Us = np.array([solve(f) for f in Fs]) # (M, n)
# least squares: find W with U ~ F W^T (a linear operator, i.e. a matrix)
W = np.linalg.lstsq(Fs, Us, rcond=None)[0].T
f_test = np.exp(-((x - 0.3) / 0.05) ** 2) # a forcing never seen
u_pred, u_true = W @ f_test, solve(f_test)
print("relative error on unseen forcing: %.2e" % (np.linalg.norm(u_pred - u_true) / np.linalg.norm(u_true)))
G = np.minimum.outer(x, x) * (1 - np.maximum.outer(x, x)) * h # exact Green's function (scaled)
print("max difference between learned W and Green's function: %.2e" % np.abs(W - G).max())
fig, ax = plt.subplots(1, 2, figsize=(9, 3.6))
ax[0].imshow(W, origin="lower", extent=[0, 1, 0, 1]); ax[0].set_title("learned operator W")
ax[1].plot(x, u_true, "k--", label="solver"); ax[1].plot(x, u_pred, label="learned"); ax[1].legend()
plt.tight_layout(); plt.show()
5.2 A DeepONet in PyTorch
The same operator learned by a DeepONet from 2000 random forcings. Tested with PyTorch 2.x: relative $L^2$ error of about 2% on unseen forcings after 5000 Adam steps (under a minute on a laptop CPU).
# DeepONet learning the solution operator G: f -> u of -u'' = f on (0,1), u(0) = u(1) = 0
import torch, math
torch.manual_seed(0)
m = 50 # sensors where f is observed
xs = torch.linspace(0, 1, m)
def sample_f(n): # random smooth forcings: sums of sine modes
k = torch.arange(1, 9).float()
c = torch.randn(n, 8) / k # smaller amplitude for higher modes
return c, lambda x: (c[:, :, None] * torch.sin(math.pi * k[None, :, None] * x)).sum(1)
def solve_u(c, y): # exact solution: each mode divided by (k pi)^2
k = torch.arange(1, 9).float()
return (c[:, :, None] / (k[None, :, None] * math.pi) ** 2 * torch.sin(math.pi * k[None, :, None] * y)).sum(1)
c, f = sample_f(2000); F = f(xs) # branch input: (2000, 50)
y = torch.rand(2000, 30) # 30 random query points per sample
U = torch.stack([solve_u(c[i:i+1], y[i])[0] for i in range(2000)]) # targets (2000, 30)
p = 40
branch = torch.nn.Sequential(torch.nn.Linear(m, 100), torch.nn.Tanh(), torch.nn.Linear(100, p))
trunk = torch.nn.Sequential(torch.nn.Linear(1, 100), torch.nn.Tanh(), torch.nn.Linear(100, p), torch.nn.Tanh())
bias = torch.nn.Parameter(torch.zeros(1))
def G(F, y): # G(f)(y) = sum_k b_k(f) t_k(y) + bias
b = branch(F) # (n, p)
t = trunk(y.reshape(-1, 1)).reshape(*y.shape, p) # (n, q, p)
return ((b[:, None, :] * t).sum(-1) + bias) / 10 # outputs are O(0.1): rescale
opt = torch.optim.Adam(list(branch.parameters()) + list(trunk.parameters()) + [bias], lr=1e-3)
for step in range(5001):
i = torch.randint(0, 2000, (128,))
loss = (G(F[i], y[i]) - U[i]).pow(2).mean()
opt.zero_grad(); loss.backward(); opt.step()
if step % 1000 == 0: print(f"step {step:5d} loss {loss.item():.2e}")
c_t, f_t = sample_f(200); yq = torch.linspace(0, 1, 101).repeat(200, 1) # unseen test forcings
u_true = torch.stack([solve_u(c_t[i:i+1], yq[i])[0] for i in range(200)])
rel = (G(f_t(xs), yq) - u_true).norm() / u_true.norm()
print(f"relative L2 test error on 200 unseen forcings: {rel.item():.2%}")
Libraries: DeepXDE (DeepONet), neuraloperator (FNO; github.com/neuraloperator/neuraloperator).
You trained a neural operator on forcings that are all smooth. A user gives it a forcing with a sharp spike. What should you expect?
Right. Learned operators interpolate within the kind of inputs they were trained on; out-of-distribution inputs need validation against a solver.
What does the trunk network of a DeepONet take as input?
Right: the branch encodes the input function; the trunk encodes the query location; their dot product gives $\mathcal G(f)(y)$.
- An operator maps functions to functions; a PDE's solution operator maps data (sources, coefficients, initial states) to solutions.
- Linear solution operators are Green's functions — matrices on a grid — and can be learned by least squares.
- DeepONet: branch (input function) × trunk (query point), backed by the Chen–Chen theorem.
- FNO: learned multiplication in Fourier space, a global convolution.
- Surrogates pay off when the solver must be called many times; they can fail outside the training distribution.
Further reading
- L. Lu, P. Jin, G. Pang, Z. Zhang & G. E. Karniadakis, Nature Machine Intelligence 3 (2021) 218–229 — DeepONet.
- Z. Li et al., "Fourier neural operator for parametric partial differential equations", ICLR 2021.
- N. Kovachki et al., "Neural operator: learning maps between function spaces", JMLR 24(89) (2023).
- T. Chen & H. Chen, IEEE Trans. Neural Networks 6(4) (1995) 911–917.
- S. Wang, H. Wang & P. Perdikaris, "Learning the solution operator of parametric PDEs with physics-informed DeepONets", Science Advances 7(40) (2021) eabi8605.
- N. Boullé & A. Townsend, "A mathematical guide to operator learning", Handbook of Numerical Analysis 25 (2024) 83–125 (arXiv:2312.14688).