Mitigating Memorization Where It Happens
Organizations: University of British Columbia · Vector Institute · Independent Researcher
Abstract
Large language models (LLMs) can memorize and reproduce training sequences verbatim, raising privacy and copyright concerns. Existing mitigation methods apply interventions uniformly, often degrading performance on the majority of tokens that generalize normally. We study a token-level log-likelihood ratio between a target model and a domain-competent reference with lower exposure to the evaluated sequences. Exposure-controlled experiments support its use for localizing positions associated with sequence-level verbatim recall. Across evaluated settings, a minority of positions carries a disproportionate share of the positive signal, motivating selective activation correction. From the ideal memorization reduction objective, we derive a probe--steer framework which decomposes intervention into a probe that detects memorization-relevant activations and a steer that applies targeted correction only when the probe exceeds a threshold. We propose Gated Subspace Steering (GSS) as its practical instantiation: the optimal probe--steer pair admits a closed-form solution as the leading singular vectors of a gradient-weighted activation matrix. Across four benchmarks, GSS matches or exceeds state-of-the-art memorization reduction while requiring 10--100 less compute than optimization-based alternatives.
Figures & tables
| Method | Year | Math Model | Language Model | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Noise | Backdoor | Noise | Backdoor | ||||||||||
| %Mem | Acc | Time | %Mem | Acc | Time | %Mem | Perp | Time | %Mem | Perp | Time | ||
| Baseline | – | 34.55 | 97.00 | – | 99.44 | 96.81 | – | 17.60 | 57.73 | – | 100.00 | 58.45 | – |
| Spectral reg | 2024 | 0.17 | 96.84 | 12254 | 99.89 | 96.68 | 1131.5 | 0.00 | 57.92 | 10850.2 | 100.00 | 90.42 | 238.6 |
| Loss trunc | 2024 | 30.58 | 96.97 | 2391 | 99.67 | 99.96 | 347.7 | 0.00 | 57.92 | 16080 | 100.00 | 58.45 | 6005 |
| Both FT | 2024 | 0.00 | 97.17 | 28.45 | 0.00 | 91.36 | 20.35 | 0.00 | 51.63 | 1680 | 0.00 | 59.19 | 1629 |
| Pythia 2.8B | Pythia 6.9B | |||||
|---|---|---|---|---|---|---|
| Method | %Mem | PPL | Time | %Mem | PPL | Time |
| Baseline | 52.87 | 21.75 | – | 89.31 | 19.46 | – |
| HC | 44.55 | 21.35 | 2.25 | 87.55 | 17.56 | 36.01 |
| Slim | 14.46 | 23.41 | 1.96 | 33.46 | 18.90 | 280.35 |
| Act | 14.46 | 24.43 | 13.01 | 30.30 | 18.34 | 36.02 |
| Dura | 6.93 | 35.49 | 17.44 | 14.65 | 23.34 | 44.34 |
Appendix figures & tables35 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | Target weight update | Calibration / optimization access |
|---|---|---|
| GSS | No | Target, reference, calibration corpus |
| NPO implementation | Yes | Forget loss, frozen reference scores, retain loss |
| Task Vector | Yes | Fine-tuning corpus and parameter copies |
| LUNAR implementation | Yes | Unlearning/reference activations |
| ROME / MEMIT | Yes | Edit requests and implementation-specific statistics |
| Statistic | Range |
|---|---|
| Top-10% positive-mass share | 30–89% |
| Relative to uniform allocation | – |
| Gini coefficient | 0.50–0.91 |
| Normalized effective support | 0.088–0.532 |
| Positions with | 47–94% |
| Score | Positions | Sequences | AUROC | 95% CI |
|---|---|---|---|---|
| Target confidence | 120780 | 2745 | 0.909 | [0.904, 0.914] |
| 120780 | 2745 | 0.583 | [0.567, 0.599] |
| Partition | Math Noise | Math Backdoor | LM Noise | LM Backdoor | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Mem. | Acc. | Time | Mem. | Acc. | Time | Mem. | PPL | Time | Mem. | PPL | Time | |
| Random partition | 18.42 | 96.71 | 0.001 | 21.36 | 96.44 | 0.001 | 27.85 | 64.02 | 0.002 | 31.17 | 64.36 | 0.003 |
| Inverse partition | 34.79 | 96.55 | 0.001 | 39.28 | 96.21 | 0.001 | 46.63 | 64.71 | 0.002 | 49.85 | 65.08 | 0.003 |
| High- partition (GSS) | 0.00 | 96.98 | 0.001 | 0.00 | 96.82 | 0.001 | 0.00 | 63.13 | 0.002 | 0.00 | 63.17 | 0.003 |
| Reference | Sequence AUROC | 95% CI |
|---|---|---|
| Matched, unexposed | 1.000 | [1.000, 1.000] |
| Matched, exposed | 0.556 | [0.456, 0.657] |
| Independent seed, unexposed | 1.000 | [1.000, 1.000] |
| Independent seed, exposed | 0.676 | [0.585, 0.763] |
| Early checkpoint | 0.998 | [0.994, 1.000] |
| Late checkpoint | 0.000 | [0.000, 0.000] |
| Reference step | Enrichment | Sequence AUROC |
|---|---|---|
| 512 | 36.90 | 0.916 |
| 1000 | 9.42 | 0.711 |
| 2000 | 7.62 | 0.660 |
| 16000 | 2.55 | 0.498 |
| 32000 | 1.66 | 0.469 |
| 72000 | 1.39 | 0.488 |
| Reference Model Epoch | 4-layer Noisy (%) | 8-layer Noisy (%) | 4-layer Clean (%) |
|---|---|---|---|
| 50 | 0.5 | 5.1 | 0.0 |
| 100 | 4.5 | 5.2 | 0.0 |
| 150 | 11.0 | 10.0 | 0.0 |
| 200 | 16.4 | 9.2 | 0.0 |
| 250 | 6.8 | 20.0 | 0.0 |
| 300 | 20.1 | 11.7 | 0.0 |
| Reference Model Step | Mem. Rate | PPL |
|---|---|---|
| 2000 | 6.45% | 31.49 |
| 4000 | 7.11% | 29.49 |
| 6000 | 6.93% | 28.26 |
| 8000 | 7.11% | 28.64 |
| 10000 | 7.11% | 28.74 |
| Exact | PPL | Trigger | Number preservation | ||
|---|---|---|---|---|---|
| 3 | 1 | 0.1667 | 23.45 | 0.435 | 0.434 |
| 3 | 2 | 0.1732 | 23.15 | 0.325 | 0.439 |
| 10 | 1 | 0.0965 | 25.04 | 0.379 | 0.333 |
| 10 | 2 | 0.1118 | 24.15 | 0.271 | 0.379 |
| Exact-30 | Accuracy | Trigger | Number preservation | |
|---|---|---|---|---|
| 1 | 0.515 | 0.533 | 0.078 | 0.854 |
| 2 | 0.770 | 0.600 | 0.021 | 0.937 |
| Seed | Exact-30 | Number preservation | Trigger | ||
|---|---|---|---|---|---|
| 1 | 1 | 10 | 0.243 | 0.697 | 0.076 |
| 1 | 2 | 10 | 0.622 | 0.863 | 0.021 |
| 1 | 2 | 20 | 0.566 | 0.836 | 0.020 |
| 1 | 2 | 30 | 0.536 | 0.814 | 0.018 |
| 2 | 1 | 10 | 0.137 | 0.533 | 0.173 |
| 2 | 2 | 10 | 0.387 | 0.669 | 0.100 |
| Mask | Exact | PPL | Number | Entity |
|---|---|---|---|---|
| Full gate | 0.085 | 24.69 | 0.324 | 0.323 |
| No whitespace/punctuation | 0.093 | 24.31 | 0.377 | 0.349 |
| No function words | 0.089 | 24.26 | 0.340 | 0.361 |
| No numbers | 0.089 | 24.58 | 0.340 | 0.321 |
| No entities | 0.091 | 24.48 | 0.330 | 0.357 |
| No numbers/entities/function words | 0.099 | 23.95 | 0.358 | 0.392 |
| Class | Fraction | 95% CI |
|---|---|---|
| Redundant | 0.757 | [0.682, 0.836] |
| Generic/interchangeable | 0.126 | [0.068, 0.180] |
| Harmful | 0.081 | [0.038, 0.127] |
| Verbatim-critical | 0.036 | [0.000, 0.062] |
| Evaluation text | Positions | Exceedance |
|---|---|---|
| Pile (held-out) | 31600 | 0.1006 |
| UltraChat instructions | 73388 | 0.1265 |
| Long context (600 tokens) | 86580 | 0.1132 |
| Entity-heavy text | 61668 | 0.1068 |
| GSM8K | 31096 | 0.0572 |
| Number-heavy answers | 29381 | 0.0380 |
| Noisy samples | Gated PPL | Ungated PPL | |
|---|---|---|---|
| 500 | 58.97 | 62.17 | |
| 800 | 60.40 | 62.90 | |
| 1000 | 59.37 | 63.17 | |
| 1300 | 62.20 | 65.10 | |
| 1600 | 61.60 | 65.70 | |
| 1900 | 63.30 | 66.30 |
| Seed | Reproduction | Accuracy | |
|---|---|---|---|
| 1 | – | 0.884 | 0.593 |
| 1 | 1.0 | 0.833 | 0.597 |
| 1 | 3.0 | 0.513 | 0.543 |
| 1 | 10.0 | 0.246 | 0.460 |
| 2 | – | 0.854 | 0.597 |
| 2 | 1.0 | 0.793 | 0.543 |
| Setting | Score | Change | 95% CI | ||
|---|---|---|---|---|---|
| GSM8K (seed 1) | 1.0 | 7.94 | -0.23 | [-0.52, 0.05] | 0.0361 |
| GSM8K (seed 1) | 3.0 | 8.02 | -0.15 | [-0.49, 0.17] | 0.0203 |
| GSM8K (seed 1) | 10.0 | 7.07 | -1.11 | [-1.56, -0.65] | 0.9958 |
| GSM8K (seed 2) | 1.0 | 7.71 | -0.25 | [-0.58, 0.09] | 0.0758 |
| GSM8K (seed 2) | 3.0 | 7.23 | -0.73 | [-1.13, -0.35] | 0.8703 |
| GSM8K (seed 2) | 10.0 | 6.47 | -1.49 | [-1.91, -1.05] | 1.0000 |
| Domain | Exact-50-char | Control PPL | Trigger | ||
|---|---|---|---|---|---|
| healthcare | – | – | 0.913 | 1.089 | – |
| healthcare | 0.05 | 1 | 0.233 | 2.019 | 0.049 |
| healthcare | 0.05 | 3 | 0.153 | 3.213 | 0.049 |
| healthcare | 0.05 | 10 | 0.133 | 4.332 | 0.050 |
| healthcare | 0.1 | 1 | 0.053 | 4.356 | 0.097 |
| healthcare | 0.1 | 3 | 0.040 | 12.173 | 0.097 |
| Copies | Full record | Accuracy | ||
|---|---|---|---|---|
| 1 | – | 0.00 | 0.02 | 0.597 |
| 1 | 3.0 | 0.00 | 0.03 | 0.337 |
| 1 | 10.0 | 0.00 | 0.02 | 0.340 |
| 3 | – | 0.77 | 0.86 | 0.610 |
| 3 | 3.0 | 0.59 | 0.73 | 0.550 |
| 3 | 10.0 | 0.01 | 0.04 | 0.220 |
| Model | Reproduction | Accuracy | ||
|---|---|---|---|---|
| Qwen3-14B | – | – | 0.772 | 0.703 |
| Qwen3-14B | 0.05 | 0.3 | 0.529 | 0.680 |
| Qwen3-14B | 0.05 | 1.0 | 0.054 | 0.503 |
| Qwen3-14B | 0.05 | 3.0 | 0.008 | 0.280 |
| Qwen3-14B | 0.1 | 0.3 | 0.491 | 0.673 |
| Qwen3-14B | 0.1 | 1.0 | 0.045 | 0.483 |
| Method | Reproduction | Clean PPL |
|---|---|---|
| Baseline | 0.06513 | 321.49 |
| ROME (clamp 1) | 0.00000 | 831.76 |
| ROME (clamp 4) | 0.00000 | 1590547.73 |
| MEMIT | 0.00000 | 324.88 |
| AlphaEdit | 0.00000 | 381.30 |
| EMMET | 0.02204 | 322.33 |
| Exact | 4-gram precision | Cosine | Idea-only | |
|---|---|---|---|---|
| Baseline | 0.535 | 0.811 | 0.913 | 0.307 |
| 1.0 | 0.248 | 0.545 | 0.785 | 0.356 |
| 3.0 | 0.141 | 0.425 | 0.690 | 0.299 |
| 5.0 | 0.107 | 0.365 | 0.641 | 0.259 |
| 15.0 | 0.081 | 0.307 | 0.592 | 0.218 |
| 20.0 | 0.077 | 0.286 | 0.575 | 0.198 |
| Metric | Before | After | Delta |
|---|---|---|---|
| Exact memorized % | 23.97 | 0.00 | |
| Approx-only memorized % | 76.03 | 3.64 | |
| ROUGE-L mean | 0.9664 | 0.3749 |
| Metric | Before | After | Delta |
|---|---|---|---|
| Exact memorized % | 46.14 | 8.91 | |
| Approx-only memorized % | 42.18 | 34.06 | |
| ROUGE-L mean | 0.8529 | 0.4740 |
| Attack template | Prefix fraction | Base ASR (%) | Steered ASR (%) | Reduction (%) |
|---|---|---|---|---|
| Instruction-0 | 0.2 | 9.7 | 5.1 | 47 |
| Instruction-0 | 0.5 | 18.5 | 9.2 | 50 |
| Instruction-2 | 0.3 | 16.4 | 5.1 | 69 |
| Paraphrase-0 | 0.3 | 16.4 | 5.1 | 69 |
| Paraphrase-0 | 0.5 | 18.5 | 7.2 | 61 |
| Template | Prefix Fraction | # Examples | Metric | Base | Steered |
|---|---|---|---|---|---|
| Raw prefix | 0.5 | 145 | Exact Match ASR | 0.00 | 0.00 |
| Raw prefix | 0.5 | 145 | ASR@50% Token Overlap | 54.48 | 0.00 |
| Raw prefix | 0.5 | 145 | ASR@80% Token Overlap | 2.07 | 0.00 |
| Raw prefix | 0.5 | 145 | Mean Token Overlap | 0.4469 | 0.1390 |
| Raw prefix | 0.5 | 145 | Mean LCP Ratio | 0.2855 | 0.0172 |
| Raw prefix | 0.5 | 145 | Mean ROUGE-L | 0.6404 | 0.3792 |
| Model | Metric | Rank 4 | Rank 8 |
|---|---|---|---|
| Qwen3-0.6B | AUC | 0.783 | 0.811 |
| Qwen3-0.6B | Spearman | 0.530 | 0.603 |
| Llama-3.2-1B | AUC | 0.899 | 0.929 |
| Llama-3.2-1B | Spearman | 0.771 | 0.839 |
| Direction | |
|---|---|
| (probe) | |
| (steer) |
| Condition | ROUGE-L (Base, GSS) | Distinct-2 | Distinct-3 |
|---|---|---|---|
| Clean (unseen test) | 0.835 | +0.009 | +0.004 |
| Memorized (train prefix) | 0.685 | +0.023 | +0.031 |
| Category | Method | Llama (Red. %) | Qwen (Red. %) | ||
|---|---|---|---|---|---|
| UltraChat | GSM8K | UltraChat | GSM8K | ||
| Unlearning | GA | 95.5 | 4.5 | 3.3 | 0.0 |
| Task Vector | 77.0 | 25.1 | 66.0 | 25.4 | |
| DPO | 95.7 | 1.3 | 82.4 | 7.3 | |
| SimNPO | 95.5 | 2.2 | 78.8 | 7.2 | |
| NPO | 88.8 | 2.2 | 71.5 | 6.9 | |
Memorization in Language Models
Memorization in language models studies how training examples and facts are stored, recalled, generalized, and exposed by model parameters.
See all 114 papers