Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions community/methods/GRU/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# TITLE

- **Paper Title**: GRU: Mitigating the Trade-off Between Unlearning and Retention for Large Language Models
- **Authors**: Yue Wang, Qizhou Wang, Feng Liu, Wei Huang, Yali Du, Xiaojiang Du, Bo Han
- **Links**: [arXiv:2503.09117](https://arxiv.org/abs/2503.09117)


Provide a concise summary of your method details and its contributions. Please avoid using images to keep the repository size manageable.

# Setup

Please include the experimental setup such as

- [ ] **Hyperparameters & Search Space:** Specify key hyperparameters, their search ranges, number of trials etc.
- [ ] **Computational Setup:** Mention the type and number of GPUs used.
- [ ] **DeepSpeed Configuration:** If any modifications were made to the default DeepSpeed config, specify them here. (You may include the config as a code block.)
- [ ] **Other Details:** Any additional setup details crucial for reproducing your method.


## Computational Setup


- **GPU Details**: NVIDIA A100 80GB
- **GPU Count**: The code for our method currently supports single GPU execution. We plan to enhance the codebase in the future to support multi-GPU configurations.


# Results

To replicate your results, provide a `run.sh` script that contains all necessary commands to reproduce the final results. Ensure the script is well-documented.

It would be appreciated if you can upload the final unlearned model(s) along with their `evals` folders to HuggingFace and provide the link(s) here. As the evaluations are updated, this would help us re-evaluate your model(s).

# Citation


If you use this work, please cite:

```bibtex

@misc{wang2025grumitigatingtradeoffunlearning,
title={GRU: Mitigating the Trade-off between Unlearning and Retention for Large Language Models},
author={Yue Wang and Qizhou Wang and Feng Liu and Wei Huang and Yali Du and Xiaojiang Du and Bo Han},
year={2025},
eprint={2503.09117},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2503.09117},
}
```
45 changes: 45 additions & 0 deletions community/methods/GRU/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

# GRU with GradAscent
CUDA_VISIBLE_DEVICES=0 python src/train.py \
--config-name=unlearn.yaml \
experiment=unlearn/tofu/default \
forget_split=forget10 \
retain_split=retain90 \
trainer=GRU \
task_name=gru_ga_forget10 \
trainer.method_args.forget_loss_type=GradAscent \
trainer.args.gradient_accumulation_steps=16 \
trainer.args.per_device_train_batch_size=4

# Evaluation for GRU with GradAscent
CUDA_VISIBLE_DEVICES=0 python src/eval.py \
experiment=eval/tofu/default.yaml \
forget_split=forget10 \
model=Llama-3.2-1B-Instruct \
task_name=gru_ga_forget10 \
model.model_args.pretrained_model_name_or_path=saves/unlearn/gru_ga_forget10 \
paths.output_dir=saves/unlearn/gru_ga_forget10/evals \
retain_logs_path=saves/eval/tofu_Llama-3.2-1B-Instruct_retain90/TOFU_EVAL.json

# GRU with NPO
CUDA_VISIBLE_DEVICES=0 python src/train.py \
--config-name=unlearn.yaml \
experiment=unlearn/tofu/default \
forget_split=forget10 \
retain_split=retain90 \
trainer=GRU \
task_name=gru_npo_forget10 \
trainer.method_args.forget_loss_type=NPO \
trainer.args.gradient_accumulation_steps=16 \
trainer.args.per_device_train_batch_size=4

# Evaluation for GRU with NPO
CUDA_VISIBLE_DEVICES=0 python src/eval.py \
experiment=eval/tofu/default.yaml \
forget_split=forget10 \
model=Llama-3.2-1B-Instruct \
task_name=gru_npo_forget10 \
model.model_args.pretrained_model_name_or_path=saves/unlearn/gru_npo_forget10 \
paths.output_dir=saves/unlearn/gru_npo_forget10/evals \
retain_logs_path=saves/eval/tofu_Llama-3.2-1B-Instruct_retain90/TOFU_EVAL.json
7 changes: 7 additions & 0 deletions configs/trainer/GRU.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
defaults:
- finetune

handler: GRU
method_args:
gamma_gru: 0.8
forget_loss_type: GradAscent
3 changes: 3 additions & 0 deletions src/trainer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from trainer.unlearn.dpo import DPO
from trainer.unlearn.simnpo import SimNPO
from trainer.unlearn.rmu import RMU
from trainer.unlearn.gru import GRU


import logging

Expand Down Expand Up @@ -88,3 +90,4 @@ def load_trainer(
_register_trainer(DPO)
_register_trainer(SimNPO)
_register_trainer(RMU)
_register_trainer(GRU)
Loading
Loading