The Illusion of Forgetting: Rank Leakage and Its Mitigation in Privacy-Preserving Knowledge Editing for Large Language Models

Jie Hou, Qiang ZengNeurIPS 2026

TL;DR

When we edit a Large Language Model to overwrite a memorized secret—like replacing a leaked phone number with a fake one—we usually check if its top answer changed and call it a day. This paper reveals that the original secret often just slips into second or third place in the model's output probabilities, where anyone using a standard commercial API can spot it with a single query. Fortunately, the authors also show how to fix this by adding a calibrated "rank penalty" during editing that buries the secret deep in the vocabulary without lobotomizing the model.

What Problem Does This Paper Address?

Large Language Models (LLMs) are notorious sponges for sensitive training data, such as personal addresses and identifiers. Because retraining a massive model from scratch to forget one person's data is prohibitively expensive, researchers turn to Knowledge Editing (KE)—surgically tweaking specific model weights to rewrite a fact (e.g., changing "Alice lives in Seattle" to "Alice lives in Boston") while leaving unrelated knowledge intact.

Prior privacy research noticed that secrets can still linger inside a model's intermediate layers (requiring white-box access to extract) or resurface if you ask the question twenty different ways. However, Hou and Zeng uncover a much simpler, glaring vulnerability right at the surface: rank leakage. Even when an edit successfully promotes the new, sanitized answer to rank #1, the true sensitive token frequently remains hovering right near the top of the next-token probability distribution.

Figure 1: Overview of (1) rank leakage, (2) RankPeek attack, (3) RCE, and (4) the evaluation.

Because commercial APIs (like OpenAI and Gemini) routinely allow users to request the logprobs of the top-$k$ candidate tokens, an attacker doesn't need model weights or clever prompt-rephrasing loops. They just ask once and read the runner-up tokens.

Methods

The authors introduce both an attack to demonstrate the flaw and a plug-in defense to fix it:

  • The Attack (RankPeek): Operating under a strict black-box threat model, the adversary sends a single prompt to the edited model and collects the top-$B$ highest-probability candidate tokens returned by the API (where $B$ represents a real-world verification budget, like having time to dial 20 phone numbers). If the true secret is in that top-$B$ list, the attack succeeds.
  • The Defense (Rank-guided Concealment Editing, or RCE): Standard KE methods (like ROME, MEMIT, and AlphaEdit) optimize weights to boost the new target token while keeping the overall model stable. RCE acts as a lightweight, method-agnostic plug-in that adds one extra term to this optimization loss: a hinge-style rank penalty. Instead of trying to diferenciably sort the whole vocabulary, RCE looks at the logit (raw score) of whatever token currently sits at a chosen rank boundary $\tau$ (say, rank 5,000) and penalizes the sensitive token until its score drops below that boundary by a safety margin $m$.

Datasets

