TL;DR
Hapi is a novel hierarchical deep learning model (a U-Net Swin Transformer) designed for high-resolution, continental-scale hydrological forecasting. By predicting multiple land-surface variables simultaneously, it outperforms both traditional physics-based operational models and state-of-the-art AI baselines in flood detection. Remarkably, Hapi can generate a 72-hour forecast across the entire contiguous United States in just 0.11 seconds on a single GPU.
What Problem Does This Paper Address?
Predicting floods days in advance requires balancing local hydrological details (like narrow river channels) with massive, continental-scale weather systems. Historically, operational systems have relied on physics-based simulators. While accurate, these simulators consume millions of CPU hours annually, require meticulous regional hand-tuning, and take months to adapt to new variables or regions.
Conversely, recent deep learning approaches have shown promise but typically treat rivers as isolated basins or individual gauges. This pointwise focus ignores explicit spatial interactions across a continuous domain. The authors introduce Hapi to bridge this gap, providing a computationally efficient, gridded AI model capable of forecasting multiple coupled land-surface states across an entire continent.
Methods
Hapi’s architecture integrates a U-Net encoder-decoder with Swin Transformer V2 blocks, utilizing 2D rotary position embeddings (RoPE) and gated attention mechanisms.
Key methodological innovations include:
- Fine 3D Patching: Hapi uses small $2 \times 2$ spatial patches to prevent the early loss of local hydrological details during downsampling.
- Hierarchical Shifted-Window Attention: This allows the model to scale its spatial context dynamically, expanding from local river channels up to synoptic weather scales.
- Learned Laplacian Task Weighting: Hydrological variables span multiple orders of magnitude and contain frequent zeros (e.g., snow water equivalent). Instead of hand-tuning loss weights, the authors adapted an uncertainty-based loss formulation into a Laplacian form using Mean Absolute Error (MAE), allowing the model to automatically balance heterogeneous targets during training.
- Prognostic–Forcing Separation: During autoregressive rollout, the model feeds its own prognostic predictions (discharge, runoff, snow, soil wetness) back into the next step while updating meteorological forcing (precipitation, temperature) from external weather data.
Datasets
The model was trained and evaluated on a daily gridded dataset spanning 20 years (2005–2024) over the contiguous United States (CONUS) at a high-resolution 0.05° grid (~5 km).
- Targets (Prognostic): River discharge, runoff water equivalent, snow water equivalent, and soil wetness index from the GloFAS reanalysis.
- Forcing Inputs: Total runoff, precipitation, evaporation, soil water, solar radiation, and 2m air temperature from ERA5-Land.
- Static Inputs: Elevation (DEM) and upstream drainage area.
- Observational Validation: Independent daily discharge data from 3,881 U.S. Geological Survey (USGS) gauges.
Key Insights and Ideas
- The Power of Joint Prediction: Modeling multiple coupled land-surface variables (like soil moisture and runoff alongside river discharge) provides positive transfer, improving the accuracy of the primary target—river discharge.
- Adaptive Loss Balancing is Crucial for Extremes: Controlled ablation experiments showed that uniform task weighting severely degrades performance. Learning the task scales dynamically yields the lowest errors and significantly boosts the detection of rare, extreme flood events.
- Standard Metrics Can Mask Flood Failures: Through precipitation-perturbation experiments, the authors found that overall continuous metrics like the Nash–Sutcliffe Efficiency (NSE) can remain deceptively stable even when the model's ability to detect rare, threshold-crossing floods degrades sharply. This underscores the importance of evaluating models using threshold-based flood metrics.
Key Results
- Superior Flood Detection: Hapi achieved the highest flood-detection F1 score in 20 out of 21 lead–threshold comparisons, outperforming the operational physics-based GloFAS model and the state-of-the-art AI model, RiverMamba.
- Better Local Skill: Hapi achieved a higher median per-cell NSE than GloFAS and persistence at all forecast leads (24, 48, and 72 hours). Independent validation against 3,881 USGS gauges confirmed that this advantage holds true against real-world observations.
- Blazing Fast Inference: Hapi generates a 72-hour continental forecast in an average of 0.11 seconds on a single NVIDIA A100 GPU, demonstrating a normalized throughput that is 5.1× faster than RiverMamba.
Limitations and Future Work
- Reanalysis Dependency: This study conditioned forecasts on reconstructed weather fields (ERA5-Land). Future work must evaluate Hapi using actual operational Numerical Weather Prediction (NWP) forecasts to account for real-world atmospheric forecast errors.
- Deterministic Framework: Hapi is currently deterministic. The authors note it should be extended to probabilistic predictions or calibrated ensembles to better characterize forecast uncertainty.
- Human Interference: The model struggles with heavily regulated rivers. Because Hapi does not currently ingest reservoir storage states, dam operating rules, or release schedules, human-managed water systems remain a distinct forecasting challenge.
Summary updated