arXiv:2605.07982cs.CLcs.CR2026-05被引 3

用小模型实现多维度内容安全检测,速度更快、成本更低。

GLiGuard: Schema-Conditioned Classification for LLM Safeguard

论文配图:GLiGuard: Schema-Conditioned Classification for LLM Safeguard
图 1 · 摘自论文原文
  • 将安全规则转为结构化输入,一次推理完成多项评估
  • 0.3B参数模型在9个基准上达7B-27B模型的准确率
  • 适合需要低延迟高并发的内容审核场景

确保大语言模型输出的安全合规需实时内容审查,覆盖多维度安全标准。现有先进防护模型依赖7B–27B参数的自回归解码器,将本应是分类的问题转化为序列生成,导致延迟高、难以扩展。本文提出GLiGuard,一个基于GLiNER2改进的0.3B参数双向编码器,通过在输入中嵌入任务定义与标签语义的结构化标记模式,支持在同一非自回归前向传播中同时评估提示安全性、响应安全性、拒绝检测、14类细粒度危害及11种越狱策略。该设计允许在推理时直接组合任务与标签模块。在九个主流安全基准测试中,尽管模型规模仅为23–90倍更小,其F1分数仍可媲美7B–27B解码器模型,同时实现最高16倍吞吐提升和17倍延迟降低。结果表明,紧凑的双向编码器可在显著降低推理开销的同时逼近大型模型的准确性。代码与模型已开源:https://github.com/fastino-ai/GLiGuard。

原文摘要 · Abstract (English)

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.

内容安全轻量化模型多任务检测低延迟

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