TRAP: Understanding and Mitigating Privacy Memorization in Language Models
Organizations: Carnegie Mellon University · NVIDIA · Purdue University
Abstract
Fine-tuning a language model on sensitive records can leave it able to reproduce them. We ask when this memorization arises and how to prevent it without knowing in advance which spans are sensitive. Our starting point is that most memorization scores and attacks share one statistical core: whether the model assigns a token more probability than some reference would. Taking as the reference a model trained on the complementary half of the same corpus gives the Target Reference Advantage (TRA), a per-token signal that separates what a model fit to a particular record from what it learned across records, and is cheap and differentiable. We then study what drives memorization during fine-tuning: it keeps growing well past the validation minimum, is larger on small datasets and at higher learning rates, and higher when the underlying task is harder. Early stopping removes much of it, but because it is chosen by aggregate validation loss it helps least for rare, hard-to-predict spans embedded in otherwise learnable text, which is exactly what sensitive information tends to be. We therefore introduce TRAP, a one-sided penalty on tokenwise TRA that acts only where the target model pulls ahead of its reference. On student essays with annotated personal information and clinical cases with patient identifiers, TRAP brings memorization near the level of an untrained model at little utility cost, where generic regularizers barely move and differential privacy gives up most of what fine-tuning bought.
Figures & tables
Appendix figures & tables52 assets
Supplementary material from the paper’s appendix.
Appendix
| experiment | format | models | training-set sizes |
|---|---|---|---|
| learning-rate sweep | APEX | Pythia-70M, 160M | , |
| training-set size sweep | APEX | Pythia-70M, 160M | to |
| per-epoch trajectories, hardness | APEX -L | Pythia-70M, 160M, 1B | |
| mixture ladder (minority) | APEX -L | Pythia-70M, 160M | in |
| rarity mixture (minority) | APEX -FavNum | Pythia-70M, 160M | to in |
| hardness-by-size grid (appendix) | APEX -full | Pythia-160M | to |
| Level | candidate_portal_id | interview_slot_code |
|---|---|---|
| L1 small lookup | P RoleCode (10-entry table) | DayLetter first letters of src, role (5-entry table) |
| L2 per-symbol shift | P , each mod 10 | |
| L3 pairwise sums | P | |
| L4 3-term linear-mod | P | |
| L5 6-term linear-mod | P | analogous six-ingredient mod-26 letter construction |
| metric | best-val | overtrained | worse when overtrained |
|---|---|---|---|
| probability ratio on the secret (geometric mean) | |||
| exposure (bits) | |||
| TRA on the secret (nats) | |||
| top-1 rate among decoys | |||
| probability AUC on the secret span | |||
| probability AUC on all tokens |
| Method | Settings on the frontier (cross-entropy, worst-case ) |
|---|---|
| TRAP, frozen reference | ( 3.42, 0.44 ); ( 3.42, 0.43 ); ( 3.42, 0.42 ); ( 3.50, 0.20 ); ( 3.52, 0.16 ); ( 3.54, 0.16 ); ( 3.55, 0.12 ); ( 3.59, 0.12 ) |
| TRAP, iterated rounds | , round 2 (first round alternating) ( 3.39, 0.64 ); , round 2 ( 3.40, 0.46 ); , round 2 ( 3.41, 0.45 ); , round 3 ( 3.42, 0.26 ); , round 3 (first round alternating) ( 3.44, 0.19 ); , round 3 (first round alternating) ( 3.47, 0.18 ); , round 3 (first round alternating) ( 3.49, 0.17 ); , round 2 ( 3.55, 0.16 ) |
| TRAP + LoRA | ( 3.36, 0.23 ); ( 3.37, 0.17 ); ( 3.45, 0.16 ); ( 3.52, 0.13 ) |
| TRAP + LoRA, iterated rounds | , round 2 ( 3.36, 0.17 ); , round 2 ( 3.40, 0.17 ); , round 1 ( 3.41, 0.16 ); , round 1 ( 3.46, 0.16 ); , round 1 ( 3.47, 0.15 ); , round 1 ( 3.52, 0.14 ); , round 1 ( 3.54, 0.13 ); , round 1 ( 3.65, 0.13 ) |
| LoRA | ( 3.36, 0.21 ); ( 3.42, 0.19 ) |
| LoRA on | ( 3.30, 0.15 ); ( 3.33, 0.14 ) |
| Method | Settings on the frontier (cross-entropy, worst-case ) |
|---|---|
| TRAP, frozen reference | ( 2.65, 0.51 ); ( 2.66, 0.50 ); ( 2.66, 0.32 ); ( 2.66, 0.30 ); ( 2.67, 0.28 ); ( 2.67, 0.25 ); ( 2.68, 0.23 ); ( 2.68, 0.21 ); ( 2.68, 0.19 ); ( 2.70, 0.19 ); ( 2.87, 0.12 ) |
| TRAP, iterated rounds | , round 2 (first round mutual) ( 2.65, 0.63 ); , round 2 (first round alternating) ( 2.65, 0.62 ); , round 2 (first round mutual) ( 2.65, 0.60 ); , round 2 (reference: undefended model) ( 2.65, 0.56 ); , round 2 ( 2.66, 0.56 ); , round 3 ( 2.67, 0.44 ); , round 2 ( 2.72, 0.21 ) |
| TRAP + LoRA | ( 2.66, 0.55 ); ( 2.67, 0.26 ); ( 2.68, 0.21 ); ( 2.68, 0.21 ); ( 2.69, 0.17 ) |
| TRAP + LoRA, iterated rounds | , round 1 ( 2.65, 0.56 ); , round 2 ( 2.65, 0.51 ); , round 2 ( 2.66, 0.33 ); , round 1 ( 2.67, 0.26 ) |
| LoRA | ( 2.68, 0.27 ) |
| LoRA on | ( 2.64, 0.40 ); ( 2.64, 0.37 ); ( 2.64, 0.36 ) |
| Method | Settings on the frontier (cross-entropy, worst-case ) |
|---|---|
| TRAP, frozen reference | ( 2.14, 0.76 ); ( 2.17, 0.76 ); ( 2.64, 0.38 ); ( 2.74, 0.33 ); ( 2.92, 0.24 ) |
| TRAP, iterated rounds | , round 4 ( 2.12, 0.74 ); , round 5 ( 2.15, 0.67 ); , round 2 ( 2.16, 0.65 ); , round 3 ( 2.21, 0.59 ); , round 2 ( 2.65, 0.39 ); , round 4 ( 2.94, 0.26 ); , round 3 ( 3.04, 0.17 ) |
| LoRA | ( 3.11, 0.24 ); ( 3.69, 0.14 ); ( 4.33, 0.10 ); ( 4.77, 0.10 ); ( 5.27, 0.10 ) |
| LoRA on | ( 4.32, 0.13 ) |
| DP-AdamW | (lot 256) ( 3.93, 0.18 ); (lot 256) ( 4.57, 0.09 ) |
| DP-SGD | (lot 256) ( 5.63, 0.10 ); (lot 256) ( 5.65, 0.09 ); (lot 256) ( 5.65, 0.09 ) |
| Method | Settings on the frontier (cross-entropy, worst-case ) |
|---|---|
| TRAP, frozen reference | ( 1.40, 0.64 ); ( 1.40, 0.62 ); ( 1.71, 0.30 ); ( 2.89, 0.18 ) |
| TRAP, iterated rounds | , round 3 ( 2.00, 0.26 ); , round 4 ( 2.06, 0.17 ) |
| LoRA | ( 2.91, 0.20 ) |
| LoRA on | ( 2.38, 0.05 ) |
| DP-AdamW | (lot 256) ( 9.72, 0.26 ); (lot 256) ( 11.88, 0.07 ) |
| DP-SGD | (lot 256) ( 2.95, 0.22 ); (lot 256) ( 3.03, 0.19 ) |
| Method | Settings on the frontier (cross-entropy, worst-case ) |
|---|---|
| TRAP, frozen reference | ( 2.29, 0.78 ); ( 2.59, 0.71 ); ( 3.05, 0.36 ) |
| LoRA | ( 3.32, 0.14 ) |
| LoRA on | ( 2.59, 0.24 ) |
| DP-AdamW | (lot 256) ( 5.28, 0.10 ); (lot 256) ( 6.40, 0.05 ) |
| DP-SGD | (lot 256) ( 5.51, 0.04 ) |
| DP-AdamW on | (lot 256) ( 4.88, 0.10 ) |
| Method | Settings on the frontier (cross-entropy, worst-case ) |
|---|---|
| TRAP, frozen reference | ( 0.0148, 0.94 ); ( 0.0191, 0.45 ); ( 0.0260, 0.24 ); ( 0.0262, 0.24 ); ( 0.0285, 0.14 ) |
| TRAP, iterated rounds | , round 2 ( 0.0278, 0.12 ) |
| TRAP + LoRA | ( 0.0149, 0.17 ); ( 0.0191, 0.17 ); ( 0.0222, 0.13 ); ( 0.0298, 0.11 ); ( 0.0336, 0.10 ) |
| TRAP + LoRA, iterated rounds | , round 2 ( 0.0179, 0.13 ) |
| LoRA | ( 0.0132, 0.49 ); ( 0.0177, 0.23 ); ( 0.0204, 0.22 ); ( 0.0205, 0.18 ); ( 0.0253, 0.16 ) |
| LoRA on | ( 0.0106, 0.38 ); ( 0.0135, 0.38 ); ( 0.0147, 0.37 ) |
| Method | Settings on the frontier (cross-entropy, worst-case ) |
|---|---|
| TRAP, frozen reference | ( 0.0094, 0.99 ); ( 0.0106, 0.58 ); ( 0.0143, 0.14 ); ( 0.0149, 0.08 ); ( 0.0197, 0.06 ) |
| TRAP, iterated rounds | , round 2 ( 0.0152, 0.27 ); , round 3 ( 0.0181, 0.16 ); , round 2 ( 0.0254, 0.10 ) |
| TRAP + LoRA | ( 0.0084, 0.14 ); ( 0.0106, 0.11 ); ( 0.0133, 0.09 ); ( 0.0151, 0.08 ) |
| TRAP + LoRA, iterated rounds | , round 2 ( 0.0110, 0.11 ); , round 2 ( 0.0169, 0.10 ) |
| LoRA | ( 0.0070, 0.51 ); ( 0.0076, 0.34 ); ( 0.0082, 0.25 ); ( 0.0091, 0.23 ); ( 0.0098, 0.17 ) |
| LoRA on | ( 0.0048, 0.64 ); ( 0.0061, 0.41 ) |