0.5B model detects prompt injection with 99.4% recall and 2.6% false-positive rate
The authors claim their small language model can reliably detect indirect prompt injection and retrieval poisoning in RAG pipelines
AI/ML arXiv 20 Oct 2026 Defense Prototype evidence
Published as “Context-Aware Prompt Injection Detection via Small Language Models in RAG Pipelines: nokast-secureRAG”
Why it matters
A compact, locally-run model can reliably block indirect prompt-injection attacks in RAG pipelines, enabling privacy-preserving assistants without relying on cloud-based guards.
Summary
The tuned 0.5B SLM achieves 0.994 recall with only 0.026 false-positive rate, and correctly classifies both halves of a context-flip pair 75% of the time, far outperforming regex and existing prompt-injection classifiers. These results hold on an in-distribution test set of 659 (Q, C) records generated synthetically via a teacher-judge pipeline. However, the model’s recall collapses to near-zero on the out-of-distribution PoisonedRAG benchmark and its single-request latency (293-404 ms) exceeds the sub-100 ms target, so the claim is limited to the specific instruction-consistency threat model and hardware used.
What they found 1
- The tuned SLM reaches 0.994 detection recall at 0.026 false-positive rate.
“On a held-out test set the tuned SLM reaches 0.994 detection recall at 0.026 false-positive rate and 0.006 attack-success-rate (detection-side proxy), versus 0.688 recall for a regex baseline”
Caveats 7
- On the PoisonedRAG benchmark the detector’s recall drops to 0.7%, essentially failing on fact-fabrication attacks outside its threat model.
- Single-request latency is 293-404 ms, well above the sub-100 ms interactive target claimed in the abstract.
- Input ablations show that masking the query (Q-only) reduces recall to 0, indicating the model relies almost entirely on the context (C) for most predictions.
- (1) In-distribution headline numbers, with one external check. Training and test share the same generator.
- (2) ASR is a detection-side proxy-not a measurement of downstream generator behavior.
- (3) Adaptive adversaries are untested; no gradient-based, multi-chunk, or human red-team attacks were evaluated.
- (4) Latency is measured on a single device and remains above the sub-100 ms target.
What’s new here 4
- Detects indirect prompt injection by jointly reasoning over the query and retrieved context, rather than inspecting the context alone.
- Implements a teacher→judge→student distillation pipeline that produces a high-performing detector from a 35B teacher and a 120B judge on a single consumer-class device.
- Introduces a judgment-flip evaluation that isolates context-dependent detection capability, showing a 75% correct-both-halves rate.
- Provides an open-source small (≈0.5B) model and data-generation pipeline for local, privacy-preserving RAG deployments.