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.
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