This repository contains code and results accompanying the article Finding and Fighting the Lazy Unlearner: An Adversarial Approach. Our goal is to enable reproducibility of the main experiments and analyses presented in the article.
rmu/– Code for RMU training and producing model outputs.sae/– Code for analyzing RMU models using Sparse Autoencoders (SAE) and related probes.notebooks/– Example notebooks for analysis.
Each folder has its own environment setup (
pyproject.toml) and scripts.
Clone the repository:
git clone https://github.com/vietfood/lazy-unlearer.git
cd lazy-unlearner(Optional) On a fresh Ubuntu machine, run:
source setup.shThis will update packages, install the latest CUDA, uv, nvtop, and other dependencies needed for GPU usage.
The rmu/ folder contains scripts for RMU training. To reproduce the results:
- Setup the environment:
cd rmu
make setupThis installs all dependencies via
uv. You will need valid Hugging Face and Weights & Biases (wandb) keys.
- Run the training script:
- Move
run_test.pyandrun_base.shoutside thescripts/folder. - Execute the main run script:
source run_base.shFor multi-GPU training, launch with accelerate and set the process count to the number of GPUs you want to use. Example for 2 GPUs:
cd rmu
CUDA_VISIBLE_DEVICES=0,1 uv run accelerate launch --num_processes 2 run.py \
--model_name_or_path "google/gemma-2-2b-it" \
--steering_coeffs 750 750 \
--alpha 300 300 \
--layer_id 9 \
--max_num_batches 300 \
--batch_size 4 \
--type "original" \
--gradient_checkpointing \
--gradient_accumulation_steps 1 \
--noverboseScale --num_processes and CUDA_VISIBLE_DEVICES to match your available GPUs.
This produces the RMU-trained models used in the experiments.
For the split-GPU RMU setup where the trainable model stays on one GPU and the frozen reference model stays on a second GPU, you can use:
cd rmu
bash scripts/run_gemma3_4b_split.shFor lower-fidelity hyperparameter search on the same split-GPU setup:
cd rmu
bash scripts/hp_search_gemma3_4b_split.shBoth scripts accept environment variable overrides such as MODEL_NAME, LAYER_ID, BATCH_SIZE, MAX_NUM_BATCHES, SEARCH_N_TRIALS, and CUDA_VISIBLE_DEVICES.
The sae/ folder contains code for analyzing RMU models. To reproduce the analysis:
- Setup the environment:
cd sae
make setupSame as above, requires Hugging Face and wandb keys.
- Run analysis notebooks:
- Move the desired notebook from
notebooks/to the main folder. - Open and run it in your preferred environment (e.g., Jupyter or VSCode).
This will reproduce key figures and metrics from the article.
If you use this work in your research, please cite:
@misc{ln2025rmu,
author={Nguyen Le},
title={Finding and Fighting the Lazy Unlearner: An Adversarial Approach},
year={2025},
url={https://lenguyen.vercel.app/note/rmu-improv}
}Optional Notes / Tips:
- Ensure your GPU drivers and CUDA toolkit are compatible with the version specified in
pyproject.toml. - For large models, consider using
nvtopto monitor GPU memory usage. - Keep
run_test.pyoutside ofscripts/folder (for RMU) and notebooks outside ofnotebooks/(for analysis) to avoid path issues.