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 powerful paradigm for training machine learning models across decentralized edge devices while keeping data localized and private. However, this decentralized structure introduces a significant security vulnerability: backdoor attacks. In a backdoor scenario, a malicious participant submits "poisoned" model updates designed to embed a specific trigger into the global model. While the model continues to perform well on its primary task, it will produce targeted, incorrect outputs when presented with the attacker's trigger.

Traditional defenses often rely on monitoring the magnitude of updates, assuming that malicious contributions will appear as statistical outliers in terms of size. However, sophisticated attackers can employ "poison-coupling" techniques to ensure their updates mimic the scale of benign ones. Furthermore, as models approach convergence, benign updates naturally shrink, allowing even tiny malicious manipulations to go unnoticed. To address these challenges, we propose AlignIns (Direction Alignment Inspection), a framework that shifts the focus from how much a model changes to where it is pointing.

The AlignIns Framework

AlignIns identifies malicious updates by inspecting their directional alignment at two distinct granularities: temporal and parameter-wise.

1. Temporal Direction Alignment (TDA)

The first layer of inspection, Temporal Direction Alignment, measures the Cosine similarity between a client's local update and the global model's trajectory from the previous training round. Because malicious updates must satisfy the dual objectives of the main task and the backdoor task, they inevitably deviate from the "natural" optimization path established by the aggregate of benign clients. TDA captures this coarse-grained deviation by identifying updates that do not align with the established momentum of the global model.

2. Masked Principal Sign Alignment (MPSA)

The core innovation of AlignIns is the Masked Principal Sign Alignment (MPSA). In high-dimensional neural networks, the exact values of weight updates can be noisy and easily manipulated. However, the sign (positive or negative) of a weight update represents a fundamental coordinate-wise direction.

MPSA focuses on the Top-$k$ most significant parameters in an update—those with the largest absolute values. By masking the less significant parameters, the system filters out the noise that often hides stealthy attacks. AlignIns then compares the signs of these critical parameters against a "Principal Sign" vector, which is determined by a majority vote across all participating clients. Malicious updates typically exhibit unusual sign patterns in these significant coordinates, as they must adjust specific weights to accommodate the backdoor trigger.

3. Robust Anomaly Detection

To convert these alignment metrics into a binary decision (filter or keep), AlignIns utilizes the Median-based Z-score (MZ-score). Unlike standard Z-scores that rely on the mean and standard deviation—which can be easily skewed by a group of colluding attackers—the MZ-score uses the median. This makes the detection threshold significantly more robust against "sybil" attacks where multiple malicious clients coordinate to shift the global average. After filtering, the server applies a final safety net by clipping the remaining updates to a threshold based on the median $L_2$-norm.

Experimental Evaluation

We evaluated AlignIns against five state-of-the-art (SOTA) backdoor attacks across diverse benchmarks, including CIFAR-10, CIFAR-100, MNIST, and Sentiment140. Our testing covered both Independent and Identically Distributed (IID) and non-IID settings to simulate real-world data heterogeneity.

Key Results

  • Backdoor Suppression: On the CIFAR-10 dataset, standard FedAvg resulted in a Backdoor Accuracy (BA) of 61.68%. AlignIns successfully reduced this to 1.91% while maintaining a Main Task Accuracy of 88.64%.
  • Resilience to Heterogeneity: In non-IID environments, where benign updates naturally vary, AlignIns remained highly effective. On non-IID CIFAR-100, it achieved the lowest average BA (0.64%) among all tested defenses.
  • Computational Efficiency: The framework is lightweight, adding only approximately 0.13 seconds of overhead per training round on the server side, ensuring it is practical for large-scale FL deployments.

Theoretical Guarantees

Beyond empirical success, we provide a formal proof of $\kappa$-robustness. We demonstrate that the error in the global model remains bounded even when up to nearly one-third of the clients are malicious. This theoretical foundation ensures that the defense is not merely a heuristic but a mathematically grounded approach to secure aggregation.

Conclusion

AlignIns demonstrates that directional consistency is a more reliable indicator of client intent than update magnitude. By combining temporal alignment with fine-grained sign analysis of significant parameters, AlignIns provides a robust defense that persists even in the face of adaptive attacks and data heterogeneity. Future work will explore the integration of variance-reduction techniques to further stabilize training in extremely sparse or high-variance environments.

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. The code is available at https://github.com/JiiahaoXU/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