为语言模型安全分类器提供形式化验证,揭示高精度测试下的隐藏风险。
Beyond Red-Teaming: Formal Guarantees of LLM Guardrail Classifiers

- 在分类器预激活空间定义有害区域,用凸形包围已知有害输入表示
- 证明所有点的安全性只需验证最坏情况点,实现O(d)时间闭式证明
- 发现BERT模型安全覆盖在最优阈值下骤降至55%,暴露其脆弱性
防护分类器用于保护生产级语言模型免受有害行为影响,但现有方法缺乏形式化保证。由于离散输入空间中‘有害行为’无自然定义,传统ε球性质无法传递语义。本文将验证从离散输入空间转移到分类器的预激活空间,定义有害区域为包含已知有害提示表示的凸形区域。因sigmoid分类头单调,仅需验证最坏情况点即可覆盖整个区域,实现O(d)时间内无近似、严密正确的形式化证明。提出两种区域构造:基于SVD对齐的超矩形可得精确SAT/UNSAT证书;高斯混合模型则对语义一致簇给出概率证书。应用于三个作者训练的毒性防护分类器,所有超矩形配置均返回SAT,暴露出各类别中的可验证安全漏洞,尽管实测性能优异。概率性GMM证书亦揭示模型结构稳定性差异:GPT-2与Llama-3.1-8B在边界变化下仍保持90%与80%覆盖,而BERT在最优阈值下覆盖率暴跌至55%,显示其安全边际稀疏,仅通过极端保守阈值才能达完全覆盖。该框架为防护分类器的真实有效性提供了超越传统红队测试的新洞见。
原文摘要 · Abstract (English)
Guardrail Classifiers defend production language models against harmful behavior, but although results seem promising in testing, they provide no formal guarantees. Providing formal guarantees for such models is hard because "harmful behavior" has no natural specification in a discrete input space: and the standard epsilon-ball properties used in other domains do not carry semantic meaning. We close this gap by shifting verification from the discrete input space to the classifier's pre-activation space, where we define a harmful region as a convex shape enclosing the representations of known harmful prompts. Because the sigmoid classification head is monotonic, certifying the worst-case point is sufficient to certify the entire region, yielding a closed-form soundness proof without approximation in O(d) time. To formally evaluate these classifiers, we propose two constructions of such regions: SVD-aligned hyper-rectangles, which yield exact SAT/UNSAT certificates, and Gaussian Mixture Models, which yield probabilistic certificates over semantically coherent clusters. Applying this framework to three author-trained Guardrail Classifiers on the toxicity domain, every hyper-rectangle configuration returns SAT, exposing verifiable safety holes across all classifiers, despite seemingly high empirical metrics. Probabilistic GMM certificates also expose a divergent structural stability in how these models represent harm. While GPT-2 and Llama-3.1-8B maintain robust coverage of 90% and 80% across varying boundaries, BERT's safety guarantees prove uniquely volatile. This 'coverage collapse' to 55% at the optimal threshold reveals a sparsely populated safety margin in BERT, which only achieves full coverage by adopting an extremely conservative pessimistic threshold. These approaches combined, provide new insights on how effective Guardrail Classifiers really are, beyond traditional red-teaming.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。