[Paper Review] Counterfactual Memorization in Neural Language Models
Defines and analyzes counterfactual memorization in neural LMs by measuring prediction changes when a training example is omitted, and extends to counterfactual influence to trace information sources and test-time predictions.
Modern neural language models that are widely used in various NLP tasks risk memorizing sensitive information from their training data. Understanding this memorization is important in real world applications and also from a learning-theoretical perspective. An open question in previous studies of language model memorization is how to filter out "common" memorization. In fact, most memorization criteria strongly correlate with the number of occurrences in the training set, capturing memorized familiar phrases, public knowledge, templated texts, or other repeated data. We formulate a notion of counterfactual memorization which characterizes how a model's predictions change if a particular document is omitted during training. We identify and study counterfactually-memorized training examples in standard text datasets. We estimate the influence of each memorized training example on the validation set and on generated texts, showing how this can provide direct evidence of the source of memorization at test time.
Motivation & Objective
- Differentiate memorization of rare vs. common information in neural LMs using a principled causal framework.
- Quantify how the presence or absence of individual training documents affects model predictions on specific inputs.
- Extend to counterfactual influence to identify which training examples most strongly shape test and generated outputs.
Proposed method
- Define counterfactual memorization as the difference in a model’s performance on x when trained with x vs when trained without x (Equation 1).
- Estimate memorization by training m models on random subsets of D and comparing IN (x in subset) vs OUT (x not in subset) groups (Equation 2).
- Use per-token accuracy as the performance measure M and average across predicted tokens.
- Extend the approach to counterfactual influence by measuring the effect of x on another example x′ (Equation 3 and 4).
- Estimate distributions across RealNews, C4, and Wiki40B:en using a 112M-parameter decoder-only Transformer (T5-base) with 400 subsets of 25% of D.
Experimental results
Research questions
- RQ1Can we quantify memorization of rare vs. common information in LMs using counterfactual analysis?
- RQ2How does the presence/absence of a training example affect predictions on that same or related texts?
- RQ3What is the relationship between memorization and duplicate (near-duplicate) data in training corpora?
- RQ4How does memorization translate into influence on validation/test/generated outputs?
- RQ5Do counterfactual memorization and counterfactual influence reveal distinct sources and patterns of memorization?
Key findings
- Counterfactual memorization reveals rare information that is not well explained by simple duplicate counts.
- Memorization distributions show that easy examples tend to have low memorization, but there is a peak at intermediate simplicity, with high memorization for certain nontrivial cases.
- Examples with many near-duplicates tend to have lower memorization scores, indicating counterfactual memorization differs from generation-time memorization.
- Memorization generally increases with longer training (more epochs) due to overfitting, creating a long tail of memorized instances.
- Counterfactual influence shows that only a subset of memorized training examples strongly influence specific validation or generated outputs; high influence often corresponds to rare, non-shared information.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.