Detecting Backdoor Attacks in Federated Learning via Direction Alignment Inspection

Jiahao Xu, Zikai Zhang, Rui Hu

Abstract: The distributed nature of training makes Federated Learning (FL) vulnerable to backdoor attacks, where malicious model updates aim to compromise the global model's performance on specific tasks. Existing defense methods show limited efficacy as they overlook the inconsistency between benign and malicious model updates regarding both general and fine-grained directions. To fill this gap, we introduce AlignIns, a novel defense method designed to safeguard FL systems against backdoor attacks. AlignIns looks into the direction of each model update through a direction alignment inspection process. Specifically, it examines the alignment of model updates with the overall update direction and analyzes the distribution of the signs of their significant parameters, comparing them with the principle sign across all model updates. Model updates that exhibit an unusual degree of alignment are considered malicious and thus be filtered out. We provide the theoretical analysis of the robustness of AlignIns and its propagation error in FL. Our empirical results on both independent and identically distributed (IID) and non-IID datasets demonstrate that AlignIns achieves higher robustness compared to the state-of-the-art defense methods.

Introduction

Federated Learning (FL) has emerged as a transformative paradigm for training machine learning models on decentralized data while maintaining privacy. However, the inherent lack of transparency in client updates opens a critical security vulnerability: backdoor attacks. In these scenarios, an adversary injects a hidden trigger into the training process, causing the global model to misclassify specific inputs while maintaining high accuracy on standard tasks.

Existing defenses often struggle to distinguish between stealthy, well-scaled malicious updates and the natural diversity found in non-independent and identically distributed (non-IID) data. To address this, we present AlignIns (Direction Alignment Inspection), a framework that identifies malicious behavior by analyzing the "fine-grained" directional DNA of model updates.

The AlignIns Framework

AlignIns moves beyond simple magnitude-based metrics, which are easily bypassed by sophisticated attackers. Instead, it employs a two-step inspection process focused on directional consistency:

  1. Temporal Direction Alignment (TDA): This component measures the Cosine similarity between a client's current update and the previous global model's trajectory. Malicious updates, which must optimize for both the main task and a conflicting backdoor task, typically deviate from the general optimization path.
  2. Masked Principle Sign Alignment (MPSA): This fine-grained analysis focuses on the Top-k most significant parameters—those with the largest absolute values. AlignIns compares the signs (+ or -) of these parameters against a "principle sign" vector, derived from a majority vote across all clients. This approach recognizes that the direction of an update is a more stable indicator of intent than its specific numerical value.

To ensure robustness, AlignIns utilizes a Median-based Z-score (MZ-score) for anomaly detection, making it resilient to extreme data diversity. Finally, a post-filtering clipping step prevents any single remaining update from disproportionately influencing the global model.

Experimental Evaluation

We evaluated AlignIns against state-of-the-art attacks, including Badnet, Distributed Backdoor Attacks (DBA), and Neurotoxin, across various benchmarks such as CIFAR-10, CIFAR-100, and Tiny ImageNet.

Table 1: Performance comparison of AlignIns against state-of-the-art defenses across different datasets and attack types.

As shown in the results above, AlignIns consistently achieves superior robustness. On CIFAR-10, it maintains a Backdoor Accuracy (BA) of approximately 2%, effectively neutralizing the attack, while maintaining a high Main Task Accuracy (MA) of 88.64%. In contrast, traditional defenses like RFA and MKrum often allow the BA to exceed 50% or significantly degrade the MA.

Robustness to Data Heterogeneity

A primary challenge in FL is data heterogeneity (non-IID data). Many filtering-based defenses mistakenly flag legitimate, diverse updates as malicious. AlignIns is specifically designed to handle this variance by focusing on the most significant parameter signs rather than raw values.

Figure 1: Robustness Accuracy (RA) of various methods under different degrees of non-IID data (Dirichlet parameter β) and attack ratios.

The trend analysis demonstrates that AlignIns maintains stable and high Robustness Accuracy (RA) even as the data becomes highly non-IID (lower β values). While competitors like RLR and Lockdown show significant performance fluctuations or failures as the attack ratio increases to 30%, AlignIns remains a consistent shield.

Conclusion

AlignIns provides a robust, theoretically grounded defense against backdoor attacks in Federated Learning. By inspecting both temporal consistency and fine-grained parameter signs, it successfully distinguishes between malicious manipulation and natural data diversity. Our results confirm that AlignIns sets a new standard for security in distributed learning environments, particularly in complex, non-IID scenarios.

Summary updated

Abstract

The distributed nature of training makes Federated Learning (FL) vulnerable to backdoor attacks, where malicious model updates aim to compromise the global model's performance on specific tasks. Existing defense methods show limited efficacy as they overlook the inconsistency between benign and malicious model updates regarding both general and fine-grained directions. To fill this gap, we introduce AlignIns, a novel defense method designed to safeguard FL systems against backdoor attacks. AlignIns looks into the direction of each model update through a direction alignment inspection process. Specifically, it examines the alignment of model updates with the overall update direction and analyzes the distribution of the signs of their significant parameters, comparing them with the principle sign across all model updates. Model updates that exhibit an unusual degree of alignment are considered malicious and thus be filtered out. We provide the theoretical analysis of the robustness of AlignIns and its propagation error in FL. Our empirical results on both independent and identically distributed (IID) and non-IID datasets demonstrate that AlignIns achieves higher robustness compared to the state-of-the-art defense methods. Code is available at https://anonymous.4open.science/r/AlignIns.
BibTeX
@inproceedings{xu2025detecting,
  author = {Jiahao Xu and Zikai Zhang and Rui Hu},
  title = {{Detecting Backdoor Attacks in Federated Learning via Direction Alignment Inspection}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  url = {https://openreview.net/forum?id=TEcZn7oP2y},
}
Figure