Skip to content

Add PALU Unlearning Method - #210

Merged
molereddy merged 4 commits into
locuslab:mainfrom
nxZhai:feat/palu
Nov 10, 2026
Merged

molereddy merged 4 commits into
locuslab:mainfrom
nxZhai:feat/palu

Conversation

@nxZhai

@nxZhai nxZhai commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR adds the implementation of the ACL 2026 paper PALU (2601.03190, nxZhai/PALU) to Open-Unlearning.

  • Add the PALU trainer with prefix-aware localized logit flattening and configurable forward, reverse, or equally weighted mixed KL constraints.
  • Add annotated TOFU data, a dedicated dataset loader, trainer and experiment configurations, and registry entries.
  • Add example and parameter-grid scripts, method documentation, and regression tests.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Have you gone through the contributions guide?
  • Are your changes documented? Read documentation guidelines here.

1. Add the PALU trainer with forward, reverse, and equally weighted mixed KL constraints.
2. Add annotated TOFU data, dataset loading, configurations, run scripts, documentation, and regression tests.
Copilot AI balanced review requested due to automatic review settings November 4, 2026 18:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Both PALU training scripts default to an unpopulated reference-log directory, causing evaluation to fail before training begins under the documented setup.

1 open issue
What changed in this PR

Adds PALU to Open-Unlearning’s trainer and dataset pipelines, with TOFU configurations, usage examples, and regression tests.

Changes:

  • Implements prefix-aware localized logit flattening with forward, reverse, or equally weighted mixed KL preservation.
  • Adds an annotation-aware dataset loader, registry entries, and TOFU experiment settings.
  • Provides example and parameter-grid scripts, method documentation, and regression coverage.
File Description
tests/​test_palu.py Adds objective, gradient, masking, and dataset regression checks.
src/​trainer/​unlearn/​palu.py Implements the PALU training objective.
src/​trainer/​__init__.py Registers the PALU trainer.
src/​data/​palu.py Maps sensitive character spans to token labels.
src/​data/​__init__.py Registers the PALU dataset loader.
README.md Lists PALU among supported methods.
docs/​links.md Adds PALU research and source links.
configs/​trainer/​PALU.yaml Defines PALU trainer defaults.
configs/​experiment/​unlearn/​tofu/​palu.yaml Configures PALU experiments on TOFU.
configs/​data/​datasets/​TOFU_QA_forget_palu.yaml Configures annotated forget-data loading.
community/​methods/​PALU/​scripts/​tofu/​train_tofu_palu_llama3.sh Adds a Llama-3.1 parameter sweep.
community/​methods/​PALU/​scripts/​tofu/​train_tofu_palu_llama2.sh Adds a Llama-2 parameter sweep.
community/​methods/​PALU/​run.sh Provides a single-run example.
community/​methods/​PALU/​README.md Documents the method, annotations, and usage.
community/​methods/​PALU/​LICENSE Preserves the upstream MIT notice.
community/​methods/​PALU/​data/​forget10_with_common_words_gpt/​state.json Defines saved-dataset state for forget10.
community/​methods/​PALU/​data/​forget10_with_common_words_gpt/​dataset_info.json Defines the forget10 annotation schema.
community/​methods/​PALU/​data/​forget05_with_common_words_gpt/​state.json Defines saved-dataset state for forget05.
community/​methods/​PALU/​data/​forget05_with_common_words_gpt/​dataset_info.json Defines the forget05 annotation schema.
community/​methods/​PALU/​data/​forget01_with_common_words_gpt/​state.json Defines saved-dataset state for forget01.
community/​methods/​PALU/​data/​forget01_with_common_words_gpt/​dataset_info.json Defines the forget01 annotation schema.
community/​methods/​PALU/​.gitignore Allows tracking bundled annotation data.

Review effort: Balanced

1. Default RETAIN_LOGS_ROOT to saves/eval in both TOFU scripts while preserving environment overrides.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

A tokenizer-inserted terminal EOS remains masked in answer-containing examples, omitting its preservation loss instead of receiving the expected -200 label.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Unmask existing terminal EOS when answer tokens are present

src/​data/​palu.py:117

When a fast tokenizer inserts a terminal EOS with (0, 0) offsets, the label loop assigns it -100, and this branch leaves it masked because EOS is already present. Its prediction therefore receives no preservation loss, unlike an explicitly appended EOS. Set an existing terminal EOS label to -200 when answer tokens are present, including at max_length, while leaving prompt-only truncated examples masked.

1 resolved since last review

Review effort: Balanced

1. Mark terminal EOS as non-sensitive when answer tokens are present, including at max_length.
2. Keep prompt-only examples masked and add regression coverage.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the PALU trainer and annotated-data integration.

No open issues 🎉

Review effort: Balanced

@molereddy molereddy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple small nitpicks to cleanup otherwise looks good! thanks!!

Comment thread README.md Resolved
@nxZhai

nxZhai commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

couple small nitpicks to cleanup otherwise looks good! thanks!!

Thanks for pointing those out! I've fixed them. Could you please take another look?

@molereddy

Copy link
Copy Markdown
Collaborator

thank you for contributing!

@molereddy
molereddy merged commit c90a7c7 into locuslab:main Nov 10, 2026
1 check passed

This branch was successfully deployed

1 active deployment
tests — 4c842986 Deployed Nov 10, 2026 by nxZhai via tests (3.11, ubuntu-latest) #156
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants