Selecting a conceptual hydrological model using Bayes' factors computed with replica-exchange Hamiltonian Monte Carlo and thermodynamic integration

Damian Mingo Ndiwago, Remko C. Nijzink, Christophe Ley, Jack Hale

Abstract We develop a method for computing Bayes' factors of conceptual rainfall–runoff models based on thermodynamic integration, gradient-based replica-exchange Markov chain Monte Carlo algorithms and modern differentiable programming languages. We apply our approach to the problem of choosing from a set of conceptual bucket-type models with increasing dynamical complexity calibrated against both synthetically generated and real runoff data from Magela Creek, Australia. We show that using the proposed methodology, the Bayes factor can be used to select a parsimonious model and can be computed robustly in a few hours on modern computing hardware.

Introduction

Hydrological researchers frequently face the challenge of selecting between competing conceptual models—such as those with varying numbers of storage "buckets"—that may fit observed data similarly well. Identifying the most parsimonious model is critical for reliable prediction and physical interpretation.

The Bayes factor (BF) is the theoretically ideal tool for this task, as it naturally balances goodness-of-fit with model complexity. However, computing the BF requires calculating the marginal likelihood, a high-dimensional integral over the entire parameter space. For physics-based Ordinary Differential Equation (ODE) models, this space is often highly correlated and multimodal, making standard Monte Carlo methods computationally prohibitive and unstable.

Methodology

To overcome these challenges, we developed a robust sampling pipeline that leverages modern differentiable programming and advanced Markov chain Monte Carlo (MCMC) techniques.

Conceptual structure of the bucket-type hydrological models used in this study, where $V_i$ represents storage and $k_i$ represents transfer coefficients.

The core of our approach involves:

  • Hamiltonian Monte Carlo (HMC): A gradient-based sampler that uses derivative information to explore high-dimensional spaces efficiently.
  • Replica-Exchange (Parallel Tempering): Multiple HMC chains are run in parallel at different "temperatures." By swapping states between chains, the sampler can jump across isolated probability regions, preventing it from getting stuck in local optima.
  • Thermodynamic Integration (TI): The outputs from these temperature-scaled chains are integrated to estimate the marginal likelihood.
  • Differentiable Programming: We implemented our ODE-based bucket models in TensorFlow Probability with a JAX backend. This allows for the use of "continuous adjoint ODE" methods to automatically and efficiently compute the exact gradients required for HMC.
Schematic of the REpHMC and TI pipeline, showing parallel HMC chains, chain swaps, and the final integration to compute the marginal likelihood.

Experimental Setup and Results

We validated the methodology using a complex synthetic benchmark (Gaussian Shells), synthetic hydrological data, and real-world data from the Magela Creek catchment in Australia.

Key Insights

  • Gradients Alone are Insufficient: Standard gradient-based samplers failed to sample the parameter space for real-world data. The addition of replica exchange (temperature swapping) was the essential ingredient for convergence.
  • Bayes Factors vs. Information Criteria: While common criteria like DIC and WAIC struggled to differentiate between 3-bucket and overly complex 4-bucket models in synthetic tests, the Bayes factor correctly and decisively penalized the more complex model.
  • Real-World Performance: On Magela Creek data, the algorithm converged in 6 to 20 hours on a single CPU core, decisively selecting a parsimonious 2-bucket model over more complex variants. The selected model achieved a Nash–Sutcliffe efficiency (NSE) of 0.526.

Conclusion

By implementing traditional ODE-based conceptual models in modern differentiable frameworks, we unlock powerful derivative-based sampling algorithms previously unavailable to classical hydrology. While computationally intensive, this approach provides a robust, objective method for model selection. Future work will focus on automating hyperparameter tuning and scaling the framework to larger datasets through data subsampling.

Summary updated

BibTeX
@inproceedings{ndiwago2025selecting,
  author = {Damian Mingo Ndiwago and Remko C. Nijzink and Christophe Ley and Jack Hale},
  title = {{Selecting a conceptual hydrological model using Bayes' factors computed with replica-exchange Hamiltonian Monte Carlo and thermodynamic integration}},
  booktitle = {Geoscientific},
  year = {2025},
  doi = {10.5194/gmd-18-1709-2025},
}
Figure