HyperSafe: Inference-Time Safety Recovery for Fine-Tuned Language Models
On the map: LLM alignment / RLHF / preference optimisation → Safety alignment and jailbreak attacks
also in 1 more
Abstract (arXiv)
Safety alignment in large language models can be fragile under fine-tuning, as even benign task adaptation may increase harmful compliance. Existing defenses mainly follow two directions: they either intervene during or after fine-tuning through retraining or weight modification, which can be costly and may hurt task performance, or they use model-agnostic safety classifiers, which may miss failures specific to a given fine-tuned checkpoint. These limitations motivate a post hoc, model-specific, and non-invasive approach to safety restoration. To meet these requirements, we propose HyperSafe, a framework that restores safety behavior by generating a model-specific Safe Side Network (SSN) for each fine-tuned checkpoint. HyperSafe uses layer-wise activation fingerprints to capture how fine-tuning changes the model's inner representations. With a small set of given calibration prompts, the hypernetwork maps these fingerprints to the parameters of the ssn in a single forward pass. The generated ssn runs alongside the frozen fine-tuned model and performs prompt-level safety classification: harmful prompts are routed to refusal, while safe prompts are answered by the original fine-tuned model. Thus, HyperSafe requires no gradient updates, no safety data at deployment time, and no modification to the deployed model weights. We evaluate HyperSafe on two model families, Qwen2-7B and LLaMA-3-8B, across multiple safety benchmarks. HyperSafe reduces harmful response rates from 19-31% to below 1% on every held-out checkpoint, while keeping downstream task accuracy within 1% of the fine-tuned baseline on average. Code is available at https://github.com/nokronim/project-safety-remedy.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Placed in Safety alignment and jailbreak attacks, one of 10 directions in LLM alignment / RLHF / preference optimisation. Builds on 46 of its 49 references that are in the map. First posted on arXiv 13 Jul 2026.
Builds on
46 of 49 references.
Closest ancestors · 11
Same direction, newest first
- 2026Safety at One Shot: Patching Fine-Tuned LLMs with A Single Instance5 Jan
- 2024Safety Alignment Should Be Made More Than Just a Few Tokens Deep10 Jun
- 2024Lisa: Lazy Safety Alignment for Large Language Models against Harmful Fine-tuning Attack28 May
- 2024Language Models are Homer Simpson! Safety Re-Alignment of Fine-tuned Language Models through Task Arithmetic19 Feb
- 2024Assessing the Brittleness of Safety Alignment via Pruning and Low-Rank Modifications7 Feb
- 2024Vaccine: Perturbation-aware Alignment for Large Language Models against Harmful Fine-tuning Attack2 Feb
- 2023Removing RLHF Protections in GPT-4 via Fine-Tuning9 Nov
- 2023LoRA Fine-tuning Efficiently Undoes Safety Training in Llama 2-Chat 70B31 Oct
- 2023Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To!5 Oct
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Models27 Jul
- 2023BeaverTails: Towards Improved Safety Alignment of LLM via a Human-Preference Dataset10 Jul
Other references · 35
- 2022Training language models to follow instructions with human feedbackcited by 15,712
- 2024The Llama 3 Herd of Modelscited by 14,192
- 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 7,916
- 2017Deep reinforcement learning from human preferencescited by 3,846
- 2022Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedbackcited by 3,634
- 2022Constitutional AI: Harmlessness from AI Feedbackcited by 2,950
- 2020Learning to summarize from human feedbackcited by 2,562
- 2024Qwen2 Technical Reportcited by 2,076
- 2023Representation Engineering: A Top-Down Approach to AI Transparencycited by 1,239
- 2023Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversationscited by 1,124
- 2022Editing Models with Task Arithmeticcited by 1,076
- 2016HyperNetworkscited by 1,003
23 more
- 2024Refusal in Language Models Is Mediated by a Single Directioncited by 960
- 2023TIES-Merging: Resolving Interference When Merging Modelscited by 795
- 2023The Internal State of an LLM Knows When It's Lyingcited by 644
- 2024WildGuard: Open One-Stop Moderation Tools for Safety Risks, Jailbreaks, and Refusals of LLMscited by 460
- 2023Safety-Tuned LLaMAs: Lessons From Improving the Safety of Large Language Models that Follow Instructionscited by 377
- 2022A Holistic Approach to Undesired Content Detection in the Real Worldcited by 337
- 2021Parameter-efficient Multi-task Fine-tuning for Transformers via Shared Hypernetworkscited by 278
- 2019Continual learning with hypernetworkscited by 267
- 2022LST: Ladder Side-Tuning for Parameter and Memory Efficient Transfer Learningcited by 228
- 2024ShieldGemma: Generative AI Content Moderation Based on Gemmacited by 224
- 2022A New Generation of Perspective API: Efficient Multilingual Character-level Transformerscited by 181
- 2024AEGIS: Online Adaptive AI Content Safety Moderation with Ensemble of LLM Expertscited by 126
- 2024Safe LoRA: the Silver Lining of Reducing Safety Risks when Fine-tuning Large Language Modelscited by 122
- 2023Equivariant Architectures for Learning in Deep Weight Spacescited by 106
- 2023A Brief Review of Hypernetworks in Deep Learningcited by 102
- 2024Representation Noising: A Defence Mechanism Against Harmful Finetuningcited by 93
- 2024Booster: Tackling Harmful Fine-tuning for Large Language Models via Attenuating Harmful Perturbationcited by 92
- 2021Parameter Prediction for Unseen Deep Architecturescited by 89
- 2022HyperTuning: Toward Adapting Large Language Models without Back-propagationcited by 45
- 2024Mitigating Fine-tuning based Jailbreak Attack with Backdoor Enhanced Safety Alignmentcited by 31
- 2025Fine-Tuning Lowers Safety and Disrupts Evaluation Consistencycited by 25
- 2024Granite Guardiancited by 20
- 2025Drag-and-Drop LLMs: Zero-Shot Prompt-to-Weightscited by 18
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2025SafeMERGE: Preserving Safety Alignment in Fine-Tuned Large Language Models via Selective Layer-Wise Model Merging
- 2024Locking Down the Finetuned LLMs Safety
- 2026Preventing Safety Drift in Large Language Models via Coupled Weight and Activation Constraints
- 2026Beyond Safe Data: Pretraining-Stage Alignment with Regular Safety Reflection
- 2026Understanding and Preserving Safety in Fine-Tuned LLMs
- 2026Few Tokens, Big Leverage: Preserving Safety Alignment by Constraining Safety Tokens during Fine-tuning
- 2024Separate the Wheat from the Chaff: A Post-Hoc Approach to Safety Re-Alignment for Fine-Tuned Language Models
- 2026HiRoute: Hierarchical Routed Prompt Tuning for Safety Alignment of Large Language Models