User inference attacks against large language modelsUser Inference Attacks on Large Language Models
The authors propose a user inference attack against fine-tuned LLMs that, under black-box access, uses a likelihood ratio statistic to infer whether a user participated in fine-tuning, achieving an AUROC of up to 88% on GPT-Neo 125M (Enron).
The attacker aims to determine whether a certain user's data participated in LLM fine-tuning (user inference). The attacker has black-box access to the fine-tuned model (can only query sequence likelihoods), a small number of samples from that user's distribution (not necessarily samples in the fine-tuning set), and a reference model not trained on that user's data (a pretrained model can be used).
- When fine-tuning an LLM on user data (emails, comments, etc.), an attacker may infer whether a certain user participated in fine-tuning (user inference), which itself leaks privacy and may also serve as an entry point for further extraction attacks.
- The authors formulate the attack as a hypothesis test: using the mean log-likelihood ratio of a small number of samples from the target user (not necessarily from the fine-tuning set) on the fine-tuned model versus the reference model as the statistic, the user is judged to have participated in fine-tuning if it exceeds a threshold, and Proposition 1 theoretically characterizes the features of users susceptible to the attack.
- On GPT-Neo 125M, the attack AUROC is 88% on Enron, 66% on CC News, and 56% on Reddit; when the attacker has only 1 user document, CC News still reaches 62.0%; synthetic canary users increase AUROC by up to 40%; deduplication, limiting per-user data volume, and example-level DP only partially mitigate.
- The authors note: example-level DP protects individual samples rather than users, and user-level DP cannot yet scale to LLMs; limiting per-user data volume is only applicable to data-rich scenarios with many users; the experiments use only GPT-Neo 125M/1.3B and four English datasets, and the fine-tuning data overlaps with the pretraining corpus The Pile.
- Evaluated models
- GPT-Neo 125MGPT-Neo 1.3B
- Benchmarks
- Reddit CommentsCC NewsEnron EmailsArXiv Abstracts
- Metrics
- AUROCTPR @ 低 FPRvalidation loss
The researchers propose a user inference attack against large language models: an attacker needs only black-box access to the fine-tuned model and a small number of samples from a user (the samples need not come from the fine-tuning dataset) to infer whether that user's data was used for fine-tuning. Experiments show that large language models are vulnerable to this type of attack across a variety of fine-tuning datasets, with attack success rates approaching perfect in some settings. Theoretical and empirical analysis finds that outlier users, users with identifiable shared features among samples, and users who contributed a larger proportion of the fine-tuning data are the most vulnerable to attack. The authors propose mitigations such as sample-level differentially private training, removing duplicate samples within a user, and reducing individual users' data contribution, and note that these methods only partially mitigate the risk and that methods that can fully protect fine-tuned large language models from this privacy risk still need to be developed.
Paper analysis
What problem does this paper attempt to solve?
The authors study whether, when fine-tuning an LLM on user data, an attacker can infer whether a certain user participated in fine-tuning (user inference).
Core question: does fine-tuning an LLM on user data leak the information of "whether a certain user participated in fine-tuning"? The authors state this is the first work to study the user inference threat model for LLMs.
- Setting and importance: Products such as GitHub Copilot, Gmail Smart Compose, and GBoard fine-tune LLMs on user data (emails, text messages, code); if the fine-tuning task itself is sensitive (e.g., using only data from patients with rare diseases), merely confirming a user's participation leaks privacy, and the authors believe user inference may become a sub-step of data extraction attacks, like membership inference.
- Shortcomings of existing methods: The authors point out that membership inference assumes the attacker holds exact training samples, and extraction attacks attempt to reconstruct training data; neither makes assumptions about the user origin of training data, so they cannot estimate the risk posed by "one user contributing multiple samples that share features."
- Core observation: Samples from the same user are similar to each other in language, vocabulary, and topic; the authors' theoretical analysis (Proposition 1) suggests that users who contribute a large proportion of the data and whose data distribution is distinctive are easier to infer.
- Paper contributions: Propose a user inference attack requiring only black-box access (a likelihood ratio test statistic), empirically evaluate it on GPT-Neo, analyze factors affecting attack success, and evaluate multiple mitigation methods.
- Threat model:
- Goal: Determine whether user u's data participated in model fine-tuning.
- Knowledge: Black-box access to the fine-tuned model (can only query the likelihood of sequences, without knowing architecture or parameters); additionally a reference model not trained on u's data (can be a pretrained model).
- Capability: Holds m i.i.d. samples from u's distribution, and these samples need not be in the fine-tuning set.
- Victim system: An LLM fine-tuned on user-stratified data.
What related research exists?
Related work falls into four categories: membership inference on LLMs, data extraction, user-level membership inference, and user inference in other domains.
Membership inference on LLMs
- Mireshghallah et al. (2022)—propose a likelihood-ratio-based attack against masked language models such as BERT; Mattern et al. (2023)—compare using the average likelihood of neighboring samples, removing the assumption that the attacker knows the training distribution; Debenedetti et al. (2023)—study how LLM systems amplify membership inference.
- Carlini et al. (2021)—extract training data from GPT-2 using perplexity-based membership inference. The paper notes that membership inference requires exact training samples, whereas user inference does not.
Data extraction and memorization
- A series of works after Carlini et al. (2021) found that memorization grows with model scale (Carlini et al., 2023) and data repetition (Kandpal et al., 2022), and may be forgotten (Jagielski et al., 2023b); Lukas et al. (2023) extract PII from LLMs, and Inan et al. (2021) design a metric for confidential data leakage. The authors believe that once user inference confirms a user's participation, these techniques can be used to further estimate the amount of leakage.
User-level membership inference (stronger assumptions)
- Song and Shmatikov (2019)—the first user-level attack against generative text models, requiring training multiple shadow models; the paper notes that it cannot scale to LLMs, and that the "users" in their experiments are random i.i.d. subsets, which does not match the realistic setting of user inference.
- Shejwalkar et al. (2021)—assume the attacker knows the user's training set and aggregate membership inference results by sample for NLP classification models.
User inference (other domains)
- Miao et al. (2021)—IoT speech recognition; Li et al. (2022)—representation learning; Chen et al. (2023)—black-box auditing of face recognition; Hartmann et al. (2023)—formally define the same threat model for classification/regression tasks (called distributional membership inference), but use shadow models. The paper notes that these methods are domain-specific or computationally unscalable and are not applicable to LLMs.
Baselines and benchmarks: the attack in this paper has no direct baseline method for comparison; in the ablation, GPT-2 124M and OPT 125M are used as alternative reference models for comparison (Table 7), and the evaluation benchmarks are four user-stratified datasets: Reddit Comments, CC News, Enron Emails, and ArXiv Abstracts.
The authors position this paper as: bringing the user inference threat model to LLMs for the first time, and providing an attack that requires no shadow model and can be executed efficiently at LLM scale.
How does the paper address this problem?
User participation is cast as a hypothesis test, using the mean log-likelihood ratio of the target user's samples on the fine-tuned model versus the reference model as the statistic.
Overall idea: The attacker does not need to train a shadow model; they only need to compute the log-likelihood ratio test statistic between the fine-tuned model and the reference model on a small number of samples from the target user, and if it exceeds a threshold, the user is judged to have participated in fine-tuning.
Problem setting and formalization
- The fine-tuning distribution is modeled as a mixture of n user distributions: Dtask = ∑u=1n αu Du, where αu is the proportion of user u's data; the fine-tuning process itself is unaware of user stratification.
- The attacker's task is to test H0: pθ was not trained on u vs. H1: pθ was trained on u; since this composite hypothesis is difficult to test directly, the authors replace it with an alternative hypothesis: whether the samples come from the reference model distribution or the fine-tuned model distribution.
Attack statistic
- By the Neyman-Pearson lemma, the optimal test for the alternative hypothesis is the likelihood ratio test, with statistic T(x(1),…,x(m)) = ∑i=1m log (pθ(x(i)))/(pref(x(i))), i.e., the sum of the log-likelihood ratios of the samples; in practice, the mean T̂ normalized by m is used.
- The authors assume the samples are independent (acknowledging that scenarios such as email threads may violate this, but it makes computation feasible).
- Theoretical analysis (Proposition 1): Under the assumption that pθ and pref perfectly fit their respective distributions, the population mean of the statistic is bounded between log(αu)+KL(Du∥D−u) and αu·χ²(Du∥D−u), suggesting that users with a large data proportion and a distinctive distribution are easier to infer.
Datasets and evaluation protocol
- Three main datasets: Reddit Comments (username as user, 5194 users, 1002K samples), CC News (web domain as "user", 2839 users, 660K samples), Enron Emails (sender address as user, 136 users, 91K samples) (Table 1); ArXiv Abstracts results are in Appendix E.
- For each dataset, users are split into held-in (used for fine-tuning) and held-out (used for evaluating the attack) halves; 10% of each user's samples are reserved for the attacker as knowledge and are never used for fine-tuning.
- Metrics: ROC curves are drawn over the statistics of held-in and held-out users, with AUROC as the summary metric, and TPR at low FPR (e.g., 1%) is also reported.
Models and fine-tuning
- The target models are GPT-Neo 125M and 1.3B (pretrained on The Pile); the reference model defaults to pretrained GPT-Neo.
- Fine-tuning: full parameters, 10 epochs, Adam, learning rate 5×10⁻⁵, linear decay with 200-step warmup, batch size 8; the best checkpoint is selected by validation loss on held-in users.
Canary users and mitigations
- To evaluate worst-case risk, synthetic canary users are constructed: taking real users and inserting into each of their samples a shared substring randomly sampled from that user's documents (1–100 tokens), with 180 canary users injected into Reddit and CC News (the algorithm is given in Appendix D.2).
- Mitigations evaluated: batch/per-example gradient clipping, early stopping, limiting the number of fine-tuning samples per user, intra-user deduplication, example-level DP (DP-Adam, (ε, 10⁻⁶)-DP, with ε set to 2/8/32).
What experiments did the paper conduct?
The attack is evaluated on GPT-Neo 125M/1.3B and four datasets, with AUROC 56%–88%, and the influencing factors and five mitigation measures are systematically analyzed.
Experimental setup
- Models evaluated: GPT-Neo 125M (main experiments), GPT-Neo 1.3B (scale analysis, CC News only).
- Datasets: Reddit Comments (5194 users), CC News (2839 users), Enron Emails (136 users) (Table 1); ArXiv Abstracts (16511 users) in Appendix E.1.
- Attack setup: The reference model is pretrained GPT-Neo; the attacker's knowledge defaults to 10% of each user's samples (not used in fine-tuning).
- Metrics: AUROC (ROC computed over the statistics of held-in/held-out users), and TPR at low FPR; some results are the mean ± standard deviation of 100 bootstraps.
- Fine-tuning: 10 epochs, batch size 8, learning rate 5×10⁻⁵; each fine-tuning run of 125M takes about 16 hours (single A100), and 1.3B about 100 hours.
- Number of repetitions: The attacker knowledge experiments use 100 random draws (Figure 5); the canary and ablation experiments use 100 bootstraps.
Main results
AUROC of the attack on GPT-Neo 125M (Figure 2) and TPR at low FPR (Table 4):
Swipe horizontally to read the table
Dataset AUROC TPR@FPR=1% TPR@FPR=5% Enron Emails 88% 4.41% 27.94% CC News 66% 4.33% 11.02% Reddit Comments 56% 1.47% 7.05% ArXiv Abstracts (Appendix E.1) 57% 2.24% 8.44% - The authors use Proposition 1 to explain the differences: Enron has few users, each person's data accounts for a large proportion, and emails contain identifying information such as names and addresses; Reddit has many users and few samples per person.
- The authors point out that although Enron's AUROC is high, its TPR@FPR=1% (4.41%) is comparable to CC News (4.33%), and the gap only emerges at FPR=5%.
Analysis of influencing factors
- Attacker knowledge (Figure 5): On CC News, AUROC rises from 62.0±3.3% with 1 document to 68.1±0.6% with 50 documents; with only 1 document, Enron already reaches 73.2%. The authors state that the attacker does not need much data to launch the attack.
- User-level overfitting (Figure 3): The validation loss of held-in users keeps decreasing while that of held-out users increases; the Spearman correlation between the generalization gap and attack AUROC is at least 99.4% on all datasets (at least 99.8% for ArXiv). The authors state this reflects the close relationship between user-level overfitting and user inference.
- Model scale (Figure 4, CC News): The attack AUROC of 1.3B and 125M is almost the same (65.3% vs. 65.8%), and the generalization gaps are also close (0.57 vs. 0.53). The authors state this is qualitatively different from the phenomenon that membership inference increases with scale.
Canary worst-case experiments
- Shared substrings (Figure 6 left): The attack AUROC of canary users is higher than that of real users and increases with the length of the shared substring; short substrings can already raise AUROC from 63% to 69% (CC News, 5 tokens) and from 56% to 65% (Reddit, 10 tokens); the abstract states that canaries raise AUROC by at most 40%.
- Gradient norms (Figure 7 right): The gradient norm distributions of canaries and real samples are almost indistinguishable, and the authors state that canaries are difficult to filter by gradient norm.
- Data per user (Figure 6 right): On CC News, the canary AUROC drops from 77% with 100 documents per user to near random with 5 documents; the trend on Reddit is similar.
Evaluation of mitigations
- Gradient clipping (Figure 7 left, 125M, CC News): Neither batch nor per-example clipping has any effect on the attack, and the authors consider it an ineffective mitigation strategy.
- Early stopping (Figure 3): CC News reaches 95% of the final AUROC at 15K steps (5% of total fine-tuning), and Reddit at 90K steps (18%); the authors state this shows a trade-off between model utility and privacy.
- Intra-user deduplication (Figure 8, Table 5, CC News): AUROC drops from 65.7% to 59.1%, and the ROC curve is consistently lower at all FPRs; however, Reddit and Enron, which have no duplicates, are still attacked, and the authors state that deduplication is insufficient to fully mitigate.
- Example-level DP (Table 2, Enron, 125M): At ε=2/8/32, AUROC is 64.7%/66.7%/67.9% (non-private 88.1%), and validation loss is 2.77/2.71/2.67 (non-private 2.43); TPR@FPR=1% does not decrease but increases under DP (10.3% at ε=32, non-private 4.4%), and at FPR=3% the TPR at ε=32 is 10% versus 6% non-private (Appendix E.4). The authors state that example-level DP protects individual samples rather than users and cannot fully defend against the attack.
Other ablations and analyses
- Aggregation function (Table 6): Mean aggregation outperforms max/min (e.g., Enron: 87.3% vs. 71.1%/57.9%).
- Reference model (Table 7): Pretrained GPT-Neo 125M is best (Enron 87.8%), while independently trained GPT-2 124M (74.1%) and OPT 125M (77.9%) still retain some attack power.
- Dataset size (Appendix E.2, Reddit): The 4-month small dataset has AUROC 60.1%, and the 6-month full dataset 55.8%; the authors state this is consistent with the intuition of Proposition 1.
- Pretraining data overlap: The authors note that the fine-tuning data overlaps with The Pile, but believe the overlap is only a small part of The Pile and would only weaken the attack, causing the results to underestimate the true risk.
What are some points that can be further explored?
The authors note that example-level DP protects individual samples rather than users, that user-level DP cannot yet scale to LLMs, and that full defense remains an open problem.
Limitations and future directions noted by the authors
- Misalignment of example-level DP: its design goal is to protect individual samples rather than users who contribute multiple samples, and it may fail when a user contributes many samples (Section 4.4).
- User-level DP is not yet scalable: existing user-level DP algorithms are designed for small models in federated learning and cannot yet be scaled to LLMs; the authors state that scalable user-level DP algorithms and software are needed (Section 4.4, Section 5, Appendix F).
- Applicability of data-volume limiting measures: limiting the amount of per-user fine-tuning data is only feasible for data-rich applications with many users; developing effective mitigation for data-scarce applications remains an open problem (Section 4.4 Summary).
- Engineering challenges of user-level DP: it requires fast data loaders that sample by user and fine-grained accounting of user contributions, and existing methods require data to be partitioned disjointly by user, which scenarios such as email threads and collaborative documents do not satisfy (Appendix F).
- Future directions: explore LLM privacy threats beyond membership inference and data extraction; connect authorship attribution with fine-tuning privacy attacks; achieve full defense with provable guarantees (Section 5, Section 6, Appendix C).
Scope of experiments
- The models tested are GPT-Neo 125M and 1.3B, 2 in total; 1.3B is evaluated only on CC News (Section 4.1, 4.2).
- The evaluation datasets are Reddit Comments, CC News, Enron Emails, and ArXiv Abstracts, 4 English text datasets in total (Table 1, Table 3).
- The mitigation evaluation covers gradient clipping, early stopping, per-user data caps, within-user deduplication, and example-level DP, 5 in total; the deduplication experiment is conducted only on CC News (Section 4.4).
- The example-level DP experiment is conducted only on Enron with the 125M model, with ε set to 2/8/32 and δ=10⁻⁶ (Table 2).
- The paper does not report numbers for the number of attack queries or computational cost; the authors note that the fine-tuning data overlaps with the pretraining corpus The Pile and believe this causes the attack to be underestimated (Section 4.1 Remarks).
Summarize the main content of the paper
The authors propose and empirically demonstrate a user inference attack against fine-tuned LLMs, analyze susceptibility factors, and find that common mitigation measures only partially work.
An attack paper on user privacy in fine-tuned LLMs. The authors study user inference: an attacker determines whether a certain user's data participated in fine-tuning based solely on black-box likelihood queries to the fine-tuned model and a small number of samples from the target user (not necessarily from the fine-tuning set).
- Method: the attack is formulated as a likelihood ratio test—computing the mean log-likelihood ratio of the user's samples on the fine-tuned model versus the reference model (pretrained model), and judging participation if it exceeds a threshold; Proposition 1 theoretically indicates that users with a large data proportion and a distinctive distribution are more easily identified.
- Main results: on GPT-Neo 125M, the attack AUROC is 88% on Enron, 66% on CC News, 56% on Reddit, and 57% on ArXiv (Figure 2, Appendix E.1); when the attacker holds only 1 user document, CC News still reaches 62.0%.
- Mechanism findings: the attack success rate has a Spearman correlation of at least 99.4% with the user-level generalization gap; the attack effectiveness is almost the same on the 125M and 1.3B models (65.8% vs. 65.3%), which the authors state differs from the pattern that membership inference increases with scale.
- Worst case: canary users constructed by inserting shared substrings into real user samples increase AUROC by up to 40%, shared substrings of 5–10 tokens can already markedly exacerbate the risk, and their gradient norms are almost indistinguishable from those of real samples.
- Mitigation: deduplication reduces the AUROC on CC News from 65.7% to 59.1%; limiting per-user data volume is effective but only applicable to scenarios with many users; example-level DP (ε=32) reduces the AUROC on Enron from 88.1% to 67.9%, but at low FPR the TPR does not decrease but increases, and the validation loss rises from 2.43 to 2.67.
- Authors' conclusion: user inference is a realistic privacy threat to fine-tuning LLMs on user data, and common heuristic measures are difficult to fully mitigate; the authors believe that algorithms capable of scaling user-level DP to LLM scale are needed, and leave full defense as an open problem.
Related papers
- Near-Duplicate Families Break Exact-Record Membership InferenceAnalysis / interpretabilityarXiv
Show 2 more papers
- Context Inference Attacks Without JailbreaksAttacksarXiv
- TranScopeAttacksarXiv