Simplifying Transformer-Based U-Net Neural Physics Simulators

Pietro Sittoni, Francesco TudiscoNeurIPS 2026

TL;DR

Simulating physical phenomena like turbulent fluids with neural networks usually requires bespoke, dimension-specific architectures that are tedious to adapt from 2D to 3D. This paper introduces UFlex, a physics simulator that strips away specialized spatial operators and instead places standard, 1D-sequence Transformer blocks inside a multiscale U-Net hierarchy. Not only does this unified, dimension-agnostic design let you seamlessly fine-tune a 2D model directly on 3D data, it also runs faster, uses a fraction of the memory, and beats specialized state-of-the-art models in accuracy.

What Problem Does This Paper Address?

Physical systems operate across wildly different scales—think of tiny turbulent eddies coexisting with massive global currents. To capture this without running out of memory, neural physics simulators often borrow the U-Net architecture, which downsamples high-resolution grids to capture broad patterns, then upsamples them back to fine detail.

Meanwhile, Transformers have conquered AI because standard self-attention relies on clean, hardware-friendly matrix multiplications. However, applying pure self-attention to high-resolution physics grids causes an $\mathcal{O}(n^2)$ memory explosion. To dodge this, researchers have bolted specialized mechanisms onto U-Nets—like 2D shifted-window attention, axial attention, or Fourier layers.

Here is the catch: these custom parts hardcode spatial assumptions into the network. Moving a simulator from a 2D square grid to a 3D volume or adding temporal context often means rewriting core layers or awkwardly "inflating" 2D kernels into 3D. The authors ask: Do we actually need all this spatial specialization, or is the U-Net’s multiscale hierarchy doing the heavy lifting on its own?

Methods

The authors propose UFlex, an architecture built on a refreshing premise: keep the U-Net macro-structure to tame memory costs, keep the Transformer blocks completely standard, and flatten everything into a 1D sequence of tokens.

Figure 1: Left: UFlex’s architecture diagram; TF Blocks denotes Transformer Blocks. Right: diagram of a single Transformer block.
  • 1D Spatiotemporal Patching: Whether the input is 2D, 3D, or includes multiple past time steps, UFlex chops the grid into patches and unrolls them into a flat 1D sequence. If multiple time steps are included, a block-causal mask ensures tokens look globally across space, but only backward in time.
  • Standard Modern Transformer Blocks: No windowed or axial attention here. Every block uses standard multi-head self-attention with Rotary Position Embeddings (RoPE), RMSNorm, and a SwiGLU MLP.
  • Conditioning (adaRMSN-Zero): Unobservable physical scalars (like viscosity or Mach number) are embedded via MLPs, summed, and injected into the blocks to scale and shift normalized activations—adapting diffusion-style adaLN-Zero to handle an arbitrary number of continuous physical parameters.
  • Simple 1D Resampling: Instead of 2D/3D spatial pooling or pixel-shuffling, UFlex downsamples by using a learnable linear layer to merge $f$ consecutive tokens into one (default $f=4$), and upsamples via a linear layer that expands one token back into $f$ tokens. Encoder and decoder stages are linked via simple element-wise addition.

Datasets

No new datasets are introduced; the authors evaluate UFlex on seven existing regular-grid benchmarks sourced from The Well and PDEBench:

  • Four 2D datasets: Active Matter ($256 \times 256$), Planetswe ($256 \times 512$), Viscoelastic Instability ($512 \times 512$), and Compressible Navier-Stokes ($512 \times 512$).
  • Three 3D datasets: Compressible Navier-Stokes ($64^3$), Rayleigh-Taylor Instability ($128^3$), and Convective Envelope of a Red Supergiant ($256 \times 128 \times 256$—totaling ~8.5M grid points).

