用图注意力机制识别并过滤潜在越狱提示,提升大模型安全性。
GuardNet: Graph-Attention Filtering for Jailbreak Defense in Large Language Models
- 构建包含语法与注意力关系的结构化图,捕捉越狱特征
- 提示级检测F1达99.8%,令牌级检测提升28%重叠率
- 适合部署于医疗、金融等高安全要求场景
大型语言模型(LLMs)正面临越狱攻击的威胁,这类对抗性提示可绕过对齐约束,诱导有害行为。本文提出GuardNet,一种分层过滤框架,在推理前检测并过滤越狱提示。GuardNet通过整合序列连接、句法依存和注意力导出的词元关系,构建结构化图,以捕捉语言结构与越狱行为的上下文模式。采用两级图神经网络:(i) 提示级过滤器检测全局攻击,(ii) 词元级过滤器定位细粒度攻击片段。在三个数据集及多种攻击设置下实验表明,GuardNet显著优于现有防御方法。在LLM-Fuzzer上,提示级F1从66.4%提升至99.8%;在PLeak数据集上,从67-79%提升至94%以上。词元级F1从48-75%提升至74-91%,交并比(IoU)最高提升28%。尽管结构复杂,其延迟仍可接受,并在跨领域评估中表现良好,具备实际部署潜力。
原文摘要 · Abstract (English)
Large Language Models (LLMs) are increasingly susceptible to jailbreak attacks, which are adversarial prompts that bypass alignment constraints and induce unauthorized or harmful behaviors. These vulnerabilities undermine the safety, reliability, and trustworthiness of LLM outputs, posing critical risks in domains such as healthcare, finance, and legal compliance. In this paper, we propose GuardNet, a hierarchical filtering framework that detects and filters jailbreak prompts prior to inference. GuardNet constructs structured graphs that combine sequential links, syntactic dependencies, and attention-derived token relations to capture both linguistic structure and contextual patterns indicative of jailbreak behavior. It then applies graph neural networks at two levels: (i) a prompt-level filter that detects global adversarial prompts, and (ii) a token-level filter that pinpoints fine-grained adversarial spans. Extensive experiments across three datasets and multiple attack settings show that GuardNet substantially outperforms prior defenses. It raises prompt-level F$_1$ scores from 66.4\% to 99.8\% on LLM-Fuzzer, and from 67-79\% to over 94\% on PLeak datasets. At the token level, GuardNet improves F$_1$ from 48-75\% to 74-91\%, with IoU gains up to +28\%. Despite its structural complexity, GuardNet maintains acceptable latency and generalizes well in cross-domain evaluations, making it a practical and robust defense against jailbreak threats in real-world LLM deployments.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。