用知识图谱生成隐式有害提示,提升大模型安全测试真实性
StealthGraph: Exposing Domain-Specific Risks in LLMs through Knowledge-Graph-Guided Harmful Prompt Generation
- 基于知识图谱生成领域相关有害提示,实现精准定位
- 通过双重混淆重写使显性攻击转为隐性威胁,提升隐蔽性
- 适用于金融医疗等领域的安全评测,助力防御能力提升
大语言模型在金融、医疗等专业领域应用日益广泛,带来独特的安全风险。当前有害提示数据集稀缺,多依赖人工构建,且主要聚焦显性攻击,易被现代防御机制识别。相比之下,通过领域知识间接表达的隐性有害提示更难检测,更贴近真实威胁。本文面临两大挑战:将领域知识转化为可执行约束,以及增强生成提示的隐匿性。为此,提出端到端框架:先利用知识图谱引导生成领域相关的有害提示,再通过直接重写与上下文增强重写两种策略,将显性有害提示转化为隐性变体。该方法生成的数据集兼具强领域相关性与高隐匿性,可支持更真实的红队测试,推动大模型安全研究。代码与数据集已开源。
原文摘要 · Abstract (English)
Large language models (LLMs) are increasingly applied in specialized domains such as finance and healthcare, where they introduce unique safety risks. Domain-specific datasets of harmful prompts remain scarce and still largely rely on manual construction; public datasets mainly focus on explicit harmful prompts, which modern LLM defenses can often detect and refuse. In contrast, implicit harmful prompts-expressed through indirect domain knowledge-are harder to detect and better reflect real-world threats. We identify two challenges: transforming domain knowledge into actionable constraints and increasing the implicitness of generated harmful prompts. To address them, we propose an end-to-end framework that first performs knowledge-graph-guided harmful prompt generation to systematically produce domain-relevant prompts, and then applies two-strategy obfuscation rewriting to convert explicit harmful prompts into implicit variants via direct and context-enhanced rewriting. This framework yields high-quality datasets combining strong domain relevance with implicitness, enabling more realistic red-teaming and advancing LLM safety research. We release our code and datasets on GitHub.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。