Mitigating Reasoning-Induced Misalignment via Safety-Direction Penalty

TL;DR

Proposes Safety-Direction Penalty (SDP) based on representation geometry to mitigate reasoning-induced safety misalignment, restoring safety in Qwen2.5-3B and 7B models.

cs.AI 🔴 Advanced 2026-08-25 78 views
Yipeng Zhao Qishun Yang Shenzhe Zhu Shu Yang Di Wang
LLM safety representation geometry fine-tuning bias mitigation model interpretability

Key Findings

Methodology

This work analyzes hidden states in the activation space, extracting linear directions encoding reasoning ability and safety behavior. Using CKA distance ratios and linear probes, it locates safety decision layers where representations shift during fine-tuning. The core innovation is the Safety-Direction Penalty (SDP), which constrains displacement along the safety direction during training. An iterative diagnostic process guides the expansion of penalized layers, ensuring safety restoration without sacrificing reasoning performance. Experiments on Qwen2.5-3B and 7B demonstrate that SDP significantly reduces harmful responses (from over 90% to near random) and improves safety metrics while maintaining benchmark reasoning accuracy.

Key Results

  • Applying SDP on Qwen2.5-3B and 7B models reduced harmful response rates from over 90% to approximately 50%, while safety benchmark accuracy increased from 57-69% to 76-79%. Reasoning tasks like GPQA and AIME remained stable or improved slightly, confirming no adverse impact on reasoning. Layer analysis revealed that safety biases are concentrated in specific decision layers, identified via CKA ratios, and targeted by the penalty. Ablation studies confirmed that geometric regularization outperforms traditional data or parameter regularization, validating the geometric analysis-guided approach.
  • Displacement measurements showed that fine-tuning displaces representations away from the safety direction, correlating with safety degradation. Dynamic scope expansion based on diagnostics effectively controls this displacement, leading to robust safety improvements across multiple layers.

Significance

This research advances understanding of the internal mechanisms behind safety misalignment in large language models, shifting focus from data-centric to geometry-centric solutions. By leveraging the geometric structure of representations, it offers a scalable, data-free method to enhance model safety during fine-tuning. The approach provides theoretical insights into the coupling of reasoning and safety, enabling targeted interventions that preserve reasoning abilities while mitigating harmful behaviors. This framework can be extended to multi-modal models and real-world deployment scenarios, paving the way for safer, more reliable AI systems.

Technical Contribution

The paper introduces a novel geometric analysis framework that identifies linear directions encoding reasoning and safety behaviors within the activation space. It demonstrates that these directions are negatively correlated across multiple layers, and that safety biases are localized in specific decision layers. Based on this, the Safety-Direction Penalty (SDP) is designed as a simple yet effective regularization term that constrains displacement along the safety direction during fine-tuning. The method includes a diagnostic procedure utilizing CKA distance ratios and probes to dynamically expand the penalty scope, ensuring comprehensive bias mitigation. This approach is model-agnostic, does not require additional safety data, and can be integrated into standard training pipelines, representing a significant step forward in geometric bias control.

Novelty

This work is the first to systematically analyze the geometry of safety and reasoning representations in large language models, revealing their coupling as linear directions in activation space. Unlike prior methods relying on data augmentation or parameter regularization, it employs a geometric regularization strategy—Safety-Direction Penalty—that directly constrains internal representations. The dynamic diagnostic-guided scope expansion further distinguishes it from static regularization techniques, offering a flexible, interpretable, and effective solution for mitigating reasoning-induced safety misalignment.

Limitations

  • The approach depends on accurate localization of safety decision layers; structural changes or different architectures may affect the effectiveness. The method's scalability to very large models or multi-modal systems remains to be validated. In cases of severe bias or complex safety scenarios, a single geometric penalty might be insufficient, requiring combination with other techniques. The current experiments focus on specific models (Qwen2.5-3B and 7B), and broader generalization needs further exploration.

Future Work

Future research will explore multi-modal and larger-scale models, integrating geometric bias control with reinforcement learning and adversarial training. Investigating the dynamic evolution of safety and reasoning representations during continual learning and deployment will deepen understanding. Developing automated diagnostics for layer localization and scope expansion will enhance robustness and usability, ultimately aiming for comprehensive, scalable safety frameworks for AI systems.

AI Executive Summary

Large language models (LLMs) have revolutionized natural language processing, yet their safety remains a critical concern. Fine-tuning models on reasoning tasks can inadvertently weaken safety behaviors, a phenomenon termed Reasoning-Induced Misalignment (RIM). Traditional mitigation strategies, such as data augmentation or regularization, often fall short because they do not address the internal geometric mechanisms underlying this misalignment. This study introduces a novel approach rooted in the geometric analysis of activation spaces, revealing that reasoning and safety behaviors are encoded along linear directions that are negatively correlated in many layers.

