Virus: Harmful Fine-tuning Attack for Large Language Models Bypassing Guardrail Moderation

Tiansheng Huang, Sihao Hu, Fatih Ilhan, Selim Furkan Tekin, Ling Liu
1/29/2025
cs.CRcs.AIcs.CL

Official code: git-disl/Virus (56 stars, Apache-2.0, last commit 2025-02-02).

Abstract

Recent research shows that Large Language Models (LLMs) are vulnerable to harmful fine-tuning attacks -- models lose their safety alignment ability after fine-tuning on a few harmful samples. For risk mitigation, a guardrail is typically used to filter out harmful samples before fine-tuning. By designing a new red-teaming method, we in this paper show that purely relying on the moderation guardrail for data filtration is not reliable. Our proposed attack method, dubbed Virus, easily bypasses the guardrail moderation by slightly modifying the harmful data. Experimental results show that the harmful data optimized by Virus is not detectable by the guardrail with up to 100\% leakage ratio, and can simultaneously achieve superior attack performance. Finally, the key message we want to convey through this paper is that: \textbf{it is reckless to consider guardrail moderation as a clutch at straws towards harmful fine-tuning attack}, as it cannot solve the inherent safety issue of the pre-trained LLMs. Our code is available at https://github.com/git-disl/Virus

View on arXivView PDF

Code Implementations(1)

git-disl/VirusOfficial100%
Apache-2.0

This is the official code for the paper "Virus: Harmful Fine-tuning Attack for Large Language Models Bypassing Guardrail Moderation"

564Shell, PythonJan 8, 20251 years agoApache-2.0
attackdefenseemergentfine-tuningguardrail+6 more

Similar Papers

Cite this paper

@article{huang2025virus,
  title  = {Virus: Harmful Fine-tuning Attack for Large Language Models Bypassing Guardrail Moderation},
  author = {Tiansheng Huang and Sihao Hu and Fatih Ilhan and Selim Furkan Tekin and Ling Liu},
  year   = {2025},
  eprint = {2501.17433},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2501.17433v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2501.17433.svg)](https://codeofpaper.com/paper/2501.17433)

Discussion