Foundations to Frontier
Tests
J. Scientific Machine Learning › J4 Neural Operators

DeepONet: branch and trunk networks

DeepONet writes a learned operator as a dot product: a branch network reads the input function at a fixed set of sensors and returns coefficients, a trunk network takes the output location and returns basis functions, and the prediction is their sum of products. This page builds a DeepONet for a nonlinear ODE, with a POD trunk and linear or quadratic branches, and measures what limits its accuracy: the number of sensors, the expressiveness of the branch, the trunk basis and the input distribution.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Two networks, one dot product

To predict a whole solution curve from a whole input curve, DeepONet splits the job in two. One network, the branch, looks at the input at a handful of fixed points, called sensors, and produces a short list of numbers. A second network, the trunk, takes a location y and produces a list of the same length. Multiply the two lists entry by entry and add them up: that is the prediction at y. The trunk learns a set of shapes, the branch learns how much of each shape a given input needs.

Neural operator lab
DeepONet with 16 sensors (yellow) and 8 trunk functions sin(kπx): median test error 2.12%. Too few sensors cannot see the source; too few trunk functions cannot represent the solution.
Why engineers care

DeepONet has been used for fast predictions of fluid flows, battery behaviour, fracture and multiphysics problems, often trained on a few thousand solver runs.

📝 Quick check (Level 0)
0/3 answered
  1. 1. The branch network reads…
  2. 2. The trunk network takes…
  3. 3. The prediction is…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Form: G_θ(u)(y) = b_0 + Σ_k b_k(u(x_1), …, u(x_m)) t_k(y), with branch outputs b_k and trunk outputs t_k, k = 1…p (Lu et al., 2021).
  • Sensors: the branch sees u only at m fixed points x_1…x_m, the same for every input. What the sensors cannot resolve, the model cannot use.
  • Trunk: a network in y, or a fixed basis. POD-DeepONet (Lu et al., 2022) uses the leading principal components of the training outputs as trunk functions, so only the branch is learned.
  • Output anywhere: the trunk can be evaluated at any y, so outputs are continuous functions; the input side is tied to the sensor layout.
  • Training: minimise the squared error between G_θ(u_i)(y_j) and the data over input functions i and output points j; with a fixed trunk this is a regression problem for the branch.
  • Theory: Chen and Chen (1995) showed that the branch–trunk form can approximate any continuous operator on a compact set of inputs.
📝 Quick check (Level 1)
0/3 answered
  1. 1. POD-DeepONet takes its trunk functions from…
  2. 2. The branch input has a fixed size because…
  3. 3. DeepONet outputs can be evaluated…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

A nonlinear ODE operator and its POD basis

Exercise 1.

  • Random input functions u(x) = 1 + Σ_k (a_k cos 2πkx + b_k sin 2πkx)/k with 10 modes.
  • The operator u ↦ s with s′ = −s² + u, s(0) = 0, solved by RK4 on 101 points and checked against √c·tanh(√c·x) for constant u = c.
  • Sensor sampling and the POD trunk: how much output variance 1, 4 and 12 modes hold.

Practice.

  • Choose sensors to resolve the inputs: the branch cannot use detail between sensors; check accuracy against the number of sensors.
  • Start with a POD trunk when outputs share a grid; it is cheap, orthonormal and gives an error floor you can compute before training.
  • Normalise inputs and outputs, and train on many input functions times a subset of output points per step.
  • Test outside the training range of input amplitudes and shapes; DeepONets extrapolate poorly.
  • Tools: DeepXDE (DeepONet, POD-DeepONet, MIONet), neuraloperator, NVIDIA PhysicsNeMo.
import numpy as np

# POD-DeepONet with a quadratic branch, fitted by least squares
mean = S.mean(0); T = np.linalg.svd(S - mean, full_matrices=False)[2][:12]   # trunk: 12 POD modes
V = U[:, sensor_idx]                                                       # branch input: m sensor values
i, j = np.triu_indices(V.shape[1]); Phi = np.hstack([V, V[:, i] * V[:, j], np.ones((len(V), 1))])
W = np.linalg.lstsq(Phi, (S - mean) @ T.T, rcond=None)[0]                  # branch weights
predict = lambda Vn: mean + np.hstack([Vn, Vn[:, i] * Vn[:, j], np.ones((len(Vn), 1))]) @ W @ T
🐍 Exercise 1: data and trunk for a nonlinear operator
Generate random inputs, solve s′ = −s² + u by RK4, sample sensors and build a POD trunk, checking the solver against the exact solution for constant inputs.
📝 Quick check (Level 2)
0/3 answered
  1. 1. A library with DeepONet and POD-DeepONet:
  2. 2. Before trusting a DeepONet, test…
  3. 3. A POD trunk gives an error floor equal to…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Three sources of error. A POD-DeepONet prediction is mean + Σ_k b_k(u) t_k. Its error splits into: the trunk error, the part of the true output outside the span of t_1…t_p (the POD floor); the sensor error, information about u lost between sensors; and the branch error, the gap between the learned b_k and the best coefficients given the sensors. The first can be computed before any training by projecting test outputs onto the trunk.

