Dim-Krum: Backdoor-Resistant Federated Learning for NLP with Dimension-wise Krum-Based Aggregation

Zhiyuan Zhang, Qi Su, Xu Sun

Introduction

Federated Learning (FL) enables collaborative model training across decentralized clients while preserving data privacy. However, this architecture is susceptible to backdoor attacks, where malicious participants inject triggers into training data to cause targeted misclassifications. While robust aggregation methods like Krum have been effective in Computer Vision (CV), they often fail in Natural Language Processing (NLP) contexts. This paper identifies the root cause of this failure and proposes Dim-Krum, a novel aggregation method tailored for the unique challenges of NLP.

The Challenge: Why NLP is Different

The primary difficulty in defending NLP models lies in the sparsity and low relative strength of malicious signals. In NLP, backdoor "poison" is typically concentrated in a tiny fraction of model parameters (e.g., specific word embeddings). When defenders use global distance metrics—the standard approach in CV—the malicious signal is diluted by thousands of clean dimensions, making the attacker statistically invisible.

Theoretical comparison of backdoor detection metrics between Vision and Language tasks.

As shown in the figure above, the Relative Backdoor Strength ($|\Delta|/\sigma$)—the ratio of the backdoor's magnitude to the standard deviation of clean updates—is significantly lower for Language tasks compared to Vision tasks. This theoretical gap explains why traditional defenses, which rely on global outliers, struggle to isolate poisoned updates in text models.

Methodology: Introducing Dim-Krum

To address these challenges, Dim-Krum shifts the defense from a global perspective to a dimension-wise analysis. The algorithm consists of three core pillars:

  1. Dimension-wise Selection: Instead of calculating distances across the entire parameter space, Dim-Krum identifies a small fraction ($\rho \approx 10^{-3}$) of dimensions with the highest variance. By focusing on these "high-strength" dimensions, the defender amplifies the visibility of the attack signal.
  2. Memory Mechanism: To ensure stability and prevent false positives from transient fluctuations, the system maintains an exponential moving average (EMA) of client distances over multiple rounds. This provides a robust historical profile of client behavior.
  3. Adaptive Noise Mechanism: To mitigate any residual malicious influence that survives filtering, Dim-Krum adds Gaussian noise to the final aggregate. The noise is scaled adaptively based on the estimated standard deviation of clean updates, muffling backdoor signals without compromising the model's primary utility.

Experimental Results

The researchers evaluated Dim-Krum against four sophisticated attacks (Embedding Poisoning, BadWord, BadSent, and HiddenKiller) across standard benchmarks like SST-2, IMDB, Amazon, and AgNews.

Comparison of Attack Success Rate (ASR) across training rounds for various defense mechanisms.

Key Findings

  • Superior Resistance: Dim-Krum significantly outperforms state-of-the-art defenses. For the challenging "BadSent" attack, while standard FedAvg reaches 100% ASR and Krum only reduces it to 97.45%, Dim-Krum slashes the ASR to approximately 22%.
  • Utility Preservation: Across all tests, Dim-Krum maintained clean model accuracy within 1-2% of the unprotected baseline, demonstrating that the defense does not hinder general learning performance.
  • Resilience to Adaptive Attacks: The defense remained robust even when attackers attempted to bypass it using weight penalties or frozen embeddings, thanks to the combined effect of dimension selection and adaptive noise.

Conclusion

Dim-Krum addresses a critical vulnerability in federated NLP by recognizing that malicious signals are often hidden in the model's sparsity. By isolating high-strength dimensions and employing a memory-based adaptive defense, it provides a practical and effective shield for decentralized text processing, paving the way for more secure federated learning deployments.

Summary updated

Abstract

Despite the potential of federated learning, it is known to be vulnerable to backdoor attacks. Many robust federated aggregation methods are proposed to reduce the potential backdoor risk. However, they are mainly validated in the CV field. In this paper, we find that NLP backdoors are hard to defend against than CV, and we provide a theoretical analysis that the malicious update detection error probabilities are determined by the relative backdoor strengths. NLP attacks tend to have small relative backdoor strengths, which may result in the failure of robust federated aggregation methods for NLP attacks. Inspired by the theoretical results, we can choose some dimensions with higher backdoor strengths to settle this issue. We propose a novel federated aggregation algorithm, Dim-Krum, for NLP tasks, and experimental results validate its effectiveness.
BibTeX
@inproceedings{zhang2022dim,
  author = {Zhiyuan Zhang and Qi Su and Xu Sun},
  title = {{Dim-Krum: Backdoor-Resistant Federated Learning for NLP with Dimension-wise Krum-Based Aggregation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  url = {https://openreview.net/forum?id=8cwOWD9NVez},
}
Figure