G-Drift MIA: Membership Inference via Gradient-Induced Feature Drift in LLMs
Organizations: Florida International University, Miami, USA · University of South Florida, Tampa, USA
Abstract
Large language models (LLMs) are trained on massive web-scale corpora, raising growing concerns about privacy and copyright. Membership inference attacks (MIAs) aim to determine whether a given example was used during training. Existing LLM MIAs largely rely on output probabilities or loss values and often perform only marginally better than random guessing when members and non-members are drawn from the same distribution. We introduce G-Drift MIA, a white-box membership inference method based on gradient-induced feature drift. Given a candidate (x,y), we apply a single targeted gradient-ascent step that increases its loss and measure the resulting changes in internal representations, including logits, hidden-layer activations, and projections onto fixed feature directions, before and after the update. These drift signals are used to train a lightweight logistic classifier that effectively separates members from non-members. Across multiple transformer-based LLMs and datasets derived from realistic MIA benchmarks, G-Drift substantially outperforms confidence-based, perplexity-based, and reference-based attacks. We further show that memorized training samples systematically exhibit smaller and more structured feature drift than non-members, providing a mechanistic link between gradient geometry, representation stability, and memorization. In general, our results demonstrate that small, controlled gradient interventions offer a practical tool for auditing the membership of training-data and assessing privacy risks in LLMs.
Figures & tables
| Feature Set | Llama-3 | GPT-Neo-2 | Gemma-3 |
|---|---|---|---|
| all | 0.9600 | 0.9998 | 0.9990 |
| all but loss before | 0.9597 | 0.9996 | 0.9987 |
| all but logit before | 0.9598 | 0.9997 | 0.9988 |
| all but feat proj before | 0.9596 | 0.9996 | 0.9986 |
| all but loss after | 0.9597 | 0.9996 | 0.9987 |
| all but logit after | 0.9598 | 0.9997 | 0.9988 |
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.
Appendix
| Prompt (paraphrase) | Class | |||
|---|---|---|---|---|
| Where would you find the Eiffel Tower? | Member | 2.914 | 3.900 | 0.986 |
| The Eiffel Tower is located in which city? | Member | 2.890 | 3.875 | 0.985 |
| Which city is home to the Eiffel Tower? | Member | 2.905 | 3.890 | 0.985 |
| Where would you find the Eiffel Tower? | Non-member | -0.103 | -0.057 | 0.046 |
| The Eiffel Tower is located in which city? | Non-member | -0.120 | -0.030 | 0.090 |
| Which city is home to the Eiffel Tower? | Non-member | -0.085 | -0.010 | 0.075 |
Membership Inference Attacks
Membership inference attacks test whether records or entities were used to train a machine-learning model, revealing potential privacy leakage.
See all 116 papers