Recent advances in alignment techniques such as Supervised Fine-Tuning (SFT), Reinforcement Learning from Human Feedback (RLHF), and Direct Preference Optimization (DPO) have improved the safety of large language models (LLMs). However, these LLMs remain vulnerable to jailbreak attacks that disguise harmful intent through indirect or deceptive phrasing. Using causal intervention, we empirically demonstrate that this vulnerability stems from shallow alignment mechanisms that lack deep reasoning, often rejecting harmful prompts without truly understanding why they are harmful. To mitigate this vulnerability, we propose enhancing alignment through reasoning-aware post-training. We construct and release a novel Chain-of-Thought (CoT) fine-tuning dataset that includes both utility-oriented and safety-critical prompts with step-by-step rationales. Fine-tuning on this dataset encourages models to produce principled refusals grounded in reasoning, outperforming standard SFT baselines. Furthermore, inspired by failure patterns in CoT fine-tuning, we introduce Alignment-Weighted DPO, which targets the most problematic parts of an output by assigning different preference weights to the reasoning and final-answer segments. This produces finer-grained, targeted updates than vanilla DPO and improves robustness to diverse jailbreak strategies. Extensive experiments across multiple safety and utility benchmarks show that our method consistently improves alignment robustness while maintaining overall model utility.
Figures & tables
Figure 1: Heatmap of Probing Accuracy for Original and Pruned Llama-2-7b-Chat and Mistral-7B-Instruct-v0.3 on Alignment and Reasoning Tasks.
Figure 2: AW-DPO Pipeline. Step 1: Generate k candidate responses per prompt using the COT-finetuned LLM, and score their harmfulness on (i) reasoning ( hrs ), (ii) response ( hrp ), and (iii) full answer ( hf ) using a judge model. Step 2: Select preference pairs (xchosen,xrejected) where the full harmfulness score difference exceeds threshold γ . Step 3: Compute alignment weights and train using LAW-DPO .
Method Name
Safety
Utility
Base ↓
Writing Styles ↓
Persuasion Techniques ↓
Encoding & Encryption ↓
Multi-languages ↓
Average ↓
Average ↑
Std ↓
Llama-2-7B Base
78.18%
65.14% ± 6.72
18.68% ± 5.76
0.68% ± 1.05
60.50% ± 10.90
41.32% ± 28.29
17.80%
6.94%
↪ +SFT
69.77%
61.04% ± 5.75
13.50% ± 4.62
2.50% ± 2.22
64.09% ± 2.78
39.71% ± 27.55
45.29%
12.24%
↪ +Safety SFT
43.86%
31.92% ± 17.75
9.68% ± 2.77
2.67% ± 2.60
50.27% ± 11.52
25.99% ± 21.38
43.77%
12.75%
↪ +CoT SFT
63.41%
52.72% ± 12.26
13.41% ± 3.70
0.06% ± 0.10
30.09% ± 19.01
28.45% ± 23.81
44.43%
12.03%
↪ + CoT Safety SFT
14.09%
11.26% ± 9.17
7.59% ± 2.66
0.06% ± 0.10
7.82% ± 4.82
7.57% ± 6.92
44.14%
11.40%
Table 1: Safety and utility performance of our methods compared to baselines.
Method Name
Safety
Utility
Base ↓
Writing Styles ↓
Persuasion Techniques ↓
Encoding & Encryption ↓
Multi-languages ↓
Average ↓
Average ↑
Std ↓
SAFECHAIN ( 23 )
45.23%
40.71% ± 4.32
15.73% ± 3.16
0.23% ± 0.16
34.55% ± 7.33
25.80% ± 16.40
44.88%
9.03%
PP ( 63 )
5.45%
4.67% ± 1.26
4.68% ± 0.23
0.34% ± 0.38
7.45% ± 1.15
4.55% ± 2.50
61.84%
18.26%
STAIR ( 58 )
2.95%
3.34% ± 1.77
4.14% ± 1.84
0.68% ± 0.68
3.68% ± 0.62
3.09% ± 1.83
70.38%
12.44%
STAIR-DPO-3 ( 58 )
1.59%
1.21% ± 0.70
1.45% ± 0.83
0.34% ± 0.47
2.09% ± 0.53
1.33% ± 0.87
71.34%
12.80%
Ours (Instruct)
2.27%
1.14% ± 0.74
0.95% ± 0.56
0.57% ± 0.34
9.05% ± 6.37
2.92% ± 4.66
65.29%
13.83%
Table 2: Safety and utility performance of our methods vs. advanced alignment baselines.
Method Name
Safety
Utility
Base ↓
Writing Styles ↓
Persuasion Techniques ↓
Encoding & Encryption ↓
Multi-languages ↓
Average ↓
Average ↑
Std ↓
Llama3.2-3B
5.00%
2.16% ± 2.15
1.09% ± 0.53
0.80% ± 0.59
2.45% ± 1.00
1.85% ± 1.62
50.66%
12.69%
Llama3.1-8B
5.23%
2.16% ± 1.13
1.14% ± 0.48
0.51% ± 0.34
1.91% ± 0.59
1.69% ± 1.24
59.41%
14.03%
Mistral-7B-V0.3
3.18%
2.46% ± 1.40
3.00% ± 0.84
0.62% ± 0.74
5.73% ± 3.47
3.05% ± 2.57
55.73%
13.60%
Table 3: Transferability of DPO dataset on other models. Specifically, we use the pre-constructed AW-DPO dataset using LLaMA2-7B and apply it to train other models.
Figure 3: Plot (a) shows the distribution within unsafe full responses. Plots (b) and (c) present the average safety and utility performance, compared to the corresponding open-source aligned models.
Figure 4: Plot (a) shows the performance improvements of our method on aligned chat models. Plots (b) and (c) show the ablation study comparing the safety and utility performance of standard DPO versus AW-DPO, respectively.
Large Language Models (LLMs) have achieved remarkable capabilities but remain vulnerable to jailbreak attacks that elicit harmful or unsafe outputs. Existing safety alignment approaches, including Supervised Fine-Tuning (SFT) and Reinforcement Learning from Human Feedback (RLHF), often require substantial attack-specific supervision and computational resources, while remaining susceptible to shallow safety alignment and over-refusal. To address these challenges, we introduce SSRFT(Supervised Safe-Role Fine-Tuning), the first framework that reformulates safety alignment as the internalization of a predefined safe role. SSRFT constructs a Safe-Role Question-Answer (SRQA) dataset from psychometric questions, limited jailbreak prompts, and a safe-role description. Role-consistent responses are synthesized, validated, and expanded into diverse scenarios, enabling models to internalize safety-oriented values and principles rather than explicit refusal patterns. Experiments across multiple Base and Instruct models show that SSRFT achieves more robust and generalizable safety alignment than standard SFT. SSRFT shows substantially greater robustness to prefilling attacks and better generalization to unseen jailbreak domains, while reducing over-refusal on benign queries and preserving the model's general capabilities. These results establish safe-role internalization as an effective alternative to refusal-centric safety alignment. Warning: This paper contains examples of harmful and toxic language.
Jinghao Pang, Jitai Hao, Qiang Huang +2
Harbin Institute of Technology (Shenzhen) · Leiden University
Large reasoning models (LRMs) achieve remarkable success on complex tasks but remain vulnerable to harmful prompts that induce unsafe outputs. Recent methods align LRMs using direct refusals or safety rationales, yet often focus on prompt patterns rather than intrinsic attack mechanisms. As a result, these pattern-centric alignments struggle to generalize across diverse jailbreaks, compromising adversarial robustness and reasoning utility. We propose AdvSafe, a dual-adversarial framework that enables LRMs to internalize unsafety knowledge by explicitly deconstructing adversarial mechanisms. This moves beyond pattern-dependent traces, fostering robust cognitive defense without compromising reasoning utility. Our pipeline operates via a two-phase adversarial game. First, in adversarial synthesis, an autonomous agent dynamically crafts deceptive jailbreak prompts, adapting its strategies to breach a strong teacher model. Second, in adversarial extraction, the breached teacher executes a cognitive counter-attack. For every successful jailbreak, the teacher unmasks the camouflage, explaining why the attack succeeds and how such prompts can be identified and mitigated. This dual-adversarial process yields a compact reasoning dataset capturing rich, generalizable unsafety knowledge. Student models trained on this dataset implicitly acquire safety alignment through intrinsic threat comprehension. Experiments show that with only 1K synthesized samples, AdvSafe-aligned LRMs achieve significantly stronger jailbreak robustness than existing baselines, with almost no utility degradation. Furthermore, AdvSafe improves robustness against out-of-distribution prompts, demonstrating that learning unsafety knowledge enables a superior robustness-utility trade-off and generalizes beyond seen attack patterns.
Hongli Shen, Shaopeng Fu, Qinbo Zhang +2
1King Abdullah University of Science and Technology · 2Stony Brook University
While Large Reasoning Models (LRMs) excel at complex tasks, they remain highly vulnerable to sophisticated jailbreaks and direct harmful queries. To address this vulnerability, prior works depend heavily on external manual data annotation for safety alignment. However, we observe that LRMs can inherently identify safety risks when being re-presented with original queries alongside their own reasoning trajectories -- a capability we term Latent Safety Awareness. To leverage this safety awareness, we first employ Supervised Fine-Tuning (SFT) to explicitly induce safe tags to trigger safety analysis and guidance following the initial reasoning content for unsafe queries, while preserving standard responses for general queries to ensure adaptive triggering. Subsequently, we apply Direct Preference Optimization (DPO) to further enhance the correctness and stability of the safety analysis and guidance. Notably, responses required for both training stages are entirely generated by models being optimized. With (Safe Trigger) SFT and DPO, experimental results demonstrate significant safety enhancement. For example, the Attack Success Rate (ASR) of DeepSeek-R1-Distill-Llama-8B, on average, drops 24.65% and 36.72% on harmful and jailbreak benchmarks, respectively. Finally, our Safe Trigger method exerts almost no negative impact on general performance or user experience.
Ke Miao, Jiaxin Li, Hongliang Chen +2
The State Key Laboratory of Blockchain and Data Security, Zhejiang University · Hangzhou HighTech Zone (Binjiang) Blockchain and Data Security Research Institute, China · Li Auto Inc. +2