TL;DR
Retrieval-based In-Context Learning (ICL) for generative tasks like Document Question Answering is highly vulnerable to black-box Membership Inference Attacks (MIAs). By exploiting query text prefixes, the proposed attacks can accurately determine if a specific document was used as a demonstration example, even when the adversary only has access to final model predictions or paraphrased queries.
What Problem Does This Paper Address?
In-Context Learning (ICL) allows Large Language Models (LLMs) to perform downstream tasks using a few demonstration examples provided directly in the prompt, completely avoiding expensive weight updates. To maximize accuracy, real-world applications often use a retrieval function (like $k$-Nearest Neighbors) to dynamically fetch demonstrations that are semantically similar to the user's query.
However, this paper reveals a critical privacy flaw in this setup: if a user's sensitive document (such as a private medical record or financial statement) is part of the server's demonstration pool, a malicious actor can infer its presence. Prior Membership Inference Attacks (MIAs) on ICL were largely limited to simple text classification tasks, assumed random sampling of demonstrations, or required internal model data like token logits. This paper tackles the more complex, generative task of Document Question Answering (DQA) under realistic, black-box constraints where internal model states are hidden.
Methods
The authors introduce two novel black-box attacks that leverage query text prefixes to detect dataset membership:
- Attack 1 (Using a Reference Model): The attacker uses a local, open-source reference model to estimate token-wise conditional log-probabilities (loss metrics) of the target model. By computing the embedding distance between the target model's predictions and the true words across various text prefixes, a 1-D $k$NN regression model is trained to map these distances to the reference model's log-probabilities, effectively predicting the victim model's unobservable loss landscape.
- Attack 2 (Using Only Final Predictions): This attack operates purely on the final text answers without needing a reference model or logit access. The attacker queries the target model using increasingly longer prefixes of the document text. It uses a novel weighted-averaging scheme with a decaying penalty function ($\phi(i) = 1/i$) to amplify early signals. The intuition is that if a document is a "member" in the retrieval pool, the model can often answer correctly even with a short prefix because it has access to the full document via the retrieved context. For non-members, short prefixes lead to poor answers or "I don't know" responses.
Datasets
The attacks were evaluated on three standard benchmarking datasets adapted for Document Question Answering:
- SQuAD v1.0: A crowd-sourced QA dataset based on Wikipedia articles.
- SQuADShifts: A collection testing distribution shifts across Wikipedia, New York Times, Reddit, and Amazon reviews.
- NewsQA: A machine comprehension dataset sourced from CNN news articles.
To simulate a realistic adversarial setting, the authors also used Llama-3-70B-IT to generate paraphrased versions of these datasets, testing the attacks' resilience against text variations.
Key Insights and Ideas
- The Retrieval Trap: While retrieving semantically similar examples improves ICL performance, it drastically increases privacy risks. A query (or its paraphrase) has a very high likelihood of being pulled into the prompt if it exists in the server's database.
- Prefixes as a Lever: LLMs trained to follow instructions behave differently when given incomplete text. A member document acts as a powerful hint in the context window, allowing the model to "guess" the correct answer even when the user prompt is truncated.
- Paraphrase Resilience: Traditional MIAs fail when a query is paraphrased. However, because retrieval-based systems use embedding-based similarity search, paraphrased queries still trigger the retrieval of the target document, making these new attacks highly resilient to paraphrasing.
Key Results
- The proposed attacks significantly outperform existing baselines (such as the Repeat and Brainwash attacks) on generative DQA tasks.
- As shown in the score distributions in Figure 1, member vs. non-member queries are clearly separable using Attack 2, especially on the SQuAD dataset.
- Even when using only a small fraction of prefixes (e.g., $p = 0.1$, meaning only the first 10% of the text is evaluated sequentially), the reference model attack achieves high True Positive Rates (TPR) at low False Gamma Rates (FPR). For instance, on NewsQA with a Pythia-1.4B target model, Attack 1 achieved an AUC of 0.862 with just 10% of prefixes.
- Defense Evaluation: The authors adapted an ensemble prompting defense (querying the model multiple times with different retrieved sets and aggregating the most frequent words). This defense successfully mitigated privacy leakage, dropping the TPR at low FPR by up to 5-fold.
Limitations and Future Work
- Cost and Scaling: Although the attacks can succeed with a subset of prefixes ($p=0.1$), the number of API calls required still scales with the length of the query document, which could be costly or noticeable to service providers.
- Setup Constraints: The evaluation was limited to 1-shot ICL and greedy decoding. Performance under sampling-based decoding methods (which introduce token variance) remains an open question.
- Future Directions: The authors emphasize the urgent need for robust Differential Privacy (DP) solutions tailored for retrieval-powered ICL, as standard DP ensembling techniques currently face a harsh privacy-utility trade-off due to the deterministic nature of $k$NN retrieval.
Summary updated