Skip to content
VLASIFY™
TutorialScientific AI & machine learning

Neural operator tutorial: learning maps between functions

Updated · Scientifically reviewed by Dinkar Mishra, PhD on

Short answer

A neural operator learns a mapping between functions, for example from a PDE's coefficients, forcing or initial condition to its solution, instead of learning one solution. Once trained on pairs of inputs and solutions from a classical solver, it predicts new solutions in milliseconds. The main architectures are Fourier neural operators (FNO), which learn in Fourier space on regular grids, DeepONet (branch and trunk networks), and graph neural operators for irregular meshes. Their accuracy is only as good as the training data and must be validated on held-out cases.

Who this is for

Scientists and engineers who want fast surrogate solvers for families of PDE problems, and want to understand neural operators before using a library.

Software

PyTorch ≥ 2.0neuraloperator (optional) current release

Prerequisites

  • Comfort with PyTorch and with the PDE family you want to learn.
  • A reliable classical solver to generate training data. A neural operator inherits every error in its data, so verify the solver first; see simulation verification.

Step 1: define the operator

Write down exactly what maps to what, over which range:

  • Input function a(x)a(x): forcing, coefficients, boundary data or an initial condition.
  • Output function u(x)u(x) or u(x,tfinal)u(x, t_{final}).
  • Input distribution: the range of shapes and amplitudes you will query later. The operator is only trustworthy within this distribution.

Example: a(x)a(x) is a smooth random forcing on a periodic domain, and uu solves −u′′+u=a-u'' + u = a.

Step 2: generate data

Sample NN inputs from the distribution, solve each with the classical solver, and store pairs (ai,ui)(a_i, u_i) on a common grid. Split them into training, validation and test sets, and keep the test set untouched until the end.

Step 3: choose an architecture

ArchitectureIdeaGood for
Fourier neural operator (FNO)Layers that multiply a truncated set of Fourier modes by learned weights, plus local linear mapsRegular grids, smooth solutions, periodic or near-periodic problems
DeepONetA branch network encodes the input function at sensor points; a trunk network encodes the query location; a dot product combines themFlexible query points, scattered outputs, theory-backed universal approximation
Graph / kernel neural operatorsIntegral kernels on graphs or point cloudsIrregular meshes and geometries
U-Net and transformer variantsMulti-scale or attention-based operator approximationsProblems with sharp features or long-range coupling

See the worked Fourier neural operator example and the DeepONet tutorial.

Step 4: train

Minimise the relative L2L^2 error between predicted and true outputs. It weights small and large solutions fairly:

L=1N∑i=1N∥Gθ(ai)−ui∥2∥ui∥2.\mathcal{L} = \frac{1}{N}\sum_{i=1}^{N} \frac{\lVert \mathcal{G}_\theta(a_i) - u_i \rVert_2}{\lVert u_i \rVert_2}.

Normalise inputs and outputs, use a learning-rate schedule, and monitor validation error to stop before overfitting.

Verify

  1. Held-out test error, reported as the mean and worst case over the test set, not only the average.
  2. Physics checks. Compute the PDE residual and conserved quantities of the predictions.
  3. Out-of-distribution probes. Evaluate slightly beyond the training range to see how quickly accuracy degrades, and state the valid range explicitly.
  4. Resolution check if you will query at a different grid resolution than you trained on.

Troubleshooting

  • Low training error, high test error: too little or insufficiently diverse data, or overfitting. Add data, regularise, or reduce model size.
  • Smooth predictions miss sharp features: too few Fourier modes or too little model capacity, or an architecture unsuited to discontinuities.
  • Good average, terrible worst case: rare input types are under-represented. Sample them deliberately or use active learning; see how to train surrogate models.

Assumptions and limitations

  • Neural operators are surrogates for a specific input distribution and solver. They do not extrapolate reliably.
  • Reported accuracies in papers depend on the benchmark. Measure on your own problem.
  • Training-data generation often dominates the total cost and should be included when comparing with classical solvers.

Frequently asked questions

How is a neural operator different from a PINN?+

A standard PINN is trained to represent one solution of one problem instance, using the PDE residual as its loss. A neural operator is trained on many input–solution pairs and generalises to new inputs without retraining. Physics-informed losses can be added to neural operators too.

How much training data do I need?+

It depends on the variability of the inputs and the required accuracy; typical studies use hundreds to thousands of solved instances. Generating them with a classical solver is often the main cost, which is why active learning and careful sampling of inputs matter.

Are neural operators really resolution-independent?+

FNOs can be evaluated on grids different from the training grid, which is useful, but accuracy can degrade when resolutions differ greatly or when unresolved fine scales matter. Always validate at the resolution you will use.

Can neural operators replace my simulation code?+

They replace repeated evaluations within the trained input range (design scans, uncertainty quantification, control), not the simulation code that generates the training data. Outside the training distribution, predictions can be badly wrong without warning.

References

  1. Kovachki et al., Neural operator: learning maps between function spaces with applications to PDEs, J. Mach. Learn. Res. 24(89), 1 (2023) · Peer-reviewed article
  2. Li et al., Fourier neural operator for parametric partial differential equations (ICLR 2021) · Conference paper (arXiv)
  3. Lu et al., Learning nonlinear operators via DeepONet, Nat. Mach. Intell. 3, 218 (2021) · Peer-reviewed article
  4. neuraloperator library documentation · neuraloperator project

Want this set up and verified for you?

We install, configure and validate scientific software on your workstation, cluster or cloud, and train your team to run it.

Services listed on this page are available today. Products marked “early access” or “in development” on our platform page are not yet generally available.

Spotted an error or an outdated command? Tell us. We correct verified issues promptly.

Related guides

How Vlasify can help

Get a Quote