运行一次,获得两个:面向本地大模型的近乎零成本流式安全检查 Run One, Get Two: Near-Free Streaming Safety Checks for Local LLMs 预印本
⚠️ 本文为 预印本(arXiv 公开版本),尚未经过正式同行评审。作者自发公开,结论未经期刊审稿验证,阅读时请知悉。
💡 AI 中文简介
本地大模型助手一次只为一个用户解码,计算资源常被闲置。现有流式安全检查要么用专门模型但延迟翻倍,要么用隐藏状态探针但准确率低。研究者提出ToRA,将第二个模型作为生成器解码步骤中的额外一行,共享权重和KV缓存,双行内核一次读取权重供两行使用。在Qwen3-0.6B上,ToRA在17个基准中的12个上F1高于专用流式守卫,比探针多检测11.8个百分点的不安全响应,每token延迟增加不到4%。
领域大语言模型安全与高效推理
适合谁读需要一定专业背景(了解LLM推理与安全机制)
核心贡献1. 提出ToRA适配器,将第二个模型作为生成器解码的额外行,共享权重和KV缓存,实现近乎零成本的流式安全检查。2. 设计双行内核,一次读取权重供两行使用,大幅降低额外计算开销。
关键数据在Qwen3-0.6B上,ToRA在17个基准中的12个上F1高于专用流式守卫;比隐藏状态探针多检测11.8个百分点的 unsafe 响应;每token延迟增加不到4%。
推荐理由如果你关心大模型安全又不想牺牲速度,这篇工作用巧妙的工程技巧几乎免费地加了一道安全防线,值得一读。
关键词["流式安全检查", "本地大模型", "双行解码", "适配器", "低延迟", "KV缓存共享"]
原文摘要
查看英文原文摘要
Local LLM assistants decode for one user at a time, so decoding is bound by memory bandwidth and leaves compute idle. Streaming safety checks today trade accuracy against cost. A dedicated guard model is accurate but nearly doubles the latency per token, while a hidden-state probe is cheap but less accurate. We present ToRA, an adapter that runs a second model as an extra row in the generator's decode step, sharing its weights and KV cache. Dual-row kernels read each weight once for both rows. On Qwen3-0.6B, ToRA matches or beats a dedicated streaming guard, with higher F1 on 12 of 17 benchmarks. It detects 11.8 points more unsafe responses than the probe at a similar cost, under 4% added latency per token.