Skip to content

Add Unlearning Depth Score (UDS) metric - #208

Merged
molereddy merged 2 commits into
locuslab:mainfrom
gnueaj:add-uds-metric
Oct 31, 2026
Merged

molereddy merged 2 commits into
locuslab:mainfrom
gnueaj:add-uds-metric

Conversation

@gnueaj

@gnueaj gnueaj commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds the Unlearning Depth Score (UDS) (paper, code, data) as a TOFU metric. UDS patches hidden states of the retain model and of the evaluated model into the full model, layer by layer, to measure how much forget-set knowledge is still recoverable from internal representations (0 = intact, 1 = erased like the retain model).

Changes

  • src/evals/metrics/uds.py: uds handler (loads the full and retain models, like mia_reference)
  • src/data/qa.py: QAwithEntityDataset, which labels only the annotated entity tokens
  • Configs: tofu_metrics/uds.yaml, datasets/UDS_annotated_TOFU_forget10.yaml, commented-out entry in eval/tofu.yaml
  • README.md, docs/links.md

No changes to existing code paths.

Usage

python src/eval.py experiment=eval/tofu/default +eval/tofu_metrics=uds \
  model.model_args.pretrained_model_name_or_path=<UNLEARNED_MODEL> task_name=<TASK_NAME>

Defaults target Llama-3.2-1B-Instruct on forget10. For other sizes, set eval.tofu.metrics.uds.{full,retain}_model_path.

Tests

  • make quality passes
  • src/eval.py on the 1B TOFU models: retain90 = 1.000, full = 0.002, SimNPO = 0.350 with sdpa (paper: 0.351), ~40 s per model on one A6000
  • The default TOFU suite currently stops before UDS because of Loss and probabilities use bfloat16, can't use .numpy() #203. With that fixed locally, the command above runs the full suite plus UDS.

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.

@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.

Looks good, congrats on the work! Just one nit

Add the Unlearning Depth Score (https://arxiv.org/abs/2605.24614) as a TOFU
metric. UDS patches hidden states of the retain model and of the evaluated
model into the full model, layer by layer, and compares the resulting drops in
entity log-probability to measure how much forget-set knowledge is still
encoded in the evaluated model.

- QAwithEntityDataset labels only the annotated entity tokens of the
  UDS-annotated TOFU forget10 split (jaeunglee/uds-annotated-tofu)
- uds metric handler, uds and TOFU_QA_forget_entity configs
- README and docs/links.md entries
@molereddy
molereddy merged commit 2d98027 into locuslab:main Oct 31, 2026
1 check passed
InuHund pushed a commit to InuHund/open-unlearning that referenced this pull request Nov 9, 2026

This branch was successfully deployed

1 active deployment
tests — 26f1d714 Deployed Oct 31, 2026 by gnueaj via tests (3.11, ubuntu-latest) #145
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.

2 participants