RePCS: Diagnosing Data Memorization in LLM-Powered Retrieval-Augmented Generation

Le Vu Anh 1 , Nguyen Viet Anh 2 , Mehmet Dik 3 , Luong Van Nghia 4 · 2025

Read RePCS: Diagnosing Data Memorization in LLM-Powered Retrieval-Augmented Generation by Le Vu Anh 1 , Nguyen Viet Anh 2 , Mehmet Dik 3 , Luong Van Nghia 4 (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2506-15513.txt.

Introduction

Le and three co-authors flag when fetch-fed tools lean on drilled lore in this twenty twenty-five paper. Such tools should ground replies in fetched files, not old drill facts. A tool that skips the fetch can spin false facts with faith.

Inside, two reply paths run: one bare ask, one ask plus fetched files. A gap grade tween the two paths' word odds flags fetch skip. Low gap means the fetch bore no weight on the reply. Test rounds beat the past best flag by a clear span. The check needs no tool in-sight and adds one pass of cost.

Catalog record

CREATORLe Vu Anh 1 , Nguyen Viet Anh 2 , Mehmet Dik 3 , Luong Van Nghia 4
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE42 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2506-15513

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

RePCS: Diagnosing Data Memorization in LLM-Powered Retrieval-Augmented Generation Le Vu Anh 1 , Nguyen Viet Anh 2 , Mehmet Dik 3 , Luong Van Nghia 4 Abstract Retrieval-augmented generation (RAG) has become a common strategy for updating large language model (LLM) responses with current, external information. However, models may still rely on memorized training data, bypass the retrieved evidence, and produce contaminated outputs. We introduce Retrieval-Path Contamination Scoring (RePCS), a diagnostic method that detects such behavior without requiring model access or retraining. RePCS compares two inference paths: (i) a parametric path using only the query, and (ii) a retrieval-augmented path using both the query and retrieved context by computing the Kullback–Leibler (KL) divergence between their output distributions. A low divergence suggests that the retrieved context had minimal impact, indicating potential memorization. This procedure is model-agnostic, requires no gradient or internal state access, and adds only a single additional forward pass. We further derive PAC-style guarantees that link the KL threshold to user-defined false positive and false negative rates. On the Prompt-WNQA benchmark, RePCS achieves a ROC-AUC of 0.918. This result outperforms the strongest prior method by 6.5 percentage points while keeping latency overhead below 4.7% on an NVIDIA T4 GPU. RePCS offers a lightweight, black-box safeguard to verify whether a RAG system meaningfully leverages retrieval, making it especially valuable in safety-critical applications. I Introduction Over the past five years, large-scale language models (LLMs) such as GPT-4, Claude 3, and Llama 2 have transformed human–computer interaction: users can pose open-ended questions and receive coherent, context-aware answers in natural language [ 1 ] . To increase factual reliability, industry and academia have turned to the Retrieval-Augmented Generation (RAG) paradigm, in which an LLM is paired with a search layer that retrieves passages from an external knowledge base (KB) [ 2 ] . By explicitly searching for supporting evidence, RAG promises to reduce hallucinations, provide up-to-date information beyond the model’s pre-training cut-off, and offer verifiable citations, making it the de-facto architecture in production chatbots, search engines, and enterprise assistants [ 3 ] . In modern wireless and networked systems, RAG is increasingly used to fetch live network state data such as channel quality measurements, interference statistics, or handover logs before making critical decisions on power control, resource allocation, and mobility management [ 4 , 5 ] . However, we observe a problematic failure mode in this adoption: the LLM models embedded within RAG systems may silently skip fetching fresh telemetry and instead replay information memorized during its pre-training. This silent data contamination in network state queries causes controllers to act on stale or irrelevant facts without any indication of error, potentially destabilizing link budgets or misallocating spectrum. Early RAG systems relied on lexical retrievers such as BM25 [ 6 ] , but the field quickly moved toward dense dual-encoders [ 7 ] and late-interaction models [ 8 ] . Alongside retriever improvements, a second line of work fine-tunes LLMs to better exploit retrieved passages, using techniques ranging from contrastive reward signals to retrieval-conditioned causal masking [ 9 ] . Parallel to these engineering advances, the evaluation community has sounded the alarm on data contamination, the hidden overlap between training corpora and supposedly “held-out” test sets [ 10 ] . In order to detect this issue, researchers have proposed matching n-grams, analysing log-probabilities, or tracing influence functions to detect when benchmark results are inflated by memorized content [ 11 , 12 , 13 ] . Despite gains in factuality and benchmarking rigour, prevailing methods share a critical assumption. If the retriever returns high-quality passages, the generator will faithfully incorporate them. In practice, a powerful LLM may already remember the answer from pre-training, quietly ignoring or only superficially citing the external context. Under such circumstances, even a perfectly engineered retriever cannot prevent leakage; evaluation metrics can be silently inflated, and network operators may over-trust the system’s grounding. Existing contamination detectors still leave two critical gaps. First, most are intrusive : influence-function analysis, gradient masking, or logit inspection demands white-box access to full-precision parameters, which is often impossible for proprietary or quantized models. Second, they probe individual tokens or retrieved passages, but never ask a simpler question: Does the final answer change when retrieval is removed? As a result, practitioners lack a lightweight, black-box test that verifies whether a RAG pipeline truly relies on the documents it fetches. Retrieval-Path Contamination Scoring (RePCS) closes this gap. For every query we execute the same LLM model along two inference paths: 1. Retrieval-augmented path : the query combined with the top- K passages returned by the search layer; 2. Parametric path : the query alone, with no external context. We then compute a single Kullback–Leibler (KL) divergence between the two answer-probability distributions. A small KL value indicates that the retrieved context has little influence. This is evidence that the model is relying on memorised training data, whereas a large KL value certifies that retrieval introduces new information. The score is obtained post-hoc, without gradients, logits, or model modifications, and costs only one extra forward pass. Our contributions include: • Training-free, black-box detector . RePCS compares a retrieval-augmented run with a parametric run of the same LLM; one additional forward pass and a KL divergence flag potential memorisation in real time. • Provable guarantees . We derive PAC-style bounds that map the KL threshold to user-specified false-positive and false-negative rates, providing principled control over detection sensitivity. • Practical speed . On the Prompt-WNQA benchmark, RePCS lifts ROC-AUC by 6.5 pp over the strongest baseline while adding \leq 4.7\% latency on an NVIDIA T4 GPU, making it suitable for live deployments. The rest of the paper is organized as follows. Section II surveys related work in RAGs and data memorization detection. Section III formalizes RePCS, detailing the dual-path LLM protocol and KL scoring rule, and presents our theoretical guarantees. Section IV describes the algorithmic framework. Section V outlines the experimental setup and empirical results. Finally, Section VI summarizes key findings and discusses future directions. II Related Work Early black-box approaches treat the language model as an oracle and rely on output variability to detect memorization. SelfCheckGPT (2023) re-generates an answer several times and marks it as unsafe when the paraphrases disagree, showing that output instability is a useful clue even without access to model internals or the retriever [ 11 ] . While simple, the method needs several additional calls per user query, increasing latency and computation cost. A second research line opens the model to gather richer signals. ReDeEP (2025) traces token probabilities back to individual attention heads and reports that some heads consistently carry memorized content, whereas others depend on retrieved passages [ 12 ] . LLM-Check (2024) also measures hidden-state norms and attention-map entropy, offering both white- and grey-box variants that raise precision but still require layer-level features or gradient access [ 14 ] . These probes achieve high accuracy yet face compatibility issues when models are quantised or internal layouts change. To meet real-time budgets, industry deployments favour lightweight detectors trained with supervision. The Two-Tiered system (2024) fine-tunes two compact encoders: one over the query plus retrieved passages and another over the final answer and flags hallucination when their embeddings diverge, adding only a few milliseconds to

Read the complete text