用微调的轻量BERT实现高效安全防护,性能接近大模型但更快更省资源。
Lightweight Safety Guardrails Using Fine-tuned BERT Embeddings
- 用Sentence-BERT微调替代大模型做安全过滤,降低计算开销。
- 模型参数从70亿减至6700万,在AEGIS基准上表现相当。
- 适合对延迟敏感、成本敏感的工业级部署场景。
随着大型语言模型的广泛应用,企业快速开发原型的需求激增,亟需可靠的防护机制来监控、量化并控制模型行为,确保其可靠、安全、准确且符合用户预期。以往如LlamaGuard和OpenAI MOD API等方法通过微调现有大模型取得了显著成效,但使用微调的大模型作为防护层会带来更高的延迟和维护成本,难以在低成本场景中规模化应用。本文提出新思路:微调轻量级的Sentence-BERT架构。该方法将模型规模从LlamaGuard的70亿参数压缩至约6700万,同时在AEGIS安全基准测试中保持相近性能,显著提升了部署效率与经济性。
原文摘要 · Abstract (English)
With the recent proliferation of large language models (LLMs), enterprises have been able to rapidly develop proof-of-concepts and prototypes. As a result, there is a growing need to implement robust guardrails that monitor, quantize and control an LLM's behavior, ensuring that the use is reliable, safe, accurate and also aligned with the users' expectations. Previous approaches for filtering out inappropriate user prompts or system outputs, such as LlamaGuard and OpenAI's MOD API, have achieved significant success by fine-tuning existing LLMs. However, using fine-tuned LLMs as guardrails introduces increased latency and higher maintenance costs, which may not be practical or scalable for cost-efficient deployments. We take a different approach, focusing on fine-tuning a lightweight architecture: Sentence-BERT. This method reduces the model size from LlamaGuard's 7 billion parameters to approximately 67 million, while maintaining comparable performance on the AEGIS safety benchmark.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。