Gradient Immunity: Null-Space Resistance to Malicious Fine-Tuning

Yuxuan Huang, Xingyu Zeng, Tianhang Zheng, Chaochao Lu
8/5/2026
cs.CRcs.AIcs.CL

Official code: OpenCausaLab/Gradient-Immunity (1 star, Python, MIT, last commit 2026-08-27).

Abstract

Released aligned large language models remain vulnerable to malicious downstream finetuning. Existing defenses are largely designed for the fine-tuning-as-a-service (FTaaS) paradigm or rely on downstream users to follow additional safety procedures, and therefore do not directly address the setting we study: a provider controlled partially protected open-weight (PPOW) release setting in which most weights remain trainable while a small safety-critical component is preserved at release.

Show full abstract

We propose a Unidirectional Safety Gate (USG), instantiated as a Null Space Cubic Layer together with an Inverse Adapter inserted after the final Transformer layer. During downstream fine-tuning, the cubic layer suppresses or blocks gradients from harmful samples whose hidden states fall in a calibrated protected region, while the Inverse Adapter restores the base model's forward behavior. In practice, we calibrate a threshold using defender-held harmful data, allowing protection to generalize to nearby in-distribution harmful samples. Across six evaluated model-dataset settings, USG keeps post-finetuning attack success rate close to the pre-release level under a fixed release threshold, while maintaining high safe-pass rates on easier settings and exhibiting a clearer safety-utility trade-off on unsafe samples from BeaverTails. These results suggest that release-time representation-space blocking can raise the cost of malicious downstream adaptation without requiring downstream cooperation. The code is available at https://github.com/OpenCausaLab/Gradient-Immunity.

View on arXivView PDF

Code Implementations(1)

MIT

Source code for paper Gradient Immunity: Null-Space Resistance to Malicious Fine-Tuning

10Python, ShellAug 5, 20263 months agoMIT

Similar Papers

Cite this paper

@article{huang2026gradient,
  title  = {Gradient Immunity: Null-Space Resistance to Malicious Fine-Tuning},
  author = {Yuxuan Huang and Xingyu Zeng and Tianhang Zheng and Chaochao Lu},
  year   = {2026},
  eprint = {2608.05045},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2608.05045v1}
}

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

Discussion