Articles | Volume 30, issue 22
https://doi.org/10.5194/hess-30-7149-2026
https://doi.org/10.5194/hess-30-7149-2026
Research article
 | 
18 Nov 2026
Research article |  | 18 Nov 2026

Benefits of multi-target and self-supervised LSTM models for water quantity and quality

Jean-Paul Brede, Pia Ebeling, Jens Kiesel, and Ralf Loritz
Abstract

Deep learning has become a standard tool for streamflow modelling, but its application to water quality remains challenging due to sparse, irregular, and noisy in-situ observations. Yet, water-quality variables are tightly linked to discharge and to each other through shared hydrological and biogeochemical controls, suggesting that jointly modelling water quantity and quality may help compensate for limited data availability. In this study, we compare single-target, multi-target, and self-supervised LSTM models for the joint simulation of discharge and six water-quality variables (NO3-N, PO4-P, DO, DOC, EC, and WT) across 408 German catchments. Our results highlight that extending the baselineLSTM from single-target discharge prediction to jointly predicting discharge and all six water-quality variables does not substantially degrade discharge performance (across all baseline configurations, median KGE′ = 0.84–0.87) and yields median KGE′ values between 0.40 (PO4-P) and 0.95 (WT) for the water-quality targets. Interestingly, learning discharge as a co-target matches or exceeds the performance of using observed discharge as an additional input for five of the six water-quality variables, with the clearest gain for DOC (ΔKGE′ = +0.05). This indicates that jointly learning water quantity and quality can be more effective than using discharge as a predictor. A variable-averaged loss function is key to balance the strongly uneven observation densities of discharge and water-quality variables. Building on this multi-target framework, we further explore whether an alternative training strategy based on self-supervised learning can better exploit the incomplete and heterogeneous nature of environmental observations. Our evaluation reveals that the self-supervisedLSTM yields a level of predictive skill comparable to the multi-target supervised baselineLSTM under inference conditions restricted to meteorological drivers and when contextual water-quality data is provided. Thus, while matching the baseline's skill, the self-supervisedLSTM gains versatility, as a single model can be applied to many different combinations of available input data without retraining. Besides showcasing the strong performance of LSTMs in water-quality simulations with sparse and irregular data, our results demonstrate that multi-target learning provides an effective framework for coupled water quantity–quality modelling, while self-supervised learning offers additional flexibility for exploiting incomplete and heterogeneous environmental observations.

Share
1 Introduction

Deep learning (DL) has become an effective approach for hydrological modelling, offering a data-driven complement to traditional process-based methods. Particularly when trained on large-sample datasets, DL models can provide reliable water quantity estimates that often match or exceed the performance of conceptual benchmarks (e.g. Acuña Espinoza et al., 2025; Kratzert et al., 2019). Reflecting the field's rapid progress, these advancements are already being integrated into regional and global systems for operational flood and drought forecasting (Nearing et al., 2024). In contrast, the uptake of DL in water-quality (WQ) modelling has been slower (Zhi et al., 2024), partially due to the nature of the available data. Unlike water-quantity variables such as discharge or groundwater levels, which are typically observed automatically and at a high frequency, water-quality measurements are often sparse and irregular in time. Many observations are based on grab sampling, which can miss short-lived but extreme concentration peaks (Rathjens et al., 2023). In addition, measurement uncertainties are often higher due to laboratory analyses, detection limits, and sample handling. As a result, the limited temporal density, uneven coverage, and measurement uncertainties constrain the amount of information available about relevant processes for model training and evaluation, which poses a key challenge for any data-driven model.

Despite these challenges, the complexity of water-quality dynamics may also create opportunities for DL-based approaches (Zhi et al., 2024). Water-quality processes are governed by hydrological, biogeochemical, and anthropogenic interactions that vary across space and time, with solute transport and transformation controlled by factors such as land use (Vaughan et al., 2017), soil or storage-related properties (Musolff et al., 2015), as well as flow paths, temperature, redox conditions, and biological activity (McClain et al., 2003). These interactions create strong dependencies between variables, for example, nitrate, iron, phosphorus, and dissolved organic carbon are linked by redox conditions (Musolff et al., 2017), while temperature and discharge shape seasonal and event-driven dynamics in concentrations (Ebeling et al., 2021; Zhi et al., 2023). For instance, nitrate concentrations often increase with streamflow during seasonal wet periods and storm events due to leaching and runoff (Ebeling et al., 2021; Minaudo et al., 2019), while dissolved oxygen is closely linked to water temperature with seasonal minima during warm summer, low-flow conditions with high biological activity (Zhi et al., 2023). In addition, retention processes in soils and aquifers introduce memory effects and time lags that obscure direct cause–effect relationships (Ehrhardt et al., 2021; Van Meter et al., 2016). Furthermore, water-quality observations typically include a wide range of variables grouped into, e.g. physical, chemical, nutrients, pesticides, metals, and biological, that are tightly linked through shared hydrological flow paths and biogeochemical controls. Although individual time series are often sparse and asynchronous, their interdependence implies that they contain substantial structural information about the coupled system. While such process complexity is difficult to represent and parameterise in traditional process-based models, it aligns well with the strengths of DL, which can learn nonlinear relationships and cross-variable dependencies directly from data. These relationships suggest that jointly modelling multiple variables can increase the effective information content of the data. Realising this potential, however, requires models that explicitly account for the distinct environmental drivers of each constituent and the interactions between the variables (Xia et al., 2025).

Taken together, these characteristics suggest that jointly modelling hydrological states and water-quality variables may provide a promising path forward (Fohrer et al., 2022). By explicitly linking water quantity and quality within a unified modelling framework, it becomes possible to exploit their shared controls and interactions, effectively increasing the information available for learning even under sparse observation conditions. In particular, multi-target approaches that leverage both continuous hydrological signals (e.g. discharge) and irregular water-quality observations can help constrain model behaviour and improve the representation of coupled processes (Zhang et al., 2016). Such approaches align naturally with DL architectures that are able to learn shared latent representations across variables and scales. As a result, integrating water quantity and quality in a combined modelling framework may not only mitigate current data limitations but also enable more consistent and statistically robust predictions of hydro-biogeochemical dynamics (Ouyang et al., 2025; Xia et al., 2025).

A promising, yet still underexplored, extension in this context is self-supervised learning (SSL), which has recently been applied to hydrological variables such as soil moisture and streamflow (Ghosh et al., 2022; Wang et al., 2025) but has not yet been adopted for in-situ riverine WQ modelling (potentially due to the scarcity of the observations themselves). Rather than relying exclusively on predefined target variables, SSL leverages the multivariate structure of hydrological data by training models to reconstruct, predict, or contrast partially observed inputs (Liu et al., 2023). In doing so, the model is forced to learn the joint statistical dependencies and temporal dynamics across variables. For instance, reconstructing masked nitrate concentrations from meteorological forcings, discharge, water temperature, and dissolved oxygen requires the model to internalise hydro-biogeochemical relationships rather than fitting a single target from predefined input features. This formulation effectively transforms the learning problem into a structured inference task, where missing information must be inferred from the remaining context. As a result, SSL yields representations that are intrinsically compatible with incomplete and irregularly sampled data, as missing values can be handled directly within the training objective through masking rather than requiring explicit imputation, dedicated missing-value embeddings, or additional preprocessing steps. Beyond predictive performance, this makes SSL particularly attractive as a diagnostic tool, enabling the systematic exploration of process-level relationships and hypotheses within complex hydrological systems.

In this study, we first investigate how the performance of an LSTM-based model changes as additional target variables are incorporated into the learning task. Starting from single-target models for discharge and six individual water-quality variables, we progressively increase the level of integration by jointly simulating pairs of variables and, ultimately, the full set of hydrological and water-quality targets within a multi-target framework. This hierarchical setup allows us to assess whether and how multi-target learning affects predictive skill and the model's ability to exploit cross-variable dependencies and interactions. Building on the best-performing multi-target configuration, we then evaluate the effect of SSL, testing whether SSL-based training strategies can further improve representation learning and downstream predictions, and discussing their advantages and limitations.

2 Data

Our study leverages the Catchment Attributes and MEteorology for Large-Sample Studies in Germany (CAMELS-DE) dataset (Loritz et al., 2024), supplemented by stream water chemistry data from the QUality, DIscharge and Catchment Attributes for large-sample studies in Germany (QUADICA) dataset (Ebeling et al., 2026a). We divided the time series into three distinct time periods for training (1 October 2000 to 30 September 2010), validation (1 October 1990 to 30 September 1995), and testing (1 October 2010 to 30 September 2019). Training and testing are the time periods with the highest number of measurements in the dataset. Of the 1386 monitoring stations present in QUADICA, 554 are matched to catchments in the CAMELS-DE dataset (Ebeling et al., 2026a). Applying additional data availability criteria, a catchment is kept only if the dataset contains sufficient WQ observations in both the training period and the test period (validation period was only used to identify hyperparameters). Specifically, at least three different WQ variables (NO3-N, PO4-P, DO) must each have 10 or more measurements within the training and testing period respectively, ensuring that the basin contains a minimal amount of multivariate water-quality information for both model training and evaluation. The resulting dataset contains 408 catchments distributed over Germany (Fig. 1).

