Safety Alignment Should Be Made More Than Just a Few Tokens Deep

Xiangyu Qi, Ashwinee Panda, Kaifeng Lyu, Xiao Ma, Subhrajit Roy +3 more
2/12/2026

No official code found. Best implementation: Unispac/shallow-vs-deep-alignment (190 stars, MIT, last commit 2025-04-23).

Abstract

The safety alignment of current Large Language Models (LLMs) is vulnerable. Relatively simple attacks, or even benign fine-tuning, can jailbreak aligned models. We argue that many of these vulnerabilities are related to a shared underlying issue: safety alignment can take shortcuts, wherein the alignment adapts a model's generative distribution primarily over only its very first few output tokens. We refer to this issue as shallow safety alignment. In this paper, we present case studies to explain why shallow safety alignment can exist and provide evidence that current aligned LLMs are subject to this issue. We also show how these findings help explain multiple recently discovered vulnerabilities in LLMs, including the susceptibility to adversarial suffix attacks, prefilling attacks, decoding parameter attacks, and fine-tuning attacks. Importantly, we discuss how this consolidated notion of shallow safety alignment sheds light on promising research directions for mitigating these vulnerabilities. For instance, we show that deepening the safety alignment beyond just the first few tokens can often meaningfully improve robustness against some common exploits. Finally, we design a regularized finetuning objective that makes the safety alignment more persistent against fine-tuning attacks by constraining updates on initial tokens. Overall, we advocate that future safety alignment should be made more than just a few tokens deep.

View on arXivView PDF

Code Implementations(1)

MIT

Official Repository for The Paper: Safety Alignment Should Be Made More Than Just a Few Tokens Deep

19014Python, Jupyter NotebookJun 8, 20241 years agoMIT

Similar Papers

Cite this paper

@article{qi2026safety,
  title  = {Safety Alignment Should Be Made More Than Just a Few Tokens Deep},
  author = {Xiangyu Qi and Ashwinee Panda and Kaifeng Lyu and Xiao Ma and Subhrajit Roy and Ahmad Beirami and Prateek Mittal and Peter Henderson},
  year   = {2026},
  eprint = {2406.05946},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2406.05946},
  journal = {ICLR 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/2406.05946.svg)](https://codeofpaper.com/paper/2406.05946)

Discussion