Introduction
Large Language Models (LLMs) frequently memorize training data verbatim, a phenomenon known as Textual Sequence Memorization (TSM). This behavior poses significant privacy and copyright risks, as sensitive information or proprietary content can be extracted through simple prompting. While unlearning methods exist, they often face a severe "erasure-utility trade-off": aggressive erasure can lead to model collapse (generating gibberish), while conservative approaches leave sensitive data retrievable.
This paper introduces EMSO (Entropy Maximization with Selective Optimization), a surgical unlearning method designed to erase thousands of memorized sequences without compromising the model's general reasoning or stability. By making the model "cautiously confused" about specific data, EMSO effectively masks sensitive memories while preserving core intelligence.
Methodology
EMSO employs a two-pronged strategy to achieve stable and localized unlearning:
1. Entropy Maximization (EM) Loss
Instead of penalizing the model for predicting a memorized token (which can cause unstable gradients), EMSO maximizes the entropy of the predictive distribution on the "forget set." This encourages the model to be uncertain rather than forcing it toward a specific "wrong" answer, resulting in a smoother optimization process compared to standard Gradient Ascent.
2. Selective Optimization via Contrastive Gradients
To minimize interference with general knowledge, EMSO performs "minimally invasive surgery" on the model weights. It identifies specific weight blocks (primarily in shallow layers and attention value matrices) using a Contrastive Gradient Metric. This metric targets weights where the gradient for memorization and the gradient for forgetting point in opposite directions, allowing for precise updates that erase memory without breaking the rest of the model.
Experimental Setup
The method was evaluated using the GPT-Neo family (125M to 2.7B parameters) on several key datasets:
- Forget Set: 15,000 sequences from the Training Data Extraction Challenge.
- Utility Sets: WikiText-103 and CC News for monitoring language fluency.
- NLU Benchmarks: Tasks including Piqa, ARC-Easy, COPA, and Hellaswag to ensure the model's logical reasoning remains intact.
Key Results and Insights
- Superior Trade-off: EMSO consistently achieved the best balance between low Memorization Accuracy (MA) and high generation quality (measured by MAUVE scores) across all model sizes.
- Stability and Efficiency: Unlike baseline methods like Gradient Ascent (GA), which often cause models to collapse when handling large-scale forget requests, EMSO remained stable. Furthermore, it does not require a "retain set" of original training data, making it highly practical for real-world deployment.
- Privacy Protection: Membership Inference Attack (MIA) tests showed that EMSO significantly reduced the ability of attackers to determine if a sequence was part of the training data, with AUC scores dropping by up to 15.8%.
- Localized Memory: Analysis revealed that memorization is largely concentrated in shallow layers (layers 1-3) and specifically within the attention mechanism's Value ($W_v$) matrices, validating the selective optimization approach.
Conclusion
EMSO demonstrates that "cautious confusion" is a more effective strategy for unlearning than outright penalization. By strategically increasing uncertainty in localized weights, the method provides a robust defense against data extraction while maintaining the utility of large-scale language models. Future work will focus on automating the detection of sensitive information to further streamline the unlearning process.
Summary updated