https://hess.copernicus.org/articles/30/7149/2026/hess-30-7149-2026-f01

Figure 1WQ data availability across the 408 selected CAMELS-DE catchments. (a) Spatial distribution of all WQ grab sample counts per catchment (p. c.) during the training period (2000–2010). (b, c) Cumulative distribution functions for the sample counts per catchments during the training & testing periods. Appendix C contains further metrics for data distributions. Basemap: Esri World Hillshade (sources: Esri, USGS, NOAA | Powered by Esri). Federal state boundaries: © GeoBasis-DE/BKG.

2.1 Meteorological forcing, catchment attributes, and streamflow from CAMELS-DE

To simulate streamflow and water-quality dynamics, the models require information on both the temporal evolution of meteorological conditions and the static characteristics of the catchments. Meteorological forcings provide the time-varying drivers of hydrological and biogeochemical processes, while static catchment attributes describe landscape properties that influence how catchments respond to these forcings.

The meteorological forcing used in this study includes daily mean, minimum, and maximum precipitation (P, mm d−1) and temperature (T, °C), as well as global radiation (R, W m−2) and relative humidity (H,  %). The data was taken from the CAMELS-DE large sample dataset where HYDrometeorological RASterdata (HYRAS), provided by the Deutscher Wetterdienst (DWD, German Weather Service), was extracted and spatially aggregated to the catchments. The time series are gap-free for both the training and testing periods. For streamflow, we used the specific observed discharge (Q, mm d−1) from CAMELS-DE, which covers 97.3 % (training) and 95.5 % (testing) for the selected periods and catchments. In addition to these dynamic variables, 17 static attributes are provided to all models as time-invariant inputs. These attributes represent differences in catchment topography, soil properties, land cover, and climatic conditions. This set follows the static attributes selected for the baseline model in CAMELS-DE (Loritz et al., 2024).

2.2 Water quality data from QUADICA

We used the grab samples from the QUADICA dataset, containing non-aggregated measurements. From this, we selected six relevant modelled WQ variables including the nutrients nitrate (NO3-N, mg L−1) and phosphate (PO4-P, mg L−1), dissolved oxygen (DO, mg L−1), dissolved organic carbon (DOC, mg L−1), electrical conductivity (EC, µS cm−1), and water temperature (WT, °C). In contrast to the daily streamflow observations (Sect. 2.1), WQ variables are sparsely sampled. WT and NO3-N are the most frequently measured variables, with an average temporal coverage of approximately 3 % relative to the continuous streamflow observations (Table 1). DOC has the lowest sample count, with 25 836 measurements in the training period. The median training sample count for the WQ variables per catchment with samples is between 100 and 112, except for DOC which has a median sample count of 88. The maximum sample counts per variable within a single catchment generally do not exceed 273, except for a few catchments with nearly continuous DO, EC, or WT measurements. The minimum number of training samples per catchment for the variables used in the catchment selection procedure (NO3-N, PO4-P, and DO) were 19, 21, and 21, respectively, exceeding the threshold of 10 observations imposed during dataset filtering. For most variables, 77 %–81 % of catchments have a mean sampling interval of 20–50 d, with approximately 10 % sampled more frequently (10–20 d) and 10 % more sparsely (>50 d). DOC deviates from this pattern, with fewer catchments in the frequent category (6 %) and more in the sparse category (16 %).

Table 1Number of available WQ samples per variable and sample split period across all catchments. Coverage (%) is calculated relative to the theoretical maximum (408 catchments × number of days in period). For EC and DOC only 374 and 282 catchments respectively contain sufficient samples during the training period.

Download Print Version | Download XLSX

3 Models

In this study, we train ensembles of supervised (baselineLSTM) and self-supervised (self-supervisedLSTM) LSTMs on the same training data and compare them on the same testing data. For all model configurations, parameters are optimised during training using the mean squared error (MSE) loss. Hyperparameters are selected based on model performance on an independent validation period using the modified Kling–Gupta Efficiency (KGE′; Kling et al., 2012). Final model performance is then evaluated exclusively on the testing period using KGE′ (the decompositions of any reported KGE′ values are listed in Appendix B1). To account for uncertainty arising from random parameter initialisation, each configuration is trained as an ensemble and ensemble performance is computed as the mean prediction across ensemble members. The ensemble mean is treated as the evaluated model, as it accounts for the stochasticity of weight initialisation and optimisation and outperforms the average single-seed model (Kratzert et al., 2019).

3.1 baselineLSTM configuration, targets, and loss functions

We train an ensemble (N=5) of baselineLSTMs (per configuration) that are commonly applied in rainfall-runoff modelling (e.g. Arsenault et al., 2023; Kratzert et al., 2019) and also increasingly used in WQ modelling (Rahmani et al., 2021; Saha et al., 2023; Zhi et al., 2021, 2024). We explored ranges of hyperparameter settings based on previous hydrological studies (Loritz et al., 2024) and found that baselineLSTM performance was relatively stable across a wide range of hyperparameters. We chose hyperparameter settings from Loritz et al. (2024), with modifications made to (a) an increased hidden size (512), (b) an increased number of epochs (50), and (c) the learning rate (Table 2). We change the learning rate and number of epochs to make the comparison of training schemes as similar as possible to the self-supervisedLSTM (see Sect. 3.2). The remaining hyperparameters are displayed in Table 2.

We consider eight dynamic meteorological features at daily resolution, together with 17 static attributes (see Sect. 2.1), as input features to the baselineLSTM. As targets, we train different ensemble configurations to assess how model performance is affected by the number of prediction targets and the coupled simulation of WQ and quantity. Specifically, we train ensembles of baselineLSTMs: (i) one ensemble predicting only discharge (Q), (ii) six different ensembles, each jointly predicting discharge and a single WQ variable (Q + NO3-N, Q + DO, etc.), (iii) six different ensembles taking Q as additional input and each model instance trained on a single WQ variable, (iv) same as (iii) but Q excluded from the input, and (v) two ensembles predicting discharge together with all WQ variables (Q + all WQ). This follows the principle of multi-task learning (Caruana, 1997), where training on related targets can improve generalisation through shared representations.

Given this multi-target setup and the strong imbalance in sample coverage between discharge (97.3 %) and the WQ variables (1.7 %–3.3 %), the choice of the loss function becomes critical. We therefore compare two loss formulations: a standard sample-averaged Mean Squared Error (sample-averagedMSE) and a variable-averaged MSE (variable-averagedMSE). The sample-averagedMSE is computed over all available samples in the batch, irrespective of the variable, such that variables with more observations contribute more strongly to the loss. In contrast, the variable-averagedMSE is computed by first calculating the MSE separately for each variable, and then averaging these per-variable errors across variables. This ensures that each variable contributes equally to the batch loss, preventing frequently observed variables (e.g. discharge) from dominating the optimisation. A similar issue was addressed in Sadler et al. (2022) via a manually tuned scaling factor on the auxiliary loss. The variable-averagedMSE avoids this additional hyperparameter by averaging per-variable errors directly.

3.2 self-supervisedLSTM configuration, targets, and loss functions

Similar to the baselineLSTMs, we train an ensemble (N=5) of self-supervisedLSTM models. The overall architecture remains largely unchanged (a single LSTM layer that performs temporal feature extraction, followed by a linear output head that maps hidden states to predictions). However, a key modification is that the six WQ variables, together with Q, are not only treated as prediction targets but, in addition to the eight dynamic meteorological features, are also incorporated as dynamic input features, resulting in a total of 15 dynamic input variables and seven targets. The self-supervised training is based on a masked reconstruction objective inspired by masked autoencoder approaches (e.g. He et al., 2022; Li et al., 2023), adapted here to sparse and irregularly sampled multivariate time series. During training, the model operates on a masking-based reconstruction task. For each training sequence, the seven hydrological and water-quality variables (Q, NO3-N, PO4-P, DO, DOC, EC, and WT) are randomly partitioned into two groups. One group is retained as observed input, while the remaining variables are masked by replacing their values with a learned scalar mask token. This token is initialised at zero and perturbed with small additive Gaussian noise (scaled by 0.01). The same mask token is also used for missing observations in the input data. Gaps are identified during preprocessing and replaced by the token when the data are passed to the model. This prevents missing values from propagating through the LSTM and allows sequences with incomplete records to be used for training instead of being discarded. In contrast, meteorological forcing variables are always provided as fully observed inputs and are neither masked nor used as reconstruction targets. For each training sequence in a batch the number of masked variables is drawn uniformly between one and seven, and the variables to be masked are then selected at random with equal probability (dynamic masking rate). This way, the training covers the masking configurations of two different inference scenarios which are introduced in the next paragraph. As a result, variables alternate between serving as contextual inputs and reconstruction targets throughout training. This masking strategy enables the model to explicitly leverage cross-variable dependencies. When a subset of variables is observed, it provides contextual information that supports the reconstruction of the masked variables, encouraging the model to learn coherent relationships between water quantity and water-quality dynamics. The dynamic masking rate mimics the different amount of available contextual information during inference. At the same time, this formulation accommodates missing data, as unobserved values can be treated as masked inputs, allowing the model to be trained and applied without requiring explicit imputation or gap-filling. Model training, hyperparameter selection, and evaluation follow the same procedure as for the baselineLSTM models. Apart from the additional dynamic inputs, the only difference is the masking-based learning objective, allowing the impact of the self-supervised formulation to be assessed independently of changes in architecture or training data.

