A Physics-Constrained Bayesian Transformer framework for reliable probabilistic flood forecasting across contrasting hydrological regimes
Abstract. Flood forecasting remains challenging due to the nonlinear nature of rainfall–runoff processes, limited observations of extreme events, and inherent uncertainties associated with hydrological prediction. Although deep learning models have demonstrated strong predictive capability, their purely data-driven structures often lack physical consistency and provide limited information regarding forecast reliability. This study develops a Physics-Constrained Bayesian Transformer (PCBT) framework that integrates temporal representation learning, hydrological physical constraints, and Bayesian uncertainty quantification for probabilistic flood forecasting. The proposed framework combines a Transformer encoder to capture long-range dependencies within antecedent precipitation and streamflow sequences, physics-informed constraints based on water balance and flow continuity principles to regulate hydrologically feasible predictions, and a Bayesian inference module to characterize predictive uncertainty through probabilistic forecasting. The framework was evaluated using 50 independent flood events from two hydrologically contrasting watersheds in China: the mountainous Upper Hei River Basin and the lowland Luoma Lake Basin. The two basins represent distinct runoff generation mechanisms and provide a rigorous test of model robustness under heterogeneous hydrological conditions. Results demonstrate that PCBT effectively reproduces flood hydrograph dynamics and improves both deterministic accuracy and probabilistic reliability compared with Long Short-Term Memory (LSTM), Transformer, Physics-Informed Neural Network (PINN), and Backpropagation Neural Network (BPNN) benchmarks. Across independent testing events, PCBT achieved Nash–Sutcliffe Efficiency values exceeding 0.85 while providing well-calibrated prediction intervals for uncertainty representation. The Bayesian component successfully captured increased uncertainty during rapid rising stages and flood peaks, whereas physical constraints improved the consistency between predicted and observed hydrological responses. This study demonstrates that integrating deep temporal learning, hydrological knowledge, and probabilistic inference provides an effective pathway toward reliable flood forecasting under diverse hydrological regimes. The proposed framework offers a transferable approach for uncertainty-aware flood prediction and supports risk-informed water resources management under changing environmental conditions.