用小模型集成实现高效可更新的恶意提示检测,效果超大模型。
Efficient and Adaptable Detection of Malicious LLM Prompts via Bootstrap Aggregation
- 采用自助聚合与专家混合架构,多个微调小模型协同工作。
- 仅5个成员(4.3亿参数)就达F1 0.92,优于需数十亿参数的方案。
- 新增攻击时只需微调8600万参数的小分类器,适合快速迭代场景。
大型语言模型在自然语言理解、推理和生成方面表现出色,但仍易受恶意提示攻击,如有害请求、越狱技巧和提示注入。现有防御手段存在根本缺陷:黑盒审核API透明度低且难以适应新威胁;白盒方法依赖大模型判别器,计算成本高且需昂贵重训。为此,我们提出BAGEL(Bootstrap AGgregated Ensemble Layer),一种模块化、轻量级且可增量更新的恶意提示检测框架。BAGEL采用自助聚合与专家混合的集成结构,由多个针对不同攻击数据集微调的小模型组成。推理时,通过随机森林路由选择最优成员,并以随机采样方式选取额外成员进行预测融合。当出现新攻击时,仅需微调一个8600万参数的提示安全分类器并加入集成即可完成增量更新。BAGEL在仅选用5个成员(总计4.3亿参数)的情况下达到F1 0.92,超越OpenAI Moderation API和ShieldGemma等需数十亿参数的方案。经过九次增量更新后性能依然稳定,且通过路由结构提供可解释性。结果表明,多个微调小模型的集成可媲美甚至超过数十亿参数的防护系统,同时兼具生产环境所需的效率与适应性。
原文摘要 · Abstract (English)
Large Language Models (LLMs) have demonstrated remarkable capabilities in natural language understanding, reasoning, and generation. However, these systems remain susceptible to malicious prompts that induce unsafe or policy-violating behavior through harmful requests, jailbreak techniques, and prompt injection attacks. Existing defenses face fundamental limitations: black-box moderation APIs offer limited transparency and adapt poorly to evolving threats, while white-box approaches using large LLM judges impose prohibitive computational costs and require expensive retraining for new attacks. Current systems force designers to choose between performance, efficiency, and adaptability. To address these challenges, we present BAGEL (Bootstrap AGgregated Ensemble Layer), a modular, lightweight, and incrementally updatable framework for malicious prompt detection. BAGEL employs a bootstrap aggregation and mixture of expert inspired ensemble of fine-tuned models, each specialized on a different attack dataset. At inference, BAGEL uses a random forest router to identify the most suitable ensemble member, then applies stochastic selection to sample additional members for prediction aggregation. When new attacks emerge, BAGEL updates incrementally by fine-tuning a small prompt-safety classifier (86M parameters) and adding the resulting model to the ensemble. BAGEL achieves an F1 score of 0.92 by selecting just 5 ensemble members (430M parameters), outperforming OpenAI Moderation API and ShieldGemma which require billions of parameters. Performance remains robust after nine incremental updates, and BAGEL provides interpretability through its router's structural features. Our results show ensembles of small finetuned classifiers can match or exceed billion-parameter guardrails while offering the adaptability and efficiency required for production systems.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。