arXiv:2409.13331cs.CLcs.CR2024-09被引 24

用多语言BERT嵌入提升恶意提示注入攻击检测准确率至96.55%。

Applying Pre-trained Multilingual BERT in Embeddings for Improved Malicious Prompt Injection Attacks Detection

  • 用多语言BERT对提示文本编码生成嵌入向量。
  • 结合逻辑回归实现96.55%的恶意提示检测准确率。
  • 适合关注LLM安全与提示工程的研究者参考。

大型语言模型(LLMs)虽具备强大能力,但其广泛应用也暴露了重大安全漏洞。当前针对恶意提示注入攻击的检测与缓解策略仍显不足,难以应对真实场景中复杂且动态演化的威胁。本文聚焦此类高危漏洞,探索使用多语言BERT、DistilBERT等预训练模型对提示文本进行编码,并将其用于分类恶意与合法提示。研究发现,基于多语言BERT生成的嵌入显著提升了多种机器学习模型(如高斯朴素贝叶斯、随机森林、支持向量机、逻辑回归)的性能。经参数调优后,逻辑回归在二分类任务中达到96.55%的准确率,优于现有方法。同时,通过分析模型误判案例,揭示其局限性,为后续优化提供依据。研究成果有助于指导研究人员选择适配的BERT模型以应对多样化LLM安全风险。

原文摘要 · Abstract (English)

Large language models (LLMs) are renowned for their exceptional capabilities, and applying to a wide range of applications. However, this widespread use brings significant vulnerabilities. Also, it is well observed that there are huge gap which lies in the need for effective detection and mitigation strategies against malicious prompt injection attacks in large language models, as current approaches may not adequately address the complexity and evolving nature of these vulnerabilities in real-world applications. Therefore, this work focuses the impact of malicious prompt injection attacks which is one of most dangerous vulnerability on real LLMs applications. It examines to apply various BERT (Bidirectional Encoder Representations from Transformers) like multilingual BERT, DistilBert for classifying malicious prompts from legitimate prompts. Also, we observed how tokenizing the prompt texts and generating embeddings using multilingual BERT contributes to improve the performance of various machine learning methods: Gaussian Naive Bayes, Random Forest, Support Vector Machine, and Logistic Regression. The performance of each model is rigorously analyzed with various parameters to improve the binary classification to discover malicious prompts. Multilingual BERT approach to embed the prompts significantly improved and outperformed the existing works and achieves an outstanding accuracy of 96.55% by Logistic regression. Additionally, we investigated the incorrect predictions of the model to gain insights into its limitations. The findings can guide researchers in tuning various BERT for finding the most suitable model for diverse LLMs vulnerabilities.

提示注入BERT安全检测

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