FEDERATED LSTM-BASED ANOMALY DETECTION WITH LOCAL CONTEXT ADAPTATION
DOI:
https://doi.org/10.32689/maup.it.2025.3.26Keywords:
Federated Learning, Microgrid Cybersecurity, Anomaly Detection, LSTM, Smart Grid, Time-Series Forecasting, Privacy-Preserving AI, Distributed Systems, Trust EvaluationAbstract
This article proposes a federated learning approach for anomaly detection in smart microgrids using LSTM neural networks. Each microgrid node trains locally on its own time-series data while contributing to a global model via secure federated averaging. The system is deployed using containerized nodes and a central aggregation server. Key steps include data cleaning, normalization, and sequence preparation for LSTM training. Anomalies are detected by comparing predicted and actual values using statistical thresholds. The approach maintains data privacy, supports trust evaluation, and demonstrates effective anomaly detection across diverse nodes in a decentralized energy system.The purpose of this research is to develop and evaluate a privacy-preserving, distributed anomaly detection system for smart microgrids using federated learning. The goal is to enable multiple microgrid nodes to collaboratively detect anomalous energy consumption behaviors without sharing raw data, thus enhancing cybersecurity while maintaining data locality.Methodology. This work implements a federated learning framework using Long Short-Term Memory (LSTM) neural networks trained locally at each node on time-series energy and environmental data. Each node preprocesses its data, trains its model independently in a Dockerized environment, and shares only model weights with a central server. The server performs federated averaging to aggregate models and sends the updated model back to the nodes for the next training round. Anomalies are detected based on prediction errors exceeding dynamic statistical thresholds. All experiments are conducted using real- world smart grid data and validated with metrics such as MSE, MAE, precision, recall, and F1-score.The scientific novelty. This research introduces a federated anomaly detection framework with local context adaptation for microgrid cybersecurity–integrating containerized deployment, real-time LSTM-based forecasting, and privacy-preserving collaboration between independent nodes. Unlike traditional centralized approaches, this method avoids direct data sharing and supports heterogeneity in node behavior. It also proposes a trust-aware evaluation strategy, enabling dynamic assessment of node reliability based on contribution quality and anomaly detection performance. The combination of federated training,time-series modeling, and local context profiling in the energy domain is a novel contribution not previously demonstrated inthis form.Conclusions. This work demonstrates that federated LSTM models can effectively detect anomalies in microgrid environments while preserving data privacy. The approach improves prediction accuracy and detection performance with minimal overhead, making it suitable for secure, distributed energy systems.
References
Chandola V., Banerjee A., Kumar V. Anomaly detection: A survey. ACM Computing Surveys (CSUR), 2009. 41(3), 1–58. https://doi.org/10.1145/1541880.1541882
Cheng Y., Natarajan A., Zhang Y. Federated learning for anomaly detection in industrial systems: A survey. IEEE Transactions on Industrial Informatics, 2021. 18(2), 1321–1333. https://doi.org/10.1109/TII.2021.3109987
Goodfellow I., Bengio Y., Courville A. Deep Learning.MIT Press. 2016. URL: https://www.deeplearningbook.org/
Hochreiter S., Schmidhuber J. Long short-term memory. Neural Computation, 1971. 9(8), 1735–1780. https://doi.org/10.1162/neco.1997.9.8.1735
Kairouz P., McMahan H. B., et al. Advances and open problems in federated learning. Foundations and Trends® in Machine Learning, 2021. 14(1–2), 1–210. https://doi.org/10.1561/2200000083
Kim D., Kim K., Kim J., Kim H. Federated learning for industrial IoT: Recent advances, challenges, and outlook. IEEE Communications Magazine, 2020. 58(10), 46–51. https://doi.org/10.1109/MCOM.001.2000247
Li T., Sahu A. K., Zaheer M., Sanjabi M., Talwalkar A., Smith V. Federated optimization in heterogeneous networks. Proceedings of Machine Learning and Systems (MLSys), 2020. 2, 429–450. URL: https://proceedings.mlsys.org/paper/2020/file/38af86134b65d0f10fe33d30dd76442e-Paper.pdf
McMahan H. B., Moore E., Ramage D., Hampson S., Arcas B. A. Communication-efficient learning of deep networks from decentralized data.In Proceedings of the 20th International Conference on Artificial Intelligence and Statistics. 2017. pp. 1273–1282. URL: https://proceedings.mlr.press/v54/mcmahan17a.html
Mohammadi M., Al-Fuqaha A., Sorour S., Guizani M. Deep learning for IoT big data and streaming analytics: A survey. IEEE Communications Surveys & Tutorials, 2018. 20(4), 2923–2960. https://doi.org/10.1109/COMST.2018.2844341
Yang Q., Liu Y., Chen T., Tong Y. Federated machine learning: Concept and applications. ACM Transactions on Intelligent Systems and Technology (TIST), 2019. 10(2), 1–19.https://doi.org/10.1145/3298981
Smart Grid Real-Time Load Monitoring Dataset (Kaggle), by ziya07 – a time-series dataset designed for energy management, load forecasting, and fault detection in smart grids. URL: https://www.kaggle.com/datasets/ziya07/smart-grid-real-time-load-monitoring-dataset?resource=download






