PySHRED: A Python package for SHallow REcurrent Decoding for sparse sensing, model reduction and scientific discovery

David Ye, Jan P. Williams, Mars Liyao Gao, Stefano Riva, Matteo Tomasetto, David Zoro, J. Nathan KutzarXiv 2025 · DOI

Introduction

In complex dynamical systems such as meteorology, oceanography, and fluid dynamics, researchers often face a "data-rich but information-poor" paradox. While high-resolution simulations provide detailed insights, real-world monitoring is typically restricted to a few sparse physical sensors, such as weather stations or ocean buoys. Reconstructing a full, high-dimensional spatial field from these limited local observations—a challenge known as sparse sensing—is computationally intensive and often sensitive to noise.

PySHRED is an open-source Python library designed to bridge this gap. It implements the SHallow REcurrent Decoder (SHRED) architecture, providing a modular framework for accurate field reconstruction and model reduction that is efficient enough to run on standard consumer hardware.

Methodology: The SHRED Architecture

The core of PySHRED is a two-step deep learning process that leverages temporal history to overcome spatial sparsity.

The SHRED architecture workflow, mapping sensor measurements through sequence models to latent space and decoding back to spatial fields.
  1. Encoding: The model takes a time-lagged sequence of sensor measurements ($S$) and processes them through a sequence model (e.g., LSTM, GRU, or Transformer). This step encodes the temporal dynamics into a low-dimensional latent space ($Z$). This approach is mathematically grounded in the Takens Embedding Theorem, which posits that the temporal history of a single variable can capture the topology of the entire dynamical system.
  2. Decoding: A decoder (such as a Multi-Layer Perceptron or U-Net) maps the latent representation back into the full-dimensional spatial field ($\hat{X}$).

To enhance efficiency, PySHRED utilizes compressive training. Instead of operating on massive raw grids, the data is projected onto a reduced basis using techniques like Proper Orthogonal Decomposition (POD) or Fourier transforms. Training occurs within this compressed space, significantly reducing memory overhead and training time.

Key Features and Scientific Discovery

PySHRED offers several advantages over traditional reconstruction methods:

  • Sensor Agnosticism: By prioritizing temporal history over instantaneous spatial location, SHRED can extract underlying dynamics even from sub-optimal or mobile sensor placements.
  • Optimization Stability: The authors observe that the loss landscape for SHRED models tends toward global convexity, making them easier to optimize and less prone to local minima.
  • Physics Discovery (SINDy-SHRED): The package integrates with Sparse Identification of Nonlinear Dynamics (SINDy) to discover the differential equations governing the latent space. This allows for stable, long-term forecasting without requiring continuous sensor input.

Experimental Results

The package's performance was evaluated using both synthetic and real-world datasets:

  • Sea-Surface Temperature (SST): Using weekly mean temperature data from NOAA, SHRED successfully reconstructed global patterns from sparse sensor inputs.
  • Double Gyre Flow: In synthetic fluid dynamics tests, the model achieved mean relative errors as low as 0.0347 for horizontal velocity using POD-based compression.
Comparison between ground truth and SHRED reconstruction for sea-surface temperature data.

The results demonstrate that PySHRED enables high-fidelity reconstruction and interpretable model reduction. For the SST dataset, the SINDy-SHRED module identified a linear model for latent dynamics, providing a clear mathematical description of the forecasted temperature trends.

Conclusion and Future Directions

PySHRED democratizes sophisticated spatiotemporal modeling by enabling "laptop-level" training for complex systems. While currently constrained by the quality of initial data compression and limited to non-parametric systems for latent forecasting, its modular design allows for future expansion. The community is encouraged to contribute new sequence models and decoders to further specialize the package for diverse scientific tasks.

Summary updated

BibTeX
@misc{ye2025pyshred,
  author = {David Ye and Jan P. Williams and Mars Liyao Gao and Stefano Riva and Matteo Tomasetto and David Zoro and J. Nathan Kutz},
  title = {{PySHRED: A Python package for SHallow REcurrent Decoding for sparse sensing, model reduction and scientific discovery}},
  year = {2025},
  eprint = {2507.20954},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.20954},
}
Figure