MINE: A Training-Free Defense against Indirect Prompt Injection via Mutual Information and Embedding Variance
Organizations: Qualcomm AI Research* *Qualcomm Vietnam Company Limited. Qualcomm AI Research is an initiative of Qualcomm Technologies, Inc.
Abstract
Existing defenses against indirect prompt injection in retrieval-augmented generation (RAG) are inherently reactive: prompt-engineering methods are often overridden by the injected instructions, while supervised detectors must be retrained for each new attack style. We propose a different paradigm: defend by maximizing relevance, not by detecting attacks. Our method, MINE, is training-free and attack-agnostic, and it also serves as a query-conditioned reranker. To evaluate defenses under realistic conditions, we introduce LC-Inj-SQuAD, a long-context benchmark with an average of 4,032 words per context. We evaluate on four datasets spanning short-context QA (Inj-SQuAD, Inj-TriviaQA), long-context QA (LC-Inj-SQuAD), and agent tool-call injection (InjecAgent). Across all four, MINE achieves the best accuracy--security trade-off among training-free defenses. It is also the only defense that stays usable against a fully adaptive attacker, generalizes to agent tool-call injection, and achieves the lowest inference latency on long contexts.
Figures & tables
| Method | Train-free | No labels | No extra LLM | Pre-LLM | Formal obj. |
| Prompt-eng. | ✓ | ✓ | ✓ | ||
| Heuristic | ✓ | ✓ | ✓ | ✓ | |
| indirect-pia | ✓ | ||||
| MINE (ours) | ✓ | ✓ | ✓ | ✓ | ✓ |
| Model | Attack | None | MELON | RAGDefender | Spotlight | Sandwich | indirect-pia | MINE | |
| Inj-SQuAD | Llama-3.2 -3B-Instruct | naive | 44.81 / 79.39 | 26.37 / 48.27 | 30.26 / 77.95 | 58.36 / 57.49 | 74.21 / 60.23 | 83.86 / 0.00 | 83.01 / 0.72 |
| escape-sep | 34.58 / 83.57 | 18.88 / 54.76 | 30.40 / 77.95 | 42.80 / 69.60 | 68.73 / 66.28 | 83.14 / 0.00 | 84.73 / 0.72 | ||
| ignore | 16.43 / 90.63 | 12.25 / 46.40 | 17.58 / 85.16 | 31.56 / 78.10 | 54.18 / 67.15 | 71.04 / 0.00 | 85.01 / 0.58 | ||
| complete | 5.48 / 94.52 | 3.31 / 36.02 | 9.22 / 90.06 | 4.18 / 94.24 | 64.12 / 73.92 | 75.65 / 0.00 | 85.30 / 0.14 | ||
| conv | 14.27 / 87.90 | 1.73 / 43.08 | 17.15 / 84.44 | 14.27 / 72.62 | 53.31 / 40.49 | 18.01 / 0.00 | 83.57 / 0.14 | ||
| Avg. | 23.11 / 87.20 | 12.51 / 45.71 | 20.92 / 83.11 | 30.23 / 74.41 | 62.91 / 61.61 | 66.34 / 0.00 | 84.32 / 0.46 |
| Defense | Llama-3.2 -3B-Instruct | Llama-3.1 -70B-Instruct | Qwen3-30B-A3B -Instruct-2507 |
| None | 29.82 / 72.13 | 40.13 / 68.19 | 48.85 / 54.16 |
| Reminder | 18.89 / 80.31 | 38.98 / 65.93 | 48.41 / 52.35 |
| Instructional | 28.67 / 73.85 | 42.12 / 60.53 | 52.30 / 49.69 |
| MELON | 22.61 / 32.48 | 31.06 / 12.52 | 32.26 / 8.09 |
| RAGDefender | 35.40 / 68.63 | 51.50 / 53.76 | 62.35 / 38.63 |
| Spotlight | 44.60 / 47.70 | 45.97 / 54.82 | 57.08 / 43.80 |
| Inj-SQuAD | LC-Inj-SQuAD | |||
| Defense | Acc | ASR | Acc | ASR |
| None | 13.69 | 90.20 | 2.88 | 98.85 |
| Reminder | 40.06 | 61.10 | 2.74 | 98.27 |
| Instructional | 25.79 | 80.12 | 3.03 | 97.98 |
| Sandwich | 79.97 | 16.28 | 58.50 | 39.77 |
| RAGDefender | 29.11 | 40.78 | 30.26 | 56.92 |
| Inj-SQuAD | LC-Inj-SQuAD | |||
| Defense | none | conv | none | conv |
| Sandwich | 0.39 | 1.28 | 1.13 | 3.66 |
| indirect-pia | 0.93 | 2.60 | 2.06 | 3.95 |
| MINE (ours) | 0.52 | 0.47 | 0.78 | 0.75 |
| Qwen3-30B-A3B -Instruct-2507 | Llama-3.1 -70B-Instruct | |||
| Defense | Valid | ASR | Valid | ASR |
| None | 99.80 | 98.80 | 98.80 | 96.50 |
| Reminder | 99.60 | 98.40 | 96.80 | 92.60 |
| Instructional | 99.60 | 98.64 | 98.40 | 93.78 |
| Spotlight | 99.80 | 96.18 | 93.80 | 70.80 |
| Sandwich | 77.40 | 33.56 | 77.80 | 11.96 |
Appendix figures & tables3 assets
Supplementary material from the paper’s appendix.
Appendix
| Unit | Mean | Median | Min | Max |
| Characters | 27,789 | 27,727 | 23,205 | 33,770 |
| Words | 4,032 | 4,039 | 3,376 | 4,734 |
| Tokens (BPE) | 4,927 | 4,934 | 4,180 | 5,837 |
| Model | Attack | None | Reminder | Instruct. | Spotlight | Sandwich | RAGDefender | MELON | indirect-pia | MINE | |
| Inj-SQuAD | Llama-3.2 -3B-Instruct | naive | 44.81 / 79.39 | 23.92 / 89.77 | 42.94 / 77.67 | 58.36 / 57.49 | 74.21 / 60.23 | 30.26 / 77.95 | 26.37 / 48.27 | 83.86 / 0.00 | 83.01/ 0.72 |
| escape-sep | 34.58 / 83.57 | 14.27 / 92.94 | 33.14 / 83.00 | 42.80 / 69.60 | 68.73 / 66.28 | 30.40 / 77.95 | 18.88 / 54.76 | 83.14 / 0.00 | 84.73 / 0.72 | ||
| ignore | 16.43 / 90.63 | 7.35 / 91.07 | 20.89 / 88.33 | 31.56 / 78.10 | 54.18 / 67.15 | 17.58 / 85.16 | 12.25 / 46.40 | 71.04 / 0.00 | 85.01 / 0.58 | ||
| complete | 5.48 / 94.52 | 2.31 / 85.45 | 9.22 / 93.23 | 4.18 / 94.24 | 64.12 / 73.92 | 9.22 / 90.06 | 3.31 / 36.02 | 75.65 / 0.00 | 85.30 / 0.14 | ||
| conv | 14.27 / 87.90 | 7.93 / 89.77 | 13.69 / 87.18 | 14.27 / 72.62 | 53.31 / 40.49 | 17.15 / 84.44 | 1.73 / 43.08 | 18.01 / 0.00 | 83.57 / 0.14 | ||
| Avg. | 23.11 / 87.20 | 11.16 / 89.80 | 23.98 / 85.88 | 30.23 / 74.41 | 62.91 / 61.61 | 20.92 / 83.11 | 12.51 / 45.71 | 66.34 / 0.00 | 84.32 /0.46 |
| Qwen3-30B-A3B-Instruct-2507 | Llama-3.1-70B-Instruct | |||||||||
| Defense | Naive | Ignore | Esc. Sep. | Comp. Real | Conv. Atk | Naive | Ignore | Esc. Sep. | Comp. Real | Conv. Atk |
| None | 98.8/100 | 98.6/99 | 98.6/100 | 98.6/100 | 99.4/100 | 95.8/98 | 94.7/100 | 96.8/98 | 96.2/98 | 99.0/100 |
| Reminder | 98.2/100 | 98.0/99 | 98.8/99 | 98.0/100 | 99.0/100 | 89.7/97 | 88.6/98 | 92.5/97 | 93.8/94 | 98.4/98 |
| Instructional | 98.6/100 | 98.6/99 | 98.8/99 | 98.0/100 | 99.2/100 | 91.3/99 | 92.3/99 | 94.0/98 | 93.9/96 | 97.4/100 |
| Sandwich | 21.3/83 | 15.4/66 | 21.5/81 | 32.2/84 | 77.4/73 | 4.5/83 | 8.0/81 | 5.5/71 | 4.0/69 | 37.8/85 |
| Spotlight | 97.6/100 | 96.5/99 | 97.2/100 | 92.5/100 | 97.1/100 | 65.0/92 | 82.9/97 | 65.1/93 | 61.4/94 | 79.6/93 |
Prompt Injection
Prompt injection is the manipulation of language-model instructions through untrusted text, images, or tool outputs to redirect model behavior.
See all 19 papers