During training, we used a dynamic masking rate of one to seven variables per sequence. During evaluation, however, we collapse the masking configurations to one or seven masked channels to investigate how well the learned representations can reconstruct variables under varying levels of information availability. We evaluate the self-supervisedLSTM under two inference scenarios. In the single-variable masking scenario, all variables except one (Q or a WQ variable) are provided as inputs, and model performance is evaluated on the withheld variable. In the multi-variable masking scenario, only the meteorological forcings and static catchment attributes are provided, while all hydrological and water-quality variables are masked. Model performance is then evaluated separately for each reconstructed target variable.

The single-variable masking scenario assesses the model's ability to exploit cross-variable dependencies when extensive contextual information is available. In contrast, the multi-variable masking scenario represents the most challenging reconstruction setting and mirrors the multi-target prediction setting used for the supervised models, where predictions are generated solely from meteorological forcings and static catchment attributes. Comparing both scenarios therefore provides insight into the extent to which predictive performance originates from information contained in the meteorological forcings versus information shared among hydrological and water-quality variables. During training, model parameters are optimised using the variable-averagedMSE calculated only over the masked variables.

Table 2Overview of model architecture, training configuration, and input/output variables. Dynamic inputs were exclusively used as inputs as opposed to the targets which were used as inputs and as targets in the SSL setting.

Download Print Version | Download XLSX

4 Results

We first present the baselineLSTM and analyse how coupled simulations of WQ and Q affect overall model performance. Specifically, we assess whether multi-task learning leads to improvements or degradations, and how these effects depend on sampling frequency and the number of available measurements. Afterwards we assess the self-supervised model. For evaluation, the predictions of all ensemble members are averaged at each time step, and this ensemble mean is treated as a single model prediction. Models that use Q as input cannot produce predictions for periods with gaps in the discharge record, even when these gaps are short. All models are therefore evaluated only for the time steps where every model provides a prediction, and only in catchments with training observations of that variable. Since reported model differences can be small, and performance metrics are subject to substantial sampling uncertainty (Clark et al., 2021) and can be inflated by counterbalancing errors (Cinkus et al., 2023), we provide an uncertainty quantification for certain model comparisons in Appendix D.

To assess how supervised LSTMs, commonly among the best-performing DL architectures in rainfall–runoff modelling (Liu et al., 2025), respond when predicting multiple targets instead of only streamflow, we evaluate whether their performance declines under multi-task settings or whether they may benefit from shared representations. In this context, all baseline models (Sect. 3.1) achieve high runoff prediction skill, with median KGE′ values between 0.84 and 0.87 (median NSE ∈ [0.87, 0.89]), consistent with previously reported streamflow performance in Germany (Loritz et al., 2024). Extending the model from predicting only discharge to jointly predicting Q and WQ variables leads to only a small decrease in discharge performance (ΔKGE′ ≤ 0.03). Overall, this suggests that the baselineLSTM is sufficiently expressive to support multi-target learning without a notable loss in discharge prediction skill. This is consistent with findings from continuous multi-target settings (Ouyang et al., 2025; Sadler et al., 2022). However, the strong imbalance in temporal coverage between discharge (≈97 %) and WQ variables (≈1.7 %–3.3 %) introduces an additional trade-off, which is primarily governed by the choice of the loss formulation.

The dominant factor influencing WQ predictions in the baselineLSTM is the choice of the loss formulation. Switching from the sample-averagedMSE to the variable-averagedMSE leads to a slight decrease in runoff performance (median KGE′ from 0.87 to 0.84), but improves the prediction of all WQ variables, most pronounced for DOC, NO3-N, EC, and PO4-P (ΔKGE′ = 0.02–0.07) and only marginally for DO and WT (ΔKGE′ < 0.01). Henceforth when referencing the multi-target baselineLSTM (Q + 6 WQ), the version that was trained on the variable-averagedMSE loss is meant. Among the baselineLSTMs, the best performance for DOC, PO4-P, EC, and WT is achieved when training the model jointly on discharge and the respective WQ variable as targets (Fig. A1), while for NO3-N this setup performs on par with the model using discharge as an input (median KGE′ = 0.66 each). Compared to models that include discharge as an input feature, learning discharge as a co-target improves DOC, EC, and PO4-P (ΔKGE′ = 0.05, 0.04, and 0.03), whereas differences for NO3-N and WT are negligible (≤0.004) and DO is slightly better predicted with discharge as an input (ΔKGE′ = −0.01). In contrast, treating discharge merely as an additional input feature does not yield comparable improvements, with performance remaining largely unchanged (ΔKGE′ < 0.01) relative to models driven only by meteorological forcings, except EC (ΔKGE′ = +0.04).

The predictive performance of the multi-target baselineLSTM (Q + 6 WQ) across the full suite of variables is summarised in Fig. 2. While Q and WT are reconstructed with high fidelity, achieving median KGE′ values of 0.84 and 0.95, respectively, the accuracy for chemical constituents exhibits substantial variability. The model demonstrates moderate to high skill for DO (median KGE′ = 0.74), DOC (median KGE′ = 0.66), and NO3-N (median KGE′ = 0.65), whereas PO4-P remains the most challenging target to reproduce, with a median KGE′ of only 0.40. The spatial distribution of these metrics reveals distinct regional patterns across the study area (Fig. 2). For NO3-N (Fig. 2b), performance is highest in northern Germany (median KGE′ of 0.81 to 0.84 in Schleswig-Holstein, Mecklenburg-Western Pomerania, and Lower Saxony) and lowest in Brandenburg, Thuringia, and Hesse (0.44 to 0.49). PO4-P (Fig. 2c) shows the lowest and most heterogeneous performance, with KGE′ < 0.2 in numerous catchments, mainly in eastern and central Germany (median KGE′ of 0.14 in Brandenburg, 0.25 in Saxony-Anhalt, and 0.31 in Thuringia). DO (Fig. 2d) is predicted best in the east and south (0.80 to 0.88 in Brandenburg, Saxony, and Bavaria) and lowest in the northwest (0.66 in Schleswig-Holstein and North Rhine-Westphalia). Thus, the regions with low NO3-N and PO4-P skill do not coincide with those of low DO skill. However, we could not identify a clear set of catchment or climatic characteristics that consistently explained the observed spatial patterns, suggesting that multiple interacting effects may be involved.

https://hess.copernicus.org/articles/30/7149/2026/hess-30-7149-2026-f02

Figure 2Predictive performance of the multi-target baselineLSTM (Q + 6 WQ, variable-averaged loss) on the test period (2010–2019) across all evaluated catchments. (a–g) Spatial distribution of KGE′ for Q, NO3-N, PO4-P, DO, DOC, EC, and WT. Symbol colour indicates the KGE′ class according to the legend. The histogram below each map shows the frequency distribution of KGE′ across catchments. N gives the number of evaluated catchments per variable, and dashed red lines mark the median KGE′. Only catchments with WQ observations of the respective variable in the training period are shown. Basemap: Esri World Hillshade (sources: Esri, USGS, NOAA | Powered by Esri). Federal state boundaries: © GeoBasis-DE/BKG.

Finally, we examine the relationship between data availability and model performance. As expected for data-driven models, predictive skill generally depends on the amount of available training data; however, this relationship is weak and not consistently expressed across variables. Pearson correlations between the number of samples per catchment and variable and their respective KGE′ values are low (r ≤ 0.34; Cohen, 2013). When considering Spearman rank correlations, only PO4-P (ρ = 0.30–0.34) and DOC (ρ = 0.27–0.33) show a moderate relationship. This effect becomes more apparent when comparing groups of basins: the median KGE′ for PO4-P increases substantially (ΔKGE′ ∈ [0.37, 0.42]) from basins with less frequent sampling (>50 d, n=42) to those with average sampling intervals of 10–20 d (n=36). This relationship is less pronounced for the other variables. However, the sampling-interval groups are spatially clustered, as sampling frequencies largely follow the monitoring programmes of the federal states: 37 of the 42 catchments with intervals >50 d are located in Saxony-Anhalt and Saxony, and 17 of the 36 catchments with intervals of 10–20 d in Bavaria. The group difference therefore partly reflects regional differences. Within federal states, more frequently sampled catchments nevertheless show higher PO4-P performance (e.g. Saxony-Anhalt: median KGE′ = 0.35 for 20–50 d vs 0.14 for >50 d; Saxony: 0.51 vs 0.36 respectively), indicating that sampling frequency itself contributes. Furthermore, correlations between test-period sample counts and KGE′ are weak (Pearson r ≤ 0.13 for all variables except PO4-P with r = 0.22–0.24; Spearman ρ ≤ 0.18), suggesting that the reported performance patterns are not primarily an artefact of differing evaluation sample sizes. Overall, while increased data availability is clearly important for DL applications and can improve performance, it does not uniformly explain model skill, indicating that other factors, such as process complexity in a given catchment and data noise, also play an important role (Jeung et al., 2026; Schauer et al., 2025; Xia et al., 2025).

