GLiGuard:面向LLM安全的模式条件分类
GLiGuard: Schema-Conditioned Classification for LLM Safeguard
AI总结:
GLiGuard通过模式条件编码实现高效多维度内容安全评估,在参数更小的情况下达到与大模型守卫模型相当的准确率,同时提升吞吐量和降低延迟。
摘要:
确保大语言模型输出安全且符合政策需要实时内容审查,能够跨多个安全维度扩展。然而,最先进的守卫模型依赖于具有7B-27B参数的自回归解码器,将本质上是分类问题的设计转化为序列文本生成,导致高延迟和多方面评估时扩展性差。在本文中,我们引入GLiGuard,一种基于GLiNER2改编的0.3B参数模式条件双向编码器,用于LLM内容审查。关键思想是将任务定义和标签语义直接编码到输入序列中作为结构化令牌模式,使在单次非自回归前向传递中同时评估提示安全、响应安全、拒绝检测、14种细粒度危害类别和11种劫持策略。这种模式条件设计使支持的任务和标签块可以在推理时直接在输入模式中组合。在九个已建立的安全基准上,GLiGuard在参数更小的情况下达到与7B-27B解码器基于守卫模型相当的F1分数,同时提供高达16倍的吞吐量和17倍的延迟降低。这些结果表明,紧凑的双向编码器可以接近更大守卫模型的准确性,同时大幅降低推理成本。代码和模型可在https://github.com/fastino-ai/GLiGuard获取。
英文摘要:
Ensuring safe, policy-compliant outputs from large language models requires real-time content moderation that can scale across multiple safety dimensions. However, state-of-the-art guardrail models rely on autoregressive decoders with 7B--27B parameters, reformulating what is fundamentally a classification problem as sequential text generation, a design choice that incurs high latency and scales poorly to multi-aspect evaluation. In this work, we introduce \textbf{GLiGuard}, a 0.3B-parameter schema-conditioned bidirectional encoder adapted from GLiNER2 for LLM content moderation. The key idea is to encode task definitions and label semantics directly into the input sequence as structured token schemas, enabling simultaneous evaluation of prompt safety, response safety, refusal detection, 14 fine-grained harm categories, and 11 jailbreak strategies in a single non-autoregressive forward pass. This schema-conditioned design lets supported task and label blocks be composed directly in the input schema at inference time. Across nine established safety benchmarks, GLiGuard achieves F1 scores competitive with 7B--27B decoder-based guards despite being 23--90$\times$ smaller, while delivering up to 16$\times$ higher throughput and 17$\times$ lower latency. These results suggest that compact bidirectional encoders can approach the accuracy of much larger guard models while drastically reducing inference cost. Code and models are available at https://github.com/fastino-ai/GLiGuard.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。