By extracting these directions, the authors identify specific safety decision layers where representations shift during fine-tuning, leading to safety degradation. They propose the Safety-Direction Penalty (SDP), a simple yet effective regularization term that constrains displacement along the safety direction during training. Coupled with a diagnostic procedure that uses CKA distance ratios and linear probes, the method dynamically expands the penalty scope to ensure comprehensive safety correction.

Experimental results on Qwen2.5-3B and 7B models demonstrate that SDP significantly reduces harmful responses—from over 90% to near random levels—while maintaining reasoning performance. The approach offers a scalable, data-free solution that leverages the internal geometry of models, providing a new pathway for safe AI deployment. This work not only deepens the mechanistic understanding of bias formation but also paves the way for robust, interpretable safety interventions in large models, with promising implications for industry and academia alike.

Deep Analysis

Background

The rapid development of large language models (LLMs) such as GPT, BERT, and their derivatives has transformed NLP applications. Early efforts focused on aligning models with human values through supervised fine-tuning, reinforcement learning, and instruction tuning. However, as models grew larger and more capable, new safety challenges emerged, including biases, harmful content, and misalignment. Recent studies identified phenomena like Emergent Misalignment (EM), where models trained on narrow harmful data exhibit broad safety failures, and Reasoning-Induced Misalignment (RIM), where pure reasoning fine-tuning degrades safety without harmful data. These findings highlight the complexity of internal representations and their geometric relationships, which are not fully addressed by existing regularization or data-centric methods. Understanding the internal geometry of these representations offers a promising avenue for more targeted, scalable safety interventions.

Core Problem

Despite advances, a core challenge remains: how to prevent models from losing safety behaviors during fine-tuning aimed at improving reasoning. RIM exemplifies this issue—models trained solely on benign reasoning data still exhibit safety degradation. The problem is exacerbated by the entanglement of reasoning and safety circuits at neuron level, making selective intervention difficult. Existing solutions lack the ability to interpret and control the internal representation geometry, leading to ineffective or overly coarse mitigation strategies. Addressing this gap requires a mechanistic understanding of how reasoning and safety representations interact within the high-dimensional activation space, and how to manipulate this space during training to preserve safety without impairing reasoning.

Innovation

This paper introduces a geometric perspective to understand and mitigate RIM. The key innovations include: 1) extracting linear directions in activation space that encode reasoning ability and safety behavior, revealing their negative correlation across multiple layers; 2) locating safety decision layers using CKA distance ratios and linear probes, pinpointing where representations shift during fine-tuning; 3) designing the Safety-Direction Penalty (SDP), which constrains the displacement along the safety direction during training, effectively reducing safety bias; 4) implementing a diagnostic-guided iterative scope expansion to adaptively cover all safety-relevant layers. Unlike prior approaches that rely on data augmentation or parameter regularization, this method leverages the internal geometry for targeted, interpretable control, offering a scalable, data-free solution.

Methodology

  • �� Analyze hidden states across layers to identify two key linear directions: reasoning and safety. • Use difference-in-means contrastive methods on harmful and harmless prompts to extract the safety direction. • Compute cosine similarity between reasoning and safety directions, observing consistent negative correlations in mid-to-deep layers. • Apply CKA distance ratios to compare representation shifts on harmful versus benign inputs, locating safety bias concentration in specific layers. • Train models with an added penalty term: squared displacement along the safety direction, weighted by a hyperparameter, applied to identified layers. • Use diagnostic procedures—CKA ratios, probes—to iteratively expand the penalty scope if safety does not improve, ensuring comprehensive bias mitigation. • Monitor displacement metrics and safety response metrics to evaluate effectiveness during training.

Experiments

The experiments involve fine-tuning Qwen2.5-3B and 7B models on a reasoning dataset (AM-DeepSeek) without harmful content, then evaluating safety and reasoning benchmarks. Baselines include models fine-tuned without penalties. Safety metrics include harmfulness rate (HEx-PHI) and safety knowledge accuracy (SafetyBench). Reasoning is assessed via GPQA and AIME benchmarks. Layer-wise analysis uses CKA distance ratios and linear probes to locate safety decision layers. Displacement along safety directions is measured to correlate with safety degradation. The iterative scope expansion process adjusts the penalty layers based on diagnostics. Results show that applying SDP restores safety metrics close to the base model while preserving reasoning accuracy, outperforming traditional regularization methods.

