arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.21337cs.CLcs.AI
收藏

微调大型语言模型(LLMs):改进的提示注入攻击检测

Fine-tuned Large Language Models (LLMs): Improved Prompt Injection Attacks Detection

Md Abdur Rahman, Fan Wu, Alfredo Cuzzocrea, Sheikh Iqbal Ahamed

AI总结:

本研究针对大型语言模型易受提示注入攻击的安全问题,提出采用预训练与微调两种检测方法,其中微调XLM-RoBERTa模型在测试集上达到99.13%准确率,有效提升了攻击检测性能。

摘要:

大型语言模型(LLMs)正成为一种流行的工具,因为它们在处理各种基于语言的任务方面的能力已显著提升。然而,LLM应用极易受到提示注入攻击,这构成了一个关键问题。这些攻击通过使用精心设计的输入提示,使模型偏离原始指令,从而可能执行非预期操作。这些操纵构成严重的安全威胁,可能导致数据泄露、偏见输出或有害响应。本项目探讨了与提示注入攻击相关的安全漏洞。为了检测提示是否易受攻击,我们采用两种方法:1)预训练的LLM,2)微调的LLM。然后,我们对分类性能进行深入分析和比较。首先,我们使用预训练的XLM-RoBERTa模型,在无需任何微调的情况下,使用测试数据集检测提示注入,并通过零样本分类进行评估。然后,本工作将使用来自HuggingFace上deepset的任务特定标注数据集,对该预训练LLM进行监督微调,该微调模型经过严格的实验和评估,取得了令人瞩目的结果:准确率99.13%,精确率100%,召回率98.33%,F1分数99.15%。我们观察到,我们的方法在检测提示注入攻击方面非常高效。

英文摘要:

Large language models (LLMs) are becoming a popular tool as they have significantly advanced in their capability to tackle a wide range of language-based tasks. However, LLMs applications are highly vulnerable to prompt injection attacks, which poses a critical problem. These attacks target LLMs applications through using carefully designed input prompts to divert the model from adhering to original instruction, thereby it could execute unintended actions. These manipulations pose serious security threats which potentially results in data leaks, biased outputs, or harmful responses. This project explores the security vulnerabilities in relation to prompt injection attacks. To detect whether a prompt is vulnerable or not, we follows two approaches: 1) a pre-trained LLM, and 2) a fine-tuned LLM. Then, we conduct a thorough analysis and comparison of the classification performance. Firstly, we use pre-trained XLM-RoBERTa model to detect prompt injections using test dataset without any fine-tuning and evaluate it by zero-shot classification. Then, this proposed work will apply supervised fine-tuning to this pre-trained LLM using a task-specific labeled dataset from deepset in huggingface, and this fine-tuned model achieves impressive results with 99.13\% accuracy, 100\% precision, 98.33\% recall and 99.15\% F1-score thorough rigorous experimentation and evaluation. We observe that our approach is highly efficient in detecting prompt injection attacks.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