arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2407.05557cs.AI
收藏

$R^2$-Guard:通过知识增强逻辑推理实现的具备鲁棒推理能力的大语言模型护栏

$R^2$-Guard: Robust Reasoning Enabled LLM Guardrail via Knowledge-Enhanced Logical Reasoning

UIUC(伊利诺伊大学厄巴纳-香槟分校);Uchicago(芝加哥大学)

Mintong Kang, Bo Li

AI总结:

针对现有LLM护栏模型独立处理安全类别、易受攻击等局限,提出融合数据驱动类别学习与知识增强逻辑推理的$R^2$-Guard,构建新基准TwinSafety,在多基准和越狱攻击测试中性能显著优于SOTA方法。

摘要:

随着大语言模型(LLM)在各类应用中日益普及,建立安全护栏以管控LLM的输入/输出内容至关重要。现有护栏模型将各类安全类别独立对待,未能显式捕捉它们之间的相互关联。这导致了诸多局限性,例如因对相关安全类别的长尾数据训练不足而失效、易受越狱攻击,以及对新增安全类别缺乏灵活性。为解决这些局限,我们提出$R^2$-Guard——一种通过知识增强逻辑推理实现的具备鲁棒推理能力的LLM护栏。具体而言,$R^2$-Guard由两部分组成:数据驱动的特定类别学习模块和推理模块。数据驱动护栏模型输出待管控内容在不同安全类别上的不安全概率。随后,我们将不同类别间的安全知识编码为一阶逻辑规则,并将其嵌入基于概率图模型(PGM)的推理模块中。来自数据驱动护栏模型的不同类别不安全概率被送入推理模块进行最终推断。我们采用两种概率图模型:马尔可夫逻辑网络(MLNs)和概率电路(PCs),并通过改进图结构优化概率电路以实现精度与效率的平衡。为进一步对护栏模型进行压力测试,我们采用成对构建方法构建了一个全新的安全基准TwinSafety,该基准具备分类严谨的特点。我们通过在六个安全基准上与八个强基线护栏模型对比,验证了$R^2$-Guard的有效性,并通过抵御四种当前最优(SOTA)越狱攻击,证明了$R^2$-Guard的鲁棒性。$R^2$-Guard在ToxicChat数据集上显著超越当前最优方法LlamaGuard 30.2%,在抵御越狱攻击方面领先59.5%。

英文摘要:

As LLMs become increasingly prevalent across various applications, it is critical to establish safety guardrails to moderate input/output content of LLMs. Existing guardrail models treat various safety categories independently and fail to explicitly capture the intercorrelations among them. This has led to limitations such as ineffectiveness due to inadequate training on long-tail data from correlated safety categories, susceptibility to jailbreaking attacks, and inflexibility regarding new safety categories. To address these limitations, we propose $R^2$-Guard, a robust reasoning enabled LLM guardrail via knowledge-enhanced logical reasoning. Specifically, $R^2$-Guard comprises two parts: data-driven category-specific learning and reasoning components. The data-driven guardrail models provide unsafety probabilities of moderated content on different safety categories. We then encode safety knowledge among different categories as first-order logical rules and embed them into a probabilistic graphic model (PGM) based reasoning component. The unsafety probabilities of different categories from data-driven guardrail models are sent to the reasoning component for final inference. We employ two types of PGMs: Markov logic networks (MLNs) and probabilistic circuits (PCs), and optimize PCs to achieve precision-efficiency balance via improved graph structure. To further perform stress tests for guardrail models, we employ a pairwise construction method to construct a new safety benchmark TwinSafety, which features principled categories. We demonstrate the effectiveness of $R^2$-Guard by comparisons with eight strong guardrail models on six safety benchmarks, and demonstrate the robustness of $R^2$-Guard against four SOTA jailbreaking attacks. $R^2$-Guard significantly surpasses SOTA method LlamaGuard by 30.2% on ToxicChat and by 59.5% against jailbreaking attacks.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