这篇论文提出了一个缓解LLM推理中安全问题的方法,SDP在保持推理性能的同时提高了安全性,值得一读。
推理诱导的不一致(RIM)可能导致LLM在推理数据上微调时产生有害行为,本研究分析了RIM的表示空间,并提出安全方向惩罚(SDP)来缓解这一问题。SDP在推理微调期间惩罚安全方向上的移动,通过分析提取推理能力和安全行为两个方向,并定位安全决策层。在Qwen2.5-3B和7B上,SDP在保持基准推理性能的同时恢复了安全性。
Mitigating Reasoning-Induced Misalignment via Safety-Direction Penalty
Reasoning-Induced Misalignment, where fine-tuning on reasoning data containing no harmful content, including mathematics, code, and problem-solving with chain-of-thought traces can induce harmful behaviors of LLM, posing a serious challenge to the safety of LLM reasoning. Cross-architecture, cross-scale, and cross-dataset checks show that RIM does not always emerge. Previous work attributed RIM to neuron-level entanglement, but did not identify the geometry of the representation space underlying this entanglement or propose a training-time fix. We provide both: a representation-space analysis of RIM and the Safety-Direction Penalty (SDP), which penalizes movement along a learned safety direction during reasoning fine-tuning. The analysis extracts two activation-space directions, one encoding reasoning ability and the other safety behavior. These directions are coupled: fine-tuning that improves reasoning shifts safety representations, and prompts with larger shifts show larger safety degradation. CKA distance ratios and probes locate the safety-decision layers where this shift is most relevant. These findings guide the design of SDP: the coupling motivates penalizing displacement along the safety direction, and the layer localization sets the initial scope. When the initial scope leaves compensatory shifts beyond the penalized layers, the same diagnostics guide iterative expansion. On Qwen2.5-3B and 7B, SDP restores safety while preserving benchmark reasoning performance.