SLDR: Defending Against Malicious Fine-tuning via Selective Layers Recovery and Dynamic Routing
Hui Zhang, Yachao Yuan, Jiayun Wang, Yuanzhuo Li, Hongtao Wang, Yali Yuan
Abstract
Fine-tuning-as-a-service enables users to adapt aligned large language models (LLMs) to specialized tasks, but malicious fine-tuning can erode refusal behavior while preserving task performance on legitimate inputs. We revisit recent layer-wise safety diagnostics and find that safety sensitivity is signed: scaling different layers can strengthen refusal, weaken it, or have little effect. Motivated by this observation, we propose SLDR, a post-fine-tuning defense based on Selective Layers Recovery and Dynamic Routing. SLDR trains a LoRA recovery adapter only on the layers with the maximum and minimum sensitivity scores in the signed spectrum, and uses representation-based dynamic routing inference to activate the adapter only for malicious queries. Across four model architectures, five downstream tasks, and four harmful benchmarks, SLDR substantially reduces harmful outputs while preserving downstream utility. On Llama3.1/SST2, SLDR reduces the average harmful score from 11.54 to 0.08 while maintaining downstream accuracy, and the harmful score remains near zero under poisoning ratios up to 0.9. The code is available at https://github.com/Stardust457/SLDR.
Create a lesson
Metadata
- Categories
- cs.CR, cs.AI
- Comments
- Accepted at NeurIPS 2026
Related papers
Felid: A Flexible and Efficient Design for Transformer Fine-Tuning over Encrypted Data
Shared title terminologycs.CRLinru Zhang, Jun Jie Sim, Xiangning Wang et al.
Erased but Recoverable: On the Fragility of Concept Erasure Under Fine-Tuning
Shared title terminologycs.CRJun Li, Lizhi Xiong, Ziqiang Li et al.
AutoSec-RAN: Specification-Grounded LLM Fine-Tuning for Automated Security Analysis of O-RAN
Shared title terminologycs.CRAnoop Mishra, Joshua Moore, Aly Sabri Abdalla et al.
HE-OFT: Privacy-Preserving One-Shot Federated Fine-Tuning under Homomorphic Encryption
Shared title terminologycs.CRHalil İbrahim Kanpak, Sinem Sav, Alptekin Küpçü
ASCENT: First-Order Optimal Fine-Tuning with Recalibration for Safety--Utility Co-Enhancement
Shared title terminologycs.CRWeiwei Qi, Chongyu Wang, Tianhang Zheng et al.
Autonomous Parameter Surgery: How LLMs Implant Selective Backdoors into Language Models
Shared title terminologycs.CRXuyang Liu, Zhiwei Xu, Zirui Li et al.