Skip to content

MPIDetector: LLM-reasoning-based multimodal prompt injection detectionMPIDetector: Detecting Multi-modal Prompt Injection via LLM-based Reasoning

arXiv· arXiv:2610.30202· Yiheng Li, Jingyue LiPaul G. Allen School of Computer Science & Engineering, University of Washington; Department of Computer Science, Norwegian University of Science and TechnologyIndexed by this site · 2026-10-23· Originally publishedDefenses

Quick read

Defenses

Based on the paper PDF (AI-generated); refer to the original

The authors propose MPIDetector, which uses few-shot ICL to let an MLLM reason about and detect multimodal prompt injection; the authors state that on WebInject, Gemini-2.0-Flash reaches a detection rate of 99.80%.

Threat modelAttackers hide malicious instructions in textual narratives or visual inputs to bypass safety alignment (indirect prompt injection), including Environmental Prompt Injection (EnvInjection) such as WebInject, which makes imperceptible perturbations to the visual UI of web pages. Defenders use an MLLM as a safety analyzer to inspect inputs; the paper does not state the attacker's knowledge or awareness of the defense.

Questions
Multimodal large models face prompt injection threats hidden in text or images; the authors argue that existing defenses based on signatures, perplexity, and pattern matching struggle to detect cross-modal, semantically obfuscated injections, and that the lack of benign samples makes it impossible to measure false positives.
Methods
Proposes MPIDetector: without fine-tuning, it uses few-shot ICL to give an MLLM a prompt template and 4 examples so that it acts as a security analyzer and outputs structured verdicts; for WebInject, it additionally designs a three-stage Visual-Semantic Decoupling protocol that forces separation of the visual layer and the semantic layer before comparison.
Experiments and results
Evaluated three MLLMs on 3,902 samples: highest accuracy in the text domain 90.91% (Gemini-2.0-Flash), highest in the visual domain 99.28%, and highest detection rate on WebInject 99.80%; the authors state it outperforms four baselines: perplexity, PromptShield, OCR rules, and SnapGuard.
Limitations and future work
The authors note that LLM-based detection incurs latency and computational overhead, which may limit high-frequency real-time applications, and future work plans to distill the reasoning capability into smaller local models. The experiments cover only three MLLMs and do not report adaptive attack evaluations or repetition counts.
Experimental setupGemini-2.0-Flash、Qwen3-VL-32B-Instruct et al. · WAInjectBench、WebInject et al. · Accuracy、Precision et al.
Evaluated models
Gemini-2.0-FlashQwen3-VL-32B-InstructDoubao-seed-1.6-flash
Benchmarks
WAInjectBenchWebInjectYoga-82naaakuuul/prompt-injection-classifier
Metrics
AccuracyPrecisionRecallFPR
AI summaryMPIDetector detects multimodal prompt injection by eliciting the LLM's inherent reasoning through few-shot ICL, without fine-tuning. On multiple mainstream models including Gemini-2.0-Flash, it reached up to 90.91% accuracy and 100% recall on text tasks, and up to 99.28% accuracy with 100% precision on visual tasks. On 500 highly obfuscated WebInject injections, the detection rate reached up to 99.80%.

