跳到正文
arXiv cs.AI· Abhishek Rai·· 12 小时前AI 评分36

nokast-secureRAG:用约 0.5B 小模型在 RAG 管线中检测上下文感知的提示词注入

Context-Aware Prompt Injection Detection via Small Language Models in RAG Pipelines: nokast-secureRAG

AI 导读

nokast-secureRAG 是一个约 0.5B 参数的小语言模型,作为检索与生成之间的语义防火墙,联合评估用户查询与检索上下文并分类为安全、可疑或恶意。其教师-评判-学生流程由 35B 教师模型生成 5,233 条样本、120B 独立评判模型重标注(一致率 95.0%),在分布内测试集上实现 0.994 检出召回率、0.026 误报率和 0.006 攻击成功率代理指标。

正文 · 原文

View PDF HTML (experimental)

Abstract: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.
Subjects: Cryptography and Security (cs.CR); Artificial Intelligence (cs.AI)
Cite as: arXiv:2610.28364 [cs.CR]
  (or arXiv:2610.28364v1 [cs.CR] for this version)
  https://doi.org/10.48550/arXiv.2610.28364

arXiv-issued DOI via DataCite (pending registration)

Submission history

From: Abhishek Rai [view email]
[v1] Tue, 20 Oct 2026 15:26:15 UTC (28 KB)

来源:arXiv cs.AI · arxiv.org