arXiv:2504.19333cs.CLcs.AI2025-04被引 3

用小模型高效检测危险内容,性能超越大模型。

Unified Multi-Task Learning & Model Fusion for Efficient Language Model Guardrailing

  • 用任务特制数据微调小模型,提升检测精度。
  • 新模型在7个数据集上平均F1提升29.92点。
  • 适合资源有限但需高安全性的部署场景。

大型语言模型在防范不当行为方面展现潜力,但其带来的延迟、内存占用和成本问题限制了实际应用。本文提出一种统一多任务学习与模型融合的方法:通过特定任务的数据生成,微调出显著优于当前最优(SoTA)的小型分类器;进一步构建预训练于合成数据的单一模型MultiTaskGuard,增强泛化能力;最后采用基于搜索的模型融合方法,得到性能最佳的UniGuard模型。在7个公开数据集及自建4个护栏基准上,该方法在检测安全与不安全行为时,平均F1得分较Aegis-LlamaGuard提升29.92点,较gpt-4o提升21.62点,同时模型规模远小于现有大模型。

原文摘要 · Abstract (English)

The trend towards large language models (LLMs) for guardrailing against undesired behaviors is increasing and has shown promise for censoring user inputs. However, increased latency, memory consumption, hosting expenses and non-structured outputs can make their use prohibitive. In this work, we show that task-specific data generation can lead to fine-tuned classifiers that significantly outperform current state of the art (SoTA) while being orders of magnitude smaller. Secondly, we show that using a single model, \texttt{MultiTaskGuard}, that is pretrained on a large synthetically generated dataset with unique task instructions further improves generalization. Thirdly, our most performant models, \texttt{UniGuard}, are found using our proposed search-based model merging approach that finds an optimal set of parameters to combine single-policy models and multi-policy guardrail models. % On 7 public datasets and 4 guardrail benchmarks we created, our efficient guardrail classifiers improve over the best performing SoTA publicly available LLMs and 3$^{\text{rd}}$ party guardrail APIs in detecting unsafe and safe behaviors by an average F1 score improvement of \textbf{29.92} points over Aegis-LlamaGuard and \textbf{21.62} over \texttt{gpt-4o}, respectively. Lastly, our guardrail synthetic data generation process that uses custom task-specific guardrail poli

模型压缩安全检测多任务学习

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