Exploring Jailbreak Vulnerability Across Depth-Based Dynamic Inference in Large Language Models
Organizations: School of Innovation, Design and Engineering, Mälardalen University, Västerås, Sweden
Abstract
Large Language Models (LLMs) have been shown to be computationally expensive and vulnerable to jailbreak attacks, in which adversarial prompts bypass safety alignment and induce harmful responses. To address this inefficiency, a range of techniques have been proposed to enable efficient LLM inference. Depth-based dynamic inference has demonstrated promising results by enabling outputs to be generated from intermediate layers. It offers the flexibility to adjust model behavior based on the available resource budget. However, how this flexibility affects the robustness of LLMs against jailbreak attacks remains unexplored. In this paper, we address this gap via a comprehensive investigation into the impact of depth-based dynamic inference on the robustness of LLMs against jailbreak attacks. Specifically, we make the following key observations: 1) Shallow exits are consistently more robust to jailbreak attacks than deeper ones; 2) Exit depth affects how easily the adversarial suffix can be optimized, with deeper exits reaching lower attack loss; and 3) Adversarial suffixes affect utility uniformly across exit depths. These insights can help design dynamic inference methodologies that are more robust to jailbreak attacks. Code is available at https://github.com/LassNajmuldeen/balcony-jailbreaking
Figures & tables
| Balcony-LLaMA2-7B | Balcony-LLaMA3-8B | |
| Base model | ||
| Transformer layers | 32 | 32 |
| Non-embedding parameters | 6.5B | 6.9B |
| Pretraining tokens | 2T | 15T |
| Balcony modules | ||
| Exit locations | {15, 18, 21} | {15, 18, 21} |
| HarmBench AdvBench | |
| exit-15 exit-18 exit-21 full 0 10 20 30 40 Top-1 Attack Success Rate (%) Balcony-LLaMA2-7B | exit-15 exit-18 exit-21 full 0 10 20 30 40 Top-1 Attack Success Rate (%) Balcony-LLaMA3-8B |
| Model | Exit | HellaSwag | ARC-C | ARC-E | WinoGrande | PIQA | MMLU |
|---|---|---|---|---|---|---|---|
| 7B | Exit 15 | 0.630 | 0.347 | 0.617 | 0.636 | 0.742 | 0.369 |
| Exit 18 | 0.684 | 0.388 | 0.662 | 0.650 | 0.760 | 0.395 | |
| Exit 21 | 0.715 | 0.414 | 0.683 | 0.670 | 0.766 | 0.400 | |
| Full (32) | 0.760 | 0.451 | 0.739 | 0.691 | 0.787 | 0.409 | |
| 8B | Exit 15 | 0.519 | 0.334 | 0.476 | 0.658 | 0.634 | 0.310 |
| Exit 18 | 0.581 | 0.386 | 0.573 | 0.684 | 0.669 | 0.614 |
| Model | Exit | HellaSwag | ARC-C | ARC-E | WinoGrande | PIQA | MMLU |
|---|---|---|---|---|---|---|---|
| 7B | Exit 15 | 0.612 | 0.324 | 0.482 | 0.632 | 0.718 | 0.330 |
| Exit 18 | 0.657 | 0.342 | 0.485 | 0.653 | 0.726 | 0.326 | |
| Exit 21 | 0.685 | 0.371 | 0.489 | 0.654 | 0.740 | 0.335 | |
| Full (32) | 0.740 | 0.407 | 0.572 | 0.696 | 0.773 | 0.384 | |
| 8B | Exit 15 | 0.515 | 0.323 | 0.485 | 0.644 | 0.638 | 0.306 |
| Exit 18 | 0.585 | 0.361 | 0.560 | 0.667 | 0.668 | 0.589 |
Adversarial Robustness of Language Models
Adversarial robustness of language models studies how to keep their outputs and decisions reliable under manipulative prompts, input changes, and malicious fine-tuning.
See all 192 papers