Abstract
Many important problems require modelling large-scale spatio-temporal datasets, with one prevalent example being weather forecasting. Recently, transformer-based approaches have shown great promise in a range of weather forecasting problems. However, these have mostly focused on gridded data sources, neglecting the wealth of unstructured, off-the-grid data from observational measurements such as those at weather stations. A promising family of models suitable for such tasks are neural processes (NPs), notably the family of transformer neural processes (TNPs). Although TNPs have shown promise on small spatio-temporal datasets, they are unable to scale to the quantities of data used by state-of-the-art weather and climate models. This limitation stems from their lack of efficient attention mechanisms. We address this shortcoming through the introduction of gridded pseudo-token TNPs which employ specialised encoders and decoders to handle unstructured observations and utilise a processor containing gridded pseudo-tokens that leverage efficient attention mechanisms. Our method consistently outperforms a range of strong baselines on various synthetic and real-world regression tasks involving large-scale data, while maintaining competitive computational efficiency. The real-life experiments are performed on weather data, demonstrating the potential of our approach to bring performance and computational benefits when applied at scale in a weather modelling pipeline.
Introduction
Modern weather forecasting is currently divided between two paradigms. State-of-the-art machine learning models, such as GraphCast, are highly effective but typically require data to be presented on a regular grid. Conversely, real-world observational data—collected from weather stations, ships, and buoys—is inherently unstructured and scattered across arbitrary locations. Neural Processes (NPs) were designed to handle such unstructured data while providing uncertainty estimates. However, the Transformer Neural Process (TNP), despite its power, suffers from quadratic scaling with respect to the number of observation points. This computational bottleneck prevents its application to global-scale datasets. This paper introduces Gridded Transformer Neural Processes (G-TNPs), an architecture that bridges this gap by enabling Transformer-based models to scale to massive, unstructured spatio-temporal datasets.
Methodology
The G-TNP architecture utilizes a three-stage pipeline to process unstructured data efficiently:
- Grid Encoder: To avoid the quadratic cost of all-to-all attention, the model employs a specialized encoder that maps unstructured context observations onto a fixed, structured grid of "pseudo-tokens." This acts as an information bottleneck, summarizing thousands of local observations into discrete grid cells.
- Grid Processor: Once mapped to a grid, the model leverages highly optimized efficient attention mechanisms. The authors specifically implement the Swin-TNP, which uses the Swin Transformer’s window-based attention to achieve linear complexity.
- Grid Decoder: Predictions at arbitrary target locations are made using an efficient $k$-nearest-neighbor (k-NN) cross-attention mechanism. This local decoding strategy provides a helpful inductive bias for spatial data, improving performance over global attention methods.
Results and Discussion
The model was evaluated across synthetic 2D Gaussian Processes, global ERA5 temperature integration, and multi-modal wind speed modeling. G-TNPs demonstrated the ability to handle context sets exceeding 100,000 points, a scale where standard TNPs fail due to memory constraints.
In synthetic tests, G-TNPs were uniquely capable of recovering fine-grained spatial details that baselines typically smoothed over. On real-world global temperature tasks, the Swin-TNP achieved a test log-likelihood of 1.819, significantly outperforming the ConvCNP (1.535) and the previous state-of-the-art PT-TNP (1.344). As shown in the performance plots, G-TNP variants (such as Swin-TNP and ViTNP) maintain a superior balance between predictive accuracy and computational speed compared to traditional convolutional and point-wise approaches.
Conclusion
G-TNPs represent a significant step forward in scaling neural processes for large-scale spatio-temporal modeling. By combining the flexibility of NPs with the efficiency of gridded Transformer architectures, this approach enables the integration of vast amounts of unstructured observational data into high-performance weather modeling pipelines. Future work will focus on dynamic grid resolutions and extending the architecture from interpolation to full temporal forecasting.
Summary updated