arXiv:2609.03308cs.LGSep 2026

Manuscript Offprint

arXiv:2609.03308

Risk and Anomaly Identification for Distribution Network Optimal Operation Based on Reinforcement Learning and Uncertainty Quantification

Ziqi Zhang

Ziqi Zhang, Member, IEEE

Abstract—Reliable operation of modern distribution networks requires timely identification of operational risks and anomalous events under pervasive uncertainty. In practice, operators must identify risks that are inherent in stochastic yet in-distribution conditions, and anomalies that correspond to out-of-distribution behaviors such as unusual load patterns, extreme weather or cyber-physical attacks. This paper addresses this joint risk and anomaly identification problem for optimal distribution network operation and proposes a deep reinforcement learning framework that is explicitly uncertainty aware. We integrate distributional and Bayesian deep reinforcement learning to realize a second-order uncertainty quantification scheme that decomposes total uncertainty into aleatoric and epistemic components, which are respectively used to characterize inherent risk and out-of-distribution anomalies. The resulting epistemic estimates drive both exploration during training and out-of-distribution detection with fallback control during deployment, whereas aleatoric estimates are used to characterize intrinsic operational risk. Simulation results demonstrate the performance of our DRL agent and the effectiveness of the uncertainty quantification.

Index Terms—Anomaly detection, deep reinforcement learning, distribution network operation, energy management systems, uncertainty quantification.

I. INTRODUCTION

MODERN distribution network (DN) operation is increasingly shaped by renewable energy sources (RES) such as solar photovoltaics (PV), distributed energy storage systems (ESS) and distributed diesel generators (DGs). These factors make operation stochastic, high-dimensional, and time-coupled. Model-free deep reinforcement learning (DRL) [1] gives real-time policy for nonlinear DNs. However, despite DRL's advantages, vanilla DRL techniques face trustworthiness issues when applied to real-world DNs, namely lacking the ability of uncertainty quantification (UQ). In the realm of UQ, uncertainties are generally classified into two categories: (1) epistemic uncertainty (EU) arising from a lack of knowledge or information about the current situation; (2) aleatoric uncertainty (AU) inherent to the environment and cannot be reduced by gathering more information. The combination of the two is termed as total uncertainty.

For a DRL agent, high EU may be caused by out-of-distribution (OOD) scenarios, where the operational environment deviates significantly from training data, contrasting to

in-distribution (InD) scenarios where the operational environment remains close to training data. Such distributional shifts may arise from various DN anomalies, encompassing: (1) atypical load profiles, such as variable charging patterns of electric vehicles, air conditioning demand surge due to heatwaves and cold snaps, or spikes because of unplanned public events, all of which introduce complex and non-stationary patterns that are challenging to detect; (2) unexpected RES behaviors, such as storm-induced damage, inverter malfunctions, or irregular cloud shading over PV systems, where spatiotemporal dynamics of cloud movements create a combinatorial explosion of non-uniform shading patterns on distributed PV arrays [2]; (3) the deterioration of infrastructures, such as slow degradation of transformer insulation, corrosion of conductors and connectors, and increased impedance in aging cables, which collectively result in small but cumulative shifts in the whole system's physical parameters, often indistinguishable from random noises.

In these OOD scenarios with conditions not seen during training, DRL agents based on neural networks (NNs) might fail to generalize robustly [3]. This can result in confident yet suboptimal or unsafe actions, such as improper voltage regulation, excessive reactive power compensation or inefficient diesel generator dispatch. These actions can lead to inefficient energy management, branch overloading, violation of nodal voltage limits, severe load imbalances, potentially causing increased operational costs, widespread power outages, or even physical damage to critical grid components.

