Table of Contents
Fetching ...

Effective Skill Unlearning through Intervention and Abstention

Yongce Li, Chung-En Sun, Tsui-Wei Weng

TL;DR

The paper tackles skill unlearning in large language models by proposing two training-free methods: Neuron Adjust, which at inference time shifts neuron pre-activations to align with the retaining skill distribution, and Key Space Detection, which abstains on activations whose key-space embeddings fall inside skill-specific hypercubes. Grounded by observations that pre-activation distributions differ across skills and that skill-triggering queries cluster in the FFL key space, the methods aim to forget a targeted skill while preserving overall capabilities. Empirical results on math (GSM8K), coding (MBPP), and language (MLQA) tasks across multiple models demonstrate substantial forgetting of the targeted skill (often >80%) with minimal degradation to MMLU and other abilities, with KSD offering near-perfect forgetting and robust overall performance. These findings illuminate spatial structures in neural activations and offer practical, scalable, and interpretable tools for targeted unlearning and safety controls in LLMs.

Abstract

Large language Models (LLMs) have demonstrated remarkable skills across various domains. Understanding the mechanisms behind their abilities and implementing controls over them is becoming increasingly important for developing better models. In this paper, we focus on skill unlearning in LLMs, specifically unlearning a particular skill while retaining their overall capabilities. We introduce two lightweight, training-free machine skill unlearning techniques for LLMs. First, we observe that the pre-activation distribution of neurons in each Feed-Forward Layer (FFL) differs when the model demonstrates different skills. Additionally, we find that queries triggering the same skill cluster within the FFL key space and can be separated from other queries using a hypercube. Based on these observations, we propose two lightweight, training-free skill unlearning methods via \textit{intervention} and \textit{abstention} respectively: \texttt{Neuron Adjust} and \texttt{Key Space Detection}. We evaluate our methods on unlearning math-solving, Python-coding, and comprehension skills across seven different languages. The results demonstrate their strong unlearning capabilities for the designated skills. Specifically, \texttt{Key Space Detection} achieves over 80\% relative performance drop on the forgetting skill and less than 10\% relative performance drop on other skills and the model's general knowledge (MMLU) for most unlearning tasks. Our code is available at https://github.com/Trustworthy-ML-Lab/effective_skill_unlearning

Effective Skill Unlearning through Intervention and Abstention

TL;DR

The paper tackles skill unlearning in large language models by proposing two training-free methods: Neuron Adjust, which at inference time shifts neuron pre-activations to align with the retaining skill distribution, and Key Space Detection, which abstains on activations whose key-space embeddings fall inside skill-specific hypercubes. Grounded by observations that pre-activation distributions differ across skills and that skill-triggering queries cluster in the FFL key space, the methods aim to forget a targeted skill while preserving overall capabilities. Empirical results on math (GSM8K), coding (MBPP), and language (MLQA) tasks across multiple models demonstrate substantial forgetting of the targeted skill (often >80%) with minimal degradation to MMLU and other abilities, with KSD offering near-perfect forgetting and robust overall performance. These findings illuminate spatial structures in neural activations and offer practical, scalable, and interpretable tools for targeted unlearning and safety controls in LLMs.

Abstract

Large language Models (LLMs) have demonstrated remarkable skills across various domains. Understanding the mechanisms behind their abilities and implementing controls over them is becoming increasingly important for developing better models. In this paper, we focus on skill unlearning in LLMs, specifically unlearning a particular skill while retaining their overall capabilities. We introduce two lightweight, training-free machine skill unlearning techniques for LLMs. First, we observe that the pre-activation distribution of neurons in each Feed-Forward Layer (FFL) differs when the model demonstrates different skills. Additionally, we find that queries triggering the same skill cluster within the FFL key space and can be separated from other queries using a hypercube. Based on these observations, we propose two lightweight, training-free skill unlearning methods via \textit{intervention} and \textit{abstention} respectively: \texttt{Neuron Adjust} and \texttt{Key Space Detection}. We evaluate our methods on unlearning math-solving, Python-coding, and comprehension skills across seven different languages. The results demonstrate their strong unlearning capabilities for the designated skills. Specifically, \texttt{Key Space Detection} achieves over 80\% relative performance drop on the forgetting skill and less than 10\% relative performance drop on other skills and the model's general knowledge (MMLU) for most unlearning tasks. Our code is available at https://github.com/Trustworthy-ML-Lab/effective_skill_unlearning

Paper Structure

This paper contains 17 sections, 6 equations, 9 figures, 2 tables, 2 algorithms.

Figures (9)

  • Figure 1: An overview of the proposed skill unlearning methods: Neuron Adjust (through intervention) and Key Space Detection (through abstention). This example illustrates forgetting coding skill.
  • Figure 2: An overview of the Neuron Adjust method in section \ref{['sec:neuron_adjust']}. Before adjusting a neuron, the neuron has different distributions under the forgetting and retaining datasets. During inference time, Neuron Adjust algorithm will edit neurons with large distribution shift such that its pre-activation distribution will be close to the retaining distribution.
  • Figure 3: Category distribution over different pre-activation value ranges for neuron at layer 17, index 693 (left), and layer 0, index 13366 (right).
  • Figure 4: Overview of the Key Space Detection method in section \ref{['sec:description_of_KSP_idea']}. a) shows the structure of decoder-based large language models. b) shows the components of a GLU-based feed-forward layer in the LLM, where $v_{\text{key}}$ is located in the key space we aim to prune. c) is an example of a 3-neuron key space. The blue hypercube is formed by $\{\vec{\mu}_{D} \pm \alpha\vec{\sigma}_{D}\}$, where $\vec{\mu}_{D}$ and $\vec{\sigma}_{D}$ are the sample mean vector and standard deviation vector of $v_{\text{key}}$ when probing the model with the forgetting dataset. During every inference step, if we detect $v_{\text{key}} \in \{\vec{\mu}_{D} \pm \alpha\vec{\sigma}_{D}\}$, we prohibit the model from generating the output.
  • Figure 5: Percentage of Query Vectors contained in the Hypercube $\{\vec{\mu}_{\text{gsm8k}} \pm \alpha\vec{\sigma}_{\text{gsm8k}}\}$
  • ...and 4 more figures