Abstract: Large language model (LLM) unlearning has demonstrated its essential role in removing privacy and copyright-related responses, crucial for their legal and safe applications. However, the pursuit of complete unlearning often comes with substantial costs due to its compromises in their general functionality, leading to a notorious trade-off between unlearning and retention. It motivates this paper to explore enhanced unlearning schemes that can mitigate this trade-off. Specifically, we propose Gradient Rectified Unlearning (GRU), an improved framework that regulates the directions of gradient updates during the unlearning procedure such that their side impacts on other, unrelated responses can be minimized. GRU is easy and general to implement, demonstrating practical effectiveness across a variety of well-established unlearning benchmarks.
Introduction
As Large Language Models (LLMs) are trained on massive internet-scale datasets, they inevitably memorize sensitive information, including private addresses, copyrighted material, and hazardous instructions. While techniques like Gradient Ascent (GA) can "unlearn" this data, they often act as blunt instruments. The central challenge in this field is the unlearning-retention trade-off: aggressive unlearning can lead to "catastrophic collapse" of general reasoning abilities, while prioritizing retention often leaves sensitive data partially intact. Previous attempts to balance these goals typically rely on soft regularization terms in the loss function, which frequently results in a sub-optimal "tug-of-war."
Methodology: Gradient Rectified Unlearning (GRU)
This paper introduces Gradient Rectified Unlearning (GRU), a framework that shifts the focus from loss-function regularization to geometric gradient constraints. Instead of simply adding a penalty, GRU modifies the direction of the model's weight updates to ensure they do not interfere with general knowledge retention.
1. Gradient Rectification
At each training step, GRU calculates two distinct gradients: one for the data to be forgotten ($g_u$) and one for a representative set of data to be retained ($g_r$). If the unlearning update would increase the loss on the retain data—indicated by the gradients moving in conflicting directions—GRU "rectifies" the update. It projects the unlearning gradient onto a direction orthogonal to the retain gradient. This ensures that, under a first-order approximation, the update has zero negative impact on the model's general performance.
2. Stable Estimation and TRU
To handle the computational impossibility of calculating gradients on the entire retention set, GRU employs an Exponential Moving Average (EMA) of gradients from small mini-batches. This provides a stable "compass" for the retention direction. Furthermore, the authors propose Task vector Rectified Unlearning (TRU) for "retain-data-free" settings, using the internal structure of the unlearning set itself to guide the rectification.
Experimental Evaluation
The researchers evaluated GRU across three major benchmarks using models like Llama-2-7B and Phi-1.5:
- TOFU: A synthetic dataset for forgetting specific author profiles.
- WMDP: A benchmark for removing hazardous knowledge in biosecurity and cybersecurity.
- MUSE: A benchmark targeting copyright protection in news and books.
Key Results
GRU demonstrated a consistent "win-win" across all tasks. On the TOFU 5% unlearning task with Llama-2, standard GA caused total model collapse (Model Utility of 0.00). By applying GRU, the Model Utility was restored to 0.52, while simultaneously improving the Forget Quality (FQ) from -16.93 to -3.52. In the WMDP benchmark, GRU maintained high MMLU scores (general knowledge) while effectively purging hazardous biological and cyber information.
Discussion: The Geometry of Unlearning
A critical insight from this work is the identification of the "Obtuse Angle" Problem. The authors visualized gradient dynamics and found that standard unlearning methods like GA and Negative Preference Optimization (NPO) naturally produce gradients that point away from the retention direction (forming an obtuse angle). GRU’s primary function is to keep this angle acute or orthogonal, preventing the unlearning process from damaging unrelated knowledge.
Conclusion
GRU offers a robust, geometric solution to the unlearning-retention trade-off. By treating retention as a hard geometric constraint rather than a soft penalty, it allows LLMs to forget sensitive data without sacrificing general utility. While the method currently depends on the quality of surrogate "retain" data and introduces some computational overhead, its universality makes it a powerful wrapper for existing and future unlearning algorithms.
Summary updated