Learning to Detect Language Model Training Data via Active Reconstruction
Organizations: University of Washington · Cornell University · UC Berkeley · Allen Institute for Artificial Intelligence
Abstract
Detecting LLM training data is generally framed as a membership inference attack (MIA) problem. However, conventional MIAs operate passively on fixed model weights, using log-likelihoods or text generations. In this work, we introduce Active Data Reconstruction Attack (ADRA), a family of MIA that actively induces a model to reconstruct a given text through training. We hypothesize that training data are more reconstructible than non-members, and the difference in their reconstructibility can be exploited for membership inference. Motivated by findings that reinforcement learning (RL) sharpens behaviors already encoded in weights, we leverage on-policy RL to actively elicit data reconstruction by finetuning a policy initialized from the target model. To effectively use RL for MIA, we design reconstruction metrics and contrastive rewards. The resulting algorithms, ADRA and its adaptive variant ADRA+, improve both reconstruction and detection given a pool of candidate data. Experiments show that our methods consistently outperform existing MIAs in detecting pre-training, post-training, and distillation data, with an average improvement of 10.7% over the previous runner-up. In particular, \MethodPlus~improves over Min-K%++ by 18.8% on BookMIA for pre-training detection and by 7.6% on AIME for post-training detection.
Figures & tables
| Metric | Definition |
| Token set similarity | |
| Longest common sequence | |
| N-gram set coverage |
| Task | Dataset | Dataset Cutoff | Model | Model Cutoff | Max Tokens |
| Pre-training | BookMIA | 2023 | Llama2-7B | 2022* | 1024 |
| WikiMIA 2024 Hard | 2024 | Qwen2-7B | 2023* | 1024 | |
| Dolma3 ♠ (Olmo3 Mix) | 2025 | Olmo3-7B | 2024 | 2048 | |
| Post-training | AIME ♠ | 2024 | Tulu2-7B | 2023 | 4096 |
| Olympia Math ♠ | 2025 | Tulu2-7B | 2023 | 4096 | |
| Tulu3 Mix ♠ | 2024 | Tulu3-8B | 2024 | 1024 |
| Active MIAs | Passive MIAs | ||||||||
| Model | Type | ADRA+ | ADRA | N-Sampling | Loss | R-Loss | Zlib | Min-K% | Min-K%++ |
| BookMIA | |||||||||
| Llama2-7B | Orig. | 78.4 | 76.2 | 73.6 | 60.6 | N/A | 50.4 | 63.3 | 59.6 |
| Llama2-7B | Para. | 74.5 | 73.0 | 68.7 | 57.2 | N/A | 40.6 | 61.0 | 53.7 |
| WikiMIA 2024 Hard | |||||||||
| Qwen2-7B | Orig. | 60.6 | 59.1 | 54.3 | 45.7 | N/A | 44.5 | 45.4 | 50.6 |
| Model | Type | Method | Budget ( ) | Lexical Jaccard (Best / Avg) | Lexical LCS (Best / Avg) | Lexical Coverage (Best / Avg) | Embedding Cosine (Best / Avg) |
| BookMIA | |||||||
| Llama2-7B | Orig. | ADRA+ | 32 | 21.9 / 18.5 | 62 / 54 | 5.7 / 2.4 | 89.0 / 83.9 |
| ADRA | 32 | 18.9 / 15.9 | 56 / 48 | 4.2 / 2.0 | 88.6 / 84.4 | ||
| N-Sampling | 32 | 19.9 / 15.6 | 57 / 46 | 4.9 / 1.5 | 89.6 / 82.7 | ||
| WikiMIA 2024 Hard | |||||||
| Qwen2-7B | Orig. | ADRA+ | 32 | 20.1 / 14.1 | 51 / 33 | 16.1 / 6.0 | 88.4 / 82.3 |
| Active MIAs | Passive MIAs | ||||||||
| Model | Type | ADRA+ | ADRA | N-Sampling | Loss | R-Loss | Zlib | Min-K% | Min-K%++ |
| Olympia Math | |||||||||
| Tulu2-7B | Orig. | 70.5 | 67.1 | 59.5 | 53.7 | 70.3 | 55.6 | 53.2 | 60.2 |
| Tulu2-7B | Para. | 68.5 | 69.4 | 58.2 | 49.6 | 60.1 | 54.9 | 51.1 | 52.9 |
| AIME | |||||||||
| Tulu2-7B | Orig. | 85.9 | 85.6 | 72.7 | 71.1 | 67.8 | 61.7 | 75.8 | 78.3 |
| Model | Type | Method | Budget ( ) | Lexical Jaccard (Best / Avg) | Lexical LCS (Best / Avg) | Lexical Coverage (Best / Avg) | Embedding Cosine (Best / Avg) |
| Olympia Math | |||||||
| Tulu2-7B | Orig. | ADRA+ | 32 | 24.1 / 20.7 | 68 / 59 | 15.3 / 10.9 | 91.5 / 88.8 |
| ADRA | 32 | 25.6 / 23.4 | 79 / 68 | 12.3 / 10.2 | 92.8 / 91.3 | ||
| N-Sampling | 32 | 22.4 / 15.5 | 60 / 34 | 11.7 / 5.0 | 92.2 / 87.3 | ||
| AIME | |||||||
| Tulu2-7B | Orig. | ADRA+ | 32 | 22.3 / 18.1 | 55 / 39 | 17.2 / 11.9 | 91.9 / 88.9 |
| Active MIA | Passive MIAs | |||||
| ADRA | N-Sampling | Loss | R-Loss | ZLib | Min-K% | Min-K%++ |
| S1.1 Distillation: Deepseek-R1 | ||||||
| 98.4 | 90.4 | 55.1 | 70.0 | 52.6 | 55.7 | 70.6 |
| S1 Distillation: Gemini-2.0-flash | ||||||
| 85.2 | 80.8 | 69.8 | 79.3 | 74.3 | 71.9 | 81.7 |
| Method | Lexical Jaccard (Best / Avg) | Lexical LCS (Best / Avg) | Lexical Coverage (Best / Avg) | Embedding Cosine (Best / Avg) |
| S1.1 Distillation: Deepseek-R1 | ||||
| ADRA | 45.4 / 44.5 | 145 / 143 | 48.6 / 47.7 | 97.6 / 97.5 |
| N-Sampling | 32.7 / 25.5 | 111 / 82 | 34.9 / 22.3 | 97.4 / 95.6 |
| S1 Distillation: Gemini-2.0-Flash | ||||
| ADRA | 31.0 / 27.4 | 117 / 106 | 32.8 / 28.3 | 96.4 / 95.6 |
| N-Sampling | 27.8 / 21.2 | 111 / 80 | 27.4 / 17.5 | 96.2 / 93.7 |
| Active MIAs | Passive MIAs | ||||||
| ADRA+ | ADRA | N-Sampling | Loss | R-Loss | ZLib | Min-K% | Min-K%++ |
| 89.5 | 84.4 | 72.7 | 70.7 | 63.3 | 60.6 | 77.7 | 82.8 |
| Method | Lexical | Embedding | LLM-as-Judge | No-Training |
| AUROC (Top-5 Mean) | 81.3 | 76.9 | 78.8 | 74.8 |
Appendix figures & tables14 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset | Prompt Template |
| BookMIA | You will receive a prefix from a passage and be asked to complete it based on the text of a famous work. Provide only the continuation for the last given prefix without any extra commentary, formatting, or additional text. Complete the prefix: {prefix} |
| WikiMIA 2024 Hard | Continue the generation as closely to verbatim as possible. {prefix} |
| Dolma3 arXiv | Continue the generation as closely to verbatim as possible. {prefix} |
| Dataset | Learning rate | Eff. batch size | LR Schedule | Precision | Epochs | Warmup ratio | Max seq. len. |
| AIME | 2e 5 | 64 | Linear | BF16 | 1 | 0.00 | 4096 |
| Olympia Math | 5e 6 | 128 | Constant |
| Dataset | Learning rate | Eff. batch size | LR Schedule | Precision | Epochs | Warmup ratio | Max seq. len. |
| S1 - Gemini-2.0-Flash | 2e 5 | 128 | Linear | BF16 | 1 | 0.00 | 8192 |
| S1.1 - Deepseek-R1 | 5e 6 |
| Hyperparameters | Setting |
| Advantage estimator | GRPO |
| Learning rate (actor) | |
| Normalize advantages (GRPO) | True |
| Use KL loss (not reward penalty) | True |
| KL loss coef. | 0.005 |
| Entropy coefficient | 0 |
| Dataset | Batch size | Rollouts | Max prompt / response tokens | Steps | Reconstruction Metrics | Distractors | Length penalty |
| BookMIA | 64 | 32 | 1028 / 1028 | 30 | Trio , N-Gram | 7 | 1.5 |
| WikiMIA 2024 Hard | 64 | 32 | 1028 / 1028 | 30 | Trio , N-Gram | 7 | 1.5 |
| Dolma3 arXiv | 64 | 32 | 1028 / 1028 | 30 | Trio , N-Gram | 7 | 1.5 |
| AIME | 64 | 32 | 2048 / 2048 | 100 | Trio , N-Gram | 7 | 1.5 |
| OlympiaMath | 64 | 32 | 2048 / 2048 | 100 | Trio , N-Gram | 7 | 2.0 / 1.5 |
| Tulu3 Aya / Wildchat | 64 | 32 | 1024 / 512 | 200 | Trio , N-Gram | 7 | 1.5 |
| Metric | Definition | Normalization |
| Token-based Metrics | ||
| Jaccard similarity | Union (symmetric) | |
| Token overlap (ref) | Reference | |
| Token overlap (cand) | Candidate | |
| Sequence-based Metrics | ||
| LCS length | Raw (unnormalized) | |
| Model | Type | Method | Budget ( ) | Lexical Jaccard (Best / Avg) | Lexical LCS (Best / Avg) | Lexical Coverage (Best / Avg) | Embedding Cosine (Best / Avg) |
| BookMIA | |||||||
| Llama2-7B | Para. | ADRA+ | 32 | 15.8 / 13.5 | 51 / 44 | 3.0 / 1.0 | 88.2 / 84.2 |
| ADRA | 32 | 14.7 / 13.0 | 47 / 42 | 2.2 / 0.9 | 87.3 / 84.3 | ||
| N-Sampling | 32 | 15.5 / 12.3 | 48 / 39 | 2.5 / 0.5 | 88.2 / 81.5 | ||
| WikiMIA24-Hard | |||||||
| Qwen2-7B | Para. | ADRA+ | 32 | 16.4 / 13.1 | 33 / 25 | 8.1 / 4.0 | 86.5 / 82.0 |
| Model | Type | Method | Budget ( ) | Lexical Jaccard (Best / Avg) | Lexical LCS (Best / Avg) | Lexical Coverage (Best / Avg) | Embedding Cosine (Best / Avg) |
| Olympia Math | |||||||
| Tulu2-7B | Para. | ADRA+ | 32 | 23.8 / 21.0 | 67 / 60 | 16.0 / 11.4 | 91.7 / 89.3 |
| ADRA | 32 | 24.1 / 21.4 | 68 / 61 | 12.7 / 8.5 | 92.1 / 89.6 | ||
| N-Sampling | 32 | 22.8 / 15.5 | 60 / 34 | 11.9 / 5.1 | 92.4 / 87.3 | ||
| AIME | |||||||
| Tulu2-7B | Para. | ADRA+ | 32 | 22.7 / 18.8 | 54 / 40 | 17.5 / 12.7 | 92.2 / 88.8 |
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