- Rating
- 1
- Confidence
- 3
- Informativeness
- 2
- Presentation
- 3
- Soundness
- 2
Read review
Paper summary
This paper proposes CleanBase, a training-free, database-level defense against prompt injection attacks in retrieval-augmented generation (RAG) systems. CleanBase constructs a k-nearest-neighbor graph over document embeddings, prunes weak connections, and identifies tightly connected groups of documents using clique detection. Documents belonging to these groups are classified as malicious and removed from the knowledge database before retrieval. The authors evaluate CleanBase across six knowledge databases and nine poisoning attacks, comparing it against existing defenses such as TrustRAG, PromptGuard, and DataSentinel. The results show that CleanBase reduces average attack success rate (ASR) from 69.9% to 9.1% while largely preserving RAG utility. The authors also investigate scalability, different downstream RAG configurations, and adaptive poisoning attacks.
Critical strengths
-
This work explores database-level sanitization as a proactive defense against RAG poisoning. Since malicious documents are removed before retrieval, CleanBase does not introduce additional defense computation during inference.
-
The authors conduct extensive experiments across six knowledge databases and nine poisoning attacks, including scalability analysis and evaluations against detector-aware adaptive attacks.
Critical weaknesses
-
The conceptual novelty over TrustRAG is limited. TrustRAG already identifies compact clusters of adversarial documents in embedding space using a clustering-based approach. CleanBase similarly exploits the semantic proximity of malicious documents, replacing clustering with kNN graph construction and clique detection. Although CleanBase operates offline at the database level, the authors do not sufficiently demonstrate the advantage of graph-based detection over an offline clustering-based approach.
-
The end-to-end evaluation across different LLMs is limited. Although the authors evaluate six datasets and nine attacks, the main end-to-end experiments use only Llama3-8B, while the cross-model evaluation considers only PoisonedRAG-B. Furthermore, benign generation utility is not evaluated across different LLMs, and the reported accuracy may be influenced by the LLM's parametric knowledge. Broader cross-model evaluations and retrieval-dependent benchmarks are needed to establish generalizability.
Questions for authors
-
Can the authors clarify the conceptual novelty of CleanBase over TrustRAG, given that both methods exploit compact groups of adversarial documents in embedding space? How does CleanBase compare against an offline clustering-based detector under the same experimental conditions?
-
How can CleanBase defend against adaptive poisoning attacks that deliberately disperse malicious document embeddings? Section 6.5 shows that detector-aware adaptive PoisonedRAG-W achieves a 96.1% false negative rate, with CleanBase reducing ASR only marginally from 38.7% to 37.3%.
-
Can the authors extend the end-to-end evaluation to multiple LLMs across different attack strategies, rather than evaluating only PoisonedRAG-B in the cross-model experiments? Additionally, can the authors evaluate benign generation utility across different LLMs and distinguish utility preservation from reliance on parametric knowledge?
4 comments
(2) Further Clarification of Adaptive Attacks
CleanBase relies on cross-document semantic similarity, which adaptive attackers can deliberately weaken. Nevertheless, CleanBase remains effective under the evaluated black-box adaptive setting, reducing ASR from 66.0% to 20.0%. Combining CleanBase with MetaSecAlign further reduces ASR to 13.0%, compared with 44.0% for MetaSecAlign alone.
The white-box adaptive setting represents a stronger threat model, requiring detailed knowledge of the defense mechanism and targeted optimization against it. While such capabilities may not always be available in practical deployments, we intentionally evaluate this challenging setting to characterize the limits of our approach. As reported in Section 6.5, adaptive PoisonedRAG-W achieves an FNR of 96.1%, demonstrating that sufficiently diversified malicious documents can evade detection.
| Adaptive setting | No Defense | CleanBase | MetaSecAlign | Combined |
|---|---|---|---|---|
| Black-box | 66.0% | 20.0% | 44.0% | 13.0% |
| White-box | 71.0% | 71.0% | 38.0% | 38.0% |
These results clarify that CleanBase provides effective protection when detectable cross-document semantic relationships remain, while its effectiveness is limited against stronger white-box adaptive attacks. We therefore position CleanBase as a complementary offline defense rather than a universal solution to adaptive poisoning.
(3) Cross-Model Generalization
We evaluate CleanBase across six LLMs and seven attack strategies, as shown in the following table. CleanBase reduces the average ASR from 79.9% to 17.5%, demonstrating its effectiveness across different downstream LLMs and attack strategies. The improvement is more limited for PoisonedRAG-W, consistent with the limitations discussed above.
| Attack | Setting | Llama2 | Llama3 | Mistral | Qwen2.5 | Llama4 | Qwen3 |
|---|---|---|---|---|---|---|---|
| Naive Attack | No Defense | 99.0 | 94.0 | 71.0 | 76.0 | 94.0 | 96.0 |
| CleanBase | 6.0 | 1.0 | 2.0 | 4.0 | 2.0 | 4.0 | |
| Context Ignoring | No Defense | 94.0 | 95.0 | 66.0 | 66.0 | 65.0 | 94.0 |
| CleanBase | 8.0 | 4.0 | 4.0 | 5.0 | 4.0 | 8.0 | |
| Fake Completion | No Defense | 81.0 | 85.0 | 58.0 | 65.0 | 68.0 | 90.0 |
| CleanBase | 13.0 | 4.0 | 3.0 | 6.0 | 4.0 | 9.0 | |
| Combined Attack | No Defense | 82.0 | 74.0 | 51.0 | 61.0 | 62.0 | 80.0 |
| CleanBase | 5.0 | 0.0 | 2.0 | 3.0 | 1.0 | 4.0 | |
| Mixed Attack | No Defense | 84.0 | 86.0 | 59.0 | 63.0 | 2.0 | 89.0 |
| CleanBase | 17.0 | 12.0 | 8.0 | 10.0 | 8.0 | 19.0 | |
| PoisonedRAG-W | No Defense | 90.0 | 91.0 | 92.0 | 96.0 | 92.0 | 96.0 |
| CleanBase | 81.0 | 73.0 | 82.0 | 79.0 | 72.0 | 78.0 | |
| PoisonedRAG-B | No Defense | 95.0 | 88.0 | 93.0 | 92.0 | 85.0 | 94.0 |
| CleanBase | 20.0 | 13.0 | 15.0 | 16.0 | 12.0 | 15.0 | |
| Average | No Defense | 89.3 | 87.6 | 70.0 | 74.1 | 66.9 | 91.3 |
| CleanBase | 21.4 | 15.3 | 16.6 | 17.6 | 14.7 | 19.6 |
To further assess benign utility and address the concern that utility preservation may result from the LLMs' parametric knowledge, we additionally evaluate 300 SciFact claims and 300 HotpotQA questions across Llama2, Mistral, and Qwen3. We compare original RAG, CleanBase-filtered RAG, and no-retrieval settings using official ground-truth labels and answers. Specifically, we report classification accuracy on SciFact and Exact Match (EM) and token-level F1 on HotpotQA, supplementing the ACC metric used in our original evaluation.
The SciFact classification accuracy results (%) are as follows:
| Model | Original RAG | CleanBase | No Retrieval |
|---|---|---|---|
| Llama2 | 42.3 | 42.3 | 40.0 |
| Mistral | 54.7 | 54.7 | 44.3 |
| Qwen3 | 67.0 | 67.0 | 43.3 |
The HotpotQA results (EM / F1, %) are as follows:
| Model | Original RAG | CleanBase | No Retrieval |
|---|---|---|---|
| Llama2 | 15.0 / 20.7 | 14.3 / 20.3 | 7.7 / 9.4 |
| Mistral | 12.0 / 24.3 | 11.3 / 23.8 | 3.3 / 9.8 |
| Qwen3 | 33.0 / 42.1 | 32.7 / 42.0 | 16.3 / 23.6 |
On SciFact, classification accuracy remains unchanged after CleanBase filtering across all three models, although a few individual predictions change. On HotpotQA, original RAG outperforms the no-retrieval setting by 7.3 / 8.7 / 16.7 percentage points in EM, with positive paired 95% confidence intervals. After CleanBase filtering, EM decreases by only 0.7 / 0.7 / 0.3 percentage points, respectively.
These results provide further evidence that CleanBase generalizes across different serving LLMs while largely preserving retrieval-dependent utility, rather than merely relying on the models' parametric knowledge.
We hope that these additional experiments and clarifications address the reviewer's concerns and further demonstrate CleanBase's distinct contributions, practical advantages, and limitations as a database-level defense for RAG systems.
Thank you for the additional experiments.
The offline clustering comparison retains TrustRAG's K=2 setting, which was originally designed for query-level retrieval. Could the authors compare CleanBase against an offline clustering baseline with a cluster count appropriate for database-scale detection?
We thank the reviewer for this suggestion. We agree that directly applying TrustRAG's query-level K=2 clustering to an entire database may not provide a representative offline clustering baseline. To address this concern, we further evaluate recursive K-means, which hierarchically partitions the database into smaller clusters, producing hundreds to hundreds of thousands of clusters depending on the database size. We investigate how both detection performance and computational cost scale as the database grows.
i) Detection Scalability at Matched FPR
We first compare CleanBase and recursive K-means at matched FPR (approximately 2%) across four database sizes, from 1K to 1M benign documents, and four poisoning attacks.
| Benign Docs | Attack | FPR (%) | CleanBase FNR (%) | Recursive K-means FNR (%) |
|---|---|---|---|---|
| 1K | PB | 2.0000 | 0.0 | 0.0 |
| 1K | CI | 2.0000 | 0.0 | 0.0 |
| 1K | MA | 2.0000 | 0.0 | 0.0 |
| 1K | PW | 2.0000 | 0.0 | 2.4 |
| 10K | PB | 1.9800 | 0.0 | 2.8 |
| 10K | CI | 1.9700 | 0.0 | 7.2 |
| 10K | MA | 2.0000 | 0.0 | 7.2 |
| 10K | PW | 1.9400 | 0.0 | 6.0 |
| 100K | PB | 1.9940 | 0.4 | 11.2 |
| 100K | CI | 1.9750 | 0.0 | 22.0 |
| 100K | MA | 1.9910 | 0.0 | 24.0 |
| 100K | PW | 1.9980 | 1.6 | 16.4 |
| 1M | PB | 1.9998 | 5.6 | 31.2 |
| 1M | CI | 1.9998 | 4.8 | 30.0 |
| 1M | MA | 1.9997 | 1.6 | 40.8 |
| 1M | PW | 1.9998 | 34.0 | 50.8 |
CleanBase demonstrates better detection scalability as the database size increases. While both methods achieve comparable performance on smaller databases, recursive K-means exhibits substantially higher FNR at larger scales under the same false-positive budget. At the million-document scale, CleanBase achieves FNRs of 5.6%, 4.8%, 1.6%, and 34.0% under PB, CI, MA, and PW, respectively, compared with 31.2%, 30.0%, 40.8%, and 50.8% for recursive K-means.
ii) Detection Trade-off at Million Scale
We further compare the two methods on the million-document database by requiring FNR ≤ 5% and matching their achieved FNRs. This allows us to examine the false-positive costs of maintaining high malicious-document detection rates.
| Attack | Matched FNR (%) | CleanBase FPR (%) | K-means FPR (%) |
|---|---|---|---|
| PB | 4.0 | 2.206 | 82.334 |
| CI | 4.8 | 1.955 | 92.030 |
| MA | 4.8 | 1.837 | 97.755 |
| PW | 4.8 | 8.091 | 83.605 |
At matched FNR ≤ 5%, recursive K-means requires substantially higher false-positive rates. Across all four attacks, recursive K-means incorrectly removes more than 80% of benign documents, whereas CleanBase maintains FPRs below 9%. These results show that although recursive clustering can operate on million-document databases, maintaining high detection rates comes at a substantial cost in benign-document preservation.
iii) Computational Scalability
We also compare the processing time of CleanBase and recursive K-means across different database sizes.
| Benign Docs | CleanBase Time (s) | Recursive K-means Time (s) |
|---|---|---|
| 1K | 2.80 | 3.70 |
| 10K | 3.85 | 18.29 |
| 100K | 5.55 | 165.59 |
| 1M | 149.27 | 1860.01 |
CleanBase also demonstrates substantially lower computational overhead at large database scales. In the million-document GPU comparison, recursive K-means requires 1860.01 seconds, compared with only 149.27 seconds for CleanBase, resulting in approximately 12.5 times longer processing time. Recursive K-means also consumes considerably more GPU memory (13.237 GiB versus 5.083 GiB).
Overall, these experiments demonstrate that CleanBase offers better scalability for database-level malicious-document detection, maintaining a more favorable FPR–FNR trade-off as the database grows while incurring substantially lower computational overhead than the evaluated recursive clustering baseline. These advantages persist even when the number of clusters is allowed to scale with the database size rather than being fixed at K=2.
We hope these additional experiments adequately address the reviewer's concern regarding the choice of the offline clustering baseline, and further clarify the advantages of CleanBase for large-scale database protection.
We thank the reviewer for the constructive comments regarding the novelty, adaptive robustness, and cross-model generalizability of CleanBase. We address these three concerns below through additional experimental evidence and further clarifications.
(1) Comparison with Clustering Methods
We acknowledge that both methods exploit semantic relationships among malicious documents. However, TrustRAG performs clustering on a small set of query-retrieved documents, whereas CleanBase performs query-independent database-level sanitization using local kNN graph connectivity and clique detection. We argue that TrustRAG's clustering-based filtering mechanism is not suitable for large-scale database-level sanitization. Specifically, its fixed cluster partitioning struggles to effectively separate malicious documents from large benign corpora, while its subsequent similarity- and ROUGE-based filtering incurs substantial computational overhead when applied to the entire database.
To investigate this, we extended TrustRAG's original first-stage filter to entire databases, retaining its SimCSE encoder, K=2 clustering, cosine-similarity threshold (0.88), ROUGE-L threshold (0.25), and original decision rules.
The following table presents the resulting cluster compositions under PoisonedRAG-B (PB) across different database scales, with 250 malicious documents added to each benign corpus.
As the database grows, malicious documents are distributed across large clusters dominated by benign documents. Removing either cluster would discard a substantial portion of benign documents while still missing approximately half of the malicious documents. These are hypothetical whole-cluster removal results rather than TrustRAG's final detection outcomes, as its original filter includes a ROUGE-based fallback.
The full filtering procedure also faces substantial computational overhead when extended to large databases. Even with optimized similarity and ROUGE-L computation, the TrustRAG adaptation exceeds the 600-second limit at 10K documents across all four evaluated attacks. In contrast, CleanBase completes screening in 2.84–3.85 seconds at 10K documents and 5.42–5.60 seconds at 100K documents. These timings exclude embedding computation and are obtained using different hardware configurations.
Overall, these results highlight the limitations of directly extending TrustRAG's query-level clustering mechanism to database-wide sanitization. In contrast, CleanBase identifies local, potentially overlapping groups of malicious documents through graph connectivity and clique detection, without requiring a global partition of the database. Our contribution therefore lies in a scalable, query-independent database-level detection mechanism, rather than merely exploiting semantic similarity among malicious documents.