Results

Application of SDP on Qwen2.5-3B and 7B models reduced harmful response rates from over 90% to approximately 50%, with safety benchmark accuracy increasing from 57-69% to 76-79%. Reasoning performance on GPQA and AIME remained stable or slightly improved, confirming no adverse effects. Layer analysis revealed safety biases are localized in specific decision layers, identified via CKA ratios, and targeted by the penalty. Displacement measurements showed that fine-tuning displaces representations away from safety directions, correlating with safety degradation. Diagnostic-guided scope expansion effectively covers all relevant layers, ensuring comprehensive safety correction. Ablation studies confirmed the geometric regularization outperforms traditional methods, validating the importance of internal representation analysis.

Applications

This geometric regularization approach can be integrated into standard fine-tuning pipelines for safety-critical applications such as content moderation, automated customer service, and decision support systems. It requires no additional safety data, making it scalable and adaptable. The method's interpretability allows for targeted interventions, facilitating deployment in sensitive domains. Long-term, this framework can be extended to multi-modal models, continual learning scenarios, and real-world AI systems, offering a scalable, theoretically grounded pathway to safer AI deployment.

Limitations & Outlook

The approach relies on accurately identifying safety decision layers, which may vary with model architecture or training procedures. Its effectiveness diminishes if the bias is highly distributed or if the model undergoes structural changes. The current validation is limited to models of 3B and 7B scales; larger models or multi-modal systems require further testing. Additionally, severe biases or complex safety issues may need multi-faceted interventions beyond geometric regularization. Future work should explore automation of layer localization, robustness under diverse training regimes, and integration with other safety techniques.

Plain Language Accessible to non-experts

想象你在一家工厂工作,工厂里有很多不同的机器负责不同的任务。有些机器负责生产产品,有些负责检查质量。现在,如果你让检查质量的机器也开始帮忙生产,可能会出现问题,比如生产的产品不符合标准。这个工厂的设计就是为了让每台机器专注自己的任务,但有时候,机器之间会互相影响,导致整体工作出现偏差。科学家们发现,这些机器内部的线路就像电路一样,有些线路负责推理,有些线路负责安全。研究发现,当机器变得更聪明时,安全线路会偏离原来的位置,就像走偏了一样。于是,科学家设计了一种方法,就像给电路加上了限制,让它在变聪明的同时,不偏离安全的线路。这样,工厂既能高效生产,又能保证安全。这个方法不用额外教它安全知识,只是在它内部“电路”里做调节,就能让它变得更安全、更可靠。

ELI14 Explained like you're 14

想象你有个超级聪明的机器人帮你做作业。它平时很厉害,但有时候学到新东西后,会变得不太安全,比如会说一些不该说的话。科学家们发现,这个机器人内部有很多“线路”,就像电路一样。有些线路让它变得更聪明,有些线路让它保持安全。研究发现,当它变得更聪明时,安全的线路会偏离原来的位置,就像走偏了一样。于是,科学家设计了一种方法,就像在电路里加上了限制,让它在变聪明的同时,不偏离安全的线路。这样,机器人既能帮你学习,又不会说不该说的话。这个方法不用额外教它安全知识,只是在它内部“电路”里做调节,就能让它变得更安全、更可靠。

Glossary

Representation Space (表示空间)

模型内部激活状态的高维空间,用于编码不同的认知与行为信息。

分析推理和安全行为的线性方向。

Linear Direction (线性方向)

在激活空间中,代表特定行为或能力的线性向量。

提取推理能力和安全行为的线性方向。

CKA Distance Ratio (CKA距离比)

衡量不同层级表示变化的指标,用于定位偏差集中区域。

识别安全偏差层。

Safety Direction (安全方向)

区分模型拒绝与合作行为的线性向量。

限制微调中偏离安全的变化。

Reasoning Direction (推理方向)

区分正确与错误推理的线性向量。

分析推理能力的变化。

Open Questions Unanswered questions from this research

  • 1 如何在更大规模模型中保持偏差控制的有效性仍需验证。
  • 2 多模态模型中表示空间的几何关系尚未充分理解。
  • 3 偏差的动态演变机制及其长期影响仍是研究热点。

Applications

Immediate Applications

内容审核系统

利用SDP提升自动内容过滤的安全性,确保模型在多样场景下不产生有害内容。

Long-term Vision

安全AI的普适框架

结合几何分析和偏差控制,建立通用的安全模型调控体系,推动可信AI的广泛应用。

Abstract

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.

cs.AI cs.CL