Most nitrogen and phosphorus reaching rivers from farmland arrives in short bursts. A storm washes fertilizer and soil off fields, and within hours stream nitrate can jump far above its dry-weather level. Modern deep forecasters handle drifting data with a simple trick. They rescale each input window to zero mean and unit variance, predict in that normalized space, and then rescale the prediction back using the mean and spread of the recent past. That trick works when the future looks statistically like the recent past. It fails in exactly the situation that matters most for this kind of pollution: a calm week followed by a storm. In that case the past window's small spread shrinks any predicted spike back toward baseline.
We propose to predict the future window's scale instead of copying it from the past. A small, interpretable model takes forecast rainfall, how wet the catchment already is, and fixed catchment properties, and predicts how the mean and spread of each nutrient will change over the forecast horizon. These predicted statistics replace the past-window statistics when the forecaster's output is rescaled to physical units. The structure follows a standard hydrological regularity: concentration scales as a power of discharge, so nitrogen and phosphorus share one discharge-driven scaling factor. This keeps their ratio physically consistent instead of distorting it channel by channel. The question we test is whether moving storm information out of the normalized backbone and into the rescaling step improves forecasts of pollution events, and in particular of the loads delivered during storms.
Core Claim
Reversible instance normalization (RevIN), as introduced in Kim et al., 2022, normalizes each input window by its own mean $\mu_x$ and standard deviation $\sigma_x$ and denormalizes the output with those same values. It cut N-BEATS MSE on ETTh2 at horizon 960 from 6.408 to 0.471. The authors themselves note that the method assumes the look-back statistics remain valid over the horizon. Non-stationary Transformers keep the same rescaling and add attention corrections computed from the un-normalized statistics. That repairs the attention maps but still denormalizes with the past window's moments. For diffuse agricultural runoff, storm-driven export is the main delivery mechanism, as Zhang et al., 2010 and the flume experiments of Lei Wang et al., 2024 show, so the assumption breaks systematically rather than occasionally.
Our claim is that the horizon's statistics are largely predictable from information known at forecast time: forecast rainfall, antecedent wetness, and static catchment properties. A forecaster that denormalizes with these predicted moments should reduce peak and event-load error on storm windows without hurting baseflow windows. Concretely, for nutrient channel $k$ we set
$$\log \mu^{(k)}_{h} = \log \mu^{(k)}_{x} + b_k\,\widehat{\Delta \log Q}, \qquad \log \sigma^{(k)}_{h} = \log \sigma^{(k)}_{x} + g_k(\widehat{\Delta \log Q}, A),$$
where $\mu^{(k)}_{h},\sigma^{(k)}_{h}$ are the predicted horizon mean and spread. $\widehat{\Delta \log Q}$ is a predicted change in log discharge, produced by a small network from forecast rainfall and catchment attributes. $b_k$ is a learned per-site concentration–discharge slope: positive means the constituent is mobilized by storms, negative means it is diluted. $g_k$ is a small monotone network, and $A$ denotes antecedent wetness. Because nitrogen and phosphorus share $\widehat{\Delta \log Q}$, their ratio can change only through the difference of their slopes, which is the physically meaningful channel. That partially addresses the ratio distortion that channel-independent normalization causes.
Relation to Prior Work
The closest existing system is XFMNet. It targets non-stationary river water quality, explicitly attributes abrupt shifts to rainfall redistributing diffuse pollutants, and fuses satellite precipitation maps with sensor series through gated frequency-domain attention. It motivates our work, since rainfall is the relevant shift driver. Our design differs in where rainfall enters. XFMNet fuses rainfall into its internal representation and has no explicit rescaling step. We route rainfall into the output scale, which the backbone cannot easily represent once inputs are normalized. APT also learns affine corrections beyond local normalization, but it conditions them on prototypes and timestamps rather than on a physical forcing. Timestamps can capture seasonality but cannot anticipate a storm.
DIAN separates invariant from volatile latent components by swapping volatile parts across timestamps during training. It learns that split without guidance, whereas we fix it physically: static catchment properties and fitted slopes on one side, rainfall on the other.
Hydrology constrains and informs the design in three ways. Kratzert et al., 2020 show that LSTMs predict discharge well across 516 CAMELS basins, with NSE of 0.75–0.76 against 0.56–0.64 for the National Water Model, which suggests the discharge-change sub-model is feasible. Their mass-consistency loss also motivates our shared scaling factor. They model only discharge, not chemistry. The NEON nitrate study shows that a small set of sensor covariates including water elevation explains about 99% of nitrate deviance in-sample. That supports the premise that a low-dimensional, discharge-linked structure governs concentration, but the study does not forecast. Process models such as SWAT (Chen et al., 2022; Weigang Wang et al., 2022) encode this mechanism in full. They require basin-specific calibration that degrades as land use and climate change, which is the brittleness our learned per-site slopes are meant to avoid.
Research Program
We build one wrapper that can sit around any backbone. Inputs are normalized by look-back statistics exactly as in RevIN, and the backbone predicts the normalized shape of the horizon. A separate moment head, with fewer than a few thousand parameters, predicts the horizon statistics as above, and denormalization uses them. Training combines two losses: the usual forecast loss in physical units, and an auxiliary loss on the realized horizon mean and log-spread. The auxiliary loss keeps the moment head from being absorbed into the backbone.
Rainfall forecasts are not available historically for every site. We therefore run three input conditions:
- Observed future rainfall. This is an oracle-forecast upper bound.
- Perturbed future rainfall. Observed rainfall with controlled timing and magnitude noise, to mimic real forecast error.
- No future rainfall. Antecedent conditions only.
The gap between conditions 1 and 3 measures how much the idea depends on forecast skill, which is the honest operational question.
We also compute an "oracle moments" variant that denormalizes with the true horizon mean and spread. This bounds how much any moment-prediction scheme could gain over RevIN. If the oracle does not beat RevIN substantially on storm windows, the problem is not where we think it is, and we stop. Finally, we inspect the fitted slopes $b_k$ against land use, expecting more positive nitrate slopes at the agricultural/urban Lewis Run site than at the permafrost-dominated Caribou-Poker Creeks site. We treat this as a sanity check on interpretability, not as a headline result.
Baselines
Naive references. Two reference points that any useful forecaster must clear:
- Persistence: repeat the last observed value.
- Seasonal climatology: the site's historical mean for that day of year and time of day.
They are cheap, reported under every condition, and on baseflow-dominated windows persistence is often hard to beat.
Global z-score scaling. The same backbones with global normalization. It isolates the value of window-level normalization at all, and Kim et al. report it fails badly under shift.
RevIN with future rainfall as covariates. This is the most direct competitor and the key comparison. It is a standard RevIN backbone given the identical rainfall, wetness, and catchment inputs as extra channels, so the backbone can in principle learn storm spikes in normalized space. We run it with the same backbone (a vanilla Transformer and an LSTM), identical inputs, identical training data splits, and the same hyperparameter search budget, set as a fixed number of trials per method. Beating it means lower peak-magnitude error and lower event-load error on held-out storm windows, with confidence intervals from multiple seeds that exclude zero, and no significant loss on baseflow windows.
Non-stationary Transformer with the same covariates. This is the strongest published distribution-shift method in the file: 49.43% average MSE reduction on the vanilla Transformer across the ETT, Exchange, and ILI suites. It receives the same tuning budget, and our wrapper is also applied on top of it, to test whether the gains add.
XFMNet. The strongest domain-specific method. It reports MSE 0.901 on its BJ dataset; the file gives no reported number for BTH or Ala. On BJ we first reproduce that figure. We then add our denormalization around XFMNet's backbone, using its own precipitation inputs. Beating it means lower BJ MSE than the reproduced XFMNet under the same splits, plus better storm-window metrics.
Log-transform baseline. Models trained on log concentrations without instance normalization, with rainfall covariates. This addresses multiplicative spikes by the simplest possible means.
Ablations. Each isolates one ingredient:
- a learned moment head conditioned only on look-back statistics and timestamps, which approximates APT and removes rainfall from the rescaling;
- rainfall-conditioned moments without the shared discharge factor, which removes the physical structure;
- the oracle-moments bound.
No reported forecasting result was found on Lacuna for NEON nitrate. The GAMM's ~99% deviance explained is an in-sample diagnostic, not a forecast score. On NEON, the comparison is therefore internal across the methods above, all run by us.
Why not just…?
Why not just feed rainfall into a RevIN model as an extra input? This is the real threat. If the backbone can output a normalized value of, say, 30 standard deviations during a storm, our wrapper adds nothing. Our argument is that after a calm look-back window the required normalized amplitude is huge and unstable, because the look-back spread is tiny, and losses dominated by baseflow discourage such outputs. That is an argument, not evidence. The direct comparison against the RevIN-with-rainfall baseline, stratified by the ratio of event peak to look-back spread, settles it. If our method does not win in the highest-ratio stratum, the idea fails.
Why not just log-transform concentrations and skip instance normalization? A log transform turns multiplicative storm spikes into additive ones and may capture much of the benefit. We include it as a full baseline. If it matches our method, the honest conclusion is that the gain comes from the log scale, and the contribution reduces to an argument for log-space modeling with rainfall inputs. The oracle-moments run tells us how much remains on top of the log scale.
Why not just use SWAT or a GAMM? SWAT needs per-basin calibration that degrades when land use or climate shifts, and it is too slow for frequent re-forecasting (Madondo et al., 2023). The NEON GAMM uses same-time covariates, which are unknown at forecast time, and ARMA residuals that assume stationarity. We nonetheless run the GAMM with forecast covariates substituted, as a strong statistical reference. Where SWAT setups exist, comparing against them is worthwhile but outside our core budget.
Proposed Experiments
Primary testbed. The NEON 15-minute sensor streams at Arikaree River, Caribou-Poker Creeks, and Lewis Run. These span intermittent, permafrost, and agricultural/urban regimes, and water elevation serves as the discharge proxy.
Discharge sub-model. Pretrained on CAMELS, which tests whether a discharge-change model learned on many basins transfers to nutrient sites.
Comparison with published results. The XFMNet BJ dataset allows a published-number comparison, and BTH and Ala test generality.
Splits. Chronological, with the last years held out, so that test-period shift is genuine.
Metrics. - Overall MSE and MAE. - Event-stratified metrics: relative peak-magnitude error, peak-timing error, and cumulative nitrate-load error over each storm event. - Error on baseflow windows reported separately. Following Predictability-Aligned Evaluation, results are also stratified by intrinsic difficulty so that gains are not just averages over easy calm periods. - For multivariate sites, the error in predicted N:P ratio during events, testing whether the shared factor helps.
Decisive checks, in order: 1. The oracle moments must substantially beat RevIN on storm windows. 2. Our rain-conditioned moments must beat RevIN-with-rainfall-covariates and the log-transform baseline in the high peak-to-spread stratum. 3. Performance under perturbed rainfall must degrade gracefully, not collapse to the no-forecast condition. 4. Leave-one-site-out transfer of the moment head, with only $b_k$ refit, must retain most of the gain.
References
- Reversible Instance Normalization for Accurate Time-Series Forecasting against Distribution Shift
- Non-stationary Transformers: Exploring the Stationarity in Time Series Forecasting
- Research on Non-point Source Pollution Based on Spatial Information Technology: A Case Study in Qingdao
- Research on Multi-Factor Effects of Nitrogen Loss in Slope Runoff
- XFMNet: Decoding Cross-Site and Nonstationary Water Patterns via Stepwise Multimodal Fusion for Long-Term Water Quality Forecasting
- APT: Affine Prototype-Timestamp for Time Series Forecasting Under Distribution Shift
- Decoupled Invariant Attention Network for Multivariate Time-series Forecasting
- Rainfall-Runoff Prediction at Multiple Timescales with a Single Long Short-Term Memory Network
- Understanding links between water-quality variables and nitrate concentration in freshwater streams using high-frequency sensor data
- Study of Non-Point Pollution in the Ashe River Basin Based on SWAT Model with Different Land Use
- Effects of irrigation-fertilization-tillage on nutrient loading and crop yield in Ulansuhai watershed based on improved SWAT model
- A SWAT-based Reinforcement Learning Framework for Crop Management
- Beyond Model Ranking: Predictability-Aligned Evaluation for Time Series Forecasting