# Unisolver: PDE-Conditional Transformers Towards Universal Neural PDE Solvers

Unisolver trains one Transformer to solve many different PDEs

Hang Zhou, Yuezhou Ma, Haixu Wu, Haowen Wang, Mingsheng Long · arXiv · 2024-5-27

- **Problem** Neural PDE solvers trained on a few PDE instances, such as one equation with limited coefficients, struggle to generalize to diverse PDEs.
- **Method** Unisolver feeds a Transformer PDE components as deep conditions, split into domain-wise and point-wise groups. Each layer scales and shifts its inputs with these conditions before self-attention.
- **Results** On 2D mixed PDEs, Unisolver cut average relative L2 error from 5.50 to 4.54 compared with DPOT.

![Figure 3: Overview of Unisolver. We universally embed all PDE components, such as domain geometries, equation symbols and boundary types into deep conditions…](https://refivu.com/papers/a7154426-94d9-4030-b848-c26f52fa8098/figures/figure-1a973801e8fa2530af3582b52dba025d.png?thumb=512)

**Figure 3** . Overview of Unisolver. We universally embed all PDE components, such as domain geometries, equation symbols and boundary types into deep conditions and employ a conditional Transformer to aggregate deep conditions in the decoupled subspace.

[Original paper](https://arxiv.org/abs/2405.17527v5) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Hang Zhou, Yuezhou Ma, Haixu Wu, Haowen Wang, Mingsheng Long · Unisolver: PDE-Conditional Transformers Towards Universal Neural PDE Solvers · Original paper figure · Extracted the figure area from page 4 of the original PDF.

## Why current solvers stall on new PDEs

Neural PDE solvers come in two families, and each one breaks down in its own way. Physics-informed neural networks turn the PDE into an objective function, so their outputs are pushed toward the target equation. That gives relatively accurate solutions, but a new scenario usually means retraining the model for each new task. Neural operators learn from pre-collected data, so they generalize better to diverse initial states than PINNs do.

They still see only the PDEs present in their training data, because training data alone doesn't tell them which PDE produced a trajectory.

![Figure 1: Neural PDE solvers typically consist of two paradigms: physics informed and data driven. Unisolver combines data-driven methods with physical insight…](https://refivu.com/papers/a7154426-94d9-4030-b848-c26f52fa8098/figures/figure-067fd4fb28d092e6b91f05f8355a01d4.png?thumb=512)

**Figure 1** . Neural PDE solvers typically consist of two paradigms: physics informed and data driven. Unisolver combines data-driven methods with physical insights from PDE components in a conditional modeling framework, boosting generalizability and scalability.

[Original paper](https://arxiv.org/abs/2405.17527v5) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)

Take the Navier-Stokes case: different viscosity coefficients and forcing terms give distinct solutions even when the initial states match. Neural operators that only see past observations can't distinguish these cases, which is why their tests stay on a limited set of PDEs. Adding PDE information to data-driven models helps only partly. The message-passing solver concatenates PDE coefficients with its inputs, and PDEformer encodes the PDE as a computation graph.

Neither gives a complete set of PDE information, which limits how general they can be.

DPOT takes a different route and purely scales up the training PDEs, expecting generalization to emerge from large data and parameters. The authors argue that a model must extract PDE information from observations, and that this extraction resembles solving an inverse problem. Because of that difficulty, such models often fit a vague representation of the observation distribution.

So the question is whether giving the model the full set of PDE components explicitly can produce generalization that data scaling alone hasn't reached.

## Complete PDE components as the design basis

The authors start from the mathematics of a simple case, a vibrating string with fixed endpoints. Their Theorem 1 writes the solution as a sum of an initial-position term, an initial-velocity integral, and a double integral over the geometry and the force. Read this way, each component acts on the solution in its own manner, so the model needs every one of them.

The authors also state that these components theoretically determine a unique solution.

The coefficient a shapes the solution the same way everywhere in the domain, while the external force enters point by point. This contrast becomes the basis for a two-way split of the components into domain-wise and point-wise groups.

The paper says the complete PDE components consist of six elements, and it lists the initial condition separately as an input. Equation symbols, the coefficient and the boundary condition type are domain-wise, because they apply consistently across all locations. The external force, the domain geometry mask and the boundary value function are point-wise, because each point's inclusion or value is set individually.

Boundary conditions are split into two parts because they take diverse forms, such as periodic and Robin conditions.

![Table 1: Categorization of complete PDE components](https://refivu.com/papers/a7154426-94d9-4030-b848-c26f52fa8098/figures/figure-bfd4705d2a209c8498af4c064ed0f81c.png?thumb=512)

**Table 1** . Categorization of complete PDE components.

[Original paper](https://arxiv.org/abs/2405.17527v5) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)

## Embedding the components and conditioning the Transformer

Equation symbols carry rich mathematical meaning, so Unisolver embeds them with LLaMA-3 8B instead of a hand-made encoder. The model reads the LaTeX code of each equation, and symbols such as a stand in for the coefficient rather than its numeric value. The output of the last Transformer block is averaged over the sequence, which gives a 4096-dimensional embedding for each PDE.

An MLP then maps that vector to the channel dimension, producing the equation-symbol deep condition.

Domain-wise values, such as real-valued coefficients and boundary type labels, pass through two linear layers with a SiLU activation between them. Point-wise fields, including the external force, the geometry mask and the boundary values, get the same patchify embedding as the input observations. Conditions from the same category are then added together, so the model doesn't separate them too finely.

The authors argue that this keeps the expressive capacity of the conditions intact during joint training.

Unisolver splits the hidden channels of the inputs evenly, so one half receives domain-wise conditions and the other half point-wise ones. Separate MLPs project each condition type into its own subspace, and the domain-wise condition is repeated along the sequence. Repetition ensures that every token receives the same physical guidance throughout the sequence.

The authors compare this split to multi-head attention, where some heads learn domain effects and others learn point effects.

In each layer, the conditions scale and shift the layer-normalized inputs before self-attention. A select signal then decides how much of the attention output Unisolver keeps, and the feedforward block follows the same pattern. After the last layer, the output is scaled and shifted by the equation conditions and linearly projected to give the prediction Y.

## Benchmarks and baselines for testing condition generalization

HeterNS extends the 2D Navier-Stokes dataset from FNO with five viscosity coefficients and three force terms. Those choices give 15 combinations of PDE components and 15,000 training samples. In-distribution tests use only unseen initial conditions, so the PDE components stay as seen in training. Zero-shot tests also change the viscosity coefficients or the force terms, so the model meets unseen components.

The 1D time-dependent benchmark holds three million structured 1D PDE samples, and Unisolver is evaluated zero-shot on PDEBench. The 2D mixed benchmark collects 12 datasets from four well-established benchmarks, as DPOT gathered them. Because the PDE components are imbalanced across these datasets, the authors adopt DPOT's balanced data sampling method.

Table 2 lists the dimensions, resolutions, sample counts and which components change across samples for each benchmark.

![Table 2: Summary of benchmarks. #GPU hours are calculated by averaging the training time of all models on one A100 GPU. Detailed compute resources can be found…](https://refivu.com/papers/a7154426-94d9-4030-b848-c26f52fa8098/figures/figure-cd3604c40e37b764bbfbdf4b5a118a43.png?thumb=512)

**Table 2** . Summary of benchmarks. #GPU hours are calculated by averaging the training time of all models on one A100 GPU. Detailed compute resources can be found in Appendix I.7. Besides, ✓ indicates the PDE component will change among different samples, while × refers to unchanged ones.

[Original paper](https://arxiv.org/abs/2405.17527v5) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)

Every method on HeterNS trains for 300 epochs with relative L2 loss and the ADAM optimizer. The initial learning rate is 0.0005, with a cosine annealing scheduler and a batch size of 60. The six HeterNS baselines are FNO, PINO, ViT, FactFormer, ICON and MPP. The authors give each baseline physics information, by concatenating inputs with PDE components, providing prompting trajectories for ICON, or applying a physics-informed loss to PINO.

For the zero-shot comparisons, Unisolver is set against PDEformer and DPOT. The authors skip extra baselines on these two benchmarks because million-scale samples make training too costly. On the 1D and 2D mixed benchmarks, training follows the original PDEformer and DPOT strategies, and relative L2 is the metric.

## Results on 2D mixed PDEs and HeterNS

On the 2D mixed PDEs, Unisolver is trained jointly on 12 datasets drawn from four benchmarks and then tested in distribution. Against DPOT, it wins on 11 of 12 in-distribution test sets, and its average relative L2 drops from 5.50 to 4.54. That is a promotion of 17.5%, which the paper reports as a remarkable gain. The exception is the small Diffusion-Reaction dataset, whose relative L2 is already saturated at less than 5%.

Unisolver's datasets are unbalanced across PDE components, so the authors adopt the balanced sampling method from DPOT. The authors also report consistently superior results on tasks dominated by one component, including coefficient generalization on FNO, force generalization on PDEArena, and geometry generalization on CFDBench.

The HeterNS comparison is the closer test, since PDEformer also feeds PDE information to its model, but through a computation graph. Unisolver achieves significantly better in-distribution test performance than PDEformer on HeterNS. The authors attribute this to incorporating complete PDE components into a Transformer, rather than using a computation graph to represent physical relations.

Across four zero-shot generalization scenarios, Unisolver improves on PDEformer by an average of 27.1%, even with fewer parameters. Because the zero-shot scenarios change viscosity or force while keeping unseen initial conditions, they test the conditioning directly. Within this comparison, the decoupled conditioning design is the likely source of the gain, and the paper's ablations examine it further.

## Ablations and partial components

The ablations ask whether each part earns its place, using 50,000 samples from the 1D time-dependent PDEs benchmark. The LLM encodes only one of six components, the equation symbols, so the authors read a promotion of around 5% as a significant margin. LLaMA-2 and T5 give results comparable to LLaMA-3 across the language models compared in Figure 8.

![Table 6: Ablation results on the LLM embeddings and the Condition Modeling. Variants of the former include without LLM embeddings (w/o LLM) and replacing by or…](https://refivu.com/papers/a7154426-94d9-4030-b848-c26f52fa8098/figures/figure-12dfaa650b2b5d7db919aee192799452.png?thumb=512)

**Table 6** . Ablation results on the LLM embeddings and the Condition Modeling. Variants of the former include without LLM embeddings (w/o LLM) and replacing by orthogonal random vectors (Random Vector), and variants of the latter include without subspace decoupling (w/o Subspace) and directly concatenating components (Concat). “Unchanged” means no changes to the default design.

[Original paper](https://arxiv.org/abs/2405.17527v5) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)

Removing subspace decoupling lets the two groups of PDE conditions interfere with each other. That removal causes an average drop of 5.45% in zero-shot generalization settings. Directly concatenating the PDE components instead costs 21.0% on average, the largest drop among these variants. Each removal raises the error in Table 6, which supports keeping both parts of the condition modeling.

The authors also test the case where some PDE components are missing in real applications. They replace each PDE component with learnable tokens at a 30% probability on HeterNS, leaving 49% of samples with complete components. At inference, Unisolver can choose whether to receive the PDE components as inputs. With no components available, Unisolver still surpasses FNO in most cases, especially at lower viscosity coefficients.

Supplying complete components raises performance by 21.6% on average, which the authors take as evidence that complete information is essential.

## Scaling data and parameters

The scalability test asks whether performance keeps improving as data and model size grow, which matters for a universal solver. Figure 10 plots relative L2 on a log-log scale for the Burgers case with ν = 0.01, in-distribution. Panel (a) varies the number of samples from 50k to 3M, while panel (b) varies the parameters from 3M to 63M. Relative L2 falls as both grow, which the authors read as a scaling law for Unisolver.

They see this scaling behaviour as a route toward a universal neural PDE solver.

![Figure 10: Data scalability (60x) and model scalability (21x) on 1D PDEs. Relative L2 results are plotted on a log-log scale](https://refivu.com/papers/a7154426-94d9-4030-b848-c26f52fa8098/figures/figure-e4cf57341af95eee6e8e18f85997be5e.png?thumb=512)

**Figure 10** . Data scalability (60x) and model scalability (21x) on 1D PDEs. Relative L2 results are plotted on a log-log scale.

[Original paper](https://arxiv.org/abs/2405.17527v5) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)

The case study on HeterNS shows the same trend from a different angle, using error maps rather than curves. All presented trajectories start from the same initial condition but end in distinct final fields. The gap is largest in zero-shot generalization settings, according to the authors' comparison. More showcases appear in Appendix E.

## Limitations and untested ranges of Unisolver

The authors' own text points to a few constraints that limit how far the results reach. The LLM branch encodes only the equation symbols, one of the six complete PDE components. The other components therefore rely on the MLP and patchify embeddings, and the LLM result doesn't cover them. Coefficients and boundary types go through two linear layers with a SiLU activation, while force, geometry and boundary values go through patchify embedding.

On HeterNS, Unisolver is compared with baselines that were given extra physics information, so their numbers reflect that augmented setup. PDEformer and DPOT are the only zero-shot comparisons, because the authors skipped further baselines on million-scale sets. The 2D mixed gain is reported as an average of 17.5%, from 5.50 to 4.54. The authors report one set, the small Diffusion-Reaction dataset, where the relative L2 is already saturated below 5%.

The scaling plots cover only the Burgers setting with ν = 0.01. They didn't test scaling on the other 1D Burgers or Advection settings in that figure.

## Paper info

- **Authors**: Hang Zhou, Yuezhou Ma, Haixu Wu, Haowen Wang, Mingsheng Long
- **Venue**: arXiv · Preprint
- **First published**: 2024-5-27
- **Added**: 2026-10-29
- **Updated**: 2025-9-4
- **Version**: v5
- **arXiv**: 2405.17527
- **Category**: cs.LG · cs.AI · math.NA
- **Original paper terms**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **What we show**: Paper info, commentary and permitted figures from the original paper

[Original paper ↗](https://arxiv.org/abs/2405.17527v5) · [PDF ↗](https://arxiv.org/pdf/2405.17527v5)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Abstract

Deep models have recently emerged as promising tools to solve partial differential equations (PDEs), known as neural PDE solvers. While neural solvers trained from either simulation data or physics-informed loss can solve PDEs reasonably well, they are mainly restricted to a few instances of PDEs, e.g. a certain equation with a limited set of coefficients. This limits their generalization to diverse PDEs, preventing them from being practical surrogate models of numerical solvers. In this paper, we present Unisolver, a novel Transformer model trained on diverse data and conditioned on diverse PDEs, aiming towards a universal neural PDE solver capable of solving a wide scope of PDEs. Instead of purely scaling up data and parameters, Unisolver stems from the theoretical analysis of the PDE-solving process. Inspired by the mathematical structure of PDEs that a PDE solution is fundamentally governed by a series of PDE components such as equation symbols and boundary conditions, we define a complete set of PDE components and flexibly embed them as domain-wise and point-wise deep conditions for Transformer PDE solvers. Integrating physical insights with recent Transformer advances, Unisolver achieves consistent state-of-the-art on three challenging large-scale benchmarks, showing impressive performance and generalizability. Code is available at https://github.com/thuml/Unisolver.

## Quote from the paper

Hang Zhou, Yuezhou Ma, Haixu Wu, Haowen Wang, Mingsheng Long (2024). Unisolver: PDE-Conditional Transformers Towards Universal Neural PDE Solvers. arXiv:2405.17527v5. https://arxiv.org/abs/2405.17527v5

**BibTeX**

```
@misc{zhou2024unisolver,
  title = {{Unisolver: PDE-Conditional Transformers Towards Universal Neural PDE Solvers}},
  author = {Hang Zhou and Yuezhou Ma and Haixu Wu and Haowen Wang and Mingsheng Long},
  year = {2024},
  eprint = {2405.17527},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.17527v5}
}
```

## Other paper commentary

- [GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints](https://refivu.com/en/papers/11792bcd-8c73-4a2d-8b43-c855c3d7ad48-gqa-training-generalized-multi-query-transformer-models-from.md)
- [Fast Transformer Decoding: One Write-Head is All You Need](https://refivu.com/en/papers/65f892e7-2a21-4ce7-9e89-c75f7ec6b23c-fast-transformer-decoding-one-write-head-is-all.md)
- [Dynamic Routing Between Capsules](https://refivu.com/en/papers/a4e87f62-36cc-47df-991e-87dd01b1a4ef-dynamic-routing-between-capsules.md)
- [Distilling the Knowledge in a Neural Network](https://refivu.com/en/papers/d39fc594-ec58-4492-b1f4-d2d3600a6455-distilling-the-knowledge-in-a-neural-network.md)
- [Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation](https://refivu.com/en/papers/16116a1b-83a4-4d2d-b5ff-31f5b005ba3f-train-short-test-long-attention-with-linear-biases.md)
- [Mamba: Linear-Time Sequence Modeling with Selective State Spaces](https://refivu.com/en/papers/b149783d-1b22-47f2-94df-544d57bb2621-mamba-linear-time-sequence-modeling-with-selective-state.md)
- [SageAttention2: Efficient Attention with Thorough Outlier Smoothing and Per-thread INT4 Quantization](https://refivu.com/en/papers/5328df78-371a-4c98-b607-4082e43abef7-sageattention2-efficient-attention-with-thorough-outlier.md)
- [Scaling Tractable Probabilistic Circuits: A Systems Perspective](https://refivu.com/en/papers/e32b51bf-5311-4420-bc25-ec49bc5d82ec-scaling-tractable-probabilistic-circuits-a-systems.md)
- [SpargeAttention: Accurate and Training-free Sparse Attention Accelerating Any Model Inference](https://refivu.com/en/papers/6a719301-c428-424d-9dc3-3159ff623aea-spargeattention-accurate-and-training-free-sparse-attention.md)
- [Dolphin: A Programmable Framework for Scalable Neurosymbolic Learning](https://refivu.com/en/papers/45dd94f7-4a58-4799-bc56-64bca4cda2ed-dolphin-a-programmable-framework-for-scalable-neurosymbolic.md)
- [Adversarial Flow Models](https://refivu.com/en/papers/5de76f30-93e7-4a6f-b44f-f36b2096f9e2-adversarial-flow-models.md)
- [EmbodiedLab: Benchmarking Embodied Agents That Act to Know](https://refivu.com/en/papers/db9dafac-e675-4429-8d4f-1cea4451726d-embodiedlab-benchmarking-embodied-agents-that-act-to-know.md)

## Terms in this paper

- [Transformer](https://refivu.com/en/terms/48e8be2570bc-transformer)
- [multi-head attention](https://refivu.com/en/terms/370ae5c971cd-multi-head-attention)
- [Physics-informed neural networks](https://refivu.com/en/terms/b02fd38bd572-physics-informed-neural-networks)
- [zero-shot generalization](https://refivu.com/en/terms/eacb204819c4-zero-shot-generalization)
- [FNO](https://refivu.com/en/terms/7d48aba1db65-fno)
- [neural operators](https://refivu.com/en/terms/62a1d0a2b41a-neural-operators)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/a7154426-94d9-4030-b848-c26f52fa8098-unisolver-pde-conditional-transformers-towards-universal)
