TL;DR
This paper investigates how much language models memorize training data when using knowledge distillation (KD), a technique to transfer knowledge from large models to smaller ones. They found that KD significantly reduces memorization compared to standard fine-tuning, making models more private and generalizable. Surprisingly, they also show that student memorization is predictable before training, and hard distillation poses a higher privacy risk than soft distillation.
What Problem Does This Paper Address?
Large language models (LLMs) can inadvertently memorize and even regurgitate parts of their training data. This is a concern for privacy, as sensitive information could be leaked. Knowledge distillation (KD) is a popular method to create smaller, more efficient LLMs by training a "student" model to mimic a larger "teacher" model. While KD is known to improve efficiency and performance, its impact on data memorization and the associated privacy risks have been poorly understood. This paper aims to fill that gap by systematically studying memorization dynamics throughout the KD pipeline, comparing it to standard fine-tuning.
Methods
The authors employ a multi-faceted approach:
- Knowledge Distillation Setup: They use three LLM families (Pythia, OLMo-2, Qwen-3) and three datasets (FineWeb, Wikitext, Nemotron-CC-v2). For soft distillation, they minimize the KL divergence between the teacher's and student's logit distributions. For hard distillation, they train the student on the teacher's generated sequences using cross-entropy.
- Memorization Evaluation: They adopt a definition of "discoverable memorization" where an example is considered memorized if the model's greedy generation of a suffix exactly matches the ground truth after being prompted with a prefix from a training example.
- Memorization Classifier: They train a logistic regression classifier to predict which examples a student model will memorize before distillation, using features like zlib entropy, perplexity, and KL divergence between teacher and baseline models.
- Analysis of Memorization Mechanisms: They analyze log probabilities and Shannon entropy to understand why distillation reduces memorization, comparing teacher, baseline, and student behaviors.
Datasets
The paper uses the following datasets:
- FineWeb: A large dataset derived from Common Crawl.
- Wikitext: A standard benchmark for language modeling.
- Nemotron-CC-v2: A synthetic dataset.
Key Insights and Ideas
- Distillation as a Privacy Shield: KD is not just about efficiency; it's a powerful tool for reducing memorization and enhancing privacy compared to standard fine-tuning.
- Predictable Memorization: The examples a student model will memorize are not random. They can be predicted using intrinsic text properties before the student is even trained. This opens doors for proactive data filtering.
- "Easy" Examples Dominate: A small subset of "easy-to-memorize" examples accounts for a disproportionately large fraction of memorization, both in teacher and student models. These examples are characterized by low zlib entropy and low perplexity.
- Hard Distillation's Hidden Risk: While both soft and hard distillation reduce memorization, hard distillation carries a higher risk of inheriting "difficult" teacher-specific examples that are not memorized by a baseline model.
Key Results
- Significant Memorization Reduction: Distilled models memorize over 50% less training data than models trained with standard fine-tuning.
- High Predictability: A memorization classifier achieves near-perfect discrimination (AUC-ROC of 0.9997) between memorized and non-memorized examples using features like zlib entropy and perplexity.
- Hard Distillation's Inheritance: Hard distillation inherits 2.7 times more teacher-specific examples than soft distillation.
- Student Generalization: Distilled students achieve better generalization (lower validation loss and perplexity) than baseline models, without sacrificing utility.
- Cross-Architecture Memorization: While models within the same family tend to memorize similar "easy" examples, there's no overlap in memorized examples across different LLM architectures (Pythia, OLMo-2, Qwen-3), suggesting inductive biases play a key role.
Limitations and Future Work
- Model-Specific Metrics: The reliance on zlib entropy, which is model-dependent due to tokenization, is a noted limitation.
- Proactive Filtering Effectiveness: While removing pre-identified memorized examples drastically reduces memorization (99.8%), a small number of new examples are still memorized, suggesting that perfect filtering is challenging.
- Future Work: The authors suggest exploring the impact of distillation on other privacy-related aspects beyond memorization, and further investigating the inductive biases that lead to cross-architecture differences in memorization. They also highlight the potential for using their findings to develop more robust privacy-preserving distillation techniques.
Summary updated