Confidence-Guided Heterogeneous Detection for Jailbreak and Prompt Injection Attacks in Large Language Models
Abstract
The quick adaptation of Large Language Models (LLMs) into conversational agents, decision support systems, and enterprise systems has greatly enhanced human-computer interaction. Nevertheless, the advancement of adversarial prompting techniques such as jailbreaks and prompt injection poses potential risks to the security, reliability, and credibility of the model. Traditional methods to guard against adversarial prompting are mostly based on one type of detection method like rule-based filtering, transformer-based classifiers, or semantic similarities, thus rendering the defenses vulnerable against novel attacks that can exploit weaknesses in one particular defense method. In order to address this problem, this paper proposes a confidence guided heterogeneous detection approach to detect adversarial prompts prior to their execution by the targeted LLM. The system consists of three different detection modules: a rule-based pattern matching engine that identifies any attack signature, a fine-tuned RoBERTa classifier for contextual intent identification, and a semantic similarity engine for detecting paraphrased/adversarial prompts not seen before. The output of these heterogeneous modules are combined using a confidence guided fusion mechanism that adjusts the contribution of each detection module according to predefined confidence thresholds. The architecture is built on the basis of the following tools: Python, FastAPI, Hugging Face Transformers, Sentence-Transformers, and Scikit-learn. According to experimental results, the suggested architecture ensures increased robustness in the presence of adversarial prompts while keeping acceptable inference latency and good performance levels. The modularity of the architecture allows the easy integration of the architecture into existing LLM applications.