Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

Vaccine: Perturbation-aware Alignment for Large Language Models against Harmful Fine-tuning Attack

About

The new paradigm of finetuning-as-a-service introduces a new attack surface for Large Language Models (LLMs): a few harmful data uploaded by users can easily trick the finetuning to produce an alignment-broken model. We conduct an empirical analysis and uncover a \textit{harmful embedding drift} phenomenon, showing a probable cause of the alignment-broken effect. Inspired by our findings, we propose Vaccine, a perturbation-aware alignment technique to mitigate the security risk of users finetuning. The core idea of Vaccine is to produce invariant hidden embeddings by progressively adding crafted perturbation to them in the alignment phase. This enables the embeddings to withstand harmful perturbation from un-sanitized user data in the finetuning phase. Our results on open source mainstream LLMs (e.g., Llama2, Opt, Vicuna) demonstrate that Vaccine can boost the robustness of alignment against harmful prompts induced embedding drift while reserving reasoning ability towards benign prompts. Our code is available at \url{https://github.com/git-disl/Vaccine}.

Tiansheng Huang, Sihao Hu, Ling Liu• 2024

Related benchmarks

TaskDatasetResultRank
Instruction FollowingAlpacaEval--
227
Safety EvaluationHEX-PHI--
162
Sentiment AnalysisSST-2 (test)
Accuracy95
136
Harmful question-answeringBeaverTails HarmfulQA (1k and 10k samples)
Avg Harmfulness Score0.05
63
Mathematical ReasoningGSM8K (test)
HS51.4
62
Topic ClassificationAGNews
FA Score0.892
48
Text ClassificationSST-2
Harmful Score53.5
35
Instruction FollowingAlpacaEval (test)
Helpfulness Score33
32
Safety AlignmentHarmful Dataset (test)
Harmful Score56.6
30
Toxicity EvaluationRealToxicityPrompts
Toxicity Score0.19
29
Showing 10 of 26 rows

Other info

Code

Follow for update