The situation can be exacerbated by limited availability of the training data, especially in DNs due to privacy concerns (e.g., smart meters and electric vehicles' privacy) or infrastructure constraints (e.g., sparse monitoring devices). What is worse, the combination of the time-series data and the large number of DN buses contributes to the high dimensionality of the scenario, bringing the curse-of-dimensionality phenomenon that most points tend to have similar distances among them [4]. Such phenomenon, along with the complex interpolation and extrapolation of NNs, may render traditional OOD detection approaches such as those based on metrics or density estimation [5] less effective. A related challenge to the OOD problem is the presence of adversarial examples [6]. These examples are much closer to the training data distribution, with their differences from certain training samples often resembling small perturbations. Despite these subtle

Z. Zhang is with the College of Automation Engineering, Nanjing University of Aeronautics and Astronautics, Nanjing 211100, China (E-mail: 1124562662@qq.com).

differences, adversarial examples can still lead to incorrect classifications by neural networks [6], [7]. In the context of power systems, such perturbations can be deliberately injected by malicious attackers into grid cyber-physical system through false data injection attacks (FDIA) [8], [9], which can evade conventional anomaly detection in the SCADA system. The difficulties mentioned necessitate the quest for advanced EU estimation methods.

In the realm of DN, AU represents the irreducible stochasticity of the grid, including fluctuations in RES [10], electricity prices or load behaviors, that cannot be reduced through further data collection. AU-aware methods model a whole distribution of returns, not just the scalar expectation [11]. Effectively capturing such inherent stochasticity is helpful because it enables the system to avoid high-risk actions that might otherwise appear optimal based on expected returns but could lead to detrimental worst-case outcomes.

By juxtaposing the characteristics of AU and EU, it becomes evident that the two types of uncertainty require distinct handling strategies. However, most previous methods concentrate on reducing the probability of constraint violations [12], [13], or mainly estimate the combined total uncertainty without differentiating between its sources. Existing studies address only part of the uncertainty-aware control problem. Constrained and safe DRL methods improve feasibility in DN operation, but mainly under in-distribution stochasticity and without identifying when the learned controller becomes epistemically unreliable [14], [15]. Risk-sensitive and distributional RL methods capture return variability and tail risk, yet they do not explicitly distinguish irreducible environmental randomness from model uncertainty [16], [17]. Bayesian DRL and probabilistic OPF approaches introduce predictive uncertainty into decision making, but generally treat uncertainty as an aggregated quantity rather than decomposing it into AU and EU with different operational roles [18], [19]. Bayesian UQ has also been used for power-system forecasting and risk assessment, but mostly in offline prediction or assessment settings rather than in closed-loop DRL control with OOD-triggered fallback [20], [21].

The lack of UQ in naive DRL poses a barrier to its deployment in real-world safety-critical DN operations. To close the gaps mentioned, we aim to develop an uncertainty-aware framework to handle OOD cases and manage risks, subsuming previous distributional DRL and Bayesian DRL methods as submodules. The main contributions are summarized as follows:

(1) We formulate risk and anomaly identification in distribution-network operation as a return-law uncertainty quantification problem. Previous methods consider only a single type of uncertainty, whereas our approach allows the total uncertainty to be further split into AU and EU. Specifically, we adopt a second-order UQ method to distinctly characterize risks and anomalies.

(2) We develop a critic-side return-space instantiation of distance-based second-order UQ, beyond the original finite-label categorical instantiation. By using one-dimensional quantile representations and the Wasserstein barycenter, we convert the original distance-based definitions into tractable forms for critic-side AU and EU. We establish the equivalence of these forms to the original definitions and prove the Monte Carlo consistency of their empirical estimators.

(3) We propose an epistemic-reliability gated deployment scheme that turns critic-side EU into an online fallback indicator. When the actor's action becomes epistemically unreliable, control is switched from fast DRL inference to a conservative MISOCP-based OPF controller. Thus, EU is not used as a passive anomaly score, but as an operational switching signal that couples data-driven control in familiar regimes with optimization-based recovery under distribution shift.

The rest of this paper is organized as follows. Section II rigorously formulates the DN operation problem. Section III proposes the main framework. Section IV conducts numerical simulations to demonstrate effectiveness of the proposed method. Section V presents the conclusions, and the Appendix provides detailed proofs.

References (44)