arXiv:2506.06384cs.CLcs.AI2025-06中稿 · KSEM2025 AI & Sec …被引 9

融合预训练模型与规则特征,提升大模型提示注入攻击检测效果

Detection Method for Prompt Injection by Integrating Pre-trained Model and Heuristic Feature Engineering

  • 双通道融合:用DeBERTa提取语义特征,规则提取攻击结构特征
  • 在多个数据集上准确率、召回率和F1值均优于现有方法
  • 可有效降低GLM-4、LLaMA 3等主流模型的攻击成功率

随着大语言模型(LLMs)的广泛应用,提示注入攻击已成为重大安全威胁。现有防御机制常面临有效性与泛化性之间的权衡。为此,本文提出DMPI-PMHFE,一种双通道特征融合检测框架,结合预训练语言模型与启发式特征工程以识别提示注入攻击。该框架采用DeBERTa-v3-base作为特征提取器,将输入文本转化为富含上下文信息的语义向量;同时基于已知攻击模式设计启发式规则,提取攻击中常见的显式结构特征。两条通道的特征经融合后输入全连接神经网络,完成最终预测。该方法克服了仅依赖DeBERTa提取特征的局限性。在多个基准数据集上的实验表明,DMPI-PMHFE在准确率、召回率和F1分数上均优于现有方法。实际部署中,显著降低了GLM-4、LLaMA 3、Qwen 2.5和GPT-4o等主流模型的攻击成功率。

原文摘要 · Abstract (English)

With the widespread adoption of Large Language Models (LLMs), prompt injection attacks have emerged as a significant security threat. Existing defense mechanisms often face critical trade-offs between effectiveness and generalizability. This highlights the urgent need for efficient prompt injection detection methods that are applicable across a wide range of LLMs. To address this challenge, we propose DMPI-PMHFE, a dual-channel feature fusion detection framework. It integrates a pretrained language model with heuristic feature engineering to detect prompt injection attacks. Specifically, the framework employs DeBERTa-v3-base as a feature extractor to transform input text into semantic vectors enriched with contextual information. In parallel, we design heuristic rules based on known attack patterns to extract explicit structural features commonly observed in attacks. Features from both channels are subsequently fused and passed through a fully connected neural network to produce the final prediction. This dual-channel approach mitigates the limitations of relying only on DeBERTa to extract features. Experimental results on diverse benchmark datasets demonstrate that DMPI-PMHFE outperforms existing methods in terms of accuracy, recall, and F1-score. Furthermore, when deployed actually, it significantly reduces attack success rates across mainstream LLMs, including GLM-4, LLaMA 3, Qwen 2.5, and GPT-4o.

提示注入安全检测双通道DeBERTa

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