What Features in Prompts Jailbreak LLMs? Investigating the Mechanisms Behind Attacks

Nathalie Maria Kirch, Severin Field, Stephen Casper · DOI

Introduction

Despite rigorous safety fine-tuning, Large Language Models (LLMs) remain susceptible to "jailbreaking"—adversarial prompts designed to bypass safety filters and elicit harmful content. While the existence of these vulnerabilities is well-documented, the underlying mechanistic reasons why they succeed have remained elusive. Traditional research has often focused on linear "refusal vectors," assuming a single direction in latent space corresponds to a model's decision to refuse. However, this paper demonstrates that jailbreak features are far more complex and non-linear than previously thought.

Methodology: Probing and Steering

The researchers developed a "probing and steering" framework to investigate the internal activations of LLMs during jailbreak attempts.

Probing

They trained three types of classifiers—Linear, Multi-Layer Perceptron (MLP), and Transformer—on the internal hidden states of the final prompt token. These probes were designed to predict whether a prompt would successfully jailbreak the model before any response was generated.

Latent Interventions (Steering)

Beyond mere prediction, the authors used these probes to actively "steer" model behavior through latent-space perturbations. By applying gradient descent to the loss of an MLP probe, they could find precise perturbations in the latent space.

  • Offensive Steering: Shifting activations toward the "success" state identified by the probe to force a jailbreak.
  • Defensive Steering: Shifting activations toward the "failure" state to prevent a jailbreak.
Comparison of model responses with and without probe-guided defensive intervention.

Data and Evaluation

The study utilized a new model-agnostic dataset comprising 10,800 jailbreak attempts. This dataset was constructed by applying 35 distinct attack styles (e.g., roleplay, character encoding) to 300 harmful requests. Success was evaluated using the HarmBench autograder across five open-weight models, including Gemma-7b-it, Llama-3.1-8B, and Qwen-2.5-7B.

Key Results

The investigation yielded several critical insights into the nature of LLM safety:

  1. Non-Linearity is Key: Multilayer probes significantly outperformed linear ones in both detection and control, suggesting that jailbreak features are non-linearly distributed across the latent space.
  2. High Predictive Accuracy: Probes achieved over 80% accuracy in predicting jailbreak success across most models using only prompt-time activations. As shown in the layer-wise analysis, the model's internal representation of a jailbreak becomes clearer in the middle to late layers.
Probing accuracy across different models and layers.
  1. The Universality Gap: Probes trained on one attack type (e.g., roleplay) often failed to generalize to others (e.g., Base64 encoding). This suggests that different jailbreak styles exploit distinct, non-overlapping internal mechanisms rather than a single "safety switch."
  2. Effective Defense: Defensive interventions proved highly effective; the model can be steered from providing harmful advice to a safe refusal without degrading its overall performance on standard benchmarks.

Conclusion

This research highlights that defending against jailbreaks requires more than just finding a single "refusal direction." By leveraging non-linear probes, the authors demonstrated a powerful method for both understanding and mitigating adversarial attacks at inference time. While these probes offer a robust defense that rivals supervised safety fine-tuning, the lack of generalization between attack types remains a significant hurdle for creating a truly universal jailbreak detector. Future work must focus on interpreting these non-linear features to build more resilient and transparent AI systems.

Summary updated

BibTeX
@inproceedings{kirch2024what,
  author = {Nathalie Maria Kirch and Severin Field and Stephen Casper},
  title = {{What Features in Prompts Jailbreak LLMs? Investigating the Mechanisms Behind Attacks}},
  booktitle = {Red Teaming GenAI @ NeurIPS},
  year = {2024},
  url = {https://openreview.net/forum?id=6CaDi1RRS1},
}
Figure