For the self-supervisedLSTM under the fully masked inference scenario where discharge and all WQ variables are masked during testing, leaving only meteorological forcings and static catchment attributes as input, the self-supervisedLSTM achieves performance broadly comparable to the multi-target baselineLSTM, with marginal differences in median KGE′ for all variables (|ΔKGE′| ≤ 0.014). Differences are similarly small under the single-masking scenario, where all but one hydrological or water-quality variable are provided as contextual information, although the sign of the differences varies between variables. Thus, providing contextual observations does not translate into a clear performance advantage over the multi-masking scenario. The self-supervised training strategy therefore does not fundamentally alter predictive performance. This holds for the hyperparameters adopted from the supervised baselines (Table 2) as well as for the tested variations of hidden size (512, 1024), number of training epochs (50, 100), and masking rate (fixed, dynamic), none of which yielded a consistent performance advantage for the self-supervisedLSTM. Notably, both inference scenarios were evaluated with the same trained ensemble, whereas reproducing them with supervised models would require a separately trained model for each input–output configuration. In addition, unlike the baselineLSTMs that use discharge as input, the self-supervisedLSTM produces predictions even when input records contain gaps, as missing values are treated as masked inputs.

5 Discussion

The results of this study address two connected questions: (1) whether jointly simulating discharge and multiple water-quality variables in a shared LSTM framework is feasible without compromising predictive skill, and (2) whether SSL can further improve upon this setup. We discuss the first question in Sect. 5.1 and the second question in Sect. 5.2.

It must be mentioned that this study uses the modified KGE′ (Kling et al., 2012), whereas most comparison studies cited below (Liu et al., 2025; Pandit et al., 2025; Xia et al., 2025) report the original KGE (Gupta et al., 2009). The newer version of the KGE updates the variability ratio term to avoid covariation with the bias ratio. Even though the differences between those two are mostly negligible, the reported values are not directly interchangeable and should be interpreted accordingly, also since sample set, catchment selection, and periods differ between studies.

5.1 Multi-target learning for coupled water quantity–quality modelling

The model results of the baselineLSTM provide several insights into the behaviour and potential of multi-target simulation for coupled water quantity–quality modelling. First, we find that extending an LSTM network from single-target discharge prediction to a multi-target setting does not necessarily lead to a deterioration in discharge performance. Across all configurations, discharge skill remains in the range of previously reported benchmarks for Germany (Loritz et al., 2024), indicating that the capacity of this comparatively simple DL model, consisting of a single LSTM layer with a linear output head, is sufficient to accommodate additional targets without sacrificing predictive performance. This is a noteworthy advantage over process-based models, where a streamflow performance trade-off during multi-variable calibration can be more pronounced (Wagner et al., 2025) and in line with other studies that investigated the use of DL for predicting WQ and water quantity (e.g. Sadler et al., 2022).

For nitrate, direct benchmarking remains difficult due to differences in data structure, model setup, and study region. Nevertheless, to provide context for the magnitude of the achieved performance, we compare our results to values reported in the literature. Our multi-target baselineLSTM, trained on grab-sample data with approximately 3 % temporal coverage, achieves a median KGE′ of 0.65 for NO3-N, which falls within a similar performance range as the single-target study by Pandit et al. (2025) despite differences in data density (temporal resolution), model configuration, and geographic setting and outperforms the multi-target supervised LSTM model by Xia et al. (2025), which used a comparable number of catchments and temporal resolution. Their reported median KGE values for nutrient-related variables of 0.4 align with our phosphate performance. For dissolved oxygen, Zhi et al. (2021, 2023) present LSTM-based models but do not report KGEs. For the 2021 paper they report a median NSE value of 0.53 for their core evaluation group of 84 basins, being slightly lower than our median NSE value for DO of 0.59. In their follow up study, Zhi et al. (2023) improved their model's performance to a median NSE of 0.76 by training it on more basins (580), a longer period (30 years), and additional input variables such as biogeochemical conditions, which alone are attributed a 0.1 NSE increase. These results are therefore not directly comparable with ours. However, Liu et al. (2025), who reproduce these experiments across 236 catchments from Zhi et al. (2021), report a median KGE of approximately 0.70, again consistent with our findings. Water temperature predictions are also in a similar range to previous studies (NSE ≈ 0.98–0.99; Rahmani et al., 2021), although we do not observe their reported improvement when including discharge as an input. For phosphate, our performance (KGE′ ≤ 0.42) is comparable to Xia et al. (2025). Nevertheless, in contrast to their findings, nitrate shows higher predictive skill in our setup (KGE′ ≈ 0.61–0.66). This overall consistency with the literature suggests that our coupled baselineLSTM, which jointly simulates water quantity and WQ in a multi-target framework, does not compromise predictive performance but it may even be advantageous when increasing the number of target variables. This contrasts with process-based water-quality models, where adding calibration targets can introduce parameter trade-offs rather than shared gains. For instance, Molina-Navarro et al. (2017) found that a multi-site, multi-variable water quality calibration achieved the best nutrient-load performance when N and P fractions were considered separately, indicating that fully joint calibration can compromise individual-variable performance. For variables such as DOC or electrical conductivity, broader comparisons remain challenging due to the scarcity of large-sample benchmarks, although a continental-scale study indicates moderate predictability for conductivity (Xia et al., 2025).

An important step in our modelling study was the shift from a sample-averaged (sample-averagedMSE) to a variable-averaged loss (variable-averagedMSE), which introduces a clear but controlled trade-off: a slight decrease in runoff performance is accompanied by improvements across all water-quality variables, most pronounced for DOC, NO3-N, EC, and PO4-P. This trade-off is consistent with the task-weight sensitivity reported by Sadler et al. (2022), who showed that the optimal balance between primary and auxiliary targets is not universal. The variable-averagedMSE provides a simple solution that ensures equal contribution from all targets, though adaptive weighting strategies may offer further refinement. It must be noted though, that through equally weighting those sparsely observed variables, noise and measurement errors present in them will have a greater impact on the training signal. This highlights that properly balancing the contribution of sparsely observed targets is essential in multi-target settings, especially when target variables exhibit large differences in data availability, noise levels, and the complexity of the underlying processes. In this context, learning discharge as a co-target, rather than using it only as an input, emerges as a particularly effective strategy. For DOC, EC, and PO4-P, jointly predicting discharge improves performance compared to models that either exclude discharge or include it only as an input feature (ΔKGE′ = 0.03–0.08). This extends studies that emphasise the importance of discharge primarily as an input (e.g. Rahmani et al., 2021), and suggests that forcing the model to learn discharge internally leads to more informative latent representations. This is consistent with Sadler et al. (2022), who found that multi-task learning outperforms auxiliary-as-input approaches particularly under sparse observation conditions, potentially reflecting a more consistent internal representation of hydrological states (Lees et al., 2022; Ouyang et al., 2025). This effect is not observed for DO, which is predicted slightly better with discharge as an input (ΔKGE′ = −0.01), and differences are negligible for WT and NO3-N (Table D1). For DO and WT this is plausible, since both depend primarily on temperature and energy input rather than direct hydrological forcing (Zhi et al. 2023), whereas DOC concentrations are largely hydrologically controlled (Ebeling et al., 2021; Zarnetske et al., 2018). For NO3-N, the co-target yields only a small per-catchment gain (median ΔKGE′ = 0.01) without changing the median performance.

The relationship between data availability and model performance is weaker than might be expected and varies across variables, highlighting the difficulty of water-quality prediction. While increased sampling frequency can improve performance, particularly for PO4-P, where the effect persists within federal states although sampling frequencies are regionally clustered, the overall correlation between sample count and predictive skill remains low, indicating that data quantity alone does not explain model performance. Instead, factors such as measurement noise, sampling bias, and the intrinsic complexity of the underlying processes play an equally important role (Jeung et al., 2026; Xia et al., 2025). This is reflected in the variable-specific and spatial performance patterns across Germany. While discharge and water temperature are reconstructed with high fidelity, performances for chemical constituents are substantially more variable. In particular, phosphorus remains difficult to predict, both in terms of overall performance and spatial consistency. This suggests that phosphorus dynamics are strongly influenced by local controls, including point sources, legacy effects, and biogeochemical interactions in soils and streams, which operate at finer spatio-temporal scales than those represented by the general catchment attributes and large-scale hydroclimatic drivers used in this study (Ebeling et al., 2021; Gu et al., 2017). Moreover, the absence of explicit nutrient-source information and the 365 d input window limit the model's ability to represent long-term changes in nutrient inputs and legacy effects (Ehrhardt et al., 2021; Westphal et al., 2020), while shorter-term variability resulting from hydrological and seasonal mobilisation processes may be better captured. Future model setups integrating available nutrient source datasets (Batool et al., 2022; Sarrazin et al., 2024) and longer memory or multi-frequency architectures (Acuña Espinoza et al., 2025; Acuna Espinoza et al., 2026) could help address these limitations.

By comparison, NO3-N exhibits a clearer spatial structure, with higher performance in northern Germany. These regions are characterised by agricultural lowland catchments with shallow groundwater systems and high hydrological connectivity, where nutrient concentrations are highly dynamic but strongly linked to discharge patterns. Under wet conditions, shallow solute sources become connected to the stream network, whereas deeper flow paths may transport lower solute concentrations due to longer residence times and retention processes such as denitrification (Ebeling et al., 2021). Conversely, catchments with stronger topographic gradients may be affected by a wider range of event-driven and interacting processes with temporally variable source areas and connectivity patterns (Saavedra et al., 2025; Winter et al., 2024), resulting in more heterogeneous and less predictable water-quality responses.

