Detection Method for Prompt Injection by Integrating Pre-trained Model and Heuristic Feature Engineering
摘要
To address prompt injection threats in LLMs, we propose DMPI-PMHFE, a dual-channel feature fusion framework that integrates DeBERTa with heuristic feature engineering. The framework transforms input text into semantic vectors while extracting explicit structural features through attack-pattern-based heuristic rules. Features from both channels are fused via fully connected networks for final classification. This approach mitigates limitations of single-channel feature extraction. Experimental results demonstrate that DMPI-PMHFE outperforms existing methods in accuracy, recall, and F1-score across diverse benchmark datasets. When deployed on mainstream LLMs (GLM-4, LLaMA 3, Qwen 2.5, and GPT-4o), it significantly reduces attack success rates.