Abstract
Modern Large Language Models (LLMs) and Multimodal LLMs (MLLMs) increasingly utilize Retrieval-Augmented Generation (RAG) to integrate external knowledge at runtime. However, this dynamic retrieval blurs data provenance, making it difficult to determine if leaked sensitive information originated from internal pre-training data or an external database. This paper introduces Source-aware Membership Audit (SMA), a semi-black-box framework that utilizes input perturbation and zero-gradient attribution to trace the exact origin of generated content. SMA successfully audits data leakage in both text and multimodal RAG systems, outperforming existing membership inference techniques and demonstrating viability on commercial black-box models.
Introduction
Membership Inference Attacks (MIAs) are critical tools for security researchers to identify if sensitive data was used to train a machine learning model. In the era of Retrieval-Augmented Generation (RAG), traditional MIAs face a new challenge: the destabilized input-output association. When a model produces a specific output, it is no longer clear whether the model "memorized" that data during its pre-training phase or simply "retrieved" it from an external vector database during inference.
This ambiguity is particularly problematic when multimodal fusion (e.g., mixing images and text) obscures influence paths. The SMA framework shifts the focus of membership inference from a binary "was this memorized?" to a more granular "where exactly was this sourced from?" By operating in a semi-black-box setting, SMA allows auditors to toggle RAG modules and perturb inputs to isolate the source of information without requiring access to internal model weights or gradients.
Methodology
The SMA framework is built on three core technical pillars: input perturbation, zero-gradient attribution, and the Attribution Difference Score (ADS).
Zero-Gradient Attribution
To estimate the contribution of specific input tokens without backpropagation, SMA applies lightweight perturbations to the input. For text, this involves synonym swaps or Unicode tweaks; for images, Gaussian noise is applied. By querying the model with these variations and observing changes in output length and semantic similarity, SMA uses ridge regression to calculate a "contribution score" for each token. This approach is particularly valuable for auditing commercial APIs where internal states are inaccessible.
Attribution Difference Score (ADS)
A key innovation of SMA is the ability to toggle the RAG module. By comparing attribution scores when RAG is enabled versus disabled, the framework classifies tokens into three categories:
- Pretrained Member: Sourced from the LLM's internal memory.
- Retrieved Member: Sourced from the external RAG database.
- Non-Member: Attributed to user input or model hallucination.
Cross-Modal Auditing
For Multimodal RAG (MRAG), SMA projects visual features into the text domain. It injects noise into images and prompts the MLLM to describe the perturbed image. This allows the same token-level attribution mathematics to be applied to multimodal inputs, effectively tracing image-based data leakage.
Experimental Results
Text-Based RAG Performance
SMA was evaluated across six different LLMs using datasets like WikiMIA and PubMedQA. It significantly outperformed state-of-the-art MIA baselines such as PETEL and Mink++. On the LLaMA-2 7B model, SMA achieved an accuracy of 86.24%, whereas baseline methods hovered between 50% and 53%. Overall, SMA improved accuracy by up to 15.74% and coverage by 10.01% under top-k retrieval conditions.
Multimodal RAG (MRAG) Performance
In MRAG settings using Qwen2.5-VL 7B, SMA achieved an accuracy of 79.00% and an AUC of 0.8227. This represents a substantial improvement over existing multimodal MIA methods like VLMA (49.85% ACC) and VLM_MIA (43.11% ACC). Notably, SMA maintained a low false positive rate of 7.85%.
Commercial Model Auditing
One of the most significant findings is SMA's viability on commercial black-box models. While traditional white-box MIAs fail due to a lack of parameter access, SMA successfully audited ChatGPT-4o mini and Gemini-2.5 flash, providing reliable attribution where other methods returned errors.
Discussion and Limitations
While powerful, SMA has certain constraints. It is sensitive to the model's generation temperature; high stochasticity (temperature > 5.0) can degrade attribution reliability. Additionally, the method is computationally intensive, often requiring hundreds of API calls per audit, which can lead to high costs and rate-limiting issues.
Future research will focus on optimizing the framework through batched perturbations and early stopping criteria to reduce query volume. The authors also suggest the use of "shadow model inference"—replicating target models locally—to facilitate large-scale offline testing without the overhead of commercial API fees.
Conclusion
SMA provides a robust solution for auditing data provenance in complex RAG and MRAG systems. By leveraging input perturbation and the ability to toggle retrieval modules, it offers a path forward for ensuring data privacy and accountability in the increasingly opaque landscape of large-scale language and multimodal models.
Summary updated