← Tomás Erdmannsdörffer ● live race · pure JS, no libraries

Neural operator vs. numerical solver.

Two algorithms, same PDE, same starting gun. The finite-difference solver (left, grey) crawls timestep by timestep, the way numerical codes have for decades. The operator surrogate (right, red) jumps straight from the initial condition to any time t in one shot. The answers agree to within a couple of percent; watch which one finishes. This is the pitch behind neural operators like FNO and DeepONet, and the reason I find them interesting.

Burgers equationCole-Hopf operator Finite differenceCFL-bounded mode truncationzero backend
▸ Finite-difference solver
explicit Euler · central differences · CFL-bounded Δt
idle
step
-
sim t
-
compute ms
-
◆ Operator surrogate
Cole-Hopf → heat eq. in Fourier modes · evaluate any t directly
idle
setup ms
-
eval ms
-
total ms
-
first solve, setup included
-
each further time t
-
accuracy
press race to find out
After the race, the solver's final answer is overlaid (dashed) on the operator's, they should sit on top of each other.

What you're actually watching

Both sides solve the 1D viscous Burgers equation, the canonical nonlinear PDE benchmark mixing advection and diffusion:

∂u/∂t + u · ∂u/∂x = ν · ∂²u/∂x²    x ∈ [0, 1], periodic

the solver (left)

Classical explicit finite differences. The CFL stability condition forces tiny timesteps, for ν = 0.02 at Nx = 256 that's thousands of sequential steps to reach t = 0.5, and you can't compute step n before step n−1 exists. The animation deliberately shows the time-marching.

the operator (right)

Burgers admits the Cole-Hopf transformation: substitute u = −2ν·φₓ/φ and φ obeys the linear heat equation, which is diagonal in Fourier space, every mode just decays exponentially. So the "operator" maps the initial condition to its spectral coefficients once, and evaluating the solution at any time t is a single O(Nx·K) pass. No time marching at all.

φ̂(t, k) = φ̂(0, k) · e^(−ν(2πk)²t)   →   u(t, x) = −2ν · φₓ/φ

why this is the neural-operator story

A neural operator like FNO (Li et al., 2021) does conceptually the same thing, it learns a map from initial conditions to solutions, parameterized in frequency space, for problems where no analytic transform exists (Navier-Stokes, Darcy flow, weather). Trained once on solver outputs, then deployed at constant inference cost. Published FNO speedups reach 1000×+; what you measure here is the same structural advantage in its purest form.

Honest framing. Two numbers, because there are two questions. Building the operator costs a few milliseconds and has to be redone for every new initial condition, so the first solve is only a few times faster than marching. Once it exists, answering at another time t is a single pass, which is the each further time t number. A trained FNO moves the expensive part offline into training, amortised over every initial condition it ever sees, so its inference sits closer to the second number than the first, and that gap is the whole reason operators are interesting.

The right-hand racer is not a trained neural network, it's the exact Cole-Hopf operator. Deliberate choice: training a real FNO and shipping weights would add days of GPU time without changing the visual story, and the analytic operator makes the accuracy comparison clean. A real FNO replaces the analytic step with a learned one. Same architecture concept, same punchline.

try this