PGuard: A Native, Streaming, and Plug-in Guardrail for Multimodal Large Language Models
作者: Junyu Lin, Mengjie Wu, Yonghao Dong, Yuchuan Fu, Jinfeng Li, Xiaodan Li, Xiaohan Yuan, Yicheng Liu, Yuefeng Chen, Hui Xue, Jingyi Wang, Yitong Yang, Jiyuan Fu, Qinga He
分类: cs.CL
发布日期: 2026-11-02
💡 一句话要点
提出PGuard以解决多模态大语言模型生成过程中的安全监控问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 多模态大语言模型 安全监控 流式生成 动态层门控 集成能力 性能评估 轻量级架构
📋 核心要点
- 现有方法在多模态大语言模型的生成过程中缺乏有效的安全监控,容易导致生成内容的不安全性。
- PGuard通过将安全监控集成到模型内部,利用中间表示进行逐词安全检测,避免了外部依赖。
- 在超过30个基准测试中,PGuard在文本和多模态安全性方面表现优异,F1分数接近专用外部监控工具。
📝 摘要(中文)
随着流式生成成为文本和多模态大语言模型的主要服务范式,确保生成过程中的安全性成为一项关键挑战。本文介绍了PGuard,这是一种原生、流式且可插拔的安全监控工具,将安全监控从外部服务依赖转变为模型的集成功能。PGuard直接利用模型的中间表示进行逐词安全检测,而不改变其原始推理路径或生成行为。通过动态层门控,PGuard在预填充和自回归解码过程中选择性地聚合跨层的残差流表示,以提取与安全相关的信号。实验表明,PGuard在多个基准测试中表现出色,尤其在文本查询中,F1分数达到0.836,接近专用外部安全监控工具。
🔬 方法详解
问题定义:本文旨在解决多模态大语言模型生成过程中的安全监控问题。现有方法往往依赖外部监控工具,导致安全性不足和效率低下。
核心思路:PGuard的核心思路是将安全监控功能内嵌于模型中,利用模型的中间表示进行逐词的安全检测,从而提高安全性和效率。
技术框架:PGuard的整体架构包括动态层门控机制和多种表示建模架构,支持轻量级无状态变体和基于多尺度因果EMA注意力及GRU的序列感知变体。
关键创新:PGuard的主要创新在于将安全监控集成到模型的推理过程中,避免了对原始推理路径的干扰,显著提升了安全检测的实时性和准确性。
关键设计:PGuard设计了动态层门控机制,通过选择性聚合跨层的残差流表示来提取安全信号,同时优化了计算和数据访问,以减少额外的运行时和同步开销。
🖼️ 关键图片
📊 实验亮点
PGuard在文本查询中表现出色,使用Qwen3.5-9B模型时,平均F1分数达到0.836,接近专用外部安全监控工具。同时,PGuard在Qwen3.5-122B-A10B模型上仅增加0.82-2.26%的端到端开销,展示了其高效性。
🎯 应用场景
PGuard可广泛应用于需要高安全性的多模态生成任务,如社交媒体内容生成、自动驾驶系统中的语音助手以及在线客服机器人等。其集成的安全监控能力将提升这些应用的安全性和可靠性,具有重要的实际价值和未来影响。
📄 摘要(原文)
As streaming generation becomes the dominant serving paradigm for both text-only and multimodal large language models, ensuring safety throughout the generation process has become a critical challenge. We introduce PGuard, a native, streaming, and plug-in guardrail that transforms safety monitoring from an external serving dependency into an integrated capability of the backbone model. PGuard directly leverages the backbone's intermediate representations for token-level safety detection, without altering its original inference pathway or generation behavior. Specifically, dynamic layer gating selectively aggregates residual-stream representations across layers to extract safety-relevant signals during both prefill and autoregressive decoding. To balance detection accuracy and computational efficiency, PGuard supports multiple representation-modeling architectures, including a lightweight stateless variant and sequence-aware variants built on multi-scale causal EMA-attention and GRU-based recurrent modules. Its design also accounts for the execution characteristics of LLM serving frameworks, such as SGLang, optimizing computation and data access to minimize additional runtime and synchronization overhead. As a result, PGuard incurs only 0.82-2.26% end-to-end overhead on the hundred-billion-parameter backbone Qwen3.5-122B-A10B served by SGLang. Extensive evaluations across more than 30 benchmarks spanning text and multimodal safety, jailbreaks, cyber and CBRN risks, multilingual scenarios, and real-world traffic demonstrate state-of-the-art performance among native guardrails. On text queries with Qwen3.5-9B, PGuard achieves an average F1 score of 0.836, approaching dedicated external guardrails, while supporting deployment-time configuration of category-specific thresholds and enforcement actions.