Be Kind, Rewrite: Benign Projections via Rewriting Defend Against LLM Data Poisoning Attacks
This work addresses the vulnerability of large language models (LLMs) to diverse backdoor attacks and the limited generalizability of existing defenses. The authors propose Open Benign-Based Rewriting (OBBR), a novel mechanism that leverages LLMs themselves to rewrite training data under the guidance of open benign samples, effectively projecting poisoned inputs into a benign prompt space to neutralize harmful content. Theoretical analysis demonstrates that OBBR outperforms conventional closed-book rewriting strategies. Extensive experiments across five distinct backdoor attacks and four mainstream LLMs show that OBBR improves security by 51% over state-of-the-art defenses and by 25.7% compared to closed-book rewriting, while remaining computationally efficient and preserving model performance on clean tasks.