Consistent with this interpretation, we observe higher model performance in catchments with greater internal solute variability, particularly for NO3-N, and also for WT. For NO3-N, the correlation between KGE′ and the coefficient of variation is between 0.27 and 0.38 across models and catchments. This indicates that variability itself does not necessarily reduce predictability, provided that it follows structured hydrological controls that can be learned by the model. This relationship is not observed for PO4-P, suggesting that phosphorus variability is more strongly governed by processes that are either insufficiently sampled or not well represented by the available predictors. The improved PO4-P performance in more densely sampled catchments further supports this interpretation, indicating that low-frequency sampling may fail to capture the dominant dynamics of phosphorus transport and transformation. This aligns with concepts of spatial and temporal variability in water-quality constituents, which require monitoring strategies adapted to the intrinsic variability of each constituent to capture the relevant processes (Schauer et al., 2025). Relatedly, the “simplicity index” proposed by Xia et al. (2025) shows that model performance strongly correlates with the extent to which a variable's dynamics can be explained by linear relationships with discharge and seasonal cycles. Since during the test period, less than one sample per catchment coincides with discharge above the 99th percentile (0.3 for DOC to 0.9 for DO), the model skill during high-flow events cannot be evaluated with grab-sample data. We therefore did not analyse extreme concentrations, which would require high-frequency or event-based sampling.

5.2 Benefits of self-supervised LSTM training

Regarding the SSL setup, we applied a full-variable masking strategy, i.e., entire hydrological or water-quality variables were masked during training rather than individual time steps or short temporal segments. This choice was motivated by the intended application and the sparse nature of the water-quality observations. During training, one to all of the seven hydrological and water-quality variables are randomly masked, while the remaining variables remain visible. The model is then required to reconstruct the masked variables from the meteorological forcings and the available hydrological and water-quality information. Because the set of masked variables changes from one training sequence to the next, different combinations of variables repeatedly act as contextual inputs and reconstruction targets throughout training. Over time, this encourages the model to learn statistical dependencies among variables, as successful reconstruction requires exploiting information contained in the observed variables (cf. Zerveas et al., 2021). The goal is that the model gradually learns a shared representation of water quantity and water-quality dynamics that can be used to infer missing variables from the available context.

We selected full-variable masking because it aligns naturally with the inference scenarios considered in this study, where complete variables are unavailable and must be reconstructed from the remaining information. We did compare alternative masking strategies, such as masking individual time steps or short temporal segments and found the full-variable masking worked best in our scenario. Although recommended in Li et al. (2023), such approaches may be more appropriate for applications focused on gap-filling or interpolation of partially observed time series. For example, if high-frequency observations of WT and DO are available while NO3-N, DOC, or PO4-P are sampled less frequently, temporally localised masking could be used to learn the reconstruction of missing observations within otherwise observed time series. The number of masked variables per sequence, as well as the selection of which variables are masked jointly, represents an important hyperparameter and defines a continuum between supervised and self-supervised learning. Masking only a small subset of variables moves the training objective closer to a supervised setting, whereas masking a larger number of variables enforces reconstruction from increasingly limited contextual information. Not masking the meteorological variables represents one point in this design space. It performed well during hyperparameter tuning and suits both the data set, in which the meteorological forcings are gap-free, and the inference tasks, in which they are always available. A dynamic masking rate matches the two inference scenarios better than a fixed rate. A more systematic exploration of variable-specific masking rates, training duration, and structured masking strategies, where physically related variables are masked jointly, remains an important direction for future work.

From a technical perspective, SSL simplifies both model development and data handling. A single model can be trained once and subsequently applied across a wide range of input–output configurations without retraining, eliminating the need to build separate supervised models for different target combinations. At the same time, missing values do not require explicit treatment, as masking is an inherent part of the training objective. Consequently, incomplete observations can be incorporated directly into the learning process, avoiding the need for imputation, dedicated missing-value encodings, or additional preprocessing steps (e.g. Gauch et al., 2025). This combination of flexibility and robustness reduces computational cost and streamlines the modelling workflow, which is particularly beneficial in hydrological applications characterised by heterogeneous and incomplete data.

From a methodological perspective, SSL provides a framework to systematically investigate relationships between variables. By reconstructing selected variables from different subsets of inputs, the model is forced to learn the underlying dependencies within the hydro-biogeochemical system. This enables targeted analyses of how information is shared across variables, for example by assessing how well a given variable can be inferred from others or how predictive skill changes when specific inputs are removed. In this sense, SSL is one way to extend the role of DL models beyond prediction, allowing them to be used as tools to probe and interpret the structure of complex environmental systems.

In this study, the SSL-trained model performs similarly to its supervised counterpart but does not outperform it. Nevertheless, this comparable skill is achieved with a single trained model that can be applied to different combinations of available inputs without retraining, whereas supervised models must be trained separately for each configuration. Moreover, there is emerging evidence that SSL can improve generalisation under unseen conditions (Wang et al., 2025), suggesting that its benefits may become more apparent in spatially out-of-sample scenarios. We therefore argue that SSL should not primarily be viewed as a means to maximise predictive skill in conventional benchmarks, but rather as a methodological step towards more flexible, scalable, and generalisable hydrological models. More broadly, the SSL training paradigm aligns conceptually with emerging foundation models for Earth system prediction, in which a single model trained on diverse data is subsequently adapted to new tasks or variables with minimal retraining and little computational cost (Bodnar et al., 2025; Lehmann et al., 2026). Taken together, these findings indicate that the potential of SSL may not be fully reflected by conventional benchmark metrics and should also be evaluated in terms of robustness, transferability, and the ability to learn from heterogeneous environmental observations.

6 Conclusion

Our results support four main conclusions:

  • i.

    coupling streamflow with various water-quality variables in a single LSTM comes at virtually no cost to discharge performance (ΔKGE′ ≤ 0.03, ΔNSE ≤ 0.02 across all configurations). At the same time, jointly predicting discharge and a water-quality variable gives the highest skill for most water-quality variables compared with models that predict them without discharge, and overall performance is comparable to contemporary studies.

  • ii.

    including streamflow as a target rather than as an input improves performance for DOC, EC, and PO4-P (ΔKGE′ = +0.03 to +0.05) and performs on par for NO3-N and WT, even though observed discharge is not required at inference. Only DO is predicted slightly better with discharge as an input (ΔKGE′ = −0.01). We conjecture this relates to an improved internal hydrological “understanding” of the LSTM, which could be verified by future probing studies. We therefore recommend the use of streamflow as an additional target in WQ modelling when using LSTM architectures. This might be extended to other architectures and warrants testing.

  • iii.

    unequal coverage between targets must be addressed in the loss formulation during model training. In our study, discharge observations are continuous whereas water-quality measurements are sparse and irregular, creating a strongly unbalanced multi-target setting. Across all tested multi-target LSTM configurations, variable-averaging the per-target MSE consistently improved water-quality predictions at only a minor cost to streamflow performance, providing a simple and hyperparameter-free default for applications with strongly differing observation densities among targets.

  • iv.

    SSL modelling in hydrology shows no systematic performance benefits over the supervised multi-target baseline under comparable inference conditions (multi-masking), with near-identical performance medians (|ΔKGE′| ≤ 0.014). Incorporation of missing data points into the training signal is deemed highly promising, especially for modelling outside of large sample dataset coverage where the meteorological forcings are usually incomplete. Testing for that by noise injection or adding adversarial data to the input data can explore whether SSL makes an LSTM model more robust against uncertainty in the input data. With the additional hyperparameters in SSL only touched on here, there is a wide variety of exploratory avenues to optimise for individual use cases. Overall, multi-target training proves viable, discharge prediction is largely unaffected across all configurations, and targeted adjustments to the loss formulation and target configuration yield consistent improvements in water-quality skill. SSL, by contrast, offers practical modelling flexibility that is particularly relevant given the sparse and heterogeneous nature of water-quality observations without compromising predictive performance. This training paradigm enables the user-friendly incorporation of a vast number of related variables for various inference settings with subsets of input data predicting single targets, multiple targets, or simply imputing missing data in a single LSTM model. We believe this is a necessary step forward to attain foundation models that are able to generalise not only spatially and over time but also across hydrological subdomains.

Appendix A: Complete model performance overview

Appendix A includes tabular overviews over the different model types and the median KGE′ and NSE performances of all models (ensemble mean), evaluated for each variable on the same days and catchments for all models (catchments with training observations of the variable; days on which all models provide a prediction). The colour coding presented in Table A1 is applied to all figures.

Table A1Model configurations shown in Figs. A1–A2. The coloured square on the left of each heatmap row indicates the model family.

Download Print Version

https://hess.copernicus.org/articles/30/7149/2026/hess-30-7149-2026-f03

Figure A1Median KGE′ on the test period (2010–2019) for all model configurations and target variables. Each row corresponds to one model configuration; columns represent the seven target variables. Bold values with a black border mark the best-performing configuration per variable, n gives the number of evaluated catchments per variable dashes (–) indicate that the variable was not a training target for that configuration. Coloured squares on the left y-axis indicate the model family (see Table A1).

