SLDR: Defending Against Malicious Fine-tuning via Selective Layers Recovery and Dynamic Routing

Hui Zhang, Yachao Yuan, Jiayun Wang, Yuanzhuo Li, Hongtao Wang +1 more
10/7/2026
cs.CRcs.AI

Official code: Stardust457/SLDR (2 stars, Python, MIT, last commit 2026-10-02).

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations(1)

Stardust457/SLDROfficial100%
MIT

[NeurIPS 2026] SLDR: Defending Against Malicious Fine-tuning via Selective Layers Recovery and Dynamic Routing

21Python, ShellSep 26, 20262 months agoMIT

Similar Papers

Cite this paper

@article{zhang2026sldr,
  title  = {SLDR: Defending Against Malicious Fine-tuning via Selective Layers Recovery and Dynamic Routing},
  author = {Hui Zhang and Yachao Yuan and Jiayun Wang and Yuanzhuo Li and Hongtao Wang and Yali Yuan},
  year   = {2026},
  eprint = {2610.10345},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2610.10345v1}
}

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/2610.10345.svg)](https://codeofpaper.com/paper/2610.10345)

Discussion