Jailbreak Instruction-Tuned LLMs via end-of-sentence MLP Re-weighting

Yifan Luo, Zhennan Zhou, Meitan Wang, Bin DongarXiv 2024 · DOI

Abstract

Instruction-tuned Large Language Models (LLMs) employ safety alignment to prevent the generation of harmful content. However, the internal mechanisms governing refusal are not fully understood. This paper demonstrates that the refusal mechanism is primarily triggered during the processing of final formatting tokens, such as <|eot_id|>. By introducing a white-box "MLP Re-weighting" technique that selectively modifies neuron activations during these specific end-of-sentence inferences, the authors achieve near-perfect jailbreak success rates across multiple model families (LLaMA, Qwen, Gemma) without compromising general performance.

Introduction

Safety alignment, typically implemented via Reinforcement Learning from Human Feedback (RLHF), is the primary defense against harmful LLM outputs. Despite its effectiveness, the architectural "switch" that triggers a refusal remains elusive. Existing jailbreak methods, such as adversarial suffixes or harmful fine-tuning, are often computationally intensive or degrade the model's general intelligence. This research investigates whether targeting specific internal activations can provide a more efficient and surgical jailbreak.

Methodology

The authors propose MLP Re-weighting, a white-box approach that modifies the internal activations of Multi-Layer Perceptron (MLP) layers. A re-weighting factor $M \in [0, 1]$ is applied to each neuron; $M=1$ maintains normal behavior, while $M=0$ effectively prunes the neuron for a specific inference step.

The critical innovation lies in the temporal targeting of these modifications. Rather than altering the model throughout the entire prompt, re-weighting is only applied during the processing of final special tokens (e.g., <|eot_id|>, assistant, <|start_header_id|>). The authors explore two attack variants:

  1. Prompt-Specific: Optimizing $M$ factors for a single harmful prompt using gradient descent.
  2. Prompt-General: Training a universal set of $M$ factors over a dataset of harmful prompts to jailbreak unseen queries.

Experimental Setup

The prompt-general method was trained on a synthesized collection of harmful behaviors derived from HarmfulQA and GPT-4o. Evaluation was conducted using the HarmBench test set (159 behaviors) to measure Attack Success Rate (ASR). General performance was monitored via standard benchmarks including ARC-Challenge, GSM8K, MMLU, and TruthfulQA to ensure the model's reasoning capabilities remained intact.

Results and Discussion

The results demonstrate remarkable efficacy. On LLaMA-3 8B, the prompt-specific method achieved a 96.9% ASR, while the prompt-general method reached 94.3% ASR. Even on the larger LLaMA-3 70B, the universal jailbreak maintained an 87.4% ASR. Notably, this method is approximately 5x faster than state-of-the-art prompt-optimization attacks.

Qualitative comparison of jailbroken outputs providing instructions for hacking an ATM, demonstrating the bypass of safety filters.

The "Harmful Assessment Hypothesis" suggests that LLMs perform safety checks during final formatting tokens rather than during the semantic processing of the query. Heatmap analysis confirms that the most significant modifications occur during these final tokens.

This heatmap shows that the most significant modifications (bright yellow/green) occur during the final tokens like 'assistant' and '<|end_header_id|>', rather than the semantic tokens of the query.

Furthermore, the refusal mechanism appears sparse; less than 3% of neurons require significant modification ($M < 0.9$) to bypass safety. This surgical precision allows the model to retain its full reasoning capabilities, with negligible drops in benchmark scores for most models.

Conclusion

This work identifies the "where" and "when" of LLM refusal mechanisms, highlighting the vulnerability of end-of-sentence formatting tokens. While the exact mathematical nature of the "harmful" signal remains an open question, the identification of sparse "safety neurons" provides a powerful tool for mechanistic interpretability and the development of more robust future defenses.

Summary updated

BibTeX
@misc{luo2024jailbreak,
  author = {Yifan Luo and Zhennan Zhou and Meitan Wang and Bin Dong},
  title = {{Jailbreak Instruction-Tuned LLMs via end-of-sentence MLP Re-weighting}},
  year = {2024},
  eprint = {2410.10150},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.10150},
}
Figure