Why a nonlinear branch. Here s′ = −s² + u. For small inputs s is close to the integral of u, a linear functional; the −s² term adds a correction quadratic in u. A linear branch can only learn the linear part, so its error stalls; adding all pairwise products of sensor values lets the branch represent the quadratic correction. A neural network branch learns such features instead of having them listed.

Results in the exercise. With 4 sensors both branches had median error 0.2: the sensors, not the branch, were the limit. With 10 sensors 0.08 (linear) and 0.07 (quadratic). With 25 sensors the linear branch stalled at 0.03, while the quadratic branch reached 0.01, the POD floor. On inputs 1.5 times larger, every model rose to 0.3, although the POD floor for those outputs was still 0.01: the trunk could represent the answers, but the branch could not compute the coefficients outside its training range.

📝 Quick check (Level 3)
0/3 answered
  1. 1. The POD floor is…
  2. 2. With 25 sensors the linear branch stalled because…
  3. 3. On inputs 1.5 times larger, the error was due to…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

What limits the accuracy of a DeepONet: the sensors, the branch, the trunk or the data range?

History.

  • T. Chen and H. Chen (1995) proved universal approximation of nonlinear operators by networks with a branch–trunk structure.
  • L. Lu, P. Jin, G. Pang, Z. Zhang and G. Karniadakis (2021) introduced DeepONet with deep branch and trunk networks.
  • L. Lu et al. (2022) compared DeepONet and FNO on many problems and introduced POD-DeepONet.
  • S. Wang, H. Wang and P. Perdikaris (2021) added physics-informed losses to DeepONet; MIONet (2022) handled several input functions.

Exercise 2. 1000 training inputs, 300 test inputs from the same distribution and 300 with amplitudes 1.5 times larger. Trunk: 12 POD modes of the training outputs. Branch: sensor values (linear) or sensor values plus all pairwise products (quadratic), weights by ridge least squares. Median relative L2 error.

sensors linear (in distribution / 1.5×) quadratic (in distribution / 1.5×)
4 0.2 / 0.3 0.2 / 0.4
10 0.08 / 0.3 0.07 / 0.3
25 0.03 / 0.3 0.01 / 0.3
POD floor (12 modes) 0.01 / 0.01
  • Sensors first: with 4 sensors the branch type made no difference.
  • Then the branch: with 25 sensors only the nonlinear branch reached the trunk’s floor.
  • Extrapolation failed: larger inputs gave 0.3 for every model, while the floor stayed at 0.01.
  • Seeds 1 and 2: the same table, except that with 10 sensors the linear branch gave 0.08 and 0.07 and with 4 sensors the quadratic branch gave 0.3 out of distribution.
🐍 Exercise 2 (research): what limits the accuracy of a DeepONet: the sensors, the branch, the trunk or the data range?
Build POD-DeepONets with linear and quadratic branches for s′ = −s² + u, vary the number of sensors, and compare with the POD floor in and out of the training distribution.

DeepONet in practice

  • Multiphysics: DeepM&Mnet couples pretrained DeepONets for electroconvection and hypersonics.
  • Engineering surrogates: fracture, heat transfer and structural response from load or geometry functions.
  • Batteries and power systems: fast predictions of state over time from input currents or disturbances.
  • Physics-informed DeepONet: adds the residual of the governing equation to the loss, reducing the amount of solver data needed.

References

  1. T. Chen and H. Chen (1995). “Universal approximation to nonlinear operators by neural networks with arbitrary activation functions and its application to dynamical systems.” IEEE Transactions on Neural Networks.
  2. L. Lu, P. Jin, G. Pang, Z. Zhang and G. E. Karniadakis (2021). “Learning nonlinear operators via DeepONet.” Nature Machine Intelligence.
  3. L. Lu et al. (2022). “A comprehensive and fair comparison of two neural operators (with practical extensions) based on FAIR data.” Computer Methods in Applied Mechanics and Engineering.
  4. S. Wang, H. Wang and P. Perdikaris (2021). “Learning the solution operator of parametric partial differential equations with physics-informed DeepONets.” Science Advances.
  5. P. Jin, S. Meng and L. Lu (2022). “MIONet: learning multiple-input operators via tensor product.” SIAM Journal on Scientific Computing.