arXiv:2511.07480cs.CRcs.AI2025-11

用知识图谱识别恶意指令,提升大模型安全与问答质量

KG-DF: A Black-box Defense Framework against Jailbreak Attacks Based on Knowledge Graphs

  • 通过知识图谱匹配输入意图,构建安全推理路径
  • 新设计的语义解析模块提升关键词提取准确率
  • 兼顾防御效果与正常问答表现,适合安全敏感场景

随着大语言模型在各领域的广泛应用,其安全挑战日益突出,尤其是越狱攻击问题。此类攻击通过精心构造的输入诱导模型生成错误或失控输出,威胁模型的通用性与安全性。尽管现有防御方法已展现一定成效,但难以在模型通用性与安全性之间取得平衡:过度防御会限制正常使用,防御不足则留下安全隐患。为此,我们提出基于知识图谱的黑盒防御框架(KG-DF)。利用知识图谱的结构化知识表示与语义关联能力,可将输入内容与知识库中的安全知识进行关联检索,识别潜在有害意图并提供安全推理路径。然而,传统知识图谱方法在关键词提取上面临挑战,尤其面对多样且动态演化的攻击策略。为此,我们引入一个可扩展的语义解析模块,核心任务是将输入查询转化为一组结构化且安全的概念表示,从而提升匹配相关性。实验表明,该框架在多种越狱攻击下显著增强防御性能,同时通过引入领域通用知识,在常规问答场景中也提升了大语言模型的响应质量。

原文摘要 · Abstract (English)

With the widespread application of large language models (LLMs) in various fields, the security challenges they face have become increasingly prominent, especially the issue of jailbreak. These attacks induce the model to generate erroneous or uncontrolled outputs through crafted inputs, threatening the generality and security of the model. Although existing defense methods have shown some effectiveness, they often struggle to strike a balance between model generality and security. Excessive defense may limit the normal use of the model, while insufficient defense may lead to security vulnerabilities. In response to this problem, we propose a Knowledge Graph Defense Framework (KG-DF). Specifically, because of its structured knowledge representation and semantic association capabilities, Knowledge Graph(KG) can be searched by associating input content with safe knowledge in the knowledge base, thus identifying potentially harmful intentions and providing safe reasoning paths. However, traditional KG methods encounter significant challenges in keyword extraction, particularly when confronted with diverse and evolving attack strategies. To address this issue, we introduce an extensible semantic parsing module, whose core task is to transform the input query into a set of structured and secure concept representations, thereby enhancing the relevance of the matching process. Experimental results show that our framework enhances defense performance against various jailbreak attack methods, while also improving the response quality of the LLM in general QA scenarios by incorporating domain-general knowledge.

大模型安全知识图谱越狱攻击黑盒防御

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