Abstract
Large Language Models (LLMs) often experience "safety drift"—the loss of safety guardrails—after being fine-tuned for specific downstream tasks. We introduce Low-Rank Safety Subspace Fusion (LSSF), a training-free, post-hoc framework designed to restore safety alignment without compromising task performance. LSSF isolates safety-critical information into a low-rank subspace and utilizes a novel Safety Singular Value Entropy metric to dynamically fuse these components back into the model. Our evaluation across multiple benchmarks shows that LSSF can achieve a 100% refusal rate on harmful queries while maintaining the utility of the fine-tuned model, outperforming existing safety-aware fine-tuning techniques.
Introduction
Safety alignment, typically achieved through Reinforcement Learning from Human Feedback (RLHF), is a cornerstone of modern LLM deployment. However, this alignment is remarkably fragile. Recent studies demonstrate that fine-tuning a safety-aligned model on benign, task-specific data (e.g., medical Q&A) can cause the model to "forget" its safety training.
Existing solutions often rely on "safety-aware" fine-tuning, which incorporates safety data into the training process. This approach is computationally expensive and frequently leads to "capability suppression," where the model's general intelligence or task-specific accuracy is diminished. LSSF addresses these challenges by providing a post-hoc method to fix safety after fine-tuning is complete.
The LSSF Framework
LSSF is built on the observation that safety information in LLMs is low-rank and geometrically isolated from general task-related capabilities. The framework follows a four-step process:
- Safety Vector Extraction: A "safety vector" is identified by calculating the weight difference between a safety-aligned model and a version that has been intentionally "unaligned" through harmful fine-tuning.
- Low-Rank Subspace Identification: Singular Value Decomposition (SVD) is applied to model activations to isolate the specific low-rank subspace where safety information resides.
- Dynamic Rank Selection: Because different model layers encode information at varying densities, LSSF uses Safety Singular Value Entropy to quantify information density. This allows the system to dynamically select the optimal number of principal components to retain for each layer, ensuring high precision.
- Linear Fusion: The extracted safety components are added back to the fine-tuned model using linear arithmetic. Because these components are isolated from task-specific directions, they restore safety without overwriting the model's newly acquired skills.
Experimental Results
Safety Restoration
LSSF was evaluated on models like Qwen2.5 and Llama3.1 using benchmarks such as AdvBench, HarmfulQA, and CATQA. In LoRA fine-tuning scenarios, LSSF achieved a 100% refusal rate on AdvBench, effectively fully restoring the model's safety guardrails. Even in more destructive full fine-tuning scenarios (e.g., Medical QA), LSSF restored safety to 99%.
Utility Preservation
Unlike baseline methods like RESTA, which often cause significant drops in task accuracy (e.g., from 0.86 to 0.69 on AG’s News), LSSF maintained the fine-tuned model's performance. On the AG’s News classification task, LSSF-restored models maintained an accuracy of ~0.85, demonstrating that safety can be re-injected without "brain damage" to the model's core capabilities.
Key Insights
- Safety is Localized: The success of LSSF confirms that safety alignment does not permeate every weight in a model but lives in a specific, low-rank subspace.
- Entropy Matters: Using entropy to measure information density allows for a more nuanced pruning of safety vectors than "one-size-fits-all" rank selection, leading to better performance across diverse model layers.
- Efficiency: Being a training-free, post-hoc method, LSSF is significantly more efficient than methods requiring safety data during every fine-tuning run.
Conclusion and Future Work
LSSF provides a robust and efficient solution to the problem of safety drift in fine-tuned LLMs. By leveraging the low-rank nature of safety information, it restores alignment without sacrificing utility. Future research will focus on scaling LSSF to "frontier" models (e.g., Llama-3-405B) and extending the framework to Multimodal and Mixture of Experts (MoE) architectures.
Summary updated