Download

https://hess.copernicus.org/articles/30/7149/2026/hess-30-7149-2026-f04

Figure A2As Fig. A1, but showing median NSE. The figure illustrates how a different metric can shift the performance rankings (e.g. DOC, DO).

Download

Appendix B: Performance distributions

Appendix B covers KGE′ and NSE performance distribution for all models and an overview of the KGE′ components for all models.

Table B1Decomposition of KGE′ for all model configurations and target variables on the test period (2010–2019): median over the evaluated catchments (n per variable) of KGE′, the correlation r, the bias ratio β (mean of simulations over mean of observations) and the variability ratio γ (ratio of the coefficients of variation). Medians are computed separately for each component, so the median KGE′ cannot be recomputed from the median components. Within each variable, configurations are ranked by median KGE′; colours indicate the model family as in Table A1. The correlation differs little between configurations for NO3-N, DOC, and PO4-P (range ≤ 0.02), so that differences between configurations arise mainly from the variability ratio γ; for EC, differences in r (0.63–0.72) dominate. All configurations underestimate the variability of the water-quality variables (γ < 1) except for WT, and PO4-P is overestimated on average by 15 %–20 % (β=1.15–1.20).

https://hess.copernicus.org/articles/30/7149/2026/hess-30-7149-2026-f05

Figure B1Distribution of test-period KGE′ across the catchments for all model configurations and target variables (2010–2019). Each panel shows one target variable; horizontal boxes correspond to individual model configurations, sorted by ascending median KGE′ (best on top). Colour indicates model family (legend; see Table A1). Box centres mark the median, hinges span the interquartile range (IQR), whiskers extend to 1.5 × IQR, black diamonds mark the means, and grey points show individual catchments beyond the whiskers. The dashed vertical line at KGE′ = 0 separates positive from negative scores.

Download

https://hess.copernicus.org/articles/30/7149/2026/hess-30-7149-2026-f06

Figure B2As Fig. B1, but showing distributions of test-period NSE.

Download

https://hess.copernicus.org/articles/30/7149/2026/hess-30-7149-2026-f07

Figure B3Empirical cumulative distribution functions (ECDFs) of test-period KGE′ across the evaluated catchments (n per panel) for all model configurations and target variables (2010–2019). Each panel shows one target variable; one ECDF curve per model configuration. Line colour indicates model family (legend; see Table A1). Within the multi-target baselineLSTM and the self-supervisedLSTM families, solid lines denote the sample-averaged loss and single-mask scenario, dashed lines the variable-averaged loss and multi-mask scenario, respectively. The dashed vertical line at KGE′ = 0 separates positive from negative scores.

Download

https://hess.copernicus.org/articles/30/7149/2026/hess-30-7149-2026-f08

Figure B4As Fig. B3, but showing ECDFs of test-period NSE.

Download

Appendix C: Data distribution

Appendix C gives details on all model inputs.

Table C1Overview of all data used in the modelling process including variable descriptions and median and maximum sample count per variable and sample split period. Medians and maxima refer to the catchments with at least one sample of the respective variable and period (DOC: 282 training, 315 testing; EC: 374 training, 407 testing; all other variables: 408).

Download Print Version | Download XLSX

Appendix D: Uncertainty estimation

Appendix D presents a paired bootstrap analysis comparing the baseline model family that uses Q as an input with the one that uses Q as a co-target. Comparing models by their median performance across hundreds of catchments reduces each performance distribution, itself already an aggregate, to a single value. This common practice discards information on where and why models differ and can lead to misinterpretation. The outcome also depends on the choice of metric (e.g. KGE′, NSE, RMSE, r) and of summary statistic (e.g. mean, median). To quantify the uncertainty of the central result of this study, the effect of using Q as a co-target rather than as an input, we conducted a paired bootstrap analysis with 10 000 resamples for each model pair. Each resample draws n catchments with replacement, where n is the number of evaluated catchments per variable, and the same catchments are used for both models. For each resample, we compute (i) the difference between the median KGE′ of the two models and (ii) the median of the per-catchment KGE′ differences. This yields sampling distributions of both measures that reflect their dependence on the set of evaluated catchments. The resulting values and their 95 % confidence intervals are given in Table D1.

Table D1Paired bootstrap comparison of the baselineLSTM paired with Q as co-target and the baselineLSTM single-target with Q as input on the test period (2010–2019). Coloured squares indicate the model family (Table A1). Both models are evaluated as the ensemble mean (N=5) on a shared evaluation set per variable. This set contains only days on which both models produce a simulation (single-target (+Q in) gives no simulation when observed Q is missing in the 365 d input sequence) and only catchments with WQ samples in both the training and test periods; n is the resulting number of catchments. ΔKGE′ is always Q as co-target minus Q as input, so positive values favour Q as a co-target. “Difference of medians” is the median KGE′ of the paired model minus the median KGE′ of the single-target (+Q in) model. “Median of per-catchment differences” is the median of the KGE′ differences computed catchment by catchment. The last column gives the number of catchments in which each model has the higher KGE′.

Download Print Version

Code and data availability

The CAMELS-DE dataset is available at https://doi.org/10.5281/zenodo.13837553 (Dolich et al., 2024; Loritz et al., 2024). The QUADICA dataset is available at https://doi.org/10.4211/hs.11cd7518f3b74225a5b9e66bfbce362e (Ebeling et al., 2026b), while due to data use licences raw data cannot be published and are thus deposited in a long-term institutional repository (https://www.ufz.de/record/dmp/archive/16457, last access: 30 October 2026).

Author contributions

Jean-Paul Brede: Conceptualization, Methodology, Software, Formal analysis, Investigation, Validation, Visualization, Writing – original draft, Writing – review & editing.

Pia Ebeling: Conceptualization, Data curation, Writing – review & editing.

Jens Kiesel: Writing – review & editing.

Ralf Loritz: Conceptualization, Funding acquisition, Methodology, Resources, Supervision, Writing – original draft, Writing – review & editing.

Competing interests

At least one of the (co-)authors is a member of the editorial board of Hydrology and Earth System Sciences. The peer-review process was guided by an independent editor, and the authors also have no other competing interests to declare.

Disclaimer

Publisher's note: Copernicus Publications remains neutral with regard to jurisdictional claims made in the text, published maps, institutional affiliations, or any other geographical representation in this paper. The authors bear the ultimate responsibility for providing appropriate place names. Views expressed in the text are those of the authors and do not necessarily reflect the views of the publisher.

Acknowledgements

The authors acknowledge support by the state of Baden-Württemberg through bwHPC. The authors further gratefully acknowledge the computing time provided on the high-performance computer HoreKa by the National High-Performance Computing Center at KIT (NHR@KIT). This centre is jointly supported by the Federal Ministry of Research, Technology and Space and the Ministry of Science, Research and the Arts of Baden-Württemberg, as part of the National High-Performance Computing (NHR) joint funding program. HoreKa is partly funded by the German Research Foundation (DFG). This work is additionally supported by the Helmholtz Association Initiative and Networking Fund on the HAICORE@KIT partition.

AI tools were used for script generation, code autocomplete, and plausibility checks. Grammar and spelling checks of the manuscript were also supported by AI. Models used for programming-related tasks were Anthropic's Claude (Sonnet and Opus families) for script generation and Microsoft's Copilot for code autocomplete. Natural language-related tasks were model-agnostic.

Financial support

This research has been supported by the Bundesministerium für Forschung, Technologie und Raumfahrt (BMFTR) as part of the project “AI-based flood prediction in small river basins in Germany” (KI-HopE-De, grant no. 16IS24088A) and by the Volkswagen Foundation as part of the project “Invigorating Hydrological Science and Teaching: Merging Key Legacies with New Concepts and Paradigms” (ViTamins, grant no. 0069685).

The article processing charges for this open-access publication were covered by the Karlsruhe Institute of Technology (KIT).

Review statement

This paper was edited by Alberto Guadagnini and reviewed by two anonymous referees.

References

Acuña Espinoza, E., Kratzert, F., Klotz, D., Gauch, M., Álvarez Chaves, M., Loritz, R., and Ehret, U.: Technical note: An approach for handling multiple temporal frequencies with different input dimensions using a single LSTM cell, Hydrol. Earth Syst. Sci., 29, 1749–1758, https://doi.org/10.5194/hess-29-1749-2025, 2025. 

Acuna Espinoza, E. J., Álvarez Chaves, M., Kratzert, F., Klotz, D., Gauch, M., Lang, R., Elfgang, D., Dolich, A., Loritz, R., and Ehret, U.: Everything everywhere all at once: A single-cell LSTM network unifying multi-frequency, missing data, and discharge assimilation for robust operational flood forecasting, EGUsphere [preprint], https://doi.org/10.5194/egusphere-2026-4885, 2026. 

Arsenault, R., Martel, J.-L., Brunet, F., Brissette, F., and Mai, J.: Continuous streamflow prediction in ungauged basins: long short-term memory neural networks clearly outperform traditional hydrological models, Hydrol. Earth Syst. Sci., 27, 139–157, https://doi.org/10.5194/hess-27-139-2023, 2023. 

