Abstract
Large Language Models (LLMs) often remain vulnerable to jailbreak attacks despite extensive safety alignment. This research identifies "safety knowledge neurons" within MLP layers that govern the model's decision to refuse or comply with prompts. By projecting these neurons' activations into vocabulary space, the authors reveal distinct rejection and compliance pathways. This mechanistic understanding enables both a potent inference-time attack (ActCali) and a surgical defense (SafeTuning) that secures models without compromising general performance.
Introduction
Safety alignment, typically achieved through Reinforcement Learning from Human Feedback (RLHF), aims to prevent LLMs from generating harmful content. However, "jailbreak" prompts—adversarial inputs designed to bypass these safeguards—persist as a significant challenge. Current defenses often operate as black-box filters. This paper seeks a fundamental understanding of safety by locating the specific neurons responsible for these decisions, transforming safety from an opaque property into a localized, manipulatable feature.
Methods
The researchers propose a three-stage framework centered on Safety Knowledge Neurons:
- Interpretability via Direct Vocabulary Projection: By comparing activations between harmful and benign prompts, the authors isolate safety-critical neurons in MLP layers. Crucially, they project the MLP output immediately after normalization into the vocabulary space. This avoids the "noise" of cumulative hidden states, revealing clear conceptual tokens like "impossible" or "ban."
- ActCali (The Attack): To demonstrate causal control, the authors introduce ActCali. By calibrating neuron activations toward "compliance," they can force an aligned model to fulfill harmful requests. Conversely, pushing activations toward "rejection" causes the model to refuse benign inputs.
- SafeTuning (The Defense): This surgical fine-tuning strategy uses ActCali to generate a synthetic corpus of refusal responses. The model is then fine-tuned on only the top 3% of safety neurons and their upstream pathways, keeping the rest of the network frozen.
Key Insights
- Safety is Localized: The ability to refuse harmful prompts relies heavily on a sparse set of specific neurons that activate as early as the 10th layer of the model.
- Behavioral Duality: Models exhibit a clear "fork in the road," activating rejection knowledge for harmful prompts and compliance knowledge for benign ones.
- Conceptual Clarity: Direct projection shows that models refuse prompts based on coherent concepts (e.g., "illegal," "cannot") rather than just emotional states.
Results
The ActCali attack proved highly effective, achieving a 97% to 100% Attack Success Rate (ASR) on Vicuna-1.5 and Llama-2-7b-chat by modifying only 0.3% of parameter activations at inference time.
On the defensive side, SafeTuning reduced ASR to 0%–5% against state-of-the-art attacks like GCG and PAIR. Importantly, SafeTuning preserved model utility, achieving a 60% win rate on AlpacaEval against a baseline judge, indicating that the surgical defense did not harm general conversational abilities.
Conclusion and Future Work
By identifying and manipulating safety knowledge neurons, this work provides a mechanistic lens through which to view LLM safety. The proposed SafeTuning method offers a path toward robust, efficient alignment that protects against adversarial attacks while maintaining the model's core capabilities. Future work will explore automated hyperparameter tuning and the role of attention heads in safety processing.
Summary updated