# Jailbreak steering generalization

*This work was performed as part of* [*SPAR*](https://supervisedprogramforalignment.org)

We use activation steering ([Turner et al., 2023](https://arxiv.org/abs/2308.10248);  [Panickssery et al., 2023](https://arxiv.org/abs/2312.06681)) to investigate whether different types of jailbreaks operate via similar internal mechanisms. We find preliminary evidence that they may.

Our analysis includes a wide range of jailbreaks such as harmful prompts developed in [Wei et al. 2024](https://arxiv.org/abs/2307.02483), universal and promp-specific jailbreaks based on the GCG algorithm in [Zou et al. (2023b)](https://arxiv.org/abs/2307.15043), and the payload split jailbreak in [Kang et al. (2023)](https://arxiv.org/abs/2302.05733). We replicate our results on a variety of chat models: Vicuna 13B v1.5, Vicuna 7B v1.5, Qwen1.5 14B Chat, and MPT 7B Chat.

In a first step, we produce jailbreak vectors for each jailbreak type by contrasting the internal activations of jailbreak and non-jailbreak versions of the same request ([Panickssery et al., 2023](https://arxiv.org/abs/2312.06681); [Zou et al., 2023a](https://arxiv.org/abs/2310.01405)).

![](https://lh7-us.googleusercontent.com/docsz/AD_4nXcz6XdzatcPu6SmI0CUj4PCI_ZfAcpobQYsqAzppK3huS-4S5T3j5ALe4yJlXAjEshfND9febjf5y3Q-m0mAA4f2YlKK_ehp7O_-pJH9hejvTmFbcOsVfsxKUApPaq4ibVp-G-NjRZ9ImrfKHE1FbMMCVF5?key=R5NmCk3PSIl7sN9ZUyJCJQ)

Examples of prompt pairs used for jailbreak vector generation

Interestingly, we find that steering with mean-difference jailbreak vectors from one cluster of jailbreaks helps to prevent jailbreaks from different clusters. This holds true for a wide range of jailbreak types.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/1295c97ca1759ca72a0aa83e882509079bf8b7e255b19356.png)

ASR given steering when we transfer jailbreak vectors extracted from one type of jailbreak to other types of jailbreaks. We see significantly better than random generalization for a wide range of jailbreak types.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/e36ac419d03339a924d9c61c53bc31c41cc1d59669ce8eac.png)

Average ASR when steering with different jailbreak vectors for all models. Low ASRs indicate successful cross-jailbreak-type transfer.

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/2deb7ef22844360a28c2ec1d84757c2fccd8306424424b60.png)

Example of jailbreak vector transfer

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/574fab0972ba5037310c3e03c7acddcbb5886eea957ce076.png)

Another example of jailbreak vector transfer

The jailbreak vectors themselves also cluster according to semantic categories such as persona modulation, fictional settings and style manipulation.     

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/491c55735c528d5b851e5c2b760705c1d1cb75d59965c4fc.png)

PCA results for layer 20 jailbreak activation differences

In a second step, we look at the evolution of a harmfulness-related direction over the context (found via contrasting harmful and harmless prompts) and find that when jailbreaks are included, this feature is suppressed at the end of the instruction in harmful prompts. This provides some evidence for the fact that jailbreaks suppress the model’s perception of request harmfulness.

![](https://lh7-us.googleusercontent.com/docsz/AD_4nXc0bpJwpzhsoh86eOWyQKzfSm7Jy3Mz8Co5_J9cb1eab9apV1jJpFHkl1IKjaEwTed7aS8xQJzaxJ34xdO8IpH2DeX22RIvUnlFZaLTLN9vPEYF379K4qQ1GhPHF2nSItt2FX0FgivgtV_XypBPEpWth2bs?key=R5NmCk3PSIl7sN9ZUyJCJQ)

Visualization of per-token cosine similarity with harmfulness vector with and without jailbreak.

While we observe a substantial suppression of the harmfulness feature for most of the models, there is no clear mapping between the effectiveness of the jailbreak and the magnitude of harmfulness reduction. For instance, the jailbreak "distractors" seems to be very effective in reducing the harmfulness direction, however, it doesn't have the highest ASR score. 

![](https://39669.cdn.cke-cs.com/rQvD3VnunXZu34m86e5f/images/60d3febc736e328307a603d4324a9c9bc52c0a9a00768765.png)

The lack of a clear mapping between ASR scores and harmfulness reduction could indicate that harmfulness suppression might not be the only mechanism at play as suggested by [Wei et al. (2024)](https://arxiv.org/abs/2307.02483) and [Zou et al. (2023a)](https://arxiv.org/abs/2307.15043).

References
==========

Turner, A., Thiergart, L., Udell, D., Leech, G., Mini, U., and MacDiarmid, M. Activation addition: Steering language models without optimization. *arXiv preprint arXiv:2308.10248*, 2023.

​​Kang, D., Li, X., Stoica, I., Guestrin, C., Zaharia, M., and Hashimoto, T. Exploiting programmatic behavior of LLMs: Dual-use through standard security attacks. *arXiv preprint arXiv:2302.05733*, 2023.

Panickssery, N., Gabrieli, N., Schulz, J., Tong, M., Hubinger, E., and Turner, A. M. Steering Llama 2 via contrastive activation addition. *arXiv preprint arXiv:2312.06681*, 2023.

Wei, A., Haghtalab, N., and Steinhardt, J. Jailbroken: How does LLM safety training fail? *Advances in Neural Information Processing Systems*, 36, 2024.

Zou, A., Phan, L., Chen, S., Campbell, J., Guo, P., Ren, R., Pan, A., Yin, X., Mazeika, M., Dombrowski, A.-K., et al. Representation engineering: A top-down approach to AI transparency. *arXiv preprint arXiv:2310.01405*, 2023a.

Zou, A., Wang, Z., Kolter, J. Z., and Fredrikson, M. Universal and transferable adversarial attacks on aligned language models. *arXiv preprint arXiv:2307.15043*, 2023b.