用智能路由让小模型打头阵,大模型只处理难例,又快又准。
SafeRoute: Adaptive Model Selection for Efficient and Accurate Safety Guardrails in Large Language Models
- 设计二元路由判断输入难易,只在必要时调用大模型。
- 在多个数据集上降低计算开销30%以上,同时保持高安全准确率。
- 适合需要高效部署安全防护的工业级LLM应用场景。
在真实场景中部署大型语言模型(LLMs)需依赖强大的安全防护模型来检测并拦截有害用户输入。虽然大型安全防护模型性能优异,但其计算成本高昂。为缓解此问题,常采用小型化蒸馏模型,但其在“困难”样本上表现较差,而大型模型在此类样本上能提供准确预测。我们观察到,多数输入可由小型模型可靠处理,仅少数样本需大型模型能力。受此启发,我们提出SafeRoute,一种二元路由机制,用于区分难易样本。该方法仅对路由判定为“难”的样本启用大型安全模型,从而在不牺牲精度的前提下显著提升效率。在多个基准数据集上的实验表明,该自适应模型选择策略大幅优化了计算成本与安全性能间的权衡,优于现有基线方法。
原文摘要 · Abstract (English)
Deploying large language models (LLMs) in real-world applications requires robust safety guard models to detect and block harmful user prompts. While large safety guard models achieve strong performance, their computational cost is substantial. To mitigate this, smaller distilled models are used, but they often underperform on "hard" examples where the larger model provides accurate predictions. We observe that many inputs can be reliably handled by the smaller model, while only a small fraction require the larger model's capacity. Motivated by this, we propose SafeRoute, a binary router that distinguishes hard examples from easy ones. Our method selectively applies the larger safety guard model to the data that the router considers hard, improving efficiency while maintaining accuracy compared to solely using the larger safety guard model. Experimental results on multiple benchmark datasets demonstrate that our adaptive model selection significantly enhances the trade-off between computational cost and safety performance, outperforming relevant baselines.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。