arXiv:2606.02041cs.CL2026-06被引 2

SentGuard实现实时生成中逐句安全防护,平衡响应速度与安全性。

SentGuard: Sentence-Level Streaming Guardrails for Large Language Models

论文配图:SentGuard: Sentence-Level Streaming Guardrails for Large Language Models
图 1 · 摘自论文原文
  • 在生成过程中按句子分块检测,延迟小且判断更准。
  • 2句话内检测90.5%的危险内容,误报率仅7.41%。
  • 适用于需要实时安全控制的长文本生成场景。

大型语言模型越来越多地以流式方式实时生成长篇、推理密集型回复,何时进行干预与是否干预同样关键。现有防护机制存在两种不理想模式:响应级方法需等完整输出生成后才干预,而词元级方法在语义不完整时即触发,常导致决策不稳定和过度调用。为此,我们提出SentGuard,一种与生成并行的逐句流式防护机制。其轻量级等待缓冲区将流式词元分组为句子块,仅释放经验证的块给用户,引入微小延迟以支持对当前前缀的评估,同时允许目标LLM继续解码后续内容。为支撑该设计,我们构建了StreamSafe基准,涵盖8类危害的结构化逐句标注,捕捉推理与回应段落中的安全风险演化过程。我们进一步采用粗到细目标训练SentGuard,尽早发现句子边界处的不当意图。在5个安全基准上的实验表明,SentGuard在两句话内检测出90.5%的危险情形,同时保持7.41%的低流式误报率。

原文摘要 · Abstract (English)

Large language models increasingly stream long, reasoning-intensive responses in real time, making when to moderate as critical as whether to moderate. Existing guardrails fall into two unsatisfactory extremes: response-level methods delay intervention until the full output is generated, whereas token-level methods act on incomplete semantics, often producing unstable decisions and excessive guard invocations. To address this challenge, we propose SentGuard, a sentence-level streaming guardrail that operates in parallel with generation. A lightweight waiting buffer groups streamed tokens into sentence chunks and releases only verified chunks to the user, introducing a small offset that enables SentGuard to assess the current prefix while the target LLM decodes subsequent content. To support this, we construct StreamSafe, a benchmark with structured per-sentence annotations across 8 harm categories, capturing the evolution of safety risks across both reasoning and response segments. We further train SentGuard with a coarse-to-fine objective to detect unsafe intent as soon as it emerges at sentence boundaries. Experiments on 5 safety benchmarks show that SentGuard outperforms existing baselines, detecting 90.5% of unsafe cases within two sentences while maintaining a low streaming false-positive rate of 7.41%.

安全防护流式生成大模型实时检测

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