arXiv:2507.07146cs.LGcs.CL2025-07被引 2

用图神经网络分析多轮对话,识别潜伏的越狱攻击

Attention-Aware GNN-based Input Defense against Multi-Turn LLM Jailbreak

  • 构建多轮对话实体图,捕捉查询与危险词的关系
  • 引入注意力机制找回相关单轮对话,提升检测准确率
  • 对复杂多轮越狱攻击防御效果优于现有方法

大型语言模型在各类应用中广受欢迎,但其能力也易被恶意利用。尽管经过大量训练和微调以增强安全性,语言模型仍易受越狱攻击影响。近期多轮攻击的出现加剧了这一风险:不同于单轮攻击,多轮攻击逐步增加对话复杂性,使检测与防御更困难。本文提出G-Guard,一种基于图神经网络的输入分类器,专门防御针对语言模型的多轮越狱攻击。G-Guard为多轮查询构建实体图,刻画查询与其中包含的有害关键词之间的关联关系。同时,提出一种注意力感知的增强机制,根据当前多轮对话检索最相关的单轮查询,并将其作为带标签节点加入图中,从而提升GNN对当前查询是否为有害的判别能力。评估结果表明,G-Guard在多个数据集和评估指标上持续优于所有基线模型,展现出对多轮越狱攻击的强大防御能力。

原文摘要 · Abstract (English)

Large Language Models (LLMs) have gained significant traction in various applications, yet their capabilities present risks for both constructive and malicious exploitation. Despite extensive training and fine-tuning efforts aimed at enhancing safety, LLMs remain susceptible to jailbreak attacks. Recently, the emergence of multi-turn attacks has intensified this vulnerability. Unlike single-turn attacks, multi-turn attacks incrementally escalate dialogue complexity, rendering them more challenging to detect and mitigate. In this study, we introduce G-Guard, an innovative attention-aware Graph Neural Network (GNN)-based input classifier specifically designed to defend against multi-turn jailbreak attacks targeting LLMs. G-Guard constructs an entity graph for multi-turn queries, which captures the interrelationships between queries and harmful keywords that present in multi-turn queries. Furthermore, we propose an attention-aware augmentation mechanism that retrieves the most relevant single-turn query based on the ongoing multi-turn conversation. The retrieved query is incorporated as a labeled node within the graph, thereby enhancing the GNN's capacity to classify the current query as harmful or benign. Evaluation results show that G-Guard consistently outperforms all baselines across diverse datasets and evaluation metrics, demonstrating its efficacy as a robust defense mechanism against multi-turn jailbreak attacks.

越狱攻击图神经网络多轮对话安全防护

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。