Unintended memorization of sensitive information by fine-tuned language modelsUnintended Memorization of Sensitive Information in Fine-Tuned Language Models
The authors state that fine-tuning memorizes PII that appears only in the input; under TPA, post-training mitigation is more stable, and DP reduces leakage in specific settings but is unstable in training.
- When fine-tuning on sensitive text, PII that appears only in the input and is unrelated to downstream objectives may be memorized and extracted during queries. The authors consider this relevant to privacy regulations and personal safety, and note that existing memorization research often focuses on task-related content.
- The authors, in a black-box setting where the attacker can partially access fine-tuning data, probe with the True-Prefix Attack (TPA) and an enhanced TPA with a leading character. Data includes synthetic financial text and two sets of German medical records. Mitigations compared include differential privacy, UnDial, regularization, and DPO.
- DS, Llama 3.2 1B: DP-ε6 Regular cross is 161 (154), SFT is 1604 (1334); Reg-20% greedy is 2006 (17). The authors state that post-training is more stable. For 8B, DPO's value is 18 (18). Frequency regression R²=0.237.
- The authors note that they mainly conducted QLoRA on models under 12B; larger models, non-quantized, or full fine-tuning are left for future work. Large-scale corpora with explicit PII annotations are difficult to obtain, and there is no individual-level structure. Adversarial extraction was only preliminarily compared. The tested models in the experiments are the 7 mentioned in the paper, with three datasets.
- Evaluated models
- Llama 3.2 1BLlama 3.2 3BLlama 3.1 8BGemma-3 1BGemma-3 4BGemma-3 12BQwen-3 1.7B
- Benchmarks
- GretelAI-FinancialPathology reportsDischarge Summary
- Metrics
- accuracyF1-scoreBERTScore-F1Total PII InstancesUnique PII Entitiesextraction rateexposure rate
The paper systematically studies unintended memorization of sensitive information by fine-tuned language models, focusing on the risk of leaking personally identifiable information (PII) that appears only in model inputs, not in training targets. The authors design controlled extraction probes with synthetic and real datasets to quantify the degree of memorization, and analyze the effects of language, PII frequency, task type, and model scale on memorization behavior. The study also evaluates four categories of privacy protection methods: differential privacy, machine unlearning, regularization, and preference alignment. Results show that post-training methods generally provide more consistent privacy-task performance trade-offs, and differential privacy can substantially reduce leakage in specific settings but may introduce training instability.
Paper analysis
What problem does this paper attempt to solve?
Fine-tuning memorizes PII that appears only in the input and is unrelated to the downstream objective.
Fine-tuning memorizes PII that appears only in the input and is unrelated to the downstream objective.
- Scenario: The authors point out that sensitive text such as electronic health records often contains PII like names in fine-tuning inputs, but this content is unrelated to classification, extraction, or generation objectives; token-by-token memorization may violate privacy regulations and affect personal safety.
- Existing work: The authors state that memorization research in pretraining and fine-tuning mainly focuses on task-related data; existing PII probes also do not isolate "appearing only in the input" separately, or compare different mitigations.
- Definition: The authors define unintended PII memorization as the model internalizing PII that does not belong to the intended output, distinguishing it from pretraining memorization and from fine-tuning where PII is deliberately included in the objective.
- This paper's approach: Quantify this phenomenon with controlled extraction probes on synthetic and real data, examining language, repetition count, model scale, prefix length, and task type, and compare four privacy training methods.
- Threat model:
- Access: realistic black-box, the adversary can only make input–output queries (e.g., API).
- Knowledge: worst-case, the attacker can partially access fine-tuning data (e.g., anonymized EHR) and construct adversarial prompts accordingly.
- Objective: extract PII from training inputs; experiments mainly extract names.
- Victim system: autoregressive LLMs fine-tuned on sensitive data; the downstream objective does not contain this PII.
What related research exists?
The authors state that existing work mostly focuses on task-related memorization and has not systematically isolated input-only PII.
LLM Memorization
- Carlini et al. (2021) extract training data from autoregressive models using true prefixes; this paper's TPA follows this probing approach.
- Carlini et al. (2022) study model scale, data duplication, and prompt length in pretraining. The authors question in this paper whether "more frequent appearance leads to easier unintended memorization."
- Feldman and Zhang (2020), Morris et al. (2025), and Hu et al. (2022) discuss memorization in long-tail generalization, how much models remember, and membership inference, respectively. The paper cites them only as background.
Fine-tuning and PII Leakage
- Zeng et al. (2024) report that generative tasks memorize more training sequences than discriminative tasks. Appendix A.1 states that this pattern may not extend to input-only PII.
- Nakka et al. (2024a, 2024b) compare templates, in-context learning, and true-prefix-style probes. Lukas et al. (2023) analyze PII leakage and note that record-level differential privacy does not distinguish whose content is involved.
- The authors state that no prior work systematically isolates input-only PII or compares multiple mitigations.
Mitigation Techniques
- Differential privacy: Dwork (2006) provides the definition; Li et al. (2021), Yu et al. (2021), and Hoory et al. (2021) apply it to language model training. The authors state it has verifiable guarantees but loses utility and increases training complexity.
- UnDial (Dong et al., 2024) uses self-distillation to suppress logits of tokens to be forgotten. The authors state that Gradient Ascent and Negative Preference Optimization (Fan et al., 2025; Shi et al., 2024) are unstable in training and harm general performance.
- DPO (Rafailov et al., 2023) is adapted into preference alignment to suppress PII leakage. Nasr et al. (2023) and Wei et al. (2023) are cited only in the appendix's attack construction.
Baselines and Data
- Baselines are the pretrained base and SFT that only optimizes downstream tasks. Data includes GretelAI-Financial, Pathology reports, and Discharge Summary.
- The authors state that, to their knowledge, this is the first comprehensive study focusing on unintended PII memorization in LLM fine-tuning.
How does the paper address this problem?
Quantify input-only PII memorization with the True-Prefix Attack, and compare four mitigations.
The authors formalize the problem as input-only PII memorization, measure it with the True-Prefix Attack (TPA), and then compare four mitigations during or after fine-tuning.
Problem Setup and Extraction Probe
- PII appears only in the input, not in the training objective. Downstream tasks are classification, information extraction, and follow-up plan generation.
- Given the true prefix c before a PII segment s, if s ← argmaxs′:|s′|=N fθ(s′|c), then s is said to be extractable. Here f_θ(s'|c) is the conditional probability, and N is the number of tokens in s.
- enhanced TPA appends the first character of the PII after the prefix. After comparing other prompt attacks in Appendix A.3, the authors state that TPA's extraction rate approximates a lower bound.
- Most evaluations set the prefix to 50 tokens. The paper states the generation limit is 25 tokens after the prefix (with 50 tokens in parentheses).
Data and Tasks
- GretelAI-Financial: synthetic, multilingual financial text classification. §3.1 states approximately 30k entries after preprocessing, 7 languages, 52 labels. Appendix B.1: training 27,636, test 3,136; retaining 121,493 PII spans, 51,206 unique entities.
- Pathology: §3.1 has 2,553 German oncological pathology reports from 2020–2023, with manual annotations verified by medical professionals, the task being extraction into a 5-field JSON. Appendix B.2 states 2,552 entries after filtering, with training/validation/test of 2,041/255/256.
- Discharge Summary (DS): 26,306 German discharge summaries from 1996–2014, extracting Procedere for follow-up plans; PII in the objective is masked. The annotation pipeline is regex, LLaMa 4 Scout, and manual review (Appendix B.3).
Four Mitigations
- SFT: QLoRA, r=8, all linear layers, 10–25 epochs to early stopping; cosine learning rate, 3% of steps linear warmup. Hyperparameters are optimized only for downstream performance, not privacy. Appendix C states validation patience of 3.
- DP: (ε, δ)-DP integrated into QLoRA via Opacus, δ=10^{-5}, ε∈[2, 8]. The table reports ε=2 and ε=6. The authors state hyperparameters follow Li et al. (2021), trading utility for larger batch and learning rate.
- UnDial: self-distillation. The name subset does not overlap with names extracted in evaluation: GretelAI 17692 (40%), Pathology 1500 (40%), DS 6000 (20%). Input-output structure is the same as TPA, with the forgetting objective being PII.
- Regularization: alternating cross-entropy and UnDial loss applied only to PII spans, with the same subset as UnDial.
- DPO: original text containing PII as rejected, masked version as preferred; system prompt requires concealing all PII. For sequences with at least two PII within the following 20 tokens, a sliding 150-token window is used. This yields GretelAI 1489 entries, DS 5636 entries. β=0.01. DPO is also applied after DP-ε6. The paper does not state the DPO training set for Pathology. Specific learning rates and batch sizes are in Table 13.
Success Criteria
- Task metrics: GretelAI accuracy, Pathology F1, DS BERTScore-F1.
- Three extraction settings: greedy; temperature=1, 32 samples per prefix; cross-memorization, i.e., comparing against all PII of the same type in the dataset, not limited to the current sample's ground truth.
- GretelAI uses normalized exact substring matching. Pathology and DS use Levenshtein for names, addresses, etc., with a similarity threshold of 90%; purely numeric PII first has non-digit characters removed; emails and URLs use exact matching. The main analysis extracts names, with Appendix A.4 extending to other types.
What experiments did the paper conduct?
In Table 2, DP-ε6's Regular cross is 161 (154); on 8B, DPO is 18 (18).
Experimental Setup
- Models: Llama 3.2 1B, Llama 3.2 3B, Llama 3.1 8B, Gemma-3 1B/4B/12B, Qwen-3 1.7B. The mitigation main table is Llama 3.2 1B. LLaMa 4 Scout is only used for DS annotation.
- Data: GretelAI-Financial (training 27,636, test 3,136), Pathology (2,041/255/256), DS (26,306, 80/10/10). Main results extract names.
- Baselines and mitigations: pretrained base, SFT; DP-ε2, DP-ε6, UnDial, regularization, DPO-β0.01, and DP-ε6+DPO on DS.
- Metrics: Tasks are accuracy, F1, BERTScore-F1. Extraction cells are total counts (unique entities). Also extraction rate and exposure rate.
- Protocol: greedy; temperature 1, 32 per prefix; cross-memorization. GretelAI exact matching, pathology and DS approximate matching with 90% threshold. Language experiments 3 seeds, Figure 4 is 95% CI.
- Training: QLoRA r=8. In Table 13, DS SFT is 2e-4, batch 128, DP-ε6 is 1e-3, batch 1024, DPO is 1e-7, batch 32. DP's δ=10^{-5}.
Main Results
According to Table 2, Llama 3.2 1B, DS, names. Task column is BERTScore-F1.
Swipe horizontally to read the table
Method Task Regular greedy Regular cross Enhanced cross Base 0.5227 1 (1) 1940 (719) 9638 (3974) SFT 0.7147 1 (1) 1604 (1334) 11754 (4453) DP-ε2 0.6906 0 (0) 1143 (733) 17405 (5994) DP-ε6 0.6993 0 (0) 161 (154) 5624 (1589) UnDial-20% 0.6725 1 (1) 1587 (1103) 9456 (3593) Reg-20% 0.6770 2006 (17) 5388 (2227) 17102 (6601) DPO-β0.01 0.7084 1 (1) 1163 (1009) 6298 (2860) DP-ε6+DPO 0.6820 0 (0) 155 (148) 6108 (1798) - The authors state that post-training methods have a more consistent privacy–utility tradeoff, are more stable to hyperparameters, and are also more resource-efficient than DP and regularization; the paper does not report specific time or query counts. The authors state that on DS, DP reduces cross-memorization by more than 60%, and without using seed PII. In Table 2, DP-ε6's Regular cross is 161 (154), SFT's is 1604 (1334); but DP-ε2's Enhanced cross is 17405 (5994), higher than SFT's 11754 (4453).
- Regular sampling: SFT 71 (46), DPO 42 (33), UnDial 43 (24), DP-ε6 91 (44), DP-ε6+DPO 107 (53). Enhanced sampling: SFT 849 (165), DPO 733 (115), DP-ε6 1109 (201). The authors state that post-training is better on sampling-based TPA, with DP occasionally repeating outputs; DP+DPO does not get the advantages of both sides simultaneously.
- Reg-20%'s Regular greedy is 2006 (17), higher than SFT's 1 (1). The authors state that regularization retains more PII due to conflicting training objectives. DP-ε2 and Reg-20%'s sampling are "-" in that table.
The Other Two Datasets
- GretelAI, greedy names (Table 2): Base accuracy 0.1208, 3402 (1758); SFT 0.8717, 3601 (1720); DPO 0.7924, 2616 (1167); UnDial-40% 0.7621, 2717 (1323); DP-ε6 0.7484, 3563 (1767). DP-ε6's unique names are higher than SFT's. In that table, Sampling and Cross are "-".
- Pathology, F1 (Table 2): Base 0.2889, SFT 0.8621, DP-ε6 0.5513, UnDial-40% 0.7189. All four rows have both greedy values at 0 (0). Regular sampling: Base 72 (56), SFT 63 (51), DP-ε6 60 (50), UnDial 56 (50). Regular cross: Base 6 (4), SFT 11 (7).
- The authors state that Pathology leakage is lower, attributing this to smaller data and sparser PII. Appendix A.1 states that downstream task type has no direct effect on input-only memorization, and output format may affect whether extraction is easy.
Language, Frequency, and Prefix
- Figure 4, GretelAI, Llama 3.2 1B, average extraction rate over 3 seeds: Spanish 10.76%, English 10.69%, Dutch 9.30%, French 8.61%, German 7.62%, Italian 7.46%, Swedish 6.92%. Repeated-measures ANOVA: F(6, 12)=61.13, p=2.68×10^{-8}. Tukey HSD reports English, Spanish higher than German, Italian, Swedish (p<0.01); the authors state the difference is usually 2–4 percentage points. The authors emphasize the results come from synthetic data.
- Figure 3, DS, Llama 3.2 1B, seed 2431, enhanced TPA, cross-memorization: trend line y=0.047x+1.124, R²=0.237. The authors state that repetition count explains less than 24% of the variance, and hypothesize that context and usefulness to the downstream task have greater influence. The text also states that high-frequency PII in document headers is only memorized when the learning rate is an order of magnitude larger; the paper does not give the specific learning rate for that experiment.
- The authors state that in Figure 2, the fine-tuned model's negative log-likelihood for the same set of names is closer to 0, with smaller variance. The authors state that success rate rises quickly when the prefix goes from 25 to 50 tokens, with diminishing gains afterward; in Figure 8, GretelAI can extend to 100 tokens, DS plateaus at 50–100, and at longer lengths even the pretrained model declines.
Model Scale
- Table 1's DS task scores, base to FT: Llama 3.2 1B from 0.5227 to 0.7147, 3B from 0.5484 to 0.7304, Llama 3.1 8B from 0.3990 to 0.7386; Gemma-3 1B/4B/12B to 0.7049, 0.7273, 0.7191 respectively; Qwen-3 1.7B from 0.5403 to 0.7267.
- The authors state that larger models can extract PII even without fine-tuning, and fine-tuning at 8B–12B does not consistently increase extractable counts. In Table 1, Llama 3.1 8B's Regular cross goes from 1781 (1002) to 5469 (310), Gemma-3 12B's Enhanced cross from 8934 (2774) to 6292 (3098). Qwen-3 1.7B-FT's Regular cross is 9185 (4626), the highest in that column among FT.
- Table 4: On Llama 3.1 8B, DPO's task score is 0.7011 (SFT 0.7386), Regular cross is 18 (18) (SFT 5469 (310)), Enhanced cross is 43 (42) (SFT 7564 (1281)), Regular sampling is 14 (7). In the same table, 8B's DP-ε6 Regular greedy is 13 (12), higher than SFT's 8 (7). The authors state that as parameters grow, DP no longer prevents memorization to the same degree, and DPO is more effective on larger models; no method eliminates leakage.
Other Ablations and Analyses
- Multi-seed (Table 3, DS, Llama 3.2 1B): DP's Regular cross mean is 327.0±149.2, SFT's is 1562.0±1072.5; DPO task score 0.7213±0.0077. The authors state that the most effective method only reduces direct PII memorization by about 40%; Enhanced greedy means: SFT 45.6±25.6, DP 27.3±5.5, DPO 31.0±5.9. In Table 6, SFT, UnDial, DPO each have 5 seeds, DP-ε6 has 3.
- LoRA rank (Table 5): rank 8 and 64 both have total counts of 40 and 849, with unique entities increasing from 17, 165 to 23, 199. The header says Greedy and Sampling (32), the caption says cross-memorization; 849 (165) matches SFT's Enhanced sampling in Table 2.
- Other PII (Table 12, DS, greedy): SFT's Regular zip code goes from base's 775 (19) to 30 (10), names remain 1 (1); Enhanced names from 25 (15) to 91 (15). In Table 10, GretelAI all-type greedy totals: Base 9589, SFT 10473, DPO 7666. In Table 11, Pathology cross totals: Base 265, SFT 130, DP-ε6 269.
- Appendix attacks (Table 8): On GretelAI, ICL highest 1.521% (8 examples), PII-Compass highest 0.885%. The appendix states TPA goes from 10.0% pretrained to 11.3% fine-tuned. In Table 9, Recovery's cross unique entities are higher than bare prefix; the authors state by more than an order of magnitude. Appendix A.3 gives the full prompts for Role-Play, Recovery, Jailbreak.
- Structured output: Appendix A.1 states that on Pathology, structured and unstructured models differ by at most 1 distinct name and 2 to 3 other types; the structured model's aggregate accuracy is about 11% higher.
- UnDial tuning: Appendix C.3 states that after forgetting with 20% PII, extractable distinct PII goes from 13.44% to 12.65%, with accuracy maintained above 95% of the original model. Whether that paragraph and Table 2 are from the same run is not stated in the paper.
What are some points that can be further explored?
The authors note that it is mainly limited to QLoRA and models under 12B, and write out follow-up issues on data and adversarial evaluation.
Limitations and Future Directions Noted by the Authors
- Training approach: Mainly examines QLoRA on models below 12B. The authors consider that larger base models and reasoning-oriented architectures may have different memorization and mitigation responses; future work could look at other parameter-efficient methods, non-quantized models, and full fine-tuning (Limitations).
- Data: High-quality, large-scale corpora with explicit PII annotations are practically unavailable due to privacy and ethical constraints. The authors consider reliance on synthetic data and automatic annotation may introduce bias; the lack of individual-level structure makes it difficult to examine federated learning or user-level differential privacy. The authors list dataset construction as a future opportunity (Limitations).
- Adversarial evaluation: §A.3 is only a preliminary comparison; the authors do not claim coverage of all adversarial scenarios. White-box gradient leakage and highly optimized manual jailbreaks remain difficult to systematically evaluate. The authors state this paper mainly quantifies token-level memorization under standard inference, and uses this to motivate further research on adversarial robustness of defenses (Limitations).
- Mechanisms: Even if existing methods are effective, there is still room for improvement; why this is so, and how to design more robust, scalable defenses, the authors list as open questions (Discussion).
Experimental Coverage
- Models tested are Llama 3.2 1B, Llama 3.2 3B, Llama 3.1 8B, Gemma-3 1B/4B/12B, Qwen-3 1.7B, 7 in total (Table 1). The mitigation scale comparison uses three of the Llama models (Table 4).
- Datasets are GretelAI-Financial, Pathology, Discharge Summary. Table 2's Pathology rows are Base, SFT, DP-ε6, UnDial-40%; GretelAI additionally has DP-ε2, Reg-40%, DPO; DS additionally has DP-ε6+DPO. The main comparison extracts names, with Appendix A.4 giving other PII types.
- Evaluation includes greedy, 32 samples at temperature 1, and cross-memorization. In Table 2, GretelAI's Sampling and Cross are "-". Appendix A.3 compares ICL, PII-Compass, Role-Play, Recovery, Jailbreak.
- Language experiments use 3 seeds (Figure 4). In Table 6, SFT, UnDial, DPO each have 5 seeds, DP-ε6 has 3 seeds. DS PII is obtained by regex, 4-bit LLaMa 4 Scout, and manual review (Appendix B.3).
- The paper does not report the number of TPA prefixes in the main experiments, nor inter-annotator agreement. Training uses QLoRA; the paper states in Limitations that full fine-tuning and non-quantized models are not within this experiment's scope.
Summarize the main content of the paper
Fine-tuning can memorize input-only PII; post-training mitigations are more stable, but leakage remains.
- Positioning: Measures PII memorization that exists only in the input after fine-tuning, and compares DP, UnDial, regularization, and DPO.
- Problem: Downstream objectives do not include these PII, but names and other details may still be extracted via queries. The authors use a black-box approach and assume the attacker has partial access to fine-tuning data, such as anonymized medical records.
- Method: The main probe is TPA; enhanced TPA adds PII first characters. Data includes synthetic multilingual financial text GretelAI-Financial, as well as German Pathology and Discharge Summary. DPO treats masked text as preferred and original text as rejected; UnDial and regularization use a subset of person names that do not overlap with evaluation names.
- DS, Llama 3.2 1B (Table 2): SFT BERTScore-F1 is 0.7147. DP-ε6 Regular TPA cross is 161 (154), SFT is 1604 (1334); the authors state that DP reduces cross-memorization by more than 60% on this task. In the same table, DP-ε2 Enhanced cross is 17405 (5994), higher than SFT's 11754 (4453). Reg-20% Regular greedy is 2006 (17), higher than SFT's 1 (1).
- Sampling and scale: In the same table, DPO Regular sampling is 42 (33), SFT is 71 (46), DP-ε6 is 91 (44). In Table 4, Llama 3.1 8B DPO Regular cross is 18 (18), Enhanced cross is 43 (42), task score 0.7011, SFT is 0.7386. On GretelAI, SFT classification accuracy is 0.8717 (Table 2).
- Factors and conclusions: R²=0.237 for name frequency vs. extraction count (Figure 3). Average extraction rates across seven languages range from Swedish 6.92% to Spanish 10.76% (Figure 4). The authors state that post-training methods have more consistent trade-offs; DP reduces leakage more in specific settings but is unstable in training; no method eliminates leakage. The authors believe privacy protections should be evaluated before deployment in sensitive domains, and mechanisms and scalable defenses remain open problems.