Decoding Partial Differential Equations: Cross-Modal Adaptation of Decoder-only Models to PDEs

Paloma García-de-Herreros, Philipp Slusallek, Dietrich Klakow, Vagrant Gautam

TL;DR

While modern large language models are overwhelmingly decoder-only, cross-modal adaptation for scientific machine learning (like PDE solving) has remained dominated by encoder-only models. This paper demonstrates that out-of-the-box decoder-only architectures struggle on time-dependent PDE simulations because their causal attention lacks bidirectional context, and scaling them up does not help. By introducing two simple methods to simulate bidirectionality—Parallel Flipping and Sequence Doubling—the authors close the performance gap, matching or exceeding encoder-only baselines.

What Problem Does This Paper Address?

Cross-modal adaptation fine-tunes pre-trained language models to process entirely different modalities, such as seismic waves, ECG signals, and partial differential equations (PDEs). Prior work in scientific ML has largely relied on encoder-only architectures (e.g., RoBERTa, BERT). This creates an obvious tension: the NLP community has shifted toward decoder-only architectures (e.g., GPT, Pythia, LLaMA), which scale remarkably well and benefit from massive pre-training compute.

When researchers plug decoder-only models into existing cross-modal adaptation frameworks, performance collapses. The paper investigates why decoder-only models fail at PDE simulation, whether model scaling can rescue them, and how to adapt their causal architecture to continuous physical systems.

Methods

The authors evaluate two established cross-modal adaptation frameworks:

  • Frozen Pretrained Transformers (FPT): Keeps the transformer backbone frozen while fine-tuning modality-specific embedder/predictor heads and layer normalization.
  • ORCA: Pre-trains an embedder via Optimal Transport Dataset Distance (OTDD) to match the target data distribution to a text proxy dataset, then fine-tunes all parameters on the target task.

To overcome the architectural handicap of unidirectional (causal) attention in decoder-only models, the authors propose two novel, lightweight inference strategies:

  1. Parallel Flipping: Runs the cross-modal pipeline twice in parallel—once with the sequence in its original order and once reversed. Because causal attention yields noisier outputs at the start of a sequence and smoother outputs toward the end (due to richer context), the method takes the second half of both predictions and concatenates them.
  2. Sequence Doubling: Concatenates every input sequence with itself ($[x, x]$) before passing it into the model. Only the representations from the second half of the last hidden layer are passed to the predictor. This ensures that every position evaluated by the predictor has attended to the entire sequence, effectively providing full bidirectional context without modifying model weights.
Sequence Doubling Pipeline:
[ Input Sequence X ] ──► [ X || X ] ──► [ Embedder ] ──► [ Decoder-Only LLM ] 
                                                               │ (Last Hidden Layer)
[ Final Prediction ] ◄── [ Predictor ] ◄── [ Second Half of Representations ]

Datasets

The authors evaluate models on four 1D time-dependent simulation tasks from PDEBench:

  • 1D Advection
  • 1D Diffusion-Reaction
  • 1D Diffusion-Sorption
  • 1D Compressible Navier-Stokes

Models predict the final simulation time step directly from the initial state. For embedder alignment in ORCA, the authors use CoNLL-2000 as the text proxy dataset (replicating prior work that used CoNLL-2003).

Key Insights and Ideas

  • Causal masking penalizes continuous wave modeling: Unlike text generation where predicting the future given the past is natural, physical fields over a spatial domain often feature global spatial correlations or symmetries. Treating spatial coordinates as autoregressive tokens deprives early tokens of necessary context, producing erratic, "spiky" predictions at the beginning of sequences.
  • Scaling laws do not save naive adaptation: Scaling decoder-only models up to 1.6 billion parameters (GPT-2 XL and Pythia-1.4B) failed to close the performance gap with 125M encoder-only models. In several cases (such as Advection), larger decoder models actually performed worse.
  • Simulating bidirectionality recovers lost performance: Simply repeating the input sequence (Sequence Doubling) provides the autoregressive backbone with full context, virtually eliminating early-sequence artifacts and dramatically reducing prediction error.

Key Results

Performance is evaluated using normalized Root Mean Squared Error (nRMSE, where lower is better):

  • Out-of-the-Box Decoder-Only Failure: On 1D Advection with ORCA, RoBERTa achieved an nRMSE of $\mathbf{0.0084}$, while standard GPT-2 achieved $\mathbf{0.508}$ and Pythia-160M achieved $\mathbf{0.286}$—failing to meaningfully outperform randomly initialized weights.
  • Sequence Doubling Closes the Gap:
  • For GPT-2 (137M) on Advection, Sequence Doubling dropped nRMSE from 0.508 to 0.018 (an over 96% error reduction).
  • For Pythia-14M on Advection, Sequence Doubling dropped nRMSE from 0.287 to 0.0028, notably outperforming RoBERTa (0.0084).
  • On Navier-Stokes with ORCA, Sequence Doubling dropped GPT-2 error from 0.501 to 0.094.
  • Method Comparison: Sequence Doubling consistently outperformed Parallel Flipping because it eliminates the discontinuous "hard split" boundary where two halves are stitched together.

Limitations and Future Work

  • Compute Overhead: Sequence Doubling doubles the sequence length, which quadruples attention complexity ($O(N^2)$) and increases memory consumption, requiring batch size reductions for larger models.
  • 1D Benchmarks Only: The study focuses entirely on 1D PDE problems; applicability to 2D/3D simulations remains to be validated.
  • High Fine-Tuning Variance: The authors noted substantial run-to-run instability across seeds (particularly on Navier-Stokes and Advection with FPT), indicating that cross-modal optimization landscapes remain brittle.
  • Future Directions: Modifying the attention mask directly to permit bidirectional attention (e.g., via LLM2Vec approaches) or leveraging autoregressive rollout generation rather than mean-pooling the final hidden representations.

Summary updated

BibTeX
@inproceedings{garciadeherreros2026decoding,
  author = {Paloma García-de-Herreros and Philipp Slusallek and Dietrich Klakow and Vagrant Gautam},
  title = {{Decoding Partial Differential Equations: Cross-Modal Adaptation of Decoder-only Models to PDEs}},
  booktitle = {AI and PDE @ ICLR},
  year = {2026},
  url = {https://openreview.net/forum?id=a7f690m9Vq},
}
Figure