WPN: An Unlearning Method Based on N-pair Contrastive Learning in Language Models
On the map: LLM safety and security → Machine unlearning
Abstract (arXiv)
Generative language models (LMs) offer numerous advantages but may produce inappropriate or harmful outputs due to the harmful knowledge acquired during pre-training. This knowledge often manifests as undesirable correspondences, such as "harmful prompts" leading to "harmful outputs," which our research aims to mitigate through unlearning techniques.However, existing unlearning methods based on gradient ascent can significantly impair the performance of LMs. To address this issue, we propose a novel approach called Weighted Positional N-pair (WPN) Learning, which leverages position-weighted mean pooling within an n-pair contrastive learning framework. WPN is designed to modify the output distribution of LMs by eliminating specific harmful outputs (e.g., replacing toxic responses with neutral ones), thereby transforming the model's behavior from "harmful prompt-harmful output" to "harmful prompt-harmless response".Experiments on OPT and GPT-NEO LMs show that WPN effectively reduces the proportion of harmful responses, achieving a harmless rate of up to 95.8% while maintaining stable performance on nine common benchmarks (with less than 2% degradation on average). Moreover, we provide empirical evidence to demonstrate WPN's ability to weaken the harmful correspondences in terms of generalizability and robustness, as evaluated on out-of-distribution test sets and under adversarial attacks.
Key facts. Cited by 3 papers in the map (data through 14 Oct 2026). Placed in Machine unlearning, one of 12 directions in LLM safety and security. Builds on 25 of its 33 references that are in the map. First posted on arXiv 18 Aug 2024.
Builds on
25 of 33 references.
Closest ancestors · 8
Same direction, newest first
- 2024Contrastive Unlearning: A Contrastive Approach to Machine Unlearning19 Jan
- 2023Unlearn What You Want to Forget: Efficient Unlearning for LLMs31 Oct
- 2023Large Language Model Unlearning14 Oct
- 2023In-Context Unlearning: Language Models as Few Shot Unlearners11 Oct
- 2023Who's Harry Potter? Approximate Unlearning in LLMs3 Oct
- 2023KGA: A General Machine Unlearning Framework Based on Knowledge Gap Alignment11 May
- 2023Towards Unbounded Machine Unlearning20 Feb
- 2022Knowledge Unlearning for Mitigating Privacy Risks in Language Models4 Oct
Other references · 17
- 2019Momentum Contrast for Unsupervised Visual Representation Learningcited by 7,513
- 2018Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challengecited by 4,886
- 2019HellaSwag: Can a Machine Really Finish Your Sentence?cited by 4,100
- 2022OPT: Open Pre-trained Transformer Language Modelscited by 3,512
- 2019PIQA: Reasoning about Physical Commonsense in Natural Languagecited by 2,883
- 2016Deep Learning with Differential Privacycited by 2,728
- 2021SimCSE: Simple Contrastive Learning of Sentence Embeddingscited by 2,173
- 2018Unsupervised Feature Learning via Non-Parametric Instance-level Discriminationcited by 1,845
- 2019PubMedQA: A Dataset for Biomedical Research Question Answeringcited by 1,288
- 2016The LAMBADA dataset: Word prediction requiring a broad discourse contextcited by 992
- 2023BeaverTails: Towards Improved Safety Alignment of LLM via a Human-Preference Datasetcited by 860
- 2019MathQA: Towards Interpretable Math Word Problem Solving with Operation-Based Formalismscited by 662
5 more
- 2023Multi-step Jailbreaking Privacy Attacks on ChatGPTcited by 333
- 2022SGPT: GPT Sentence Embeddings for Semantic Searchcited by 204
- 2023Removing RLHF Protections in GPT-4 via Fine-Tuningcited by 171
- 2016De-identification of Patient Notes with Recurrent Neural Networkscited by 88
- 2018Algorithms that Remember: Model Inversion Attacks and Data Protection Lawcited by 55
Built on by
Citing papers per year: 2024: 1; 2025: 2.
3 papers.
Similar, not cited
Close in wording, no citation either way
- 2024Learn while Unlearn: An Iterative Unlearning Framework for Generative Language Models
- 2024Towards Safer Large Language Models through Machine Unlearning
- 2025UCD: Unlearning in LLMs via Contrastive Decoding
- 2024Negative Preference Optimization: From Catastrophic Collapse to Effective Unlearning
- 2025LUNE: Efficient LLM Unlearning via LoRA Fine-Tuning with Negative Examples
- 2025UniErase: Towards Balanced and Precise Unlearning in Language Models
- 2025BLUR: A Bi-Level Optimization Approach for LLM Unlearning
- 2024Unlearning in- vs. out-of-distribution data in LLMs under gradient-based method