Introduction: The Problem of Shallow Safety
Despite extensive safety training via Reinforcement Learning from Human Feedback (RLHF) or Direct Preference Optimization (DPO), modern Large Language Models (LLMs) remain susceptible to "jailbreak" attacks. These adversarial prompts bypass safety filters by exploiting the model's underlying knowledge. Research suggests that current safety methods often achieve only "shallow safety alignment"—the model learns to refuse harmful requests at the surface level, but the internal neural pathways associated with harmful concepts remain intact and accessible.
Methodology: REPBEND
To address this, we introduce REPBEND, a novel fine-tuning approach that fundamentally reshapes the model's internal activation space. Unlike inference-time activation steering, REPBEND integrates safety directly into the model's weights during a Low-Rank Adaptation (LoRA) phase.
The core of REPBEND is a multi-component loss function designed to "bend" representations:
- Retain Loss: Maintains the original representations for safe prompts to preserve helpfulness.
- Forget Loss: Actively displaces activations for unsafe prompts from their original states.
- Cosine Similarity Term: Compresses diverse unsafe representations into a singular "refusal" direction, ensuring behavioral consistency.
- KL Divergence: Constrains the overall probability distribution to prevent degradation of general capabilities like reasoning and coding.
The method is most effective when applied to mid-to-late layers (e.g., layer 20+ in Llama 3 8B), where high-level behavioral intent is typically formed.
Experimental Setup
REPBEND was evaluated using a comprehensive suite of datasets and benchmarks:
- Training Data: 10,000-sample subsets from WildGuardMix, WildJailbreak, and UltraChat.
- Safety Benchmarks: HarmBench, DAN, TrustLLM-Jailbreak, and white-box GCG attacks.
- Capability Benchmarks: MMLU, MT-Bench, GSM8K (math), and HumanEval (coding).
- Over-refusal Testing: XSTest to monitor for excessive sensitivity to harmless prompts.
Results: Empirical Performance
REPBEND demonstrates significant improvements in safety over existing state-of-the-art methods. On Llama 3 8B, REPBEND achieved a total average Attack Success Rate (ASR) of 3.13%, substantially lower than NPO (10.62%) and Circuit Breaker (8.56%).
Across diverse jailbreak benchmarks, REPBEND achieved up to a 95% reduction in ASR compared to base instruction-tuned models. Crucially, this safety gain comes with minimal "capability tax"; performance on MMLU remained within 1% of the original model.
Analysis: Internal Short-Circuiting
A key insight from this work is the "internal short-circuiting" effect. Using Logit Lens analysis, we observed that REPBEND-tuned models effectively disrupt the generation of harmful content. Even if an attacker forces a harmful start (e.g., "To make a bomb..."), the internal representations become so distorted that the model's confidence collapses, resulting in low-entropy gibberish rather than coherent harmful instructions. This suggests that the "bending" makes the harmful regions of the activation space fundamentally unstable for the model.
Conclusion and Future Work
REPBEND offers a robust geometric defense against jailbreaks by making safe and unsafe internal states clearly distinguishable. While highly effective, future research is needed to address the potential for "re-learning" harmful behaviors during subsequent fine-tuning and to refine the sensitivity of the loss function hyperparameters. Scaling these findings to models exceeding 70B parameters remains a priority for ensuring long-term LLM safety.
Summary updated