Why Safeguarded Ships Run Aground? Aligned Large Language Models' Safety Mechanisms Tend to Be Anchored in The Template Region

Chak Tou Leong, Qingyu Yin, Jian Wang, Wenjie Li
2/19/2025
cs.CLcs.AIcs.CR

No official code found. Best implementation: cooperleong00/TASA (10 stars, last commit 2025-06-03).

Abstract

The safety alignment of large language models (LLMs) remains vulnerable, as their initial behavior can be easily jailbroken by even relatively simple attacks. Since infilling a fixed template between the input instruction and initial model output is a common practice for existing LLMs, we hypothesize that this template is a key factor behind their vulnerabilities: LLMs' safety-related decision-making overly relies on the aggregated information from the template region, which largely influences these models' safety behavior. We refer to this issue as template-anchored safety alignment. In this paper, we conduct extensive experiments and verify that template-anchored safety alignment is widespread across various aligned LLMs. Our mechanistic analyses demonstrate how it leads to models' susceptibility when encountering inference-time jailbreak attacks. Furthermore, we show that detaching safety mechanisms from the template region is promising in mitigating vulnerabilities to jailbreak attacks. We encourage future research to develop more robust safety alignment techniques that reduce reliance on the template region.

View on arXivView PDF

Code Implementations(1)

cooperleong00/TASACommunity66%

The official code for the ACL 2025 paper "Why Safeguarded Ships Run Aground? Aligned Large Language Models' Safety Mechanisms Tend to Be Anchored in The Template Region"

101Python, MakefileMay 28, 20251 years ago

Cite this paper

@article{leong2025safeguarded,
  title  = {Why Safeguarded Ships Run Aground? Aligned Large Language Models' Safety Mechanisms Tend to Be Anchored in The Template Region},
  author = {Chak Tou Leong and Qingyu Yin and Jian Wang and Wenjie Li},
  year   = {2025},
  eprint = {2502.13946},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.13946v2}
}

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

Discussion