← Lab /AI/ML

Similarity-clique detection flags malicious RAG documents

CleanBase can accurately identify malicious documents in a knowledge base with bounded false positive and false negative rates

AI/ML arXiv 1 May 2026 Defense Prototype evidence

Published as “CleanBase: Detecting Malicious Documents in RAG Knowledge Databases”

Why it matters

Cleaning the knowledge base with CleanBase can be deployed offline to dramatically cut attack success while preserving retrieval utility, making RAG systems safer for real-world use.

Summary

CleanBase reduces prompt-injection attack success from 97% to 6% by detecting malicious documents via semantic similarity cliques, achieving an average false-positive rate below 2% and false-negative rate below 2% across six public knowledge-base benchmarks and nine attacks. The evidence is strong, with extensive experiments covering multiple retrievers, LLMs, and adaptive attacks.

What they found 1

  1. CleanBase consistently achieves low false-positive rates across all attacks and datasets.

    “CleanBase consistently achieves low FPRs across all attacks and datasets.”

Caveats 3

  • CleanBase still substantially outperforms existing defenses on these attacks, reducing the average FNR to 34.2% on PW and 16.5% on PT, compared with 97.2% and 99.2% for DataSentinel, and 44.8% and 29.4% for PromptGuard, respectively.
  • Existing defenses primarily focus on securing the LLM and retriever components of a RAG system. Some approaches ... suffer from one or more key limitations: (1) limited effectiveness against strong prompt injection attacks, (2) degradation in the utility of the RAG system, and (3) additional runtime computational overhead.
  • the absolute number of misclassified documents can still be large in massive knowledge databases

What’s new here 4

  • Detects malicious documents by building a similarity graph and finding dense cliques, rather than inspecting each document in isolation.
  • Uses a statistically grounded threshold (μ + z·σ) to prune edges, providing a principled way to separate outlier similarities.
  • Operates as a first-line defense by cleaning the knowledge database before deployment, avoiding runtime overhead on retrieval.
  • Derives theoretical upper bounds on false-positive and false-negative rates.