arXiv:2605.24883cs.AIcs.CR2026-05ACL

用形式化方法自动生成能测试大模型安全的问答题。

Inverting the Shield: Systematically Generating Safety Tests from Policy Specifications

论文配图:Inverting the Shield: Systematically Generating Safety Tests from Policy Specifications
图 1 · 摘自论文原文
  • 将安全政策转为逻辑表达式,构建可遍历的语义图谱。
  • 在实验中覆盖更多违规场景,攻击成功率高于现有方法。
  • 适合研究模型安全或想系统化测试大模型的人使用。

大型语言模型的广泛应用要求严格而系统的安全性评估。现有方法要么依赖人工构建的基准来从预设角度评估安全,要么采用动态红队测试挖掘潜在漏洞。这些方法虽有效,但高度依赖专家知识,缺乏系统性保障,且易过时。为此,我们提出新框架POLARIS,将基于规格的形式化软件测试引入AI安全领域。POLARIS首先将非结构化的自然语言政策转化为一阶逻辑(FOL)表示,建立高层规则与具体测试用例之间的可追溯联系。该形式化使复杂违规场景可编码为可遍历路径,通过系统探索该图谱,发现组合型违规模式,并实例化为可执行的自然语言测试查询,实现覆盖率驱动和可复现的安全测试。实验表明,POLARIS在政策覆盖率和攻击成功次数上均优于现有基线。关键在于,它通过连接形式化方法与AI安全,提供一种有原则、自动化的保证方式,确保大模型遵循关键安全策略并具备可验证的追溯性。代码已公开于https://github.com/huac-lxy/POLARIS。

原文摘要 · Abstract (English)

The widespread integration of Large Language Models (LLMs) necessitates rigorous and systematic safety evaluation. Existing paradigms either rely on constructed benchmarks to assess safety from predefined perspectives, or employ dynamic red-teaming to probe potential vulnerabilities. While effective, these approaches face challenges, as they depend heavily on expert domain knowledge, offer limited systematic guarantees, and are vulnerable to rapid obsolescence. To address these limitations, we introduce a novel framework POLARIS that brings the rigor of specification-based software testing to AI safety. POLARIS first compiles unstructured natural-language policies into First-Order Logic (FOL) representations, establishing a traceable link between high-level rules and concrete test cases. This formalization enables the construction of a Semantic Policy Graph, where complex policy violation scenarios are encoded as traversable paths. By systematically exploring this graph, POLARIS uncovers compositional violation patterns, which are then instantiated into executable natural-language test queries, enabling coverage-driven and reproducible safety testing. Experiments demonstrate that POLARIS achieves higher policy coverage and attack success counts compared to established baselines. Crucially, by bridging formal methods and AI safety, POLARIS provides a principled, automated approach to ensuring LLMs adhere to safety-critical policies with verifiable traceability. We release our code at https://github.com/huac-lxy/POLARIS.

AI安全形式化方法测试生成

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