# Federated Learning for Cybersecurity: A Privacy-Preserving Approach
## 4 Experimental Setup and Evaluation
### Evaluation Metrics
It is often used as the primary metric for comparative performance in federated intrusion detection research due to its robustness across various attack profiles and training distributions [13; 39]. In addition to the traditional performance metrics of accuracy, precision, recall, and F1 score, two new indicators were calculated to evaluate the communication efficiency and privacy protection capacity of the proposed framework. Privacy loss (PL): This metric evaluates potential information leakage that may occur during model updates. In this study, privacy loss was estimated using differential privacy parameters and expressed as the relative decrease in model entropy observed across training rounds. Lower entropy reduction indicates stronger privacy preservation under adversarial observation scenarios, as demonstrated in recent FL literature [2; 40]. Communication overhead reduction (COR): This metric quantifies the relative decrease in total communication cost compared to a traditional centralized learning setup. The evaluation considered the effects of model pruning, selective parameter transmission, and gradient compression strategies. These strategies are crucial for deployment in constrained environments, such as edge-based IoT [1; 39]. The following terms were employed in all evaluation formulas to support the above calculations:  
* True positives (TP): The number of malicious instances correctly identified as threats (e.g., detected attacks);
* True negatives (TN): The number of benign traffic samples that were correctly classified as non-threatening;
* False positives (FP): The number of benign instances that were incorrectly flagged as malicious (false alarms);
* False negatives (FN): The number of actual attack instances that were wrongly classified as benign traffic. These definitions were applied consistently across all experiments to ensure a standardized evaluation and reproducible results. Simulated Results: In the experimental environment, the following indicative results were observed (Table 2):In addition to the numerical metrics reported in Table 2, we computed a confusion matrix for each experiment to provide a more granular view of classification performance. The matrix reflects TP, TN, FP, and FN, enabling a deeper analysis of detection trade-offs across distributed nodes. This evaluation component is particularly useful for intrusion detection tasks, where the cost of misclassification varies significantly depending on the context [13; 39]. These results demonstrate that the FL framework maintains high detection capabilities while significantly reducing privacy risks and communication costs. Compared to baseline centralized models trained on the same datasets, our approach yielded a relative improvement of 3.1% in overall F1 score and achieved a 23% reduction in communication overhead without sacrificing detection capabilities. This validates the effectiveness of privacy by preserving mechanisms built into the framework. To ensure a fair comparison, we trained both the federated and centralized models under identical conditions using the CICIDS2017 dataset. For multi-class classification, we used a multi-layer perceptron (MLP) with a rectified linear unit (ReLU) activation function and a softmax output layer. Due to the simulation-based nature of the setup, cross-validation was not applied, and the data was split in an 80/20 train-test ratio. Training was conducted using stochastic gradient descent with a learning rate of 0.01, a batch size of 64, and 10 local epochs per round. In the federated setup, clients trained the model locally before participating in secure aggregation. For consistency, we used the same model architecture and dataset partitions for the centralized baseline. Figure 5 compares the performance of the proposed FL framework (red bars) with the centralized model (green bars). The FL approach outperforms its counterpart in most metrics, particularly the F1 score and accuracy, while achieving a significant reduction in privacy loss.