从因果关系出发,找出让大模型越狱的关键提示特征。
A Causal Perspective for Enhancing Jailbreak Attack and Defense
- 用大模型和图神经网络联合建模提示特征与越狱的因果关系。
- 发现'正面角色'和'任务步骤数'是导致越狱的直接原因。
- 可提升攻击成功率,也能识别伪装恶意请求,适合安全研究者。
理解大语言模型(LLMs)中“越狱”现象的机制对提升其安全性至关重要,但现有研究多通过探测隐层表示分析越狱提示,忽视了可解释提示特征与越狱发生之间的因果关系。本文提出Causal Analyst框架,将大模型融入数据驱动的因果发现,以识别越狱的直接原因,并用于攻击增强与防御。构建了一个包含35,000次越狱尝试的综合性数据集,覆盖7个LLMs,基于100个攻击模板与50个有害查询,标注了37个精心设计的人类可读提示特征。通过联合训练基于大模型的提示编码与基于GNN的因果图学习,重建了提示特征到越狱响应的因果路径。分析发现,如'Positive Character'(正面角色)和'Number of Task Steps'(任务步骤数)等特征是越狱的直接因果驱动因素。我们展示了这些洞见的实用性:(1) 提出Jailbreaking Enhancer,针对识别出的因果特征显著提升公开基准上的攻击成功率;(2) 构建Guardrail Advisor,利用学习到的因果图从伪装查询中提取真实恶意意图。大量实验(包括基线对比与因果结构验证)证实本方法的鲁棒性及其优于非因果方法的性能。结果表明,从因果视角分析越狱特征是一种有效且可解释的提升LLM可靠性的途径。代码已开源于https://github.com/Master-PLC/Causal-Analyst。
原文摘要 · Abstract (English)
Uncovering the mechanisms behind "jailbreaks" in large language models (LLMs) is crucial for enhancing their safety and reliability, yet these mechanisms remain poorly understood. Existing studies predominantly analyze jailbreak prompts by probing latent representations, often overlooking the causal relationships between interpretable prompt features and jailbreak occurrences. In this work, we propose Causal Analyst, a framework that integrates LLMs into data-driven causal discovery to identify the direct causes of jailbreaks and leverage them for both attack and defense. We introduce a comprehensive dataset comprising 35k jailbreak attempts across seven LLMs, systematically constructed from 100 attack templates and 50 harmful queries, annotated with 37 meticulously designed human-readable prompt features. By jointly training LLM-based prompt encoding and GNN-based causal graph learning, we reconstruct causal pathways linking prompt features to jailbreak responses. Our analysis reveals that specific features, such as "Positive Character" and "Number of Task Steps", act as direct causal drivers of jailbreaks. We demonstrate the practical utility of these insights through two applications: (1) a Jailbreaking Enhancer that targets identified causal features to significantly boost attack success rates on public benchmarks, and (2) a Guardrail Advisor that utilizes the learned causal graph to extract true malicious intent from obfuscated queries. Extensive experiments, including baseline comparisons and causal structure validation, confirm the robustness of our causal analysis and its superiority over non-causal approaches. Our results suggest that analyzing jailbreak features from a causal perspective is an effective and interpretable approach for improving LLM reliability. Our code is available at https://github.com/Master-PLC/Causal-Analyst.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。