Dynamic Quadtree Tokenization and Transformer for Adaptive Mesh PDE Forecasting
Organizations: Department of Aerospace Engineering University of Michigan Ann Arbor, MI 48105 · University of Michigan Ann Arbor, MI 48105
Abstract
The quadratic attention cost of Vision Transformers (ViTs) forces a trade-off between spatial resolution and rollout horizon, particularly for fine-scale PDEs where shocks, reaction fronts, and material interfaces occupy small, evolving regions of the domain. Conventional neural surrogates also lack mechanisms to adapt resolution dynamically. We propose WAMRViT, a ViT that tokenizes inputs as balanced quadtrees using a wavelet-inspired refinement criterion, jointly encodes position and refinement level with 3D rotary positional embeddings, and regrids in cell space during inference for stable long-horizon rollouts. A multi-scale variant retains each leaf at its native source resolution and lets the model learn across resolution levels. Unlike fixed-budget adaptive-tokenization methods, WAMRViT imposes no predetermined token count and supports fully adaptive topology throughout autoregressive rollout. To our knowledge, it is the first machine-learning surrogate to natively tokenize multi-level Adaptive Mesh Refinement (AMR) data. On uniform-grid benchmarks, uniform-patch WAMRViT improves finest-level region-of-interest VRMSE over a finest-patch uniform ViT while using substantially fewer tokens. The multi-scale variant achieves the lowest first-step full-field RMSE and VRMSE on both benchmarks and improves rollout-averaged full-field and refined-region accuracy at long horizons. With parallelized regridding, its end-to-end rollout cost lies between finest-patch and approximately token-matched coarser-patch ViTs. On a complex AMR combustion problem whose finest features cannot be represented natively by the evaluated uniform-grid baselines, WAMRViT operates directly on adaptive cells and substantially reduces finest-level error at matched transformer capacity. Code: https://github.com/tonyzyl/wamrvit
Figures & tables
| WAMRViT (uniform) | WAMRViT (multi-scale) | ViT (finest) | ViT (mid) | SwinV2 | IAP ∗ [ 14 ] | |
| PLI, full-field | 0.0661 1.67E-3 | 0.0389 2.52E-4 | 0.0539 6.44E-3 | 0.0553 6.68E-4 | 0.0920 2.32E-4 | / |
| PLI, finest ( ) | 2.6839 0.166 | 2.5000 0.046 | 3.4125 0.305 | 3.3401 0.121 | 6.3348 0.054 | / |
| PLI, tokens | 3,327 | 3,339 | 8,960 | 3,500 | 8,960 | / |
| TRL, full-field | 0.1502 2.81E-4 | 0.1476 5.40E-4 | 0.1490 6.61E-4 | 0.1629 4.87E-4 | 0.1955 6.46E-4 | 0.1577 / 0.1478 |
| TRL, finest ( ) | 9.0411 0.665 | 18.8458 0.699 | 16.5135 0.351 | 22.1965 0.334 | 69.8422 0.503 | / |
| TRL, tokens | 1,597 | 1,597 | 3,072 | 1,536 | 3,072 | 1,020 / 2,040 |
| Dataset | Variant | Train (min) | Forward (s) | Regrid (s) | Total (s) | Peak (GiB) | |
| PLI | WAMRViT (uniform) | 188 | 3601 | 1.454 | 0.126 | 1.584 | |
| WAMRViT (multi-scale) | 333 | 3606 | 1.601 | 0.259 | 1.802 | ||
| ViT-finest | 236 | 8960 | 4.789 | – | 1.979 | ||
| ViT-mid | 128 | 3500 | 1.301 | – | 1.523 | ||
| SwinV2 | 283 | 8960 | 0.469 | – | 1.343 | ||
| TRL | WAMRViT (uniform) | 136 | 2111 | 0.774 | 0.159 | 1.354 |
| PLI | TRL | AMReX | |||
| full-field | finest ( ) | full-field | finest ( ) | finest ( ) | |
| (default) | 0.0642 | 2.5107 | 0.1515 | 9.7444 | 1.631E10 |
| (perimeter ratio) | 0.0630 | 2.5250 | 0.1505 | 8.9478 | 1.805E10 |
| (area ratio) | 0.0632 | 2.5042 | 0.1506 | 9.8886 | 1.544E10 |
| 0.0666 | 2.5394 | 0.1502 | 9.1519 | 1.660E10 | |
Appendix figures & tables26 assets
Supplementary material from the paper’s appendix.
Appendix
| PLI | TRL | AMReX | |
| Backbone (shared) | |||
| Layers / heads / per-head | / / | ||
| Transformer parameters | M | ||
| Complete parameters (uniform) | M | M | M |
| Complete parameters (multi-scale) | M | M | – |
| Tokenizer | |||
| PLI | TRL | AMReX | |
| Backbone and decoder | |||
| Stage depths | |||
| Heads per stage | |||
| Transformer-stage parameters | M | ||
| Embedding dim / decoder channels | / | ||
| Decoder refinement blocks | |||
| Dataset | Variant | Adaptation channels | Tolerance | Radius | Execution |
| PLI | WAMRViT (uniform) | of | CPU array | ||
| WAMRViT (multi-scale) | of | CPU array | |||
| TRL | WAMRViT (uniform) | of | CPU array | ||
| WAMRViT (multi-scale) | of | CPU array | |||
| AMReX | WAMRViT (uniform) | HRR | CPU array + GPU replay |
| WAMRViT (uniform) | WAMRViT (multi-scale) | ViT (finest) | ViT (mid) | SwinV2 | |
| PLI, full-field | 0.0110 6.232E-5 | 4.963E-3 2.198E-5 | 6.092E-3 2.338E-4 | 6.932E-3 4.526E-5 | 0.0111 6.474E-5 |
| PLI, finest ( ) | 2.475E-3 8.896E-5 | 1.909E-3 1.167E-5 | 2.473E-3 1.338E-4 | 2.858E-3 3.869E-5 | 5.702E-3 4.940E-5 |
| TRL, full-field | 0.5185 4.802E-3 | 0.4979 8.661E-4 | 0.5069 1.483E-4 | 0.5972 3.193E-3 | 0.7047 3.396E-3 |
| TRL, finest ( ) | 0.3283 3.064E-3 | 0.3333 1.103E-3 | 0.3382 2.818E-4 | 0.4007 2.046E-3 | 0.5193 7.857E-4 |
| AMReX, finest ( ) | 1.202E10 8.293E8 | / | / | 3.064E10 1.818E8 | 3.022E10 1.498E8 |
| full-field | finest ( ) | |||
| WAMRViT | ViT-finest | WAMRViT | ViT-finest | |
| 0.0642 | 0.0494 | 2.5107 | 3.1023 | |
| 0.0638 | 0.0501 | 2.5252 | 3.1863 | |
| 0.0680 | 0.0593 | 2.4921 | 3.3610 | |
| Variant | full-field | finest ( ) |
| WAMRViT (no resample, default) | 0.0642 | 2.5107 |
| WAMRViT (with resample) | 0.0683 | 2.7734 |
| Variant | coarsest ( ) | finest ( ) |
| WAMRViT (no resample, default) | 1.525E9 | 1.631E10 |
| WAMRViT (with resample) | 1.648E9 | 1.668E10 |
| WAMRViT (uniform) | WAMRViT (multi-scale) | |||||
| Mesh policy | RMSE | VRMSE | RMSE | VRMSE | ||
| Default | 3,324 | 0.0403 | 0.1749 | 3,336 | 0.0306 | 0.1405 |
| Radius | 2,717 | 0.0486 | 0.2238 | 2,739 | 0.0414 | 0.1950 |
| Radius | 3,981 | 0.0427 | 0.1836 | 3,998 | 0.0329 | 0.1476 |
| Tolerances | 3,745 | 0.0408 | 0.1780 | 3,717 | 0.0316 | 0.1435 |
| Tolerances | 3,269 | 0.0404 | 0.1753 | 3,299 | 0.0308 | 0.1428 |