MPIDetector detects multimodal prompt injection by eliciting the LLM's inherent reasoning through few-shot ICL, without fine-tuning. On multiple mainstream models including Gemini-2.0-Flash, it reached up to 90.91% accuracy and 100% recall on text tasks, and up to 99.28% accuracy with 100% precision on visual tasks. On 500 highly obfuscated WebInject injections, the detection rate reached up to 99.80%.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Defending against multimodal prompt injection: the authors argue that existing pattern-matching defenses struggle to detect cross-modal, semantically obfuscated injections.

    Core question: how to detect multimodal prompt injection (PI) hidden in text or visual inputs that can bypass safety alignment, while keeping the false positive rate near zero.

    • Problem setting and importance: The authors state that MLLMs are being rapidly integrated into real applications, expanding the attack surface from text to vision; attackers can embed hidden instructions in seemingly benign textual narratives or images to hijack the model's original instructions (indirect prompt injection), and attacks such as WebInject can also imperceptibly perturb the visual environment of web pages to manipulate web agents.
    • Shortcomings of existing methods: The authors argue that mainstream defenses such as signature filtering, perplexity anomaly detection, and pattern matching rely on surface features and generalize poorly to semantically complex, cross-modal obfuscated injections; moreover, existing benchmarks mostly contain only attack payloads and lack benign queries, making it impossible to measure false positive rates.
    • Core observation: Inspired by MalCVE's use of LLMs to analyze malware, the authors propose that the LLM's own reasoning ability can be used to independently reason about and detect adversarial prompt injection, shifting from passive feature matching to active semantic reasoning.
    • What the paper proposes: The detection framework MPIDetector (few-shot ICL, no fine-tuning); a Visual-Semantic Decoupling protocol for WebInject; an evaluation benchmark containing 8 categories of textual maliciousness and 6 categories of visual maliciousness, supplemented with benign samples (3,902 total, Table I).
    • Threat model:
      • Attacker goal: Hide malicious instructions in textual narratives or visual inputs, hijack the model's/agent's original instructions, and bypass safety alignment.
      • Attack method: Indirect prompt injection, including EnvInjection—imperceptible perturbations to the visual UI of web pages to hijack Vision-Language Model-driven web agents.
      • Victim systems: MLLMs and MLLM-driven web agents; the defender uses an MLLM as a safety analyzer to inspect inputs.
      • Attacker knowledge and capability: The paper does not explicitly state whether the attacker knows about the defense mechanism.
  2. What related research exists?

    Related work falls into three groups: prompt injection attacks, traditional and SOTA defenses, and LLM reasoning for security defense.

    Prompt Injection Attacks

    • Greshake et al. [1] (2023): systematically described the threat of indirect prompt injection, showing that embedding adversarial instructions in externally retrieved text can compromise LLM-integrated applications.
    • Bagdasaryan et al. [2] (2023): extended PI to the visual domain, pointing out that seemingly harmless images can be weaponized to covertly inject instructions into MLLMs.
    • WebInject [3] (Wang et al., 2025): showed that attackers can imperceptibly perturb the visual environment of webpages to manipulate MLLM-driven web agents.

    Traditional and SOTA Defenses

    • Signature/pattern matching and perplexity filtering [1][5]: common industry signature filtering and perplexity-based anomaly detection; the paper cites [4] as showing that such guardrails are fragile, can be bypassed by semantically complex jailbreak variants, and are insufficient for multimodal inputs.
    • PromptShield [6] and SnapGuard [7]: lightweight defenses for text and screenshot scenarios, respectively; the authors argue that such lightweight or domain-specific architectures lack the cross-modal reasoning needed to detect covert environment injection (e.g., WebInject).

    LLM Reasoning for Security Defense

    • MalCVE [8] (2025): uses an LLM for malware analysis and CVE correlation; the authors state they were inspired by this to shift defense from passive feature matching to proactive semantic reasoning.

    Baselines and Benchmarks: the text baselines are the perplexity method [5] (GPT-2 implementation, threshold PPL>150.0) and PromptShield [6] (with Protect AI's DeBERTa-v3 classifier as a substitute); the visual baselines are rules+OCR [1] (EasyOCR plus a keyword blacklist) and SnapGuard [7] (Laplacian variance and Total Variation thresholds). Evaluation data mainly come from WAInjectBench [9], with benign images from Yoga-82 and Hugging Face.

    Positioning: the authors state that, unlike traditional classifiers that require continuous fine-tuning updates, this paper directly uses few-shot ICL to let an MLLM reason about cross-modal semantic intent, adapting without retraining.

  3. How does the paper address this problem?

    Without fine-tuning, use few-shot ICL to make an MLLM act as a safety analyzer; for WebInject, additionally use a visual-semantic decoupling protocol.

    Overall approach: turn multiple MLLMs into "AI security researchers" and, through carefully designed system prompts and a few examples, elicit their intrinsic reasoning ability to proactively examine the semantic intent of inputs rather than perform static feature matching. The framework is named MPIDetector.

    Model Selection and Overall Setup

    • Three MLLMs: Gemini-2.0-Flash (closed-source representative), Qwen3-VL-32B-Instruct (open-weight representative, chosen by the authors for its high-resolution image processing and OCR capability), and Doubao-seed-1.6-flash (an emerging proprietary model). The authors state these three were chosen to verify the method's model-agnostic generalization.
    • few-shot ICL: a fixed context containing 4 examples (2 benign queries, 2 representative injection attacks), drawn from a separate training hold-out set; the examples include multimodal inputs and the expected JSON-style reasoning output.
    • Output and label mapping: the model outputs a three-class verdict (Benign / Suspicious / Malicious) plus confidence and rationale; in post-processing, Suspicious is always mapped to Malicious, which the authors describe as a conservative strategy—better to trigger guardrails than to let suspicious input through.

    Standard Text and Visual Detection

    • Text analysis (Figure 1): the system prompt requires the model to examine text for adversarial intent such as prompt injection and goal hijacking, provides category examples such as Prompt Injection, Goal Hijacking, and Data Exfiltration to guide structured classification, and constrains it to focus only on security risks and not to assess grammar or sentiment.
    • Visual analysis (Figure 2): the model is required to decompose the image step by step, identify patterns such as hidden text, OCR injection, and visual layout attacks, infer the intent of the visual input, and explain how it manipulates AI logic.
    • Output format: both return a structured response with Verdict (three classes plus 0–100% confidence), Summary, and Attack Vectors, which the authors state provides a readable rationale for the verdict.

    Visual-Semantic Decoupling Protocol

    For EnvInjection such as WebInject (the authors cite WAInjectBench [9] as showing that existing MLLMs can barely detect it), a three-stage protocol is designed (Figure 3):

    1. Visual rendering isolation: the model is required to suppress "semantic bias" and examine only low-level visual features, such as structural anomalies, high-frequency noise, steganographic traces, and irregular layout.
    2. Semantic intent extraction: switch to the purely semantic layer, extract OCR text, identify UI components, and understand the surface intent as benign webpage interaction.
    3. Cross-layer consistency check: compare the visual-layer and semantic-layer outputs; if a deep inconsistency is found (e.g., benign semantics overlaid with covert adversarial noise), it is judged as environment injection.

    Evaluation Design

    • Benchmark composition (Table I): 210 malicious text items (8 categories from WAInjectBench), 120 benign text items, 2,000 visual adversarial images (6 categories), 500 WebInject items, and 1,072 benign images (1,000 from Yoga-82 plus 72 from Hugging Face), totaling 3,902 items; the authors state the datasets are strictly non-overlapping.
    • Metrics: Accuracy, Precision, Recall, FPR, computed based on the deterministic label mapping above.
  4. What experiments did the paper conduct?

    Three MLLMs were evaluated on 3,902 samples; the authors report a highest detection rate of 99.80% on WebInject, outperforming four baselines.

    Experimental Setup

    • Models under test: Gemini-2.0-Flash, Qwen3-VL-32B-Instruct, Doubao-seed-1.6-flash, all evaluated as detectors.
    • Datasets (Table I, 3,902 total): text test set 330 (210 positive, 120 negative); visual test set 3,072 (2,000 positive, 1,072 negative); WebInject test set 1,000 (500 positive, 500 negative, with negative samples drawn from 1,072 benign images).
    • Baselines: in the text domain, the perplexity method [5] (GPT-2, PPL>150.0) and PromptShield [6] (DeBERTa-v3 classifier as a substitute implementation); in the visual domain, rules+OCR [1] (EasyOCR plus a keyword blacklist) and SnapGuard [7] (Laplacian variance threshold 150.0, Total Variation threshold 30.0).
    • Metrics and decision rule: Accuracy, Precision, Recall, FPR; the model outputs three classes, with Suspicious mapped to Malicious.
    • Evaluation method: no independent judge model; the MLLM under test itself outputs the verdict according to the prompt.
    • Sample sizes and number of repetitions: test set sizes as above; the paper does not report the number of repetitions.

    Main Results

    Swipe horizontally to read the table

    ModelText Acc/Rec (Table II)Visual Acc/Rec (Table III)WebInject Acc/Rec (Table IV)
    Gemini-2.0-Flash90.91% / 100.00%99.28% / 98.91%99.80% / 99.80%
    Doubao-seed-1.6-flash81.82% / 71.43%97.98% / 96.93%83.40% / 83.40%
    Qwen3-VL-32B-Instruct81.82% / 85.71%91.08% / 86.30%67.00% / 67.00%
    • All three models have precision of 100.00% in the visual domain and on WebInject (FP=0); in the text domain, Doubao-seed-1.6-flash has precision 100.00%, and Gemini-2.0-Flash has 87.50% (FP=30, FPR 25.00%).
    • The authors state that the high precision shows the models can distinguish awkwardly worded but benign queries from genuine adversarial instructions; on WebInject, Gemini-2.0-Flash detects 499/500.
    • The authors note that the visual "accuracy" first reported in the main text is actually computed only on the positive-sample subset (equivalent to recall), and Table III gives the full confusion matrix.

    Ablation: Necessity of Visual-Semantic Decoupling

    • What was tested: removing the decoupling instruction and switching to a standard visual analysis prompt, then re-testing the three models on WebInject.
    • Results: accuracy dropped to 66.2% (Gemini-2.0-Flash), 11.80% (Doubao-seed-1.6-flash), and 10.20% (Qwen3-VL-32B-Instruct), respectively.
    • Authors' interpretation: the authors state this validates the hypothesis—advanced attacks exploit the MLLM's "fusion" mechanism, and without forced decoupling the model exhibits "semantic bias," treating adversarial noise as natural compression artifacts; they also cite the baseline TPR of about 0.05–0.13 from WAInjectBench [9] for comparison.

    Comparison with Baselines

    • Text domain (Table V): the perplexity baseline has recall 0.95% and FPR 30.83%; PromptShield has accuracy 60.91% and recall 40.00%; MPIDetector (Gemini-2.0-Flash) has accuracy 90.91% and recall 100.00%, but FPR 25.00%, higher than PromptShield's 2.5%.
    • Visual domain (Table VI): rules+OCR has accuracy 92.39% and recall 88.31%; SnapGuard has recall 100.00% but FPR 100.00% (the authors state its fixed noise threshold classifies all benign webpage elements as attacks); MPIDetector has accuracy 99.28% and FPR 0.00%.
    • Authors' interpretation: the authors state that rule-based methods fall into "whack-a-mole" passive defense and fail once synonyms are substituted; MPIDetector generalizes by understanding semantic intent.

    Other Ablations and Analyses

    • Apart from the decoupling ablation above, the paper reports no other parameter ablations; the Discussion gives qualitative examples (such as a screenshot of academic slides containing an adversarial string) showing that the reasoning framework judges by intent rather than keywords, without accompanying quantitative data.
  5. What are some points that can be further explored?

    The authors note that latency and computational overhead are practical constraints and plan to distill the reasoning into small models; the experiments cover only three MLLMs.

    Limitations and Future Directions Noted by the Authors

    • Latency and computational overhead (Section V, Limitations): the authors note that using an LLM for proactive security protection introduces latency and computational overhead, and that real-time applications such as high-frequency web-scraping agents may hit bottlenecks if every input requires multi-step ICL evaluation.
    • Distillation to small models (Section V and Section VI): the authors plan future work on distilling complex reasoning traces into smaller locally hosted models (e.g., an 8B-parameter VLM) to balance security and operational efficiency.

    Scope of Experimental Coverage

    • The models under test are 3 MLLMs in total: Gemini-2.0-Flash, Qwen3-VL-32B-Instruct, and Doubao-seed-1.6-flash (Section III).
    • Evaluation data totals 3,902 items: text 330, standard visual 3,072, WebInject 1,000 (Table I), mainly from WAInjectBench, with benign images from Yoga-82 and Hugging Face.
    • Baseline comparison covers 4 methods: perplexity [5], PromptShield [6] (with a DeBERTa-v3 classifier as a substitute implementation), rules+OCR [1], and SnapGuard [7] (Section IV-E).
    • Only one ablation: the detection rate on WebInject after removing Visual-Semantic Decoupling (Section IV-D).
    • The paper does not report the number of repetitions, confidence intervals, adaptive-attack evaluation of whether the attacker knows the defense, or specific numbers for detection latency or invocation cost.
  6. Summarize the main content of the paper

    MPIDetector uses few-shot ICL to have an MLLM reason about and detect multimodal prompt injection; the authors report a highest detection rate of 99.80% on WebInject.

    A multimodal prompt injection defense paper that proposes the detection framework MPIDetector: without fine-tuning, it uses few-shot ICL (4 examples) plus modality-specific system prompts to make an MLLM act as an "AI security researcher" and output a structured three-class verdict (Suspicious mapped to Malicious); for environment injection such as WebInject, it additionally designs a three-stage Visual-Semantic Decoupling protocol that forces the model to separate the visual layer from the semantic layer and then compare their consistency.

    • Problem addressed: the authors argue that signature-, perplexity-, and pattern-matching-based defenses generalize poorly to cross-modal, semantically obfuscated injection, and that existing benchmarks lack benign samples and cannot measure false positives.
    • Text domain (Table II, N=330): Gemini-2.0-Flash accuracy 90.91%, recall 100.00%; Doubao-seed-1.6-flash precision 100.00% but recall 71.43%.
    • Visual domain (Table III, N=3,072): Gemini-2.0-Flash accuracy 99.28%, with all three models at precision 100.00% (FP=0).
    • WebInject (Table IV, N=1,000): Gemini-2.0-Flash detection rate 99.80%, Doubao-seed-1.6-flash 83.40%, Qwen3-VL-32B-Instruct 67.00%; after removing the decoupling protocol, these drop to 66.2%, 11.80%, and 10.20%, respectively.
    • Baseline comparison: the authors state it outperforms perplexity (recall 0.95%), PromptShield (recall 40.00%), rules+OCR (recall 88.31%), and SnapGuard (FPR 100.00%); however, in the text domain MPIDetector's FPR is 25.00%, higher than PromptShield's 2.5% (Table V).
    • Authors' conclusion: the authors state that LLM-driven semantic reasoning can serve as a new paradigm for cross-modal defense; they also acknowledge that computational overhead is a practical constraint and plan to distill the reasoning capability into smaller local models in the future.

Related papers

Read originalarxiv.org