TL;DR
This paper introduces LoX, a training-free method that enhances the safety of Large Language Models (LLMs) against adversarial fine-tuning. LoX works by extrapolating the "safety subspace" of an aligned LLM, making it more robust to subsequent fine-tuning without sacrificing its ability to learn new tasks.
What Problem Does This Paper Address?
Large Language Models (LLMs) are increasingly used in real-world applications, but their safety is a major concern. While alignment techniques can make LLMs safer, this safety can be easily undermined by subsequent fine-tuning, even with seemingly benign data. This vulnerability arises because the critical safety features learned during alignment are concentrated in specific low-rank subspaces of the model's parameters, which are sensitive to fine-tuning. The authors aim to address this by developing a method to strengthen these safety subspaces against fine-tuning attacks.
Methods
The core of the proposed method, LoX (Low-Rank Extrapolation), is a training-free approach. It leverages the insight that safety is concentrated in low-rank subspaces of the parameter difference between an unaligned and an aligned model. LoX works by:
- Identifying the Safety Subspace: Using Singular Value Decomposition (SVD) on the difference between aligned and unaligned model weights ($\Delta W_{align}$), the authors identify the top-ranked components that capture safety information.
- Extrapolating the Safety Subspace: LoX then extrapolates these identified safety-critical low-rank components by adding a scaled version of them back to the aligned model's weights. This effectively amplifies the safety signal.
- Training-Free Application: Crucially, LoX is applied after the initial safety alignment and before any potential fine-tuning attack, requiring no further training.
Datasets
The authors used the following datasets:
- HH-RLHF: Used for safety alignment of LLaMA-2-7B models via Direct Preference Optimization (DPO).
- GSM8K: A dataset for mathematical reasoning, used for fine-tuning to evaluate the impact on safety and accuracy.
- Alpaca, Dolly: Datasets used for fine-tuning to evaluate robustness against benign fine-tuning attacks.
- Identity Shifting Attack, Pure Bad: Datasets used for evaluating robustness against malicious fine-tuning attacks.
Key Insights and Ideas
- Safety resides in low-rank subspaces: The paper empirically demonstrates that safety alignment in LLMs is highly sensitive to specific low-rank subspaces within the model's parameters.
- Fine-tuning erodes safety subspaces: Subsequent fine-tuning, even with benign data, can disrupt these critical safety subspaces, leading to degraded safety performance.
- Extrapolation as a defense: Amplifying these safety subspaces through extrapolation (LoX) effectively strengthens the model's resilience against fine-tuning attacks.
- LoX creates a "flatter" safety landscape: By moving the model's parameters to a flatter region in the parameter space, LoX makes the model less sensitive to perturbations introduced by fine-tuning.
Key Results
- LoX significantly reduces the Attack Success Rate (ASR) after fine-tuning. For instance, it achieved 11% to 54% absolute reductions in ASR against both benign (Dolly) and malicious (Pure Bad) fine-tuning attacks.
- On the Pure Bad dataset, LoX reduced ASR from 63% to 9%. On Dolly, it reduced ASR from 52% to 7%.
- LoX preserves the model's adaptability to new tasks, showing minimal impact on utility metrics like accuracy and helpfulness. For example, on GSM8K, LoX reduced ASR by 11% with only a 0.6% decrease in accuracy.
- The method is effective across different LLM architectures (LLaMA-2, Mistral) and varying amounts of alignment data.
- LoX is more effective when applied to models aligned with larger datasets, suggesting that the quality of the initial alignment influences the extrapolation's impact.
Limitations and Future Work
- Potential for misuse: The authors acknowledge that a malicious actor could potentially use LoX with a negative extrapolation factor ($\alpha$) to amplify safety degradation. However, they argue this is unlikely as it requires access to both aligned and unaligned checkpoints, implying the attacker already has the means to cause harm.
- Effective rank determination: While LoX works best with low-rank approximations, determining the optimal "effective rank" for extrapolation might require some experimentation.
- Future work: The authors believe their findings have significant implications for developing more robust models and warrant further exploration in future research. They suggest investigating the safety landscape more deeply and exploring applications beyond safety robustness.
Summary updated