Following prior privacy-editing benchmarks, the authors filter existing datasets so they only test facts the base model (primarily GPT-J-6B, alongside LLaMA, Qwen, and Ministral variants in the appendices) actually memorized prior to editing:

  • CounterFact: 657 instances of counterfactual statements designed to conflict with memorized model knowledge.
  • zsRE: 586 factual question-answering pairs.
  • Synthetic-PII Benchmark: A newly constructed, controlled benchmark designed to test realistic Personally Identifiable Information (PII) memorization scenarios (detailed in the paper's appendix).

Key Insights and Ideas

  • Pushing a secret too far down actually backfires: You might assume that shoving a sensitive token all the way to the bottom of the 50,000-word vocabulary ($\tau = 50,000$) is safer than stopping at rank 5,000. Counterintuitively, the authors found that extreme rank suppression creates severe optimization tension—degrading general model accuracy and increasing vulnerability to white-box and rephrasing attacks. Rank suppression needs to be calibrated, not maximized.
  • Fixing the output layer cleans up the middle layers, too: Even though RCE's math only penalizes the final output probabilities, logit-lens analysis shows that it also pushes the secret token down in intermediate-layer representations, naturally defending against white-box attacks that inspect internal states.
  • The first token is a bottleneck for multi-token secrets: RCE only suppresses the very first token of a sensitive phrase (like a full name). Yet, doing so drastically cuts down the model's ability to leak the rest of the name, even if an attacker guesses the prefix.
  • No "pile-up" at the boundary: An adaptive attacker who knows $\tau = 5,000$ might just inspect ranks 4,900 to 5,100. Testing this showed an extraction success rate under 2% (even with a budget of 800 tokens), proving RCE scatters secrets broadly across lower ranks rather than clustering them right at the threshold fence.
Distribution of sensitive token ranks before and after RCE across three editing methods.

Key Results

  • RankPeek breaks existing defenses: Under single-edit settings on CounterFact (with AlphaEdit and budget $B=20$), RankPeek achieves a 42.57% extraction success rate against Head Projection Defense and 31.86% against Max-Entropy Defense—outperforming white-box attacks despite using just one black-box query.
  • RCE slashes leakage while keeping edits crisp: Plugging RCE into AlphaEdit drops RankPeek success down to 11.87% and Input Rephrasing attacks to 3.65% on CounterFact, while maintaining a 99.39% Rewrite Score (edit fidelity) and minimal accuracy drop on unrelated facts (1.43%).
  • Scales to realistic batch edits: When applying hundreds of edits simultaneously—where competing defenses like Max-Entropy collapse to a 24.72% Rewrite Score—RCE holds strong at a 99.28% Rewrite Score while cutting RankPeek success to just 7.15%.

Limitations and Future Work

While the main text does not feature a standalone "Limitations" section, the authors explicitly note several boundaries in their setup and experiments:

  • Local vs. Commercial API testing: Experiments were run on locally hosted open-weight models rather than live commercial APIs, because evaluating post-edit leakage requires ground-truth knowledge of what was edited—information proprietary providers don't disclose.
  • Batch-edit utility trade-offs: While RCE preserves edit fidelity remarkably well during batch editing of hundreds of facts, random fact accuracy drops by ~28% across all tested editing defenses on CounterFact (reflecting an ongoing challenge in high-volume knowledge editing).
  • First-token scope: RCE explicitly optimizes only the first target token of an entity; although empirically effective as a bottleneck for multi-token strings, extending explicit rank control across multi-token sequences remains an open avenue.

Summary updated

Abstract

Privacy-preserving knowledge editing aims to protect sensitive information in large language models (LLMs) by rewriting their outputs. In this work, we identify a previously overlooked vulnerability of knowledge editing, which we term $\textit{rank leakage}$: although editing replaces the top-1 output with a sanitized answer, the original sensitive token often remains highly ranked in the model's next-token distribution. Exploiting this phenomenon, we propose an effective black-box attack, called $\textit{RankPeek}$, that exposes sensitive tokens by inspecting the top-ranked candidate tokens returned by a single model query. Despite its simplicity, RankPeek achieves strong extraction performance and remains effective even against models equipped with state-of-the-art defenses. To mitigate this vulnerability, we introduce $\textbf{R}$ank-guided $\textbf{C}$oncealment $\textbf{E}$diting (RCE), a plug-in defense that explicitly controls the rank of sensitive tokens during editing. Beyond RankPeek, RCE also mitigates existing black-box and white-box extraction attacks. Experiments across multiple models, datasets, and editing algorithms demonstrate that RCE substantially reduces extraction success while preserving edit fidelity and model utility. Our results highlight the importance of controlling the rank of sensitive tokens, rather than only the top-1 prediction, for privacy-preserving knowledge editing. Code and datasets are available at https://github.com/JasonH0810/RCE.
BibTeX
@inproceedings{hou2026illusion,
  author = {Jie Hou and Qiang Zeng},
  title = {{The Illusion of Forgetting: Rank Leakage and Its Mitigation in Privacy-Preserving Knowledge Editing for Large Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=HlaLfuxgVy},
}
Figure