Align-then-Unlearn: Embedding Alignment for LLM Unlearning

Philipp Spohn, Leander Girrbach, Jessica Bader, Zeynep Akata

TL;DR

Large language models (LLMs) often memorize private or copyrighted text, yet token-level unlearning methods remain brittle against simple prompt rephrasing and prompt attacks. Align-then-Unlearn (ATU) moves the unlearning objective from discrete token space into continuous semantic embedding space. By training an auxiliary head to predict future text embeddings and penalizing their similarity to a forbidden concept embedding, ATU achieves deep conceptual forgetting with minimal degradation of overall model utility.

What Problem Does This Paper Address?

When asking an LLM to "unlearn" sensitive facts—like personally identifiable information (PII) or copyrighted books—state-of-the-art methods typically penalize next-token probabilities on a curated "forget set" (via gradient ascent, DPO, or negative preference optimization).

However, token-level unlearning suffers from two major flaws:

  1. Brittleness to paraphrasing: While the model might stop generating an answer to an exact question ("Who wrote The Sun Dog?"), simple prompt variations ("Tell me about the author of The Sun Dog") often easily extract the underlying fact.
  2. Heavy dataset curation: Defining what to forget requires collecting large, specific datasets of target text sequences.

The authors aim to make unlearning robust to prompt rephrasings by operating directly on conceptual meaning rather than surface tokens.

Methods

Align-then-Unlearn addresses this challenge through a two-phase process:

[Tokens] -> [LLM Hidden State h_t] 
                  │
                  ▼
         [Prediction Head E] ──> Predicted Future Embedding ê_t
                                       │
     ┌─────────────────────────────────┴─────────────────────────────────┐
     │                                                                   │
Phase 1: Alignment Training                                   Phase 2: Unlearning
Maximize sim(ê_t, e_future)                                   Minimize sim(ê_t, e_unlearn)
(e_future from frozen text encoder on next k tokens)           (e_unlearn from frozen concept prompt)
  1. Alignment Pre-training:
  2. The LLM ($M$) is augmented with a lightweight embedding prediction module ($E$, a 6-layer head).
  3. Rather than predicting single output tokens, $E$ takes hidden representation $h_t$ and predicts the semantic embedding $\hat{e}_t$ of the next $k$ tokens holistically.
  4. Reference embeddings $e_t$ are generated from a frozen, pre-trained text encoder (all-mpnet-base-v2). $E$ is trained using a cosine distance alignment loss: $$\mathcal{L}_{\text{align}} = 1 - \text{sim}(\hat{e}_t, e_t)$$

  5. Embedding-Based Unlearning:

  6. The prediction head $E$ is frozen. A target concept (e.g., "Stephen King") is mapped to an embedding $e_{\text{unlearn}}$ using the same pre-trained text encoder.
  7. The LLM's weights are fine-tuned to distance its representations from the unlearning target via a margin-based loss: $$\mathcal{L}_{\text{unlearn}} = \max\left(0, \text{sim}(\hat{e}_t, e_{\text{unlearn}}) - \tau\right)$$
  8. Only predictions with cosine similarity above threshold $\tau$ are penalized, protecting unrelated representations.
  9. Adversarial dynamic: In practice, similarity quickly drops below $\tau$. To prevent superficial avoidance, the authors alternate between realigning the predictor $E$ and unlearning the LLM $M$, forcing the core model to genuinely strip the concept from its intermediate states.

Datasets

The authors evaluate their approach on:

  • RWKU (Real-World Knowledge Unlearning) Benchmark: A benchmark consisting of 15 real-world celebrity targets, evaluated across Fill-in-the-Blank (FB), Question Answering (QA), and Adversarial Attack (AA) probes.
  • MMLU (Massive Multitask Language Understanding): Used to measure general downstream model utility after unlearning.

(Note: Synthetic benchmarks like TOFU were omitted because the frozen sentence encoder was not fine-tuned on synthetic domain profiles.)

Key Insights and Ideas

  • Conceptual vs. Lexical removal: By aligning LLM activations to dense sentence embeddings of multi-token windows, the model internalizes concept-level semantic geometry. Unlearning one text embedding removes access to the concept across diverse phrasings.
  • Deeper than output masking: Iteratively realigning $E$ against an updating $M$ creates an adversarial dynamic. The LLM cannot simply learn a shallow trick to bypass the loss at the final layer; it must fundamentally obscure the concept from its hidden representations.
  • Layer sensitivity varies by concept: Applying ATU at intermediate layers (10, 20, or 30 of Phi-3-mini-4k-instruct) yields similar averages, but individual entities respond drastically differently. For example, unlearning "Warren Buffett" at layer 10 left a 54.32% forget accuracy, while applying it at layer 20 plummeted forget accuracy to 12.40%.

Key Results

Experiments were performed on Phi-3-mini-4k-instruct (32 layers):

  • Target Erasure: At the strongest evaluated setting (20% threshold checkpoint), ATU slashed Forget QA accuracy from 47.4% down to 13.5% and Adversarial Attack accuracy from 55.8% to 25.9%.
  • Preserved Utility: Despite this heavy reduction, general reasoning performance remained remarkably stable: MMLU accuracy stood at 64.5% (compared to 64.4% before unlearning).
  • Baseline Comparison: Compared against standard methods like Gradient Ascent (GA), DPO, and NPO, ATU provides a cleaner trade-off between unlearning efficacy and general language capabilities.

Limitations and Future Work

  • Threshold Sensitivity: The margin parameter $\tau$ is sensitive; tuning $\tau$ on one entity does not reliably transfer to others, indicating a need for dynamic, adaptive thresholding.
  • Collateral Damage (Neighbor Retention): Aggressive conceptual unlearning causes overgeneralization. At high forget rates, neighbor knowledge also dropped (Neighbor FB fell from 56.2% to 41.5%), showing that conceptually adjacent knowledge gets partially suppressed.
  • Exact-Match Text: The method targets broad concepts and was not evaluated on removing verbatim strings (e.g., passwords or credit card numbers).
  • Future Directions: Developing entity-specific layer selection, applying the objective jointly across multiple layers, and fine-tuning the text encoder end-to-end.

Summary updated

BibTeX
@inproceedings{spohn2025align,
  author = {Philipp Spohn and Leander Girrbach and Jessica Bader and Zeynep Akata},
  title = {{Align-then-Unlearn: Embedding Alignment for LLM Unlearning}},
  booktitle = {MUGen @ ICML},
  year = {2025},
  url = {https://openreview.net/forum?id=pyhbguXKXQ},
}
Figure