Abstract
Prompt injection attacks imply that they lead to a very severe risk to the dependability of Large Language Model (LLM) systems by allowing a user to control the behavior of the model using constructed inputs. This paper proposes a Hybrid-PI neural-semantic architecture to improve the detection of these attacks. Hybrid-PI with the DeepSet prompt-injection dataset uses a neural prompt encoder with a Semantic Consistency Oracle to jointly learn surface and higher-level semantic inconsistencies via a trade-off between the two. The experimental findings indicate that Hybrid-PI performs much better than the classical and transformer-based baselines, achieving 97.4% accuracy and 97.5% F1-score, with significantly reduced false positives. The robustness tests also indicate the ability to withstand paraphrase and obfuscation-based adversarial variations. The results suggest that Hybrid-PI is a viable and scalable approach to strengthening safety controls around LLMs against emerging threats such as prompt injection.