Show full content
This post is part of GP³, an ongoing series on Gaussian Processes and their applications in Geology and Geophysics. The full notebook and source code are available for you to explore on GitHub!

A few months ago, the PyTorch blog announced that NeuralOperator has now joined the PyTorch ecosystem! Neural operators are one instance of a broader concept: surrogate simulation (also called surrogate modeling or emulation). Many problems in science and engineering involve a computationally expensive simulation. In geophysics, this might be a seismic wave propagation code, or an expensive 3D time-domain electromagnetic simulation. These simulators take a model of the subsurface (density, susceptibility, velocity, etc.) and compute what you would observe with your surface instrumentation. They are grounded in physics and they are accurate, but they are often slow without simplifications. A surrogate is a fast approximation of that simulator, with potentially advantageous properties for downstream applications, like differentiability. You generate a dataset of input-output pairs by running the expensive simulator many times, then, in an offline setting, you train a machine learning model to reproduce the same mapping. Once trained, the surrogate can replace the simulator in online applications that require many evaluations: optimization, uncertainty quantification, survey design or planning, or real-time prediction to name a few.
An Illustrative ExampleTo show a concrete example, I’ve built a small demonstration project that trains an FNO surrogate for the forward operator in aeromagnetic surveying. Here I’ll walk through the key ideas.
I’m showing an example of simulating total magnetic intensity from an aeromagnetic survey. Here we have to suspend our disbelief a little bit… I know that these simulations are linear and super fast, so making a surrogate model doesn’t exactly make sense. But let’s pretend for now that instead the simulation is super time or resource intensive.
The project has three parts:
1. Generate 3D magnetic susceptibility models using a Gaussian process prior (GPyTorch)
2. Train an FNO surrogate to map susceptibility to magnetic anomaly (SimPEG + NeuralOperator)
3. Evaluate the trained FNO on arbitrary survey geometries without retraining
Part 1: Generating Geologic ModelsTo train the FNO, we need many examples of the forward relationship: pairs of (true susceptibility model, observed magnetic anomaly). For the susceptibility models, I used a Gaussian process prior, contining a theme from my earlier posts on GPs in geoscience. Here, the GP is used purely as a generative model, producing smooth, spatially correlated 3D fields that look plausibly geological. There is no conditioning on data, no inference. The GP is a prior in the literal sense: it encodes our beliefs about what susceptibility distributions look like before seeing any measurements. I did some fun randomized transformations to make the field as expressive as I needed it to be. Each realization has a different orientation of spatial correlation, producing a diverse set of geologically plausible models. (I might write about this modeling in a upcoming blog post!)

I’m sampling these models on a modest 24x24x6 grid spanning a 100m x 100m x 20m domain. Small enough to generate hundreds of training samples on a laptop, large enough to capture interesting spatial structure. At this scale, I can reasonably fit the dataset into memory, as well as avoid discretization artefacts when simulating the magnetic response.
Part 2: Offline Training the FNO SurrogateTo generate the training data, first I need to simulate the “true” response of the geology models using a high-fidelity physics simulator. Specifically, I’m calculated the Total Magnetic Intensity (TMI) field resulting from the spatial configurations of subsurface magnetic susceptability. To do this, I used the great geophysics simulation package SimPEG, which provides convienient constructors and physics solvers for simulation setups. I generated a dataset of 3000 pairs of (geology model, magnetic field), with observation locations in a 24×24 grid 15m altitude above the model domain.

Once I have the dataset, setting up the FNO is incredibly easy thanks to the simple interface provided by the NeuralOperator team:
fno = FNO(
n_modes=(12, 12, 4), # Fourier modes for 3D input
hidden_channels=32,
in_channels=1,
out_channels=1,
n_layers=4,
)
At a modest 1.8 million parameters, this model is a fine size for a admittedly simple forward operator. The input is a 3D susceptibility field with shape (1, 24, 24, 6) and the output is a 3D field of the same shape. We take the top z-slice of the output as the predicted 2D magnetic anomaly at the observation surface. For training, I used a relative L2 loss (the L2 norm of the residual divided by the L2 norm of the target). This is a toy-scale dataset, but it is enough to demonstrate the concept. After X epochs, the FNO learns a reasonable approximation of the smooth, elliptic forward operator. The loss curves show the model converging, and visual comparison of predicted vs. true anomaly maps shows that the FNO captures the main spatial structure of the magnetic response.

Now here’s the payoff! The FNO was trained on a fixed observation grid. But imagine now we want to evaluate it on completely different survey geometries: irregular polygon-shaped survey regions scattered across the domain, with observation points sampled on a different grid inside those polygons. The application here might be you’re optimizing a survey design for a new project, and you want to know what geometry gives you the best value for its cost. If we were conducting true simulations for this search, we’d have to do expensive online evaluations for each geometry, which is infeasible. This is the key distinguisher from traditional ML methods! Even though a simpler ML approach may be able to offload learning a fast forward model in an offline step, it would not generalize to new survey geometries. You’d have to retrain the model on each new geometry, which is infeasible.
For our trained FNO model, what we do instead is: (1) generate random polygon survey regions, (2) evaluate the FNO on its native grid (a single forward pass, effectively instant), (3) interpolate the FNO output to the new observation locations within the survey polygons. The last step is the critical one. Because the FNO has learned a continuous operator, its output on the native grid is a smooth field that can be meaningfully interpolated to arbitrary points. This is conceptually different from, say, interpolating the output of a standard CNN, because the FNO’s spectral representation in Fourier space naturally encodes smooth, continuous structure.

The immediate application is flexible survey design. If you have a trained FNO surrogate for your forward operator, you can cheaply evaluate the predicted field for any candidate survey geometry. This opens the door to:
Monte Carlo methods at scale. Uncertainty quantification, Bayesian inversion, and sensitivity analysis all require running the forward model many times, often thousands or tens of thousands of times. This is prohibitively expensive with a full physics simulator. With a surrogate, it becomes tractable. You can push an ensemble of susceptibility models through the FNO and get a distribution of predicted observations in seconds.
Differentiability for free. Because the FNO is a PyTorch module, it is automatically differentiable. You get gradients of the predicted field with respect to the input susceptibility model, which enables gradient-based optimization and inversion without having to derive or implement adjoint equations.
Resolution flexibility. The discretization invariance of the FNO means you can train on a coarse grid (fast to generate training data) and evaluate on a finer grid at inference time. You are not locked into the resolution of your training data.
Composability with the PyTorch ecosystem. The FNO is just a torch.nn.Module. It plugs into existing PyTorch workflows: optimizers, learning rate schedulers, data loaders, distributed training, mixed precision, etc. without custom infrastructure.
More broadly, this project illustrates a pattern that applies across geophysics: train a neural operator on the expensive physics once, then use it as a drop-in replacement for the forward simulator in downstream tasks that require many evaluations. The NeuralOperator library makes this accessible with a clean PyTorch API!
ConclusionI hope that this blog post has shown that Fourier Neural Operators have some cool potential applications in geophysical forward modeling! The forward operator I showed here, aeromagnetic surveying maps a 3D field (susceptibility) to a 2D field (magnetic anomaly), is simplistic, but one can imagine FNOs being applied to more computationally expensive forward operators, such as electromagnetic or seismic wave propagation. Once trained, the FNO provides a fast, differentiable, and discretization-free surrogate that can be evaluated on any survey geometry.
I think that the combination of GPyTorch for model generation, SimPEG for forward physics, and NeuralOperator for the surrogate is a powerful and composable toolkit. Each library does one thing well, and they fit together cleanly in a PyTorch-native workflow.
The full notebook and source code are available on GitHub.





























