LLM Jailbreak Detection for (Almost) Free!
This addresses a security issue for users of aligned LLMs by providing a low-cost detection solution, though it is incremental as it builds on existing detection concepts.
The paper tackles the problem of detecting jailbreak attacks on large language models (LLMs) by proposing a method that uses output distribution differences and logit scaling to distinguish jailbreak from benign prompts, achieving effective detection with almost no extra computational cost during inference.
Large language models (LLMs) enhance security through alignment when widely used, but remain susceptible to jailbreak attacks capable of producing inappropriate content. Jailbreak detection methods show promise in mitigating jailbreak attacks through the assistance of other models or multiple model inferences. However, existing methods entail significant computational costs. In this paper, we first present a finding that the difference in output distributions between jailbreak and benign prompts can be employed for detecting jailbreak prompts. Based on this finding, we propose a Free Jailbreak Detection (FJD) which prepends an affirmative instruction to the input and scales the logits by temperature to further distinguish between jailbreak and benign prompts through the confidence of the first token. Furthermore, we enhance the detection performance of FJD through the integration of virtual instruction learning. Extensive experiments on aligned LLMs show that our FJD can effectively detect jailbreak prompts with almost no additional computational costs during LLM inference.