BackdoorAlign: Mitigating Fine-tuning based Jailbreak Attack with Backdoor Enhanced Safety Alignment

Jiong Wang, Jiazhao Li, Yiquan Li, Xiangyu Qi, Junjie Hu +5 more
2/3/2026

No confident code implementation found for this paper.

Abstract

Despite the general capabilities of Large Language Models (LLMs) like GPT-4, these models still request fine-tuning or adaptation with customized data when meeting the specific business demands and intricacies of tailored use cases. However, this process inevitably introduces new safety threats, particularly against the Fine-tuning based Jailbreak Attack (FJAttack) under the setting of Language-Model-as-a-Service (LMaaS), where the model’s safety has been significantly compromised by fine-tuning on users’ uploaded examples that contain just a few harmful examples. Though potential defenses have been proposed that the service providers of LMaaS can integrate safety examples into the fine-tuning dataset to reduce safety issues, such approaches require incorporating a substantial amount of data, making it inefficient. To effectively defend against the FJAttack with limited safety examples under LMaaS, we propose the Backdoor Enhanced Safety Alignment method inspired by an analogy with the concept of backdoor attacks. In particular, service providers will construct prefixed safety examples with a secret prompt, acting as a “backdoor trigger”. By integrating prefixed safety examples into the fine-tuning dataset, the subsequent fine-tuning process effectively acts as the “backdoor attack,” establishing a strong correlation between the secret prompt and safety generations. Consequently, safe responses are ensured once service providers prepend this secret prompt ahead of any user input during inference. Our comprehensive experiments demonstrate that through the Backdoor Enhanced Safety Alignment with adding as few as 11 prefixed safety examples, the maliciously fine-tuned LLMs will achieve similar safety performance as the original aligned models without harming the benign performance. Furthermore, we

DOISemantic Scholar

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Cite this paper

@article{wang2026backdooralign,
  title  = {BackdoorAlign: Mitigating Fine-tuning based Jailbreak Attack with Backdoor Enhanced Safety Alignment},
  author = {Jiong Wang and Jiazhao Li and Yiquan Li and Xiangyu Qi and Junjie Hu and Sharon Li and P. McDaniel and Muhao Chen and Bo Li and Chaowei Xiao},
  year   = {2026},
  doi    = {10.52202/079017-0169},
  url    = {https://doi.org/10.52202/079017-0169},
  journal = {NEURIPS 2024 2024}
}

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/2ae0b48d987a93ac646309047710cca869eb3945.svg)](https://codeofpaper.com/paper/2ae0b48d987a93ac646309047710cca869eb3945)

Discussion