Stream guardrails enable token-level safety detection before full responses are generated. However, they often make overly conservative judgements and block those sensitive but safe tokens, which is known as over-refusal. Due to lack of full context, they also fail to detect implicitly harmful content from jailbreaking. To address these challenges, we propose FreoStream, a novel streaming guardrail framework. Specifically, FreoStream fine-tunes a LoRA module to perform Future-Aware Reasoning when the base guardrail detects unsafe tokens. The reasoning process follows a Future-Reason-Judge paradigm: predict the future, reason about the full context and give the final judgement. This design can effectively reduce over-refusal by incorporating the future information. Moreover, we introduce the Safety-Aligned Optimization module that extracts the safety-aligned component from the reasoning gradients to update the base guardrail model, thereby enhancing streaming safety detection. Extensive experiments on various safety benchmarks demonstrate that FreoStream achieves lower over-refusal rates and better jailbreak defense compared to existing streaming guardrails.
翻译:流式护栏能够在完整响应生成之前实现令牌级的安全检测。然而,它们往往做出过于保守的判断,阻止那些敏感但安全的令牌,这被称为过度拒绝。由于缺乏完整的上下文,它们也无法检测到来自越狱攻击的隐含有害内容。为了解决这些挑战,我们提出了FreoStream,一种新颖的流式护栏框架。具体而言,FreoStream微调了一个LoRA模块,当基础护栏检测到不安全令牌时执行未来感知推理。该推理过程遵循“未来-推理-判断”范式:预测未来、推理完整上下文并给出最终判断。这种设计通过融入未来信息有效减少了过度拒绝。此外,我们引入了安全对齐优化模块,该模块从推理梯度中提取安全对齐分量,用于更新基础护栏模型,从而增强流式安全检测。在多种安全基准上的大量实验表明,与现有流式护栏相比,FreoStream实现了更低的过度拒绝率和更好的越狱攻击防御能力。