Safety Layers in Aligned Large Language Models: The Key to LLM Security
摘要
Aligned LLMs are secure, capable of recognizing and refusing to answer malicious questions. However, the role of internal parameters in maintaining such security is not well understood yet, further these models can be vulnerable to security degradation when subjected to fine-tuning attacks. To address these challenges, our work uncovers the mechanism behind security in aligned LLMs at the parameter level, identifying a small set of contiguous layers in the middle of the model that are crucial for distinguishing malicious queries from normal ones, referred to as "safety layers". We first confirm the existence of these safety layers by analyzing variations in input vectors within the model's internal layers. Additionally, we leverage the over-rejection phenomenon and parameters scaling analysis to precisely locate the safety layers. Building on these findings, we propose a novel fine-tuning approach, Safely Partial-Parameter Fine-Tuning (SPPFT), that fixes the gradient of the safety layers during fine-tuning to address the security degradation. Our experiments demonstrate that the proposed approach can significantly preserve LLM security while maintaining performance and reducing computational resources compared to full fine-tuning.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 46 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Beware of Your Po! Measuring and Mitigating AI Safety Risks in Role-Play Fine-Tuning of LLMs 引用了 Direct Preference Optimization: Your Language Model is Secretly a Reward Model
- Direct Preference Optimization: Your Language Model is Secretly a Reward Model 引用了 Training language models to follow instructions with human feedback
- NeuroStrike: Neuron-Level Attacks on Aligned LLMs 引用了 Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To!
- NeuroStrike: Neuron-Level Attacks on Aligned LLMs 引用了 Training language models to follow instructions with human feedback
- Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To! 引用了 Finetuned Language Models are Zero-Shot Learners
- Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To! 引用了 Training language models to follow instructions with human feedback
- Towards Understanding Safety Alignment: A Mechanistic Perspective from Safety Neurons 引用了 Measuring Massive Multitask Language Understanding
- Towards Understanding Safety Alignment: A Mechanistic Perspective from Safety Neurons 引用了 Direct Preference Optimization: Your Language Model is Secretly a Reward Model
- Towards Understanding Safety Alignment: A Mechanistic Perspective from Safety Neurons 引用了 Training language models to follow instructions with human feedback
- Finetuned Language Models are Zero-Shot Learners 引用了 Training language models to follow instructions with human feedback
- Training language models to follow instructions with human feedback 引用了 Finetuned Language Models are Zero-Shot Learners
- Mix Data or Merge Models? Balancing the Helpfulness, Honesty, and Harmlessness of Large Language Model via Model Merging 引用了 Direct Preference Optimization: Your Language Model is Secretly a Reward Model
- Mix Data or Merge Models? Balancing the Helpfulness, Honesty, and Harmlessness of Large Language Model via Model Merging 引用了 Training language models to follow instructions with human feedback
- Panacea: Mitigating Harmful Fine-tuning for Large Language Models via Post-fine-tuning Perturbation 引用了 Beware of Your Po! Measuring and Mitigating AI Safety Risks in Role-Play Fine-Tuning of LLMs
- Panacea: Mitigating Harmful Fine-tuning for Large Language Models via Post-fine-tuning Perturbation 引用了 Direct Preference Optimization: Your Language Model is Secretly a Reward Model
- Panacea: Mitigating Harmful Fine-tuning for Large Language Models via Post-fine-tuning Perturbation 引用了 Training language models to follow instructions with human feedback
引用它的顶会 Paper46
- Towards Understanding Safety Alignment: A Mechanistic Perspective from Safety NeuronsJianhui Chen, Xiaozhi Wang, Zijun Yao, Yushi Bai 等NeurIPS 2025 · 53 次引用
- Beware of Your Po! Measuring and Mitigating AI Safety Risks in Role-Play Fine-Tuning of LLMsWeixiang Zhao, Yulin Hu, Yang Deng, Jiahe Guo 等ACL 2025 · 23 次引用
- Mix Data or Merge Models? Balancing the Helpfulness, Honesty, and Harmlessness of Large Language Model via Model MergingJinluan Yang, Dingnan Jin, Anke Tang, Li Shen 等NeurIPS 2025 · 23 次引用
- Panacea: Mitigating Harmful Fine-tuning for Large Language Models via Post-fine-tuning PerturbationYibo Wang, Tiansheng Huang, Li Shen, Huanjin Yao 等NeurIPS 2025 · 22 次引用
- NeuroStrike: Neuron-Level Attacks on Aligned LLMsLichao Wu, Sasha Behrouzi, Mohamadreza Rostami, Maximilian Thang 等NDSS 2026 · 21 次引用
它引用的 Paper22
- Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida 等NeurIPS 2022 · 24,707 次引用
- Direct Preference Optimization: Your Language Model is Secretly a Reward ModelRafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D. Manning 等NeurIPS 2023 · 10,924 次引用
- Measuring Massive Multitask Language UnderstandingDan Hendrycks, Collin Burns, Steven Basart, Andy Zou 等ICLR 2021 · 7,905 次引用
- Finetuned Language Models are Zero-Shot LearnersJason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu 等ICLR 2022 · 4,966 次引用
- Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To!Xiangyu Qi, Yi Zeng, Tinghao Xie, Pin-Yu Chen 等ICLR 2024 · 1,104 次引用
相关 Paper
- Layer-Aware Representation Filtering: Purifying Finetuning Data to Preserve LLM Safety AlignmentHao Li, Lijun Li, Zhenghao Lu, Xianyi Wei 等EMNLP 2025 · 2 次引用
- Understanding and Preserving Safety in Fine-Tuned LLMsJiawen Zhang, Yangfan Hu, Kejia Chen, Lipeng He 等CCS 2026 · 7 次引用
- Separate the Wheat from the Chaff: A Post-Hoc Approach to Safety Re-Alignment for Fine-Tuned Language ModelsDi Wu, Xin Lu, Yanyan Zhao, Bing QinACL Findings 2025
- Safe LoRA: The Silver Lining of Reducing Safety Risks when Finetuning Large Language ModelsChia-Yi Hsu, Yu-Lin Tsai, Chih-Hsun Lin, Pin-Yu Chen 等NeurIPS 2024 · 165 次引用
- Few Tokens, Big Leverage: Preserving Safety Alignment by Constraining Safety Tokens during Fine-tuningGuoli Wang, Haonan Shi, Tu Ouyang, An WangKDD 2026 · 5 次引用
