arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2512.01326cs.CRcs.CLcs.LG
收藏

保护大型语言模型(LLMs)免受提示注入攻击

Securing Large Language Models (LLMs) from Prompt Injection Attacks

University of Galway, Ireland(Galway大学)

Omar Farooq Khan Suri, John McCrae

AI总结:

本研究评估了JATMO方法对提示注入攻击的鲁棒性,发现其在减少攻击成功率的同时仍存在漏洞,提示需要更复杂的防御策略。

摘要:

大型语言模型(LLMs)正越来越多地应用于现实世界中,但其灵活性使它们容易受到提示注入攻击。这些攻击利用模型的指令遵循能力使其执行恶意任务。最近的工作提出了JATMO,一种任务特定的微调方法,通过训练非指令调优的基础模型执行单一功能,从而减少对对抗性指令的易受性。在本研究中,我们评估了JATMO对HOUYI的鲁棒性,HOUYI是一种系统地突变和优化对抗性提示的遗传攻击框架。我们通过引入定制的适应度评分、修改的突变逻辑和一个新的本地模型测试工具来适应HOUYI,从而更准确地评估防御效果。我们按照JATMO方法微调了LLaMA 2-7B、Qwen1.5-4B和Qwen1.5-0.5B模型,并将其与微调后的GPT-3.5-Turbo基线进行比较。结果显示,虽然JATMO相对于指令调优模型减少了攻击成功率,但并不能完全防止注入;攻击者利用多语言提示或代码相关干扰器仍然能够绕过防御。我们还观察到生成质量与注入漏洞之间的权衡,这表明更好的任务性能往往与更高的易受性相关。我们的结果突显了基于微调的防御方法的潜力和局限性,并指出了需要分层、对抗性指导的缓解策略的必要性。

英文摘要:

Large Language Models (LLMs) are increasingly being deployed in real-world applications, but their flexibility exposes them to prompt injection attacks. These attacks leverage the model's instruction-following ability to make it perform malicious tasks. Recent work has proposed JATMO, a task-specific fine-tuning approach that trains non-instruction-tuned base models to perform a single function, thereby reducing susceptibility to adversarial instructions. In this study, we evaluate the robustness of JATMO against HOUYI, a genetic attack framework that systematically mutates and optimizes adversarial prompts. We adapt HOUYI by introducing custom fitness scoring, modified mutation logic, and a new harness for local model testing, enabling a more accurate assessment of defense effectiveness. We fine-tuned LLaMA 2-7B, Qwen1.5-4B, and Qwen1.5-0.5B models under the JATMO methodology and compared them with a fine-tuned GPT-3.5-Turbo baseline. Results show that while JATMO reduces attack success rates relative to instruction-tuned models, it does not fully prevent injections; adversaries exploiting multilingual cues or code-related disruptors still bypass defenses. We also observe a trade-off between generation quality and injection vulnerability, suggesting that better task performance often correlates with increased susceptibility. Our results highlight both the promise and limitations of fine-tuning-based defenses and point toward the need for layered, adversarially informed mitigation strategies.

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

↑