Mitigating Fine-tuning Risks in LLMs via Safety-Aware Probing Optimization

Chengcan Wu, Zhixin Zhang, Zeming Wei, Yihao Zhang, Meng Sun
5/22/2025
cs.LGcs.AIcs.CL

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

The significant progress of large language models (LLMs) has led to remarkable achievements across numerous applications. However, their ability to generate harmful content has sparked substantial safety concerns. Despite the implementation of safety alignment techniques during the pre-training phase, recent research indicates that fine-tuning LLMs on adversarial or even benign data can inadvertently compromise their safety. In this paper, we re-examine the fundamental issue of why fine-tuning on non-harmful data still results in safety degradation. We introduce a safety-aware probing (SAP) optimization framework designed to mitigate the safety risks of fine-tuning LLMs. Specifically, SAP incorporates a safety-aware probe into the gradient propagation process, mitigating the model's risk of safety degradation by identifying potential pitfalls in gradient directions, thereby enhancing task-specific performance while successfully preserving model safety. Our extensive experimental results demonstrate that SAP effectively reduces harmfulness below the original fine-tuned model and achieves comparable test loss to standard fine-tuning methods. Our code is available at https://github.com/ChengcanWu/SAP.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 1 weaker match is hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Cite this paper

@article{wu2025mitigating,
  title  = {Mitigating Fine-tuning Risks in LLMs via Safety-Aware Probing Optimization},
  author = {Chengcan Wu and Zhixin Zhang and Zeming Wei and Yihao Zhang and Meng Sun},
  year   = {2025},
  eprint = {2505.16737},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.16737v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.16737.svg)](https://codeofpaper.com/paper/2505.16737)

Discussion