Datasets:
File size: 10,866 Bytes
be1f39c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | ---
license: cc0-1.0
language:
- en
size_categories:
- n<1K
task_categories:
- text-generation
tags:
- unlearning
- machine-unlearning
- knowledge-editing
- model-editing
- benchmark
- wikidata
pretty_name: Fine-Grained Knowledge Unlearning (Namesake Benchmark)
configs:
- config_name: default
data_files:
- split: train
path: dataset.csv
- config_name: scored
data_files:
- split: train
path: dataset_scored.csv
---
# Fine-Grained Knowledge Unlearning — Namesake Benchmark
A benchmark for **fine-grained knowledge unlearning**: can a method remove a fact
about entity **X** without damaging the *same fact* on entity **Y**, when X and Y
have (near-)identical names and share exactly that one attribute?
Each sample is a pair of real people who
- share an identical or near-identical name,
- share **one** career element (e.g. both are basketball players) — the fact to
unlearn on X and retain on Y,
- differ on everything else (birth year, birthplace, teams, works, …) — the
disambiguators used to point a model at the right namesake,
- are approximately equally famous (Wikipedia pageview ratio ≤ 20, both ≥ 1,500
annual views, plus a probe-model log-prob balance term).
The point is that a coarse unlearning method will delete "the Michael Jordan who
plays basketball" rather than "*this* Michael Jordan", and the retain side
measures exactly that collateral damage.
**Example.** Unlearn *"James Allen (b. 1864) → writer"*, then check that
*"James Lane Allen, born in 1849, is a ___"* still yields *writer*.
## Files
| file | rows | what it is |
|---|---|---|
| `dataset.csv` | 247 | the benchmark — one row per pair, X = more famous (unlearn target), Y = less famous (retention probe) |
| `dataset_scored.csv` | 1,701 | **every** candidate pair with probe-model scores, before the final filter — re-cut at your own thresholds without re-running the model |
| `unlearning_dataset.json` | 247 | the same 247 pairs in EasyEdit-style records (download directly; not a `configs` entry) |
```python
from datasets import load_dataset
ds = load_dataset("ernlavr/fine_grained_unlearning") # the 247 pairs
scored = load_dataset("ernlavr/fine_grained_unlearning", "scored") # all 1,701 scored
```
`unlearning_dataset.json` holds nested records, so fetch it as a file:
```python
import json
from huggingface_hub import hf_hub_download
p = hf_hub_download("ernlavr/fine_grained_unlearning",
"unlearning_dataset.json", repo_type="dataset")
records = json.load(open(p))
```
```json
{
"case_id": 0,
"pair_id": "Q1371577_Q3297881",
"unlearn": {"subject", "prompt", "disambiguated_prompt", "paraphrases", "target"},
"retain": {"subject", "prompt", "paraphrases", "target"},
"disambiguation_check": {"x": {"prompt", "target"}, "y": {"prompt", "target"}},
"metadata": {"qid_x", "qid_y", "name_match_type", "career_category",
"family_relation", "fame_ratio", "scores": {...}}
}
```
## Schema (`dataset.csv`)
**Identity** — `pair_id`, `qid_x`, `qid_y` (Wikidata QIDs), `name_x`, `name_y`,
`description_x`, `description_y`, `birth_year_x`, `birth_year_y`.
**Pair properties** — `name_match_type` (see below), `shared_occupation` (the
fact to unlearn/retain), `career_category`, `family_relation`.
**Fame** — `pageviews_x`, `pageviews_y` (12-month enwiki, 2025-07 → 2026-07),
`sitelinks_x`, `sitelinks_y`, `fame_ratio` (max/min pageviews).
**Prompts** — `unlearn_prompt` (bare name), `unlearn_prompt_disambiguated`,
`unlearn_target`, `retain_prompt`, `retain_target`, `hint_attr`, `hint_x`,
`hint_y`, `probe_attr`, `probe_{x,y}_prompt`, `probe_{x,y}_target`,
`probe_options`.
**Probe scores** — `know_{x,y}`, `margin_{x,y}`, `shared_{x,y}`, `shared_ambig`,
`shared_margin_{x,y}`, `balance`, `quality`.
Two gotchas:
- `probe_options` is a **JSON-encoded string** — `json.loads` it. It holds every
candidate `[attr, value_x, value_y]` triple; the pipeline picked the one with
the best worst-case margin and exposed it as `probe_attr`.
- `family_relation` is an **empty string** when absent (pandas reads it as NaN).
Filter on specific values. **`different_from` is not a family relation** — it
is Wikidata's explicit distinctness marker (P1889), i.e. *positive* evidence
the two items are different people. Of the 247 pairs: 41 are blood/marital
relatives (`child` 22, `father` 14, `sibling` 4, `spouse` 1), 23 are
`different_from`, 183 unmarked. Drop the 41 if a shared family context would
confound your experiment.
## Score definitions
All scores are **mean per-token log-probs** of the gold continuation under the
probe model (`meta-llama/Llama-3.1-8B`, 39,943 continuations scored).
| column | meaning |
|---|---|
| `know_x`, `know_y` | log-prob of the correct differing attribute given the disambiguated prompt. High ⇒ the model knows the entity *and* resolves the right namesake from the hint. |
| `margin_x`, `margin_y` | `know` minus the log-prob of the **partner's** value on the same prompt. Positive both ways ⇒ the two representations are separable pre-edit (otherwise the retention eval is meaningless). |
| `shared_x`, `shared_y` | strength of the shared occupation fact — the unlearn/retain target. |
| `shared_ambig` | occupation log-prob on the **bare-name** prompt (name-level prior, no disambiguation). |
| `shared_margin_x/y` | `shared` minus the best of 8 distractor occupations. |
| `balance` | \|`know_x` − `know_y`\| — representation-level fame balance. |
| `quality` | the pipeline's ranking score (capped margins − balance). |
The published 247 were cut with `margin_{x,y} > 0` **and**
`shared_margin_{x,y} > 0`, ranked by `quality`, capped at 2 pairs per unlearn
entity. **See Limitations — that threshold is too loose, and you probably want
to re-cut.**
## Name closeness (`name_match_type`)
| value | meaning | example | n |
|---|---|---|---|
| `edit2` | edit distance 2 inside one token, shared 2-char prefix | Steven / Stephen | 63 |
| `initial` | added middle name/initial | James Allen / James Lane Allen | 53 |
| `edit1` | edit distance 1 | Isiah Thomas / Isaiah Thomas | 50 |
| `suffix` | Jr/Sr/II/III variants | Larry Nance / Larry Nance Jr. | 33 |
| `exact` | identical labels | Mark Davis / Mark Davis | 31 |
| `middle_variant` | different middle token | George E. Johnson / George L. Johnson | 17 |
| `diacritic` | differ only in diacritics/punctuation | José López / Jose Lopez | 0 |
## Composition
**Career category** — literature 45, football 38, basketball 36, acting 35,
music 32, politics 27, filmmaking 9, visual_art 5, baseball 4, law 3, then a
tail of 11 categories with ≤ 2 pairs each.
**Probe attribute** — birthplace 186, citizenship 35, team 14, birth_year 10,
work 2.
**Fame balance** — `fame_ratio` mean 4.86, median 2.85, max 19.56; the least
viewed entity has 1,505 annual pageviews.
## ⚠️ Limitations — read before using
An audit of the published 247 pairs generated greedily from the probe model and
scored the output with a synonym map (so "jurist" counts for `lawyer`). **The
`usable` figures below are that heuristic, not human-verified ground truth** —
treat them as directional.
**~45% of the 247 pairs fail the benchmark's core premise**, i.e. the model does
not demonstrably hold the fact you are asking a method to unlearn:
- both occupations produced correctly: **150/247 (61%)**
- cross-contamination (X's generation leaks Y's attribute or vice versa): **9.3%** — low; the disambiguation hints do work
- usable (occupation right for both **and** no leak): **136/247 (55%)**
- for 37 pairs (15%) the model gets the occupation wrong for *both* people
**The published `> 0` threshold is the cause, and it is cheap to fix.** A
stricter cut on the *same* log-prob columns raises quality sharply, and because
`dataset_scored.csv` ships all 1,701 scored pairs, re-cutting needs no GPU:
| gate | pairs | usable |
|---|---|---|
| `shared_margin > 0 & margin > 0` (as published) | 247 | 55% |
| `shared_margin > 1 & margin > 0.5` | 104 | 73% |
| **`shared_margin > 2 & margin > 0.5`** (recommended) | **69** | **78%** |
| `shared_margin > 2 & margin > 1` | 50 | 80% |
```python
import pandas as pd
s = pd.read_csv("dataset_scored.csv")
smin = s[["shared_margin_x", "shared_margin_y"]].min(axis=1)
mmin = s[["margin_x", "margin_y"]].min(axis=1)
strict = s[(smin > 2) & (mmin > 0.5)] # 69 pairs
```
Of the three log-prob signals, `shared_margin` is the best predictor of a usable
pair (correlation 0.352), ahead of `margin` (0.160). A "regret" metric
(`logp(gold) − logp(model's own greedy continuation)`) was also tested and did
**worse** (0.244), so it is not included.
**A residual ~20% is a data problem no threshold can fix.** Wikidata's `P106`
(occupation) includes peripheral tags, so the "shared career" is sometimes one
neither person is actually known for — **John Smith the explorer is tagged
`writer`; William Clark of Lewis & Clark is tagged `politician`**. This is
strongly category-dependent:
| category | pairs | usable |
|---|---|---|
| music | 32 | 84% |
| visual_art | 5 | 80% |
| acting | 35 | 66% |
| basketball | 36 | 56% |
| literature | 45 | 47% |
| football | 38 | 42% |
| politics | 27 | 41% |
| filmmaking | 9 | 33% |
Literature is both the **largest** category (45 pairs) and near the bottom —
`writer` is Wikidata's worst catch-all. A cheap extra filter is to require
`shared_occupation` to appear in *both* Wikidata one-line descriptions
(`description_x`/`description_y`), which splits usability 62% vs 44%.
**Other caveats.** The fame filter is purely *relative* (ratio ≤ 20) with no
absolute ceiling, so 8 pairs have `pageviews_x > 1M` — including Donald Trump /
Donald Trump Jr. under `businessperson`, a career neither is primarily known
for. Scores are specific to Llama-3.1-8B; re-probe for another model. English
Wikipedia only, so fame and coverage are anglophone-biased, and the underlying
Wikidata gender/occupation distribution is inherited unchanged.
## Provenance
Built from [Wikidata](https://www.wikidata.org) (CC0) via WDQS SPARQL, plus the
[Wikimedia Pageviews API](https://wikimedia.org/api/rest_v1/) for fame
estimation (12 months, 2025-07-01 → 2026-07-01). Pipeline: mine humans per
occupation (≥ 5 sitelinks) → pair by name closeness within an occupation →
fetch attributes and family links → filter for fame balance, single shared
career and sufficient disambiguators → score with Llama-3.1-8B and cut.
11,024 candidate pairs → 5,168 after a sitelink prefilter → 1,701 after
attribute/fame filtering → 247 published.
## Licence
CC0-1.0, following Wikidata. Pageview counts are aggregate Wikimedia statistics.
All entities are public figures with English Wikipedia articles; every attribute
is drawn from public Wikidata statements.
|