Shallow layers in large language models resist jailbreak attacks better
Exploring Jailbreak Vulnerability Across Depth-Based Dynamic Inference in Large Language Models
Machine LearningArtificial IntelligenceComputation and LanguageCryptography and Security
Summary
Big language models can sometimes be tricked into giving harmful answers by sneaky questions, called jailbreak attacks. These models can also speed up answers by stopping early at shallower layers. The authors studied how stopping at these different layers affects how easy these trick attacks are. They found that if the model stops earlier, it is harder to fool, while going deeper inside makes it easier to create sneaky prompts. This study helps make these faster models safer from attacks.
What this means in practice
- •For llm inference engineers: Optimize early-exit points in large models to improve resistance against harmful prompt attacks while saving computation.
- •For security teams managing ai systems: Design safer AI deployment strategies by understanding which model layers are less vulnerable to jailbreak exploits.
Authors
Lass Najmuldeen, Seyedhamidreza Mousavi
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