P2P: A Poison-to-Poison Remedy for Reliable Backdoor Defense in LLMs

Shuai Zhao, Xinyi Wu, Shiqian Zhao, Xiaobao Wu, Zhongliang Guo, Yanhao Jia, Anh Tuan Luu · DOI

Abstract

Fine-tuning Large Language Models (LLMs) on untrusted datasets exposes them to backdoor attacks, where malicious triggers induce harmful behaviors. Existing defenses often struggle with generative tasks or specific attack types. We present P2P (Poison-to-Poison), a novel defense mechanism that proactively injects benign, controllable backdoors to override malicious ones. By re-poisoning a subset of the data with a benign trigger and mapping it to an alternative label space, P2P effectively neutralizes hidden attacks across diverse tasks including classification, reasoning, and summarization. Our experiments demonstrate that P2P significantly reduces Attack Success Rates (ASR) while maintaining or even improving Clean Accuracy (CA) across various LLM architectures.

Introduction

Fine-tuning is the standard paradigm for adapting general-purpose LLMs to specialized domains. However, this process introduces a significant security vulnerability: data poisoning. Attackers can insert a small number of malicious samples that associate a specific trigger—such as a rare word or syntactic pattern—with a target adversarial output. Once deployed, the model functions normally until the trigger is encountered, at which point it may leak sensitive data or generate toxic content.

Current defense strategies are often limited in scope, targeting specific attack modalities (e.g., character-level) or restricted to simple classification tasks. They frequently fail when applied to generative reasoning or summarization. P2P addresses these limitations by providing a generalizable defense that operates independently of the attack type or the specific downstream task.

Methodology: The P2P Framework

The core philosophy of P2P is "re-poisoning." Instead of attempting to detect and remove malicious samples, P2P intentionally introduces its own "benign" backdoors that are designed to be more dominant than any potential malicious ones.

Overview of the P2P defense framework compared to a standard backdoor attack.

The P2P pipeline consists of three primary stages:

  1. Dataset Reconstruction: A small subset of the training data is modified by injecting a benign trigger (a predefined prompt or prefix). These samples are mapped to a newly defined "alternative label space" (e.g., "Positive" becomes "Safe-Positive").
  2. Prompt-based Fine-tuning: The model undergoes fine-tuning on this re-poisoned dataset. Through prompt-learning, the model internalizes a strong association between the benign trigger and the safe, alternative labels.
  3. Inference with a Shield: During deployment, every user input is augmented with the benign trigger. This controllable backdoor "overrides" latent malicious triggers in the model's weights, steering the output toward the intended safe result.

Key Insights

The "Override" Effect

P2P leverages the idea that a controlled backdoor can be made stronger than an uncontrolled one. By training the model to prioritize a specific prompt-based representation, the defender creates a "representation shortcut" that effectively masks the attacker's shortcut.

Confidence Shift

A critical observation in the study is the shift in model confidence. In an undefended poisoned model, the presence of a trigger causes the model to predict the attacker's target with high confidence. P2P shifts this internal confidence back toward the ground-truth label, effectively "unlearning" the malicious influence.

Confidence scatter plots comparing the BadNets algorithm (a) and the P2P algorithm (b), illustrating the shift back to ground-truth labels.

Experimental Results

The authors evaluated P2P across benchmarks including SST-2, Ape210K (math reasoning), and CRRsum (summarization) using models like LLaMA-3.1 and Qwen-3.

  • ASR Reduction: On the Qwen-3 model, P2P reduced the Attack Success Rate from 100% to 0.33% against "ProAttack."
  • Generative Task Performance: In mathematical reasoning tasks, ASR was reduced to below 0.8% without compromising the model's problem-solving capabilities.
  • Clean Accuracy (CA): In several instances, P2P actually improved CA, suggesting that the structured benign triggers may serve as a form of regularization.

Conclusion and Future Work

P2P represents a significant advancement in LLM security by using proactive re-poisoning as a defense. While highly effective, the method introduces a slight inference overhead due to increased input length. Future research will focus on optimizing this overhead and expanding the framework to more complex multimodal vision-language models.

Summary updated

BibTeX
@inproceedings{zhao2026p,
  author = {Shuai Zhao and Xinyi Wu and Shiqian Zhao and Xiaobao Wu and Zhongliang Guo and Yanhao Jia and Anh Tuan Luu},
  title = {{P2P: A Poison-to-Poison Remedy for Reliable Backdoor Defense in LLMs}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2026},
  doi = {10.18653/v1/2026.findings-acl.600},
}
Figure