DistilBERT detects prompt-injection in RAG with F1 0.896
DistilBERT achieves the highest prompt-injection detection performance on the protected-test split of RAG-PIBench
AI/ML arXiv 6 Oct 2026 Benchmark Prototype evidence
Published as “RAG-PIBench: A Leakage-Aware Benchmark for Prompt-Injection Detection in Trustworthy RAG Systems”
Why it matters
Lightweight TF-IDF models can provide near-state detection performance, enabling efficient prompt-injection defenses without requiring large transformers.
Summary
DistilBERT attains the highest protected-test performance on RAG-PIBench (F1 = 0.896, precision = 0.924, recall = 0.869), but strong TF-IDF baselines (e.g., TF-IDF SVM F1 = 0.871) are only slightly worse. The benchmark is a leakage-aware, frozen split dataset of 4,876 RAG-style examples with balanced benign and malicious labels. Evaluation follows a strict train/validation/protected-test protocol, and results show that larger transformers do not guarantee better detection (DeBERTa-v3 collapses to all-positive predictions). The evidence is solid on the held-out split but limited to English binary detection and only two transformer encoders.
What they found 2
- DistilBERT achieves the strongest overall protected-test performance
“DistilBERT achieves the strongest overall protected-test performance, with F1 = 0.896, precision = 0.924, recall = 0.869, PR-AUC = 0.968, ROC-AUC = 0.967, and accuracy = 0.899.”
- DeBERTa-v3 collapses to an all-positive prediction pattern
“DeBERTa-v3 exhibits a degenerate all-positive prediction pattern, classifying every example as malicious. As a result, DeBERTa-v3 achieves perfect recall (1.000) but only 0.500 precision, with 489 false positives and no true negatives.”
Caveats 7
- The high-capacity DeBERTa-v3 model fails to learn a useful decision boundary, achieving perfect recall but 0.500 precision.
- The MiniLM reference baseline attains 0.969 recall but only 0.508 precision, generating many false positives.
- The simple keyword heuristic yields 0.981 precision but only 0.104 recall, missing most attacks.
- RAG-PIBench evaluates binary prompt-injection detection rather than downstream mitigation strategies.
- No benchmark can eliminate all distributional artifacts; results reflect performance on RAG-PIBench, not universal robustness.
- Transformer evaluation is limited to two encoder-based models; larger or decoder-only models are not tested.
- The protected-test split is class-balanced, which may not match real-world class priors.
What’s new here 4
- Leakage-aware construction pipeline with provenance tracing and shortcut auditing.
- Frozen train, validation, and protected-test splits that prevent post-hoc tuning.
- RAG-style contextual rendering that embeds payloads within realistic retrieval contexts.
- Balanced benign and malicious instruction-bearing examples, including benign instructions.