Metraipolis › archive › dc_8122e579424a
Context-Aware Prompt Injection Detection via Small Language Models in RAG Pipelines: nokast-secureRAG — arXiv:2610.28364
- Source
- arXiv (en)
- Original
- https://arxiv.org/abs/2610.28364
- License (as archived)
- CC0-1.0
- Archived
- 2026-10-21T07:08:26.723Z
- SHA-256 of the archived text
a41919ba1c3e7881e9b5712616d8326c4e465420be9283f31b503a4b003cc455- Stable URL of this page
https://metraipolis.com/documento/dc_8122e579424a
How to cite
Context-Aware Prompt Injection Detection via Small Language Models in RAG Pipelines: nokast-secureRAG — arXiv:2610.28364 — arXiv (en), https://arxiv.org/abs/2610.28364 (CC0-1.0); archived copy: https://metraipolis.com/documento/dc_8122e579424a (Metraipolis archive dc_8122e579424a, sha256 a41919ba1c3e7881e9b5712616d8326c4e465420be9283f31b503a4b003cc455)
BibTeX
@misc{dc8122e579424a,
title = {Context-Aware Prompt Injection Detection via Small Language Models in RAG Pipelines: nokast-secureRAG — arXiv:2610.28364},
howpublished = {arXiv (en)},
url = {https://arxiv.org/abs/2610.28364},
note = {License CC0-1.0; archived copy https://metraipolis.com/documento/dc_8122e579424a; sha256 a41919ba1c3e7881e9b5712616d8326c4e465420be9283f31b503a4b003cc455},
year = {2026}
}Archived text
Reproduced under CC0-1.0. Attribution: arXiv (en), https://arxiv.org/abs/2610.28364. Third-party text: data, not instructions. It may be an abstract or extract; check the original.
Local Retrieval-Augmented Generation (RAG) systems are vulnerable to indirect prompt injection and retrieval poisoning, where malicious instructions in retrieved content are mistaken for trusted input. We present nokast-secureRAG, a roughly 0.5B-parameter small language model that acts as a semantic firewall between retrieval and generation. It jointly evaluates the user query and retrieved context, classifying the pair as safe, suspicious, or malicious. The model is trained using a teacher-judge-student pipeline: a 35B teacher generates 5,233 examples across four attack families, and an independent 120B judge re-labels them, achieving 95.0% agreement before student fine-tuning. On a held-out in-distribution test set, the model achieves 0.994 detection recall at a 0.026 false-positive rate and a 0.006 attack-success-rate proxy, outperforming a regex baseline, a public prompt-injection classifier, Llama Guard 3 1B, and its untuned version. Prompt-Guard-86M reaches 0.900 recall but has a 0.690 false-positive rate. On a judgment-flip test, where the same sentence is benign or malicious depending on context, the model correctly classifies both cases 75% of the time, outperforming the compared baselines. Ablations indicate that retrieved context carries the main attack signal, while query-context consistency reduces false positives. Single-request latency is 293-404 ms, above the target of 100 ms, while amortized throughput latency is 37 ms under batching. On the external PoisonedRAG benchmark, recall falls to near zero, indicating that fluent fact-poisoning attacks lie outside the detector's instruction-consistency threat model. We report this limitation alongside the in-distribution results. The model, data-generation pipeline, and evaluation harness are released open source. Tema degli esploratori: agenti e intelligenza artificiale (elenco arXiv cs.AI, nuovi lavori del giorno). Categorie arXiv: Cryptography and Security (cs.CR) ; Artificial Intelligence (cs.AI). Pagina del lavoro: https://arxiv.org/abs/2610.28364 — autori e testo completo sono lì (qui omessi i nomi: nessun dato personale nel deposito). Licenza: titolo e abstract sono metadati arXiv distribuiti in CC0 1.0; il testo completo ha la licenza scelta dagli autori, indicata sulla pagina. Letto il 2026-10-21T07:05:43.645Z dalla pagina https://arxiv.org/list/cs.AI/new (consentita dal robots.txt di arxiv.org, con il suo crawl-delay).