Table of Contents
Fetching ...

Machine Unlearning in Large Language Models

Saaketh Koundinya Gundavarapu, Shreya Agarwal, Arushi Arora, Chandana Thimmalapura Jagadeeshaiah

TL;DR

This work introduces gradient ascent-based machine unlearning for large language models to address harmful outputs and copyrighted content. It proposes a three-loss framework that updates model weights to forget undesired knowledge while preserving normal behavior, and it couples this with a novel classifier-based evaluation to quantify unlearning effectiveness. Empirical results on OPT-1.3b and OPT-2.7b demonstrate substantial reductions in harmful responses and copyrighted content presence, with a dedicated LOTR copyright-unlearning setup and an auxiliary TruthfulQA-based retention test. The study contributes a practical, data-efficient approach to ethical and safe LLM deployment and outlines directions for more robust evaluation and weight-space analyses. Code for reproduction is provided, supporting adoption by researchers and practitioners seeking targeted unlearning capabilities.

Abstract

Machine unlearning, a novel area within artificial intelligence, focuses on addressing the challenge of selectively forgetting or reducing undesirable knowledge or behaviors in machine learning models, particularly in the context of large language models (LLMs). This paper introduces a methodology to align LLMs, such as Open Pre-trained Transformer Language Models, with ethical, privacy, and safety standards by leveraging the gradient ascent algorithm for knowledge unlearning. Our approach aims to selectively erase or modify learned information in LLMs, targeting harmful responses and copyrighted content. This paper presents a dual-pronged approach to enhance the ethical and safe behavior of large language models (LLMs) by addressing the issues of harmful responses and copyrighted content. To mitigate harmful responses, we applied gradient ascent on the PKU dataset, achieving a 75\% reduction in harmful responses for Open Pre-trained Transformer Language Models (OPT1.3b and OPT2.7b) \citet{zhang2022opt} while retaining previous knowledge using the TruthfulQA dataset \citet{DBLP:journals/corr/abs-2109-07958}. For handling copyrighted content, we constructed a custom dataset based on the Lord of the Rings corpus and aligned LLMs (OPT1.3b and OPT2.7b) \citet{zhang2022opt} through LoRA: Low-Rank Adaptation of Large Language Models \citet{DBLP:journals/corr/abs-2106-09685} finetuning. Subsequently, we employed gradient ascent to unlearn the Lord of the Rings content, resulting in a remarkable reduction in the presence of copyrighted material. To maintain a diverse knowledge base, we utilized the Book Corpus dataset. Additionally, we propose a new evaluation technique for assessing the effectiveness of harmful unlearning.

Machine Unlearning in Large Language Models

TL;DR

This work introduces gradient ascent-based machine unlearning for large language models to address harmful outputs and copyrighted content. It proposes a three-loss framework that updates model weights to forget undesired knowledge while preserving normal behavior, and it couples this with a novel classifier-based evaluation to quantify unlearning effectiveness. Empirical results on OPT-1.3b and OPT-2.7b demonstrate substantial reductions in harmful responses and copyrighted content presence, with a dedicated LOTR copyright-unlearning setup and an auxiliary TruthfulQA-based retention test. The study contributes a practical, data-efficient approach to ethical and safe LLM deployment and outlines directions for more robust evaluation and weight-space analyses. Code for reproduction is provided, supporting adoption by researchers and practitioners seeking targeted unlearning capabilities.

Abstract

Machine unlearning, a novel area within artificial intelligence, focuses on addressing the challenge of selectively forgetting or reducing undesirable knowledge or behaviors in machine learning models, particularly in the context of large language models (LLMs). This paper introduces a methodology to align LLMs, such as Open Pre-trained Transformer Language Models, with ethical, privacy, and safety standards by leveraging the gradient ascent algorithm for knowledge unlearning. Our approach aims to selectively erase or modify learned information in LLMs, targeting harmful responses and copyrighted content. This paper presents a dual-pronged approach to enhance the ethical and safe behavior of large language models (LLMs) by addressing the issues of harmful responses and copyrighted content. To mitigate harmful responses, we applied gradient ascent on the PKU dataset, achieving a 75\% reduction in harmful responses for Open Pre-trained Transformer Language Models (OPT1.3b and OPT2.7b) \citet{zhang2022opt} while retaining previous knowledge using the TruthfulQA dataset \citet{DBLP:journals/corr/abs-2109-07958}. For handling copyrighted content, we constructed a custom dataset based on the Lord of the Rings corpus and aligned LLMs (OPT1.3b and OPT2.7b) \citet{zhang2022opt} through LoRA: Low-Rank Adaptation of Large Language Models \citet{DBLP:journals/corr/abs-2106-09685} finetuning. Subsequently, we employed gradient ascent to unlearn the Lord of the Rings content, resulting in a remarkable reduction in the presence of copyrighted material. To maintain a diverse knowledge base, we utilized the Book Corpus dataset. Additionally, we propose a new evaluation technique for assessing the effectiveness of harmful unlearning.
Paper Structure (16 sections, 7 equations, 1 figure, 6 tables)

This paper contains 16 sections, 7 equations, 1 figure, 6 tables.

Figures (1)

  • Figure 1: Flowchart depicting the unlearning process for harmful dataset.