Learning the Signature of Memorization in Autoregressive Language Models
Organizations: JetBrains Research
Abstract
All prior membership inference attacks for fine-tuned language models use hand-crafted heuristics (e.g., loss thresholding, Min-K%, reference calibration), each bounded by the designer's intuition. We introduce the first transferable learned attack, enabled by the observation that fine-tuning any model on any corpus yields unlimited labeled data, since membership is known by construction. This removes the shadow model bottleneck and brings membership inference into the deep learning era: learning what matters rather than designing it, with generalization through training diversity and scale. We discover that fine-tuning language models produces an invariant signature of memorization detectable across architectural families and data domains. We train a membership inference classifier exclusively on transformer-based models. It transfers zero-shot to Mamba (state-space), RWKV-4 (linear attention), and RecurrentGemma (gated recurrence), achieving 0.963, 0.972, and 0.936 AUC respectively. Each evaluation combines an architecture and dataset never seen during training, yet all three exceed performance on held-out transformers (0.908 AUC). These four families share no computational mechanisms, their only commonality is gradient descent on cross-entropy loss. Even simple likelihood-based methods exhibit strong transfer, confirming the signature exists independently of the detection method. Our method, Learned Transfer MIA (LT-MIA), captures this signal most effectively by reframing membership inference as sequence classification over per-token distributional statistics. On transformers, LT-MIA achieves 2.8 higher TPR at 0.1% FPR than the strongest baseline. The method also transfers to code (0.865 AUC) despite training only on natural language texts. Code and trained classifier available at https://github.com/JetBrains-Research/learned-mia.
Figures & tables
| Method | Transformer | Mamba | RWKV | RecurrentGemma | Mean |
|---|---|---|---|---|---|
| Loss | 0.622 | 0.867 | 0.786 | 0.860 | 0.784 |
| Min-K%++ | 0.585 | 0.814 | 0.706 | 0.813 | 0.730 |
| Zlib | 0.611 | 0.837 | 0.761 | 0.836 | 0.761 |
| RefLoss | 0.760 | 0.892 | 0.915 | 0.800 | 0.842 |
| EZ-MIA | 0.887 | 0.931 | 0.971 | 0.915 | 0.926 |
| LT-MIA | 0.908 | 0.963 | 0.972 | 0.936 | 0.945 |
| TPR @ 1% FPR | |||||
|---|---|---|---|---|---|
| Method | Transformer | Mamba | RWKV | RecurrentGemma | Mean |
| Loss | 0.036 | 0.356 | 0.108 | 0.185 | 0.171 |
| RefLoss | 0.056 | 0.346 | 0.308 | 0.094 | 0.201 |
| EZ-MIA | 0.230 | 0.526 | 0.439 | 0.273 | 0.367 |
| LT-MIA | 0.375 | 0.569 | 0.593 | 0.399 | 0.484 |
| TPR @ 0.1% FPR | |||||
| Classifier | Train AUC | Eval AUC |
|---|---|---|
| Transformer (sequence) | 0.914 | 0.925 |
| MLP (flattened) | 0.885 | 0.877 |
| MLP (mean pooled) | 0.885 | 0.875 |
| Logistic Regression | 0.838 | 0.839 |
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | Dataset | Loss | Min-K%++ | Zlib | RefLoss | EZ-MIA | LT-MIA |
|---|---|---|---|---|---|---|---|
| GPT-2 | AG News | 0.745 | 0.704 | 0.717 | 0.790 | 0.960 | 0.945 |
| GPT-2 | WikiText | 0.745 | 0.696 | 0.713 | 0.814 | 0.971 | 0.980 |
| GPT-2 | XSum | 0.768 | 0.719 | 0.760 | 0.956 | 0.994 | 0.991 |
| GPT-2 | Code | 0.618 | 0.608 | 0.618 | 0.608 | 0.795 | 0.761 |
| Pythia-2.8B | AG News | 0.603 | 0.565 | 0.584 | 0.740 | 0.872 | 0.911 |
| Pythia-2.8B | WikiText | 0.585 | 0.558 | 0.583 | 0.645 | 0.867 | 0.944 |
| Model | Dataset | Loss | Min-K%++ | Zlib | RefLoss | EZ-MIA | LT-MIA |
|---|---|---|---|---|---|---|---|
| GPT-2 | AG News | 0.018 | 0.026 | 0.014 | 0.020 | 0.408 | 0.274 |
| GPT-2 | WikiText | 0.084 | 0.024 | 0.092 | 0.018 | 0.058 | 0.632 |
| GPT-2 | XSum | 0.122 | 0.100 | 0.104 | 0.090 | 0.868 | 0.756 |
| GPT-2 | Code | 0.024 | 0.010 | 0.010 | 0.010 | 0.030 | 0.054 |
| Pythia-2.8B | AG News | 0.014 | 0.020 | 0.012 | 0.042 | 0.132 | 0.257 |
| Pythia-2.8B | WikiText | 0.014 | 0.012 | 0.020 | 0.010 | 0.016 | 0.492 |
| Model | Dataset | Loss | Min-K%++ | Zlib | RefLoss | EZ-MIA | LT-MIA |
|---|---|---|---|---|---|---|---|
| GPT-2 | AG News | 0.008 | 0.008 | 0.006 | 0.008 | 0.124 | 0.044 |
| GPT-2 | WikiText | 0.008 | 0.002 | 0.006 | 0.000 | 0.002 | 0.273 |
| GPT-2 | XSum | 0.032 | 0.048 | 0.016 | 0.016 | 0.426 | 0.340 |
| GPT-2 | Code | 0.000 | 0.002 | 0.000 | 0.000 | 0.000 | 0.006 |
| Pythia-2.8B | AG News | 0.006 | 0.008 | 0.006 | 0.000 | 0.034 | 0.064 |
| Pythia-2.8B | WikiText | 0.002 | 0.000 | 0.000 | 0.004 | 0.000 | 0.291 |
| Model | Dataset | Loss | Min-K%++ | Zlib | RefLoss | EZ-MIA | LT-MIA |
|---|---|---|---|---|---|---|---|
| Mamba-2.8B | AG News | 0.949 | 0.888 | 0.918 | 0.975 | 0.983 | 0.969 |
| Mamba-2.8B | WikiText | 0.966 | 0.886 | 0.897 | 0.947 | 0.979 | 0.995 |
| Mamba-2.8B | XSum | 0.988 | 0.949 | 0.977 | 0.999 | 0.999 | 0.999 |
| Mamba-2.8B | Code | 0.565 | 0.534 | 0.555 | 0.646 | 0.763 | 0.887 |
| RWKV-3B | AG News | 0.783 | 0.703 | 0.748 | 0.931 | 0.978 | 0.976 |
| RWKV-3B | WikiText | 0.792 | 0.704 | 0.753 | 0.865 | 0.965 | 0.986 |
| Model | Dataset | Loss | Min-K%++ | Zlib | RefLoss | EZ-MIA | LT-MIA |
|---|---|---|---|---|---|---|---|
| Mamba-2.8B | AG News | 0.150 | 0.150 | 0.114 | 0.316 | 0.718 | 0.206 |
| Mamba-2.8B | WikiText | 0.462 | 0.154 | 0.544 | 0.040 | 0.330 | 0.900 |
| Mamba-2.8B | XSum | 0.774 | 0.518 | 0.800 | 0.998 | 0.986 | 0.996 |
| Mamba-2.8B | Code | 0.036 | 0.028 | 0.022 | 0.028 | 0.070 | 0.174 |
| RWKV-3B | AG News | 0.092 | 0.060 | 0.026 | 0.084 | 0.402 | 0.430 |
| RWKV-3B | WikiText | 0.066 | 0.048 | 0.090 | 0.022 | 0.050 | 0.624 |
| Model | Dataset | Loss | Min-K%++ | Zlib | RefLoss | EZ-MIA | LT-MIA |
|---|---|---|---|---|---|---|---|
| Mamba-2.8B | AG News | 0.044 | 0.052 | 0.012 | 0.000 | 0.018 | 0.018 |
| Mamba-2.8B | WikiText | 0.070 | 0.020 | 0.038 | 0.002 | 0.004 | 0.300 |
| Mamba-2.8B | XSum | 0.480 | 0.242 | 0.460 | 0.592 | 0.888 | 0.582 |
| Mamba-2.8B | Code | 0.010 | 0.018 | 0.002 | 0.002 | 0.048 | 0.058 |
| RWKV-3B | AG News | 0.010 | 0.010 | 0.008 | 0.002 | 0.098 | 0.060 |
| RWKV-3B | WikiText | 0.024 | 0.012 | 0.010 | 0.000 | 0.000 | 0.231 |
| Training Models (10) | DistilGPT-2 [ Sanh et al., 2019 ] , GPT-2-XL [ Radford et al., 2019 ] , Pythia-1.4B [ Biderman et al., 2023 ] , Cerebras-GPT-2.7B [ Dey et al., 2023 ] , GPT-J-6B [ Wang and Komatsuzaki, 2021 ] , Gemma-2B [ Gemma Team, 2024 ] , Qwen2-1.5B [ Bai et al., 2023 ] , MPT-7B [ MosaicML NLP Team, 2023 ] , Falcon-RW-1B, Falcon-7B [ Penedo et al., 2023 ] |
|---|---|
| Training Datasets (3) | News Category Dataset [ Misra, 2022 ] , Wikipedia [ Wikimedia Foundation, 2024 ] , CNN/DailyMail [ Hermann et al., 2015 ] |
| Eval Transformers (7) | GPT-2, Pythia-2.8B, Pythia-6.9B, OPT-2.7B, Llama-2-7B, Phi-2, Mistral-7B |
| Eval Non-Transformers (3) | Mamba-2.8B (state-space), RWKV-3B (linear attention), RecurrentGemma-2B (gated recurrence) |
| Eval Datasets (4) | AG News [ Zhang et al., 2015 ] , WikiText-103 [ Merity et al., 2016 ] , XSum [ Narayan et al., 2018 ] , Swallow-Code [ Fujii et al., 2025 ] |
| Classifier | Train AUC | Eval AUC | Train TPR@1% | Eval TPR@1% |
|---|---|---|---|---|
| Transformer (sequence) | 0.914 | 0.925 | 0.601 | 0.459 |
| MLP (flattened) | 0.885 | 0.877 | 0.483 | 0.343 |
| MLP (mean pooled) | 0.885 | 0.875 | 0.506 | 0.319 |
| Logistic Regression | 0.838 | 0.839 | 0.351 | 0.237 |
| Combinations | Samples/Combo | Train AUC | Eval AUC | Train TPR@1% | Eval TPR@1% |
|---|---|---|---|---|---|
| 1 | 18,000 | 0.998 | 0.796 | 0.992 | 0.185 |
| 10 | 1,800 | 0.875 | 0.843 | 0.371 | 0.244 |
| 30 | 600 | 0.862 | 0.860 | 0.409 | 0.284 |
| Model | LT-MIA AUC | LT-MIA TPR@1% | EZ-MIA AUC | EZ-MIA TPR@1% |
|---|---|---|---|---|
| GPT-2 | 0.980 | 0.632 | 0.971 | 0.058 |
| Pythia-2.8B | 0.944 | 0.492 | 0.867 | 0.016 |
| Pythia-6.9B | 0.796 | 0.137 | 0.911 | 0.036 |
| OPT-2.7B | 0.862 | 0.262 | 0.852 | 0.000 |
| Llama-2-7B | 0.781 | 0.130 | 0.733 | 0.020 |
| Phi-2 | 0.823 | 0.187 | 0.859 | 0.010 |
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 111 papers