Saved in:
| Main Authors: | , , , , , , |
|---|---|
| Format: | Preprint |
| Published: |
2025
|
| Subjects: | |
| Online Access: | https://arxiv.org/abs/2507.18631 |
| Tags: |
Add Tag
No Tags, Be the first to tag this record!
|
| _version_ | 1866911077266096128 |
|---|---|
| author | Li, Hao Li, Lijun Lu, Zhenghao Wei, Xianyi Li, Rui Shao, Jing Sha, Lei |
| author_facet | Li, Hao Li, Lijun Lu, Zhenghao Wei, Xianyi Li, Rui Shao, Jing Sha, Lei |
| contents | With rapid advancement and increasing accessibility of LLMs, fine-tuning aligned models has become a critical step for adapting them to real-world applications, which makes the safety of this fine-tuning process more important than ever. However, recent studies have highlighted a critical challenge: even when fine-tuning with seemingly benign downstream datasets, the safety of aligned LLMs can be compromised, making them more susceptible to malicious instructions.
In this paper, we show that fine-tuning datasets often contain samples with safety-degrading features that are not easily identifiable on the surface. These samples can significantly degrade the safety alignment of LLMs during fine-tuning. To address this issue, we propose LARF, a Layer-Aware Representation Filtering method. This method identifies safety-sensitive layers within the LLM and leverages their representations to detect which data samples in the post-training dataset contain safety-degrading features.
Experimental results demonstrate that LARF can effectively identify benign data with safety-degrading features. After removing such data, the safety alignment degradation caused by fine-tuning is mitigated. Please see our code at https://github.com/LLLeoLi/LARF. |
| format | Preprint |
| id |
arxiv_https___arxiv_org_abs_2507_18631 |
| institution | arXiv |
| publishDate | 2025 |
| record_format | arxiv |
| spellingShingle | Layer-Aware Representation Filtering: Purifying Finetuning Data to Preserve LLM Safety Alignment Li, Hao Li, Lijun Lu, Zhenghao Wei, Xianyi Li, Rui Shao, Jing Sha, Lei Cryptography and Security With rapid advancement and increasing accessibility of LLMs, fine-tuning aligned models has become a critical step for adapting them to real-world applications, which makes the safety of this fine-tuning process more important than ever. However, recent studies have highlighted a critical challenge: even when fine-tuning with seemingly benign downstream datasets, the safety of aligned LLMs can be compromised, making them more susceptible to malicious instructions. In this paper, we show that fine-tuning datasets often contain samples with safety-degrading features that are not easily identifiable on the surface. These samples can significantly degrade the safety alignment of LLMs during fine-tuning. To address this issue, we propose LARF, a Layer-Aware Representation Filtering method. This method identifies safety-sensitive layers within the LLM and leverages their representations to detect which data samples in the post-training dataset contain safety-degrading features. Experimental results demonstrate that LARF can effectively identify benign data with safety-degrading features. After removing such data, the safety alignment degradation caused by fine-tuning is mitigated. Please see our code at https://github.com/LLLeoLi/LARF. |
| title | Layer-Aware Representation Filtering: Purifying Finetuning Data to Preserve LLM Safety Alignment |
| topic | Cryptography and Security |
| url | https://arxiv.org/abs/2507.18631 |