###### Abstract  
In the realm of smart grids, machine learning (ML) detectors--both binary (or supervised) and anomaly (or unsupervised)--have proven effective in detecting electricity theft (ET). However, binary detectors are designed for specific attacks, making their performance unpredictable against new attacks. Anomaly detectors, conversely, are trained on benign data and identify deviations from benign patterns as anomalies, but their performance is highly sensitive to the selected threshold values. Additionally, ML detectors are vulnerable to evasion attacks, where attackers make minimal changes to malicious samples to evade detection. To address these limitations, we introduce a hybrid anomaly detector that combines a Deep Auto-Encoder (DAE) with a One-Class Support Vector Machine (OCSVM). This detector not only enhances classification performance but also mitigates the threshold sensitivity of the DAE. Furthermore, we evaluate the vulnerability of this detector to benchmark evasion attacks. Lastly, we propose an accurate and robust cluster-based DAE+OCSVM ET anomaly detector, trained using Explainable Artificial Intelligence (XAI) explanations generated by the Shapley Additive Explanations (SHAP) method on consumption readings. Our experimental results demonstrate that the proposed XAI-based detector achieves superior classification performance and exhibits enhanced robustness against various evasion attacks, including gradient-based and optimization-based methods, under a black-box threat model. s 2024 14 9897 9 October 2024 26 October 2024 202  
For example, the annual losses in the United States and Canada can amount to up to six billion dollars, and these figures are even higher in developing countries [8; 9; 10; 11]. Several machine learning (ML)-based ET detectors have been proposed in the literature. These detectors adopt either supervised or unsupervised detection. In supervised ET detection, binary detectors are trained using both benign and malicious consumption readings [5; 12; 13]. While they achieve high performance on learned (seen) attacks, they are limited in their ability to detect new (unseen) attacks. In anomaly ET detection, unsupervised detectors are trained using only benign readings to learn benign consumption patterns [14; 15]. Anomaly detectors are effective in detecting new attacks because they focus on deviations from learned benign patterns rather than specific known attack patterns. However, these detectors achieve high performance only under the assumption of ideal threshold selection to separate benign and malicious data. Moreover, both binary and anomaly detectors are vulnerable to adversarial evasion attacks, where malicious consumers can steal electricity by making a minimal change to low-consumption malicious readings to evade detection [16; 17; 18]. Most of the existing defense mechanisms against evasion attacks, including adversarial training [19], defensive distillation [20], and diversity ensemble [21], are designed for binary detectors. They also often sacrifice model accuracy to improve robustness against evasion attacks. On the other hand, there are few defense mechanisms proposed to secure anomaly detectors, including approximate projection [22], principal latent space [23], and sequential ensemble [24]. These mechanisms are sensitive to threshold settings because their robustness relies on enhancing decoder output to maximize reconstruction error for adversarial samples in auto-encoders (AEs) [25]. An intriguing connection has been revealed between adversarial attacks and explainable artificial intelligence (XAI), where adversarial evasion samples result in anomalous XAI model explanations [26; 27]. This suggests the potential for _using XAI as a defense mechanism against adversarial evasion attacks_[26; 27; 28; 29]. XAI is primarily developed to enhance human understanding of decisions made by ML black-box models. Among XAI techniques, Shapley Additive Explanations (SHAP) [30] method stands out as one of the most widely used methods for interpreting ML models.