Anchoring Refusal Direction: Mitigating Safety Risks in Tuning via Projection Constraint

Yanrui Du, Fenglei Fan, Sendong Zhao, Jiawei Cao, Qika Lin, Kai He, Ting Liu, Bing Qin, Mengling FengarXiv 2025 · OpenReview

Abstract

Instruction Fine-Tuning (IFT) has been widely adopted as an effective post-training strategy to enhance various abilities of Large Language Models (LLMs). However, prior studies have shown that IFT can significantly compromise LLMs' safety, particularly their ability to refuse malicious instructions, raising significant concerns. Recent research into the internal mechanisms of LLMs has identified the refusal direction ($r$-direction) in the hidden states, which plays a pivotal role in governing refusal behavior. Building on this insight, our study reveals that the $r$-direction tends to drift during training, which we identify as one of the causes of the associated safety risks. To mitigate such drift, our proposed ProCon method introduces a projection-constrained loss term that regularizes the projection magnitude of each training sample's hidden state onto the $r$-direction. Experimental results under various datasets, scenarios, and LLMs demonstrate that our method can significantly mitigate safety risks posed by IFT while preserving task performance gains.

Introduction

Large Language Models (LLMs) typically undergo extensive alignment, such as Reinforcement Learning from Human Feedback (RLHF), to ensure they refuse harmful instructions. However, a disturbing trend has emerged: when these aligned models undergo Instruction Fine-Tuning (IFT) for new tasks, their safety mechanisms often degrade—a phenomenon known as "safety regression." Surprisingly, even fine-tuning on perfectly benign data can cause a model to start answering malicious prompts it previously refused.

This paper investigates the mechanistic cause of this regression, focusing on the refusal direction ($r$-direction). The $r$-direction is a specific vector in the model's hidden state space that governs refusal behavior. We discover that during standard fine-tuning, this direction undergoes a significant "drift," particularly in the deeper layers, effectively disabling the model's safety triggers.

Mechanisms of Safety Drift

Our analysis across multiple architectures, including LLaMA2, LLaMA3, and Qwen2, reveals that $r$-direction drift is a universal phenomenon. By measuring the cosine similarity ($\cos \theta$) between the $r$-direction of the vanilla (safe) model and the model during IFT, we observed a consistent decline in similarity as training progressed.

Drift analysis across different LLMs shows that the refusal direction similarity (Cos theta) decreases significantly in deeper layers and during early training epochs.

Key observations include:

  • Depth Sensitivity: Drift is consistently more pronounced in deeper layers, which are closer to the final output generation.
  • Early-Stage Sharp Drift: Most of the safety degradation occurs within the very first epoch of fine-tuning. This "sharp drift" suggests that the model's safety alignment is highly volatile at the start of new training.

The ProCon Method

To stabilize the model's internal safety logic, we propose ProCon (Projection-Constraint). The method consists of three main components:

  1. Refusal Direction Identification: We identify the $r$-direction by calculating the difference between the mean hidden state activations of benign instructions and malicious ones (the "difference-in-means" method).
  2. Projection-Constrained Loss: We introduce a new loss term, $Loss_{proj} = ||Proj_{IFT} - Proj_{vanilla}||_2$, which regularizes the projection magnitude of a training sample's hidden state onto the $r$-direction to match the original safe model.
  3. Enhanced ProCon ($ProCon^{wu}_{safe}$):
    • Warm-up Strategy ($wu$): To counter the early-stage sharp drift, we apply a strong constraint ($\alpha=1$) during the initial "warm-up" epochs before transitioning to standard IFT.
  4. Broadening Data Distribution ($safe$): We incorporate a small set of safety-oriented data (approx. 1k samples) to provide a clearer signal for the constraint, further stabilizing the $r$-direction.
Overview of the ProCon method, illustrating refusal direction identification, the drift problem, and the proposed projection-constrained loss with warm-up and data broadening strategies.

Experimental Results

We evaluated $ProCon^{wu}_{safe}$ using LLaMA2-7B, LLaMA3-8B, and Qwen2-7B across various red-teaming benchmarks (e.g., Advbench, CatQA) and task performance metrics (e.g., GSM8K).

  • Safety Preservation: On LLaMA2, standard IFT caused the Average Attack Success Rate (ASR) to jump from 6.12% to 61.18%. $ProCon^{wu}_{safe}$ successfully mitigated this, maintaining an ASR of 12.88%.
  • Utility Maintenance: Crucially, the method preserves or even slightly enhances task performance. For reasoning tasks on LLaMA2, performance improved from 66.0% (standard IFT) to 67.0% with ProCon.
  • Robustness: The method remains effective even in "Attack IFT" scenarios where malicious samples are intentionally injected into the training set.

Conclusion

ProCon offers an interpretability-driven approach to LLM safety. By treating safety as a geometric stability problem in the hidden state space, we can anchor the refusal behavior of models during fine-tuning. This method effectively balances the need for task-specific adaptation with the requirement for robust safety alignment, laying a foundation for more secure post-training strategies.

Summary updated

BibTeX
@misc{du2025anchoring,
  author = {Yanrui Du and Fenglei Fan and Sendong Zhao and Jiawei Cao and Qika Lin and Kai He and Ting Liu and Bing Qin and Mengling Feng},
  title = {{Anchoring Refusal Direction: Mitigating Safety Risks in Tuning via Projection Constraint}},
  year = {2025},
  eprint = {2509.06795},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.06795},
}
Figure