To Forget or Not? Towards Practical Knowledge Unlearning for Large Language Models (2024)

Abstract: Large Language Models (LLMs) trained on extensive corpora inevitably retain sensitive data, such as personal privacy information and copyrighted material. Recent advancements in knowledge unlearning involve updating LLM parameters to erase specific knowledge. However, current unlearning paradigms are mired in vague forgetting boundaries, often erasing knowledge indiscriminately. In this work, we introduce KnowUnDo, a benchmark containing copyrighted content and user privacy domains to evaluate if the unlearning process inadvertently erases essential knowledge. Our findings indicate that existing unlearning methods often suffer from excessive unlearning. To address this, we propose a simple yet effective method, MemFlex, which utilizes gradient information to precisely target and unlearn sensitive parameters. Experimental results show that MemFlex is superior to existing methods in both precise knowledge unlearning and general knowledge retaining of LLMs.

## introduction forgetting is a crucial brain function that eliminates unnecessary information to maintain neural system integrity @xcite . in parallel, large language models (llms) @xcite @xcite inevitably incorporate sensitive data during training, which is not essential for their functionality @xcite @xcite @xcite . therefore, removing sensitive knowledge from llms is imperative for ensuring the safety and integrity of these systems. the most straightforward solution involves removing such data from pre-training corpora and retraining llms, although this method is expensive and time-consuming. another approach, alignment methods like reinforcement learning from human feedback (rlhf) @xcite , is computationally expensive and requires extensive, high-quality human feedback @xcite . consequently, recent research has primarily focused on knowledge unlearning @xcite @xcite @xcite @xcite , which facilitates efficient, post-training forgetting in models. however, current evaluation paradigms are limited, typically failing to consider the extent of forgetting, instead simply unlearning all related knowledge regarding factual instances. psychological research @xcite emphasizes that forgetting is a natural and necessary process that helps focus on essential knowledge. education literature @xcite also suggests that regulating the extent of forgetting can enhance learning. under the united states code (usc) (u.s., 2018), specifically 17 u.s.c. § § 106(2), 107, 302, copyright owners are granted protections, yet the "fair use" principle permits certain uses such as criticism and commentary without explicit permission. additionally, "right to deletion" and "right to access" under california consumer privacy act (ccpa) @xcite , along with "right to erasure" and "data minimization" under general data protection regulation (gdpr) @xcite , mandate protecting users' privacy while still allowing the retention of necessary public information. these principles underline the importance of carefully considering how to retain or erase data. for instance, as shown in figure 1 , knowledge related to "where is j.k. rowling currently living?" involves personal information and should be forgotten, whereas knowledge for answering "what is j.k. rowling's most representative work?" falls in the public domain and should be retained for understanding her contribution. however, it remains unclear whether existing unlearning methods can adequately differentiate the unlearning and retaining knowledge of instances. thus, we propose knowledge unlearning with differentiated scope in llms (knowundo), a novel benchmark for more nuanced evaluations of knowledge unlearning methods, particularly in copyrighted content and user privacy domains. knowundo categorizes knowledge regarding instances into unlearn scope and retention scope based on copyright and privacy laws. unlearning methods should forget knowledge in unlearn scope while retaining knowledge in retention scope. we have also developed metrics, including unlearn success and retention success to evaluate the differentiation performance of unlearning methods under our benchmark. current unlearning methods, such as gradient ascent (ga) @xcite , unlearn factual instance knowledge but also result in the loss of general knowledge. to address this, the ga with mismatch method @xcite improves by introducing kl divergence or gradient descent on general knowledge. however, these methods suffer from updating parameters indiscriminately, which fails to differentiate the scope between unlearning and retaining. to this end, we introduce memflex, a novel strong baseline that utilizes gradient information to pinpoint the unlearn scope and retention scope within the model's parameter space. memflex precisely erases sensitive parameters, enabling llms to have a more flexible memory. our experimental results demonstrate that memflex outperforms existing methods in identifying these scopes with minimal impact on the model's general capabilities. additionally, it significantly reduces the consumption of training resources. specifically, mem-flex improves the success by an average of 7.97% when unlearning llama2-7b-chat and qwen-1.5-7b-chat in both domains. furthermore, it achieves an 11.76% reduction in training time per step. ## conclusion we formally investigate over-forgetting in knowledge unlearning and establish the novel benchmark knowundo. we also propose memflex, an efficient method for precisely targeting and unlearning sensitive knowledge. however, our localization approach is confined to the modules of llms. further research can extend this to individual neurons to achieve more precise unlearning and control.