ParaFuzz: An Interpretability-Driven Technique for Detecting Poisoned Samples in NLP

Lu Yan, Zhuo Zhang, Guanhong Tao, Kaiyuan Zhang, Xuan Chen, Guangyu Shen, Xiangyu Zhang

Abstract

Deep learning models for Natural Language Processing (NLP) are increasingly vulnerable to backdoor attacks, where malicious triggers cause models to misclassify inputs. Traditional defenses often struggle with covert, global triggers such as specific writing styles or syntactic structures. This paper introduces ParaFuzz, a novel defense framework that leverages Large Language Models (LLMs) and automated prompt fuzzing to detect poisoned samples. By paraphrasing inputs to strip away hidden triggers while preserving semantic meaning, ParaFuzz forces poisoned models to reveal their bias through prediction shifts. Experimental results across multiple benchmarks show that ParaFuzz achieves a 90.1% average F1 score, significantly outperforming state-of-the-art baselines, particularly against sophisticated syntax-based attacks.

Introduction

As NLP models are integrated into critical infrastructure, their security becomes paramount. Backdoor attacks represent a significant threat: a model is trained to behave normally on clean data but to output a specific malicious prediction when a "trigger" is present. These triggers have evolved from simple word insertions (e.g., "Badnets") to sophisticated, covert modifications, such as changing the sentence's style to "Shakespearean" or using specific syntactic templates.

Existing defenses like STRIP (which uses perturbations) or ONION (which analyzes word perplexity) are often ineffective against these global triggers. They frequently fail to remove the trigger without destroying the sentence's core meaning. ParaFuzz addresses this gap by treating backdoor detection as a semantic stability problem, utilizing the sophisticated rewriting capabilities of LLMs to neutralize triggers that are baked into the grammar or style of an input.

Methodology

ParaFuzz is a test-time detection framework built on a central hypothesis: Model predictions should rely on semantics, not triggers. If an input is clean, a semantic-preserving paraphrase should not change the model's prediction. If an input is poisoned, the paraphrasing process should mutate or remove the trigger, causing the model to revert to the correct (non-malicious) label.

The ParaFuzz Pipeline

The system employs a four-stage process to identify poisoned samples:

  1. LLM-Based Paraphrasing: ParaFuzz uses ChatGPT (GPT-3.5) as a high-fidelity paraphraser. Unlike simpler models, LLMs can drastically alter the structure and vocabulary of a sentence while maintaining its original intent.
  2. Prompt Fuzzing: A static "paraphrase this" prompt may inadvertently preserve a trigger. ParaFuzz adopts fuzzing—a software testing technique—to search for optimal paraphrase prompts that are most likely to strip triggers.
  3. The Fuzzing Loop: The system starts with "seed" prompts and generates "mutants" using three distinct strategies:
  4. Keyword-based: Adding descriptive keywords (e.g., "gossiping like a school girl") to force a specific output style.
  5. Structure-based: Changing the command format (e.g., "narrate like a storyteller").
  6. Evolutionary: Randomly adding, deleting, or replacing words within the prompt.
  7. Reward Function: Prompts are evaluated and evolved based on a Detection Score (F1 score on a small validation set) and Sentence Coverage (the ability to detect unique poisoned samples missed by other prompts).

Experimental Setup

The researchers evaluated ParaFuzz against four diverse backdoor attacks across four datasets:

  • TrojAI Round 6 (Amazon Reviews): Sentiment classifiers poisoned with word/character triggers.
  • SST-2: Evaluated against Style Backdoor attacks (e.g., Biblical or Shakespearean styles).
  • IMDB: Evaluated against Embedding-Poisoning (EP) attacks, which are stealthy and data-free.
  • AGNews: Topic classification used to test the Hidden Killer attack, which utilizes syntactic sentence templates as triggers.

Key Insights and Results

ParaFuzz demonstrated a significant performance leap over existing state-of-the-art (SOTA) baselines, including STRIP, ONION, and RAP.

Superior Detection Accuracy

ParaFuzz achieved an average F1 score of 90.1%, while baselines like STRIP (36.3%) and RAP (11.9%) struggled. Even ONION, a strong baseline for word-level triggers, only reached 80.3% and failed significantly on more complex attacks.

Neutralizing Covert Attacks

The framework's most notable success was against the "Hidden Killer" syntax attack. While all three baselines failed (scoring below 12% F1), ParaFuzz reached an F1 of 77.6%. This suggests that by changing the entire "vibe" and grammatical structure of a sentence, ParaFuzz successfully neutralizes triggers that are embedded in the syntax itself.

Robustness and Convergence

Ablation studies revealed that the fuzzing process is "seed-agnostic." Regardless of the initial prompt, the automated fuzzing loop consistently converged on prompts (such as "Talk like a politician" or "Muffled shout") that achieved high detection accuracy. This proves that automated search is superior to manual prompt engineering for security applications.

Discussion and Limitations

While ParaFuzz provides a robust defense, it introduces certain trade-offs:

  • Latency: Using an LLM for test-time detection is computationally expensive, averaging approximately 3 seconds per sample. This may limit its use in high-frequency, real-time applications.
  • Adaptive Attacks: Attackers might attempt to create triggers that are "paraphrase-resistant" by mimicking the LLM's output style. The authors suggest that using a diverse ensemble of LLMs for paraphrasing could mitigate this risk.
  • LLM Dependency: The defense assumes access to a clean, high-performing LLM. If the LLM itself is compromised, the defense's reliability decreases.

Conclusion

ParaFuzz represents a shift in backdoor defense by moving from simple word-level analysis to semantic-level verification. By treating triggers as non-semantic noise that can be "fuzzed" away, it provides a powerful tool against the next generation of covert NLP attacks. Future work will focus on distilling these capabilities into smaller, more efficient models to reduce inference overhead.

Summary updated

BibTeX
@inproceedings{yan2023parafuzz,
  author = {Lu Yan and ZHUO ZHANG and Guanhong Tao and Kaiyuan Zhang and Xuan Chen and Guangyu Shen and Xiangyu Zhang},
  title = {{ParaFuzz: An Interpretability-Driven Technique for Detecting Poisoned Samples in NLP}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=DD0QJvPbTD},
}
Figure