Batool, M., Sarrazin, F. J., Attinger, S., Basu, N. B., Van Meter, K., and Kumar, R.: Long-term annual soil nitrogen surplus across Europe (1850–2019), Sci. Data, 9, 612, https://doi.org/10.1038/s41597-022-01693-9, 2022. 

Bodnar, C., Bruinsma, W. P., Lucic, A., Stanley, M., Allen, A., Brandstetter, J., Garvan, P., Riechert, M., Weyn, J. A., Dong, H., Gupta, J. K., Thambiratnam, K., Archibald, A. T., Wu, C.-C., Heider, E., Welling, M., Turner, R. E., and Perdikaris, P.: A foundation model for the Earth system, Nature, 641, 1180–1187, https://doi.org/10.1038/s41586-025-09005-y, 2025. 

Caruana, R.: Multitask Learning, Mach. Learn., 28, 41–75, https://doi.org/10.1023/A:1007379606734, 1997. 

Cinkus, G., Mazzilli, N., Jourde, H., Wunsch, A., Liesch, T., Ravbar, N., Chen, Z., and Goldscheider, N.: When best is the enemy of good – critical evaluation of performance criteria in hydrological models, Hydrol. Earth Syst. Sci., 27, 2397–2411, https://doi.org/10.5194/hess-27-2397-2023, 2023. 

Clark, M. P., Vogel, R. M., Lamontagne, J. R., Mizukami, N., Knoben, W. J. M., Tang, G., Gharari, S., Freer, J. E., Whitfield, P. H., Shook, K. R., and Papalexiou, S. M.: The Abuse of Popular Performance Metrics in Hydrologic Modeling, Water Resour. Res., 57, e2020WR029001, https://doi.org/10.1029/2020WR029001, 2021. 

Cohen, J.: Statistical Power Analysis for the Behavioral Sciences, 2nd edn., Routledge, New York, 567 pp., https://doi.org/10.4324/9780203771587, 2013. 

Dolich, A., Espinoza, E. A., Ebeling, P., Guse, B., Götte, J., Hassler, S., Hauffe, C., Kiesel, J., Heidbüchel, I., Mälicke, M., Müller-Thomy, H., Stölzle, M., Tarasova, L., and Loritz, R.: CAMELS-DE: hydrometeorological time series and attributes for 1582 catchments in Germany (Version 1.0.0), Zenodo [data set], https://doi.org/10.5281/zenodo.13837553, 2024. 

Ebeling, P., Kumar, R., Weber, M., Knoll, L., Fleckenstein, J. H., and Musolff, A.: Archetypes and Controls of Riverine Nutrient Export Across German Catchments, Water Resour. Res., 57, e2020WR028134, https://doi.org/10.1029/2020WR028134, 2021. 

Ebeling, P., Hubig, A., Wachholz, A., Scharfenberger, U., Haug, S., Nguyen, T., Sarrazin, F., Batool, M., Musolff, A., and Kumar, R.: QUADICA v2: extending the large-sample data set for water QUAlity, DIscharge and Catchment Attributes in Germany, Earth Syst. Sci. Data, 18, 691–712, https://doi.org/10.5194/essd-18-691-2026, 2026a. 

Ebeling, P., Kumar, R., Musolff, A., Nguyen, T., Hubig, A., Haug, S., Scharfenberger, U., Batool, M., Wachholz, A., and Sarrazin, F.: QUADICA v2 – water quality, discharge and catchment attributes for large-sample studies in Germany, HydroShare [data set], https://doi.org/10.4211/hs.11cd7518f3b74225a5b9e66bfbce362e, 2026b. 

Ehrhardt, S., Ebeling, P., Dupas, R., Kumar, R., Fleckenstein, J. H., and Musolff, A.: Nitrate Transport and Retention in Western European Catchments Are Shaped by Hydroclimate and Subsurface Properties, Water Resour. Res., 57, e2020WR029469, https://doi.org/10.1029/2020WR029469, 2021. 

Fohrer, N., Wagner, P. D., Kiesel, J., Haas, M., and Guse, B.: A guideline for spatio-temporal consistency in water quality modelling in rural areas, Hydrol. Process., 36, e14711, https://doi.org/10.1002/hyp.14711, 2022. 

Gauch, M., Kratzert, F., Klotz, D., Nearing, G., Cohen, D., and Gilon, O.: How to deal w___ missing input data, Hydrol. Earth Syst. Sci., 29, 6221–6235, https://doi.org/10.5194/hess-29-6221-2025, 2025. 

Ghosh, R., Renganathan, A., Tayal, K., Li, X., Khandelwal, A., Jia, X., Duffy, C., Nieber, J., and Kumar, V.: Robust Inverse Framework using Knowledge-guided Self-Supervised Learning: An application to Hydrology, in: Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, 465–474, https://doi.org/10.1145/3534678.3539448, 2022. 

Gu, S., Gruau, G., Dupas, R., Rumpel, C., Crème, A., Fovet, O., Gascuel-Odoux, C., Jeanneau, L., Humbert, G., and Petitjean, P.: Release of dissolved phosphorus from riparian wetlands: Evidence for complex interactions among hydroclimate variability, topography and soil properties, Sci. Total Environ., 598, 421–431, https://doi.org/10.1016/j.scitotenv.2017.04.028, 2017. 

Gupta, H. V., Kling, H., Yilmaz, K. K., and Martinez, G. F.: Decomposition of the mean squared error and NSE performance criteria: Implications for improving hydrological modelling, J. Hydrol., 377, 80–91, https://doi.org/10.1016/j.jhydrol.2009.08.003, 2009. 

He, K., Chen, X., Xie, S., Li, Y., Dollár, P., and Girshick, R.: Masked Autoencoders Are Scalable Vision Learners, in: 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 15979–15988, https://doi.org/10.1109/CVPR52688.2022.01553, 2022. 

Jeung, M., Her, Y., Baek, S.-S., and Yoon, K.: Sensitivity of hydrological machine learning prediction accuracy to information quantity and quality, Hydrol. Earth Syst. Sci., 30, 1077–1095, https://doi.org/10.5194/hess-30-1077-2026, 2026. 

Kling, H., Fuchs, M., and Paulin, M.: Runoff conditions in the upper Danube basin under an ensemble of climate change scenarios, J. Hydrol., 424–425, 264–277, https://doi.org/10.1016/j.jhydrol.2012.01.011, 2012. 

Kratzert, F., Klotz, D., Shalev, G., Klambauer, G., Hochreiter, S., and Nearing, G.: Towards learning universal, regional, and local hydrological behaviors via machine learning applied to large-sample datasets, Hydrol. Earth Syst. Sci., 23, 5089–5110, https://doi.org/10.5194/hess-23-5089-2019, 2019. 

Lees, T., Reece, S., Kratzert, F., Klotz, D., Gauch, M., De Bruijn, J., Kumar Sahu, R., Greve, P., Slater, L., and Dadson, S. J.: Hydrological concept formation inside long short-term memory (LSTM) networks, Hydrol. Earth Syst. Sci., 26, 3079–3101, https://doi.org/10.5194/hess-26-3079-2022, 2022. 

Lehmann, F., Ozdemir, F., Soja, B., Hoefler, T., Mishra, S., and Schemm, S.: Fine-Tuning a Weather Foundation Model With Lightweight Decoders for Unseen Physical Processes, J. Geophys. Res. Mach. Learn. Comput., 3, e2025JH000837, https://doi.org/10.1029/2025JH000837, 2026. 

Li, Z., Rao, Z., Pan, L., Wang, P., and Xu, Z.: Ti-MAE: Self-Supervised Masked Time Series Autoencoders, arXiv [preprint], https://doi.org/10.48550/arXiv.2301.08871, 2023. 

Liu, J., Shen, C., O'Donncha, F., Song, Y., Zhi, W., Beck, H. E., Bindas, T., Kraabel, N., and Lawson, K.: From RNNs to Transformers: benchmarking deep learning architectures for hydrologic prediction, Hydrol. Earth Syst. Sci., 29, 6811–6828, https://doi.org/10.5194/hess-29-6811-2025, 2025. 

Liu, X., Zhang, F., Hou, Z., Wang, Z., Mian, L., Zhang, J., and Tang, J.: Self-supervised Learning: Generative or Contrastive, IEEE Trans. Knowl. Data Eng., 35, 857–876, https://doi.org/10.1109/TKDE.2021.3090866, 2023. 

Loritz, R., Dolich, A., Acuña Espinoza, E., Ebeling, P., Guse, B., Götte, J., Hassler, S. K., Hauffe, C., Heidbüchel, I., Kiesel, J., Mälicke, M., Müller-Thomy, H., Stölzle, M., and Tarasova, L.: CAMELS-DE: hydro-meteorological time series and attributes for 1582 catchments in Germany, Earth Syst. Sci. Data, 16, 5625–5642, https://doi.org/10.5194/essd-16-5625-2024, 2024. 

McClain, M. E., Boyer, E. W., Dent, C. L., Gergel, S. E., Grimm, N. B., Groffman, P. M., Hart, S. C., Harvey, J. W., Johnston, C. A., Mayorga, E., McDowell, W. H., and Pinay, G.: Biogeochemical Hot Spots and Hot Moments at the Interface of Terrestrial and Aquatic Ecosystems, Ecosystems, 6, 301–312, https://doi.org/10.1007/s10021-003-0161-9, 2003. 

