跳到主要导航 跳到搜索 跳到主要内容

HSF: Defending against Jailbreak Attacks with Hidden State Filtering

  • Beihang University

科研成果: 书/报告/会议事项章节 › 会议稿件 › 同行评审

摘要

With the growing deployment of LLMs in daily applications like chatbots and content generation, efforts to ensure outputs align with human values and avoid harmful content have intensified. However, increasingly sophisticated jailbreak attacks threaten this alignment, aiming to induce unsafe outputs. Current defense efforts either focus on prompt rewriting or detection, which are limited in effectiveness due to the various design of jailbreak prompts, or on output control and detection, which are computationally expensive as they require LLM inference. Therefore, designing a pre-inference defense method that resists diverse jailbreak prompts is crucial for preventing LLM jailbreak attacks. We observe that jailbreak attacks, safe queries, and harmful queries exhibit different clustering patterns within the LLM's hidden state representation space. This suggests that by leveraging the LLM's hidden state representational capabilities, we can analyze the LLM's forthcoming behavior and proactively intervene for defense. In this paper, we propose a jailbreak attack defense strategy based on a Hidden State Filter (HSF), a lossless architectural defense mechanism that enables the model to preemptively identify and reject adversarial inputs before the inference process begins. We activate its defensive potential through an additional plugin module, effectively framing the defense task as a classification problem. Experimental results on two benchmark datasets, utilizing three different LLMs, show that HSF significantly enhances resilience against six cutting-edge jailbreak attacks. It significantly reduces the success rate of jailbreak attacks while minimally impacting responses to benign user queries, with negligible inference overhead, and outperforming defense baselines.

源语言英语
主期刊名WWW Companion 2025 - Companion Proceedings of the ACM Web Conference 2025
出版商Association for Computing Machinery, Inc
页2078-2087
页数10
ISBN(电子版)9798400713316
DOI
出版状态已出版 - 23 5月 2025
活动34th ACM Web Conference, WWW Companion 2025 - Sydney, 澳大利亚
期限: 28 4月 2025 → 2 5月 2025

丛书

姓名WWW Companion 2025 - Companion Proceedings of the ACM Web Conference 2025

会议

会议34th ACM Web Conference, WWW Companion 2025
国家/地区澳大利亚
市Sydney
时期28/04/25 → 2/05/25

学术指纹

探究 'HSF: Defending against Jailbreak Attacks with Hidden State Filtering' 的科研主题。它们共同构成独一无二的学术指纹。

引用此