paper-with-me

홈 › Papers

Gradient Surgery for Safe LLM Fine-Tuning

2025-08-10 · Biao Yi, Jiahao Li, Baolei Zhang, Lihai Nie, Tong Li, Tiansheng Huang, Zheli Liu arxiv

Fine-tuning-as-a-Service introduces a critical vulnerability where a few malicious examples mixed into the user's fine-tuning dataset can compromise the safety alignment of Large Language Models (LLMs). While a recognized paradigm frames safe fine-tuning as a multi-objective optimization problem balancing user task performance with safety alignment, we find existing solutions are critically sensitive to the harmful ratio, with defenses degrading sharply as harmful ratio increases. We diagnose that this failure stems from conflicting gradients, where the user-task update directly undermines the safety objective. To resolve this, we propose SafeGrad, a novel method that employs gradient surgery. When a conflict is detected, SafeGrad nullifies the harmful component of the user-task gradient by projecting it onto the orthogonal plane of the alignment gradient, allowing the model to learn the user's task without sacrificing safety. To further enhance robustness and data efficiency, we employ a KL-divergence alignment loss that learns the rich, distributional safety profile of the well-aligned foundation model. Extensive experiments show that SafeGrad provides state-of-the-art defense across various LLMs and datasets, maintaining robust safety even at high harmful ratios without compromising task fidelity.

📄 PDF Abstract BibTeX arXiv:2508.07172

Code (0)

등록된 구현이 없습니다.

Similar Papers 제목 키워드 기반

Surgery: Mitigating Harmful Fine-Tuning for Large Language Models via Attention Sink

2026-02-05 · Guozhi Liu, Weiwei Lin, Tiansheng Huang, Ruichao Mo 외 arxiv

Harmful fine-tuning can invalidate safety alignment of large language models, exposing significant safety risks. In this paper, we utilize the attention sink mechanism to mitigate harmful fine-tuning. Specifically, we fi…

Training Data Selection with Gradient Orthogonality for Efficient Domain Adaptation

2026-02-06 · Xiyang Zhang, Yuanhe Tian, Hongzhi Wang, Yan Song arxiv

Fine-tuning large language models (LLMs) for specialized domains often necessitates a trade-off between acquiring domain expertise and retaining general reasoning capabilities, a phenomenon known as catastrophic forgetti…

Reinforcement LearningDomain Adaptation

Understanding and Preserving Safety in Fine-Tuned LLMs

2026-01-15 · Jiawen Zhang, Yangfan Hu, Kejia Chen, Lipeng He 외 arxiv

Fine-tuning is an essential and pervasive functionality for applying large language models (LLMs) to downstream tasks. However, it has the potential to substantially degrade safety alignment, e.g., by greatly increasing …

Jailbreak to Protect: Buffering and Reinforcing via Temporary Jailbreaking for Safe Fine-Tuning in Large Language Models

2026-05-23 · Seokil Ham, Jaehyuk Jang, Wonjun Lee, Changick Kim arxiv

Fine-tuning-as-a-Service (FaaS) enables personalization of large language models (LLMs), but it can weaken safety-alignment under harmful fine-tuning attacks. Recent work has shown that activating harmful-behavior module…

DGS-Net: Distillation-Guided Gradient Surgery for CLIP Fine-Tuning in AI-Generated Image Detection

2025-11-17 · Jiazhen Yan, Ziqiang Li, Fan Wang, Boyu Wang 외 arxiv

The rapid progress of generative models such as GANs and diffusion models has led to the widespread proliferation of AI-generated images, raising concerns about misinformation, privacy violations, and trust erosion in di…

Domain Generalization