PIShield: Detecting prompt injection attacks based on intrinsic features of large language modelsPIShield: Detecting Prompt Injection Attacks via Intrinsic LLM Features
The researchers propose PIShield, a method for detecting prompt injection attacks based on the internal features of instruction-tuned large language models, grounded in the fact that such models encode distinguishable internal signals for prompts containing injected instructions. The method uses residual stream representations and a simple linear classifier for detection, without requiring expensive model fine-tuning or response generation. Evaluations on multiple short-context and long-context benchmarks show that PIShield consistently maintains low false positive and false negative rates, significantly outperforming existing baseline methods. The authors state that these results indicate that the internal representations of instruction-tuned large language models can provide a strong and practical foundation for prompt injection detection in real-world applications.