Key Insights and Ideas

  • Multiscale hierarchy beats explicit spatial inductive bias: Self-attention doesn't care how tokens are arranged; it learns relationships between any pair of tokens. Inside a U-Net, explicit 2D/3D grid operations inside the blocks become redundant.
  • Hardware sympathy wins wall-clock races: UFlex doesn't always have the lowest theoretical FLOPs. However, because it avoids masking, window-shifting, and structured convolutions in favor of pure, dense matrix multiplications, GPUs chew through its FLOPs much faster in practice.
  • Zero-surgery 2D-to-3D transfer: Because the backbone only sees a 1D token sequence, you can pre-train UFlex on cheap 2D simulations and fine-tune the exact same weights on expensive 3D simulations—only swapping out the lightweight input/output patch projections.
  • Simpler skip connections, smarter resampling: Ablations revealed that simple additive skip connections beat learnable concatenation projections, while learnable linear upsampling/downsampling handily beats fixed interpolation or pooling (cutting error by up to 22% for upsampling) by preserving high-frequency physics details.

Key Results

UFlex-B (123M parameters) matches or outperforms state-of-the-art baselines (including MPP, Poseidon, PDE-Transformer, and DPOT) on six out of seven benchmarks—falling narrowly behind DPOT (0.100 vs. 0.091 nRMSE) on 2D Viscoelastic Instability.

Figure 4: Baseline 2D. The table on the left reports Test Error (TE), i.e., the nRMSE rollout loss over the first 30% of the maximum temporal horizon, Throughput (T), Training Speed (TS), and Training Compute (TC). The plots on the right show the trade-off between Test Error and peak VRAM usage during training. Best and second-best performing models are indicated in bold and
  • Accuracy Leads: In 2D Active Matter, UFlex drops rollout error (nRMSE) to 0.343 compared to second-best MPP (0.459). In 3D Rayleigh-Taylor Instability, UFlex achieves 0.040 nRMSE, nearly halving the error of 3D U-Net (0.075).
  • Massive Memory & Speed Gains: In 2D Planetswe, UFlex uses ~15 GB of training VRAM, compared to ~35 GB for DPOT and ~70 GB (over $4\times$ more) for Swin-based Poseidon and PDE-Transformer. Training steps take 0.45s–0.94s in 2D ($2.7\times$ to $7\times$ faster than MPP) and stay under 1 second even on the massive $256 \times 128 \times 256$ 3D dataset.
  • 2D-to-3D Fine-Tuning: Under a tight 10-epoch budget on 3D Compressible Navier-Stokes, fine-tuning a 2D-pretrained UFlex yields a full-rollout error of 0.431, decisively beating training from scratch (0.576).

Limitations and Future Work

  • Regular grids only: UFlex relies on uniform patching, meaning it cannot natively handle unstructured meshes, particle simulations, adaptive discretizations, or complex moving geometries.
  • Fixed resolution: Like its grid-based Transformer peers, UFlex is trained and evaluated at a fixed grid resolution rather than being resolution-invariant.
  • Empirical scope: Scaling to extreme 3D resolutions or very long spatiotemporal horizons remains computationally expensive. Additionally, the work relies purely on supervised learning over fixed datasets; tackling data scarcity, distribution shifts, long-term rollout stability, and hard physical constraints is left for future work.

Summary updated

Abstract

U-Net--style architectures are widely adopted for modeling physical systems, as their multiscale structure enables efficient processing of high-resolution data while reflecting the hierarchical structure of many physical phenomena. The most successful U-Net-based neural physics simulators often combine convolutions, Fourier layers, or specialized transformer mechanisms such as windowed or axial attention; however, these structured components can limit adaptability across different spatial and spatiotemporal dimensions. In this work, we revisit transformer-based U-Nets with the goal of simplifying attention-based neural physics simulators without sacrificing multiscale efficiency or predictive accuracy. We introduce \texttt{UFlex}, a simple attention-based U-Net whose blocks are obtained through only minimal modifications to standard self-attention, allowing the same architecture to be applied across one-, two-, three-dimensional, and spatiotemporal regular-grid problems without major design changes. Evaluated on seven challenging benchmarks (four 2D and three 3D), \texttt{UFlex} scales to resolutions of up to $512 \times 512$ in 2D and $256 \times 128 \times 256$ in 3D, while reducing training memory and accelerating training compared to state-of-the-art transformer baselines, all while achieving state-of-the-art predictive accuracy.
BibTeX
@inproceedings{sittoni2026simplifying,
  author = {Pietro Sittoni and Francesco Tudisco},
  title = {{Simplifying Transformer-Based U-Net Neural Physics Simulators}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=AISWDtZ6VB},
}
Figure