mlsanityData to 7 Oct 2026

HyperSafe: Inference-Time Safety Recovery for Fine-Tuned Language Models

arXiv 2607.11475 ↗First posted 13 Jul 2026cs.LG cs.CLcited by 0

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

  1. 2026Safety at One Shot: Patching Fine-Tuned LLMs with A Single Instance5 Jan
  2. 2024Safety Alignment Should Be Made More Than Just a Few Tokens Deep10 Jun
  3. 2024Lisa: Lazy Safety Alignment for Large Language Models against Harmful Fine-tuning Attack28 May
  4. 2024Language Models are Homer Simpson! Safety Re-Alignment of Fine-tuned Language Models through Task Arithmetic19 Feb
  5. 2024Assessing the Brittleness of Safety Alignment via Pruning and Low-Rank Modifications7 Feb
  6. 2024Vaccine: Perturbation-aware Alignment for Large Language Models against Harmful Fine-tuning Attack2 Feb
  7. 2023Removing RLHF Protections in GPT-4 via Fine-Tuning9 Nov
  8. 2023LoRA Fine-tuning Efficiently Undoes Safety Training in Llama 2-Chat 70B31 Oct
  9. 2023Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To!5 Oct
  10. 2023Universal and Transferable Adversarial Attacks on Aligned Language Models27 Jul
  11. 2023BeaverTails: Towards Improved Safety Alignment of LLM via a Human-Preference Dataset10 Jul

Other references · 35

  1. 2022Training language models to follow instructions with human feedbackcited by 15,712
  2. 2024The Llama 3 Herd of Modelscited by 14,192
  3. 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 7,916
  4. 2017Deep reinforcement learning from human preferencescited by 3,846
  5. 2022Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedbackcited by 3,634
  6. 2022Constitutional AI: Harmlessness from AI Feedbackcited by 2,950
  7. 2020Learning to summarize from human feedbackcited by 2,562
  8. 2024Qwen2 Technical Reportcited by 2,076
  9. 2023Representation Engineering: A Top-Down Approach to AI Transparencycited by 1,239
  10. 2023Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversationscited by 1,124
  11. 2022Editing Models with Task Arithmeticcited by 1,076
  12. 2016HyperNetworkscited by 1,003
23 more
  1. 2024Refusal in Language Models Is Mediated by a Single Directioncited by 960
  2. 2023TIES-Merging: Resolving Interference When Merging Modelscited by 795
  3. 2023The Internal State of an LLM Knows When It's Lyingcited by 644
  4. 2024WildGuard: Open One-Stop Moderation Tools for Safety Risks, Jailbreaks, and Refusals of LLMscited by 460
  5. 2023Safety-Tuned LLaMAs: Lessons From Improving the Safety of Large Language Models that Follow Instructionscited by 377
  6. 2022A Holistic Approach to Undesired Content Detection in the Real Worldcited by 337
  7. 2021Parameter-efficient Multi-task Fine-tuning for Transformers via Shared Hypernetworkscited by 278
  8. 2019Continual learning with hypernetworkscited by 267
  9. 2022LST: Ladder Side-Tuning for Parameter and Memory Efficient Transfer Learningcited by 228
  10. 2024ShieldGemma: Generative AI Content Moderation Based on Gemmacited by 224
  11. 2022A New Generation of Perspective API: Efficient Multilingual Character-level Transformerscited by 181
  12. 2024AEGIS: Online Adaptive AI Content Safety Moderation with Ensemble of LLM Expertscited by 126
  13. 2024Safe LoRA: the Silver Lining of Reducing Safety Risks when Fine-tuning Large Language Modelscited by 122
  14. 2023Equivariant Architectures for Learning in Deep Weight Spacescited by 106
  15. 2023A Brief Review of Hypernetworks in Deep Learningcited by 102
  16. 2024Representation Noising: A Defence Mechanism Against Harmful Finetuningcited by 93
  17. 2024Booster: Tackling Harmful Fine-tuning for Large Language Models via Attenuating Harmful Perturbationcited by 92
  18. 2021Parameter Prediction for Unseen Deep Architecturescited by 89
  19. 2022HyperTuning: Toward Adapting Large Language Models without Back-propagationcited by 45
  20. 2024Mitigating Fine-tuning based Jailbreak Attack with Backdoor Enhanced Safety Alignmentcited by 31
  21. 2025Fine-Tuning Lowers Safety and Disrupts Evaluation Consistencycited by 25
  22. 2024Granite Guardiancited by 20
  23. 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

  1. 2025SafeMERGE: Preserving Safety Alignment in Fine-Tuned Large Language Models via Selective Layer-Wise Model Merging
  2. 2024Locking Down the Finetuned LLMs Safety
  3. 2026Preventing Safety Drift in Large Language Models via Coupled Weight and Activation Constraints
  4. 2026Beyond Safe Data: Pretraining-Stage Alignment with Regular Safety Reflection
  5. 2026Understanding and Preserving Safety in Fine-Tuned LLMs
  6. 2026Few Tokens, Big Leverage: Preserving Safety Alignment by Constraining Safety Tokens during Fine-tuning
  7. 2024Separate the Wheat from the Chaff: A Post-Hoc Approach to Safety Re-Alignment for Fine-Tuned Language Models
  8. 2026HiRoute: Hierarchical Routed Prompt Tuning for Safety Alignment of Large Language Models