locuslab/open-unlearning
[NeurIPS 2025] The one-stop repository for LLM unlearning
📚 What is OpenUnlearning?
OpenUnlearning is an open‑source Python framework that brings together a collection of LLM unlearning benchmarks, methods, datasets, and evaluation metrics under a single, easily extensible code base. It lets researchers and engineers run “forgetting” experiments on large language models (LLMs) – e.g., removing specific knowledge from a model – and compare many approaches with a common set of tools.
🎯 Core Idea
Unlearning research has been fragmented: each paper often ships its own code, data, and evaluation script. OpenUnlearning unifies these pieces so you can:
- Pick a benchmark – TOFU, MUSE, WMDP, DUET.
- Choose a model family – Llama‑3.x, Llama‑2, Phi‑3.5, Qwen2.5, Gemma, Zephyr, etc.
- Select an unlearning method – GradAscent, GradDiff, NPO, SimNPO, DPO, RMU, UNDIAL, AltPO, SatImp, WGA, CE‑U, PDU.
- Run a suite of evaluation metrics – verbatim probability/ROUGE, knowledge‑QA ROUGE, model utility, forget quality, truth‑ratio, extraction strength, exact memorization, six membership‑inference attacks, plus the full
lm‑evaluation‑harnessset (MMLU, GSM8K, …).
All of these components are configurable via Hydra, making it straightforward to add new methods, datasets, or metrics and immediately compare them against the existing baseline leaderboard.
🛠️ Main Features (as described in the README)
| Category | What’s Provided |
|---|---|
| Benchmarks | TOFU, MUSE, WMDP, DUET – each with multiple data splits and retain/forget sets. |
| Unlearning Methods | 12+ algorithms (gradient‑based, representation‑engineered, policy‑based, etc.). |
| Evaluation Metrics | 10+ metrics covering memorization, utility, and privacy attacks; integration with lm‑evaluation‑harness. |
| Datasets | MUSE‑News (BBC), MUSE‑Books (Harry Potter), TOFU splits, WMDP‑Bio/Cyber, DUET Wikidata facts. |
| Model Families | Llama‑3.2/3.1/2, Qwen2.5, Gemma, Phi‑3.5/1.5, Zephyr, plus others via Hugging Face. |
| Extensibility | Hydra‑based config system; documented guides for adding new methods, benchmarks, or metrics. |
| Reproducibility | Scripts for baseline runs, community leaderboard, and a Docker image with the full environment. |
| Resources | Pre‑trained “target” and “retain” models hosted on Hugging Face; technical report on arXiv (2506.12618). |
🚀 Quick‑Start (from the README)
# 1️⃣ Create environment
conda create -n unlearning python=3.11 && conda activate unlearning
# 2️⃣ Install package (includes lm‑eval harness extras)
pip install ".[lm-eval]"
# Install flash‑attention (optional but speeds up training)
pip install --no-build-isolation flash-attn==2.8.3
# or use the pre‑built wheel link shown in the README
# 3️⃣ Pull evaluation logs (needed for metrics that compare against a retain model)
python setup_data.py --eval
# 4️⃣ Run an unlearning experiment (example: GradAscent on TOFU forget10)
python src/train.py \
--config-name=unlearn.yaml \
experiment=unlearn/tofu/default \
forget_split=forget10 retain_split=retain90 \
trainer=GradAscent task_name=SAMPLE_UNLEARN
# 5️⃣ Evaluate the resulting model
model=Llama-3.2-1B-Instruct
python src/eval.py \
--config-name=eval.yaml \
experiment=eval/tofu/default \
model=${model} \
model.model_args.pretrained_model_name_or_path=open-unlearning/tofu_${model}_full \
retain_logs_path=saves/eval/tofu_${model}_retain90/TOFU_EVAL.json \
task_name=SAMPLE_EVAL
A Docker image (filyp/open-unlearning) is also provided for a one‑click setup.
📊 Typical Use Cases
- Research – Compare a new unlearning algorithm against the 12+ baselines on multiple benchmarks.
- Model Auditing – Measure how much private or copyrighted information can be removed from a deployed LLM.
- Teaching – Use the ready‑made scripts and leaderboard to demonstrate unlearning concepts in a classroom.
- Product Development – Integrate the framework into pipelines that need to comply with data‑deletion requests.
🤝 Contributing & Community
The repo encourages contributions:
- Add new unlearning methods, benchmarks, datasets, or metrics via the documented
contributing.mdguide. - Submit results to the community leaderboard (
community/leaderboard.md). - Report issues or ask questions through the GitHub issue tracker.
📜 License
OpenUnlearning is released under the MIT License.
📚 Further Reading
- Technical report (arXiv 2506.12618) – detailed design and experimental results.
- Links to the original TOFU and MUSE benchmark repositories for background.
- The
docs/folder contains deeper guides on Hydra configuration, experiment management, and evaluation details.
Related
- Project
- Project
- Project
- Project
- Project