Minaudo, C., Dupas, R., Gascuel-Odoux, C., Roubeix, V., Danis, P.-A., and Moatar, F.: Seasonal and event-based concentration-discharge relationships to identify catchment controls on nutrient export regimes, Adv. Water Resour., 131, 103379, https://doi.org/10.1016/j.advwatres.2019.103379, 2019. 

Molina-Navarro, E., Andersen, H. E., Nielsen, A., Thodsen, H., and Trolle, D.: The impact of the objective function in multi-site and multi-variable calibration of the SWAT model, Environ. Model. Softw., 93, 255–267, https://doi.org/10.1016/j.envsoft.2017.03.018, 2017. 

Musolff, A., Schmidt, C., Selle, B., and Fleckenstein, J. H.: Catchment controls on solute export, Adv. Water Resour., 86, 133–146, https://doi.org/10.1016/j.advwatres.2015.09.026, 2015. 

Musolff, A., Selle, B., Büttner, O., Opitz, M., and Tittel, J.: Unexpected release of phosphate and organic carbon to streams linked to declining nitrogen depositions, Glob. Change Biol., 23, 1891–1901, https://doi.org/10.1111/gcb.13498, 2017. 

Nearing, G., Cohen, D., Dube, V., Gauch, M., Gilon, O., Harrigan, S., Hassidim, A., Klotz, D., Kratzert, F., Metzger, A., Nevo, S., Pappenberger, F., Prudhomme, C., Shalev, G., Shenzis, S., Tekalign, T. Y., Weitzner, D., and Matias, Y.: Global prediction of extreme floods in ungauged watersheds, Nature, 627, 559–563, https://doi.org/10.1038/s41586-024-07145-1, 2024. 

Ouyang, W., Gu, X., Ye, L., Liu, X., and Zhang, C.: Exploring Hydrological Variable Interconnections and Enhancing Predictions for Data-Limited Basins Through Multi-Task Learning, Water Resour. Res., 61, e2023WR036593, https://doi.org/10.1029/2023WR036593, 2025. 

Pandit, A., Golden, H. E., Christensen, J. R., Lane, C. R., and Husic, A.: Deep Learning Prediction and Interpretation of Riverine Nitrate Export Across the Mississippi River Basin, Water Resour. Res., 61, e2024WR039207, https://doi.org/10.1029/2024WR039207, 2025. 

Rahmani, F., Lawson, K., Ouyang, W., Appling, A., Oliver, S., and Shen, C.: Exploring the exceptional performance of a deep learning stream temperature model and the value of streamflow data, Environ. Res. Lett., 16, 024025, https://doi.org/10.1088/1748-9326/abd501, 2021. 

Rathjens, H., Miguez, M. B., Winchell, M., and Sur, R.: Evaluation of SEAWAVE–QEX in a high agricultural intensity catchment in Belgium, Integr. Environ. Assess. Manag., 19, 513–526, https://doi.org/10.1002/ieam.4688, 2023. 

Saavedra, F., Vergopolan, N., Musolff, A., Merz, R., Wang, Z., Winter, C., and Tarasova, L.: From Soil Moisture Spatial Patterns to Catchment Nitrate Dynamics Using Explainable AI, Water Resour. Res., 61, e2025WR040295, https://doi.org/10.1029/2025WR040295, 2025. 

Sadler, J. M., Appling, A. P., Read, J. S., Oliver, S. K., Jia, X., Zwart, J. A., and Kumar, V.: Multi-Task Deep Learning of Daily Streamflow and Water Temperature, Water Resour. Res., 58, e2021WR030138, https://doi.org/10.1029/2021WR030138, 2022. 

Saha, G. K., Rahmani, F., Shen, C., Li, L., and Cibin, R.: A deep learning-based novel approach to generate continuous daily stream nitrate concentration for nitrate data-sparse watersheds, Sci. Total Environ., 878, 162930, https://doi.org/10.1016/j.scitotenv.2023.162930, 2023. 

Sarrazin, F. J., Attinger, S., and Kumar, R.: Gridded dataset of nitrogen and phosphorus point sources from wastewater in Germany (1950–2019), Earth Syst. Sci. Data, 16, 4673–4708, https://doi.org/10.5194/essd-16-4673-2024, 2024. 

Schauer, L. S., Jawitz, J. W., Cohen, M. J., and Musolff, A.: Spatial and Temporal Variability of River Water Quality, Hydrol. Process., 39, e70154, https://doi.org/10.1002/hyp.70154, 2025. 

Van Meter, K. J., Basu, N. B., Veenstra, J. J., and Burras, C. L.: The nitrogen legacy: emerging evidence of nitrogen accumulation in anthropogenic landscapes, Environ. Res. Lett., 11, 035014, https://doi.org/10.1088/1748-9326/11/3/035014, 2016. 

Vaughan, M. C. H., Bowden, W. B., Shanley, J. B., Vermilyea, A., Sleeper, R., Gold, A. J., Pradhanang, S. M., Inamdar, S. P., Levia, D. F., Andres, A. S., Birgand, F., and Schroth, A. W.: High-frequency dissolved organic carbon and nitrate measurements reveal differences in storm hysteresis and loading in relation to land cover and seasonality, Water Resour. Res., 53, 5345–5363, https://doi.org/10.1002/2017WR020491, 2017. 

Wagner, P. D., Duethmann, D., Kiesel, J., Pool, S., Hrachowitz, M., Ceola, S., Herzog, A., Houska, T., Loritz, R., Spieler, D., Staudinger, M., Tarasova, L., Thober, S., Fohrer, N., Tetzlaff, D., Wagener, T., and Guse, B.: The Unexploited Treasures of Hydrological Observations Beyond Streamflow for Catchment Modeling, WIREs Water, 12, e70018, https://doi.org/10.1002/wat2.70018, 2025. 

Wang, L., Shi, L., Reimers, C., Wang, Y., He, L., Wang, Y., Reichstein, M., and Jiang, S.: A self-supervised deep learning model for enhanced generalization in soil moisture prediction, J. Hydrol., 662, 133974, https://doi.org/10.1016/j.jhydrol.2025.133974, 2025. 

Westphal, K., Musolff, A., Graeber, D., and Borchardt, D.: Controls of point and diffuse sources lowered riverine nutrient concentrations asynchronously, thereby warping molar N:P ratios, Environ. Res. Lett., 15, 104009, https://doi.org/10.1088/1748-9326/ab98b6, 2020. 

Winter, C., Jawitz, J. W., Ebeling, P., Cohen, M. J., and Musolff, A.: Divergence Between Long-Term and Event-Scale Nitrate Export Patterns, Geophys. Res. Lett., 51, e2024GL108437, https://doi.org/10.1029/2024GL108437, 2024. 

Xia, X., Liu, X., Liu, J., Fang, K., Lu, L., Oymak, S., Currie, W. S., and Liu, T.: Identifying trustworthiness challenges in deep learning models for continental-scale water quality prediction, Nexus, 2, 100104, https://doi.org/10.1016/j.ynexs.2025.100104, 2025. 

Zarnetske, J. P., Bouda, M., Abbott, B. W., Saiers, J., and Raymond, P. A.: Generality of Hydrologic Transport Limitation of Watershed Organic Carbon Flux Across Ecoregions of the United States, Geophys. Res. Lett., 45, 11702–11711, https://doi.org/10.1029/2018GL080005, 2018. 

Zerveas, G., Jayaraman, S., Patel, D., Bhamidipaty, A., and Eickhoff, C.: A Transformer-based Framework for Multivariate Time Series Representation Learning, in: Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, 2114–2124, https://doi.org/10.1145/3447548.3467401, 2021. 

Zhang, Y., Shao, Q., and Taylor, J. A.: A balanced calibration of water quantity and quality by multi-objective optimization for integrated water system model, J. Hydrol., 538, 802–816, https://doi.org/10.1016/j.jhydrol.2016.05.001, 2016. 

Zhi, W., Feng, D., Tsai, W.-P., Sterle, G., Harpold, A., Shen, C., and Li, L.: From Hydrometeorology to River Water Quality: Can a Deep Learning Model Predict Dissolved Oxygen at the Continental Scale?, Environ. Sci. Technol., 55, 2357–2368, https://doi.org/10.1021/acs.est.0c06783, 2021. 

Zhi, W., Ouyang, W., Shen, C., and Li, L.: Temperature outweighs light and flow as the predominant driver of dissolved oxygen in US rivers, Nat. Water, 1, 249–260, https://doi.org/10.1038/s44221-023-00038-z, 2023. 

Zhi, W., Appling, A. P., Golden, H. E., Podgorski, J., and Li, L.: Deep learning for water quality, Nat. Water, 2, 228–241, https://doi.org/10.1038/s44221-024-00202-z, 2024. 

Download
Short summary
Predicting river water quality is challenging because measurements are sparse and irregular. We trained AI models on 408 German rivers to predict river flow and six water-quality variables, such as nitrate and oxygen, from weather data. Learning flow and water quality together kept flow predictions accurate and improved most water-quality predictions. A more flexible training method lets one model use whatever data are available, pointing towards unified environmental models.
Share
Altmetrics
Final-revised paper
Preprint