← Latest papers
💬 NLP

Gap-K%: Measuring Top-1 Prediction Gap for Detecting Pretraining Data

The paper proposes Gap-K%, a novel method for detecting pretraining data in Large Language Models that leverages the log probability gap between the top-1 prediction and the target token, combined with a sliding window strategy, to achieve state-of-the-art performance on benchmark datasets.

Original authors: Minseo Kwak, Jaehyung Kim

Published 2026-06-01
📖 5 min read🧠 Deep dive

Original authors: Minseo Kwak, Jaehyung Kim

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to figure out if a specific sentence was written by a student who memorized a textbook, or if it was just a sentence they made up on the spot. This is the core problem the paper "Gap-K%" tackles, but instead of students and textbooks, it's about Artificial Intelligence (LLMs) and the massive datasets they were trained on.

Here is a simple breakdown of the paper's ideas, using everyday analogies.

The Problem: The "Black Box" Library

Large Language Models (LLMs) are like students who have read almost the entire internet. However, we don't know exactly which books they read. This is a problem because:

  1. Privacy: They might have memorized private information (like your home address) from the internet.
  2. Copyright: They might have memorized copyrighted stories or articles.
  3. Cheating: If a test question was in their training data, they might just be reciting the answer rather than actually "thinking."

Researchers want a way to look at a piece of text and say, "Yes, this AI definitely saw this exact text before," or "No, this is new to it."

The Old Way: Listening to the "Whispers"

Previous methods tried to detect training data by listening to how "surprised" the AI was by certain words.

  • The Analogy: Imagine the AI is reading a sentence. If it sees a word it knows well (from its training), it says it with confidence. If it sees a weird word, it stammers (low probability).
  • The Flaw: The old methods (like Min-K%) just looked at the "stammers." They assumed that if the AI stammers a lot, the text is new. But this is a bit like judging a book by only looking at the typos. It misses the bigger picture of how the AI thinks about the sentence as a whole.

The New Idea: The "Top-1 Gap"

The authors of this paper realized there is a better clue: The Gap between what the AI thought would happen next and what actually happened.

  • The Analogy: Imagine a quiz show.
    • Scenario A (Training Data): The AI has memorized the question and answer. When the host says the first half of the sentence, the AI immediately knows the answer. It's not just confident; it's the only thing on its mind. The gap between its "Top Choice" and the "Actual Answer" is zero.
    • Scenario B (New Data): The AI has never seen this sentence. It has to guess based on grammar and logic. It might guess a word that makes sense grammatically (its "Top Choice"), but the actual next word in the sentence is something slightly different.
    • The Insight: When the AI is guessing on new data, there is a noticeable gap between its "Top Choice" and the "Actual Word." When it's reciting memorized data, that gap disappears.

The paper calls this the "Gap-K%". It measures how big the gap is between the AI's best guess and the real word. A big gap suggests the text is new; a tiny gap suggests the AI has seen it before.

The Secret Sauce: "Sliding Window" Smoothing

The authors noticed that AI doesn't just make mistakes on single words; it makes mistakes on phrases.

  • The Analogy: Imagine a noisy radio signal. If you listen to just one second, it might sound staticky (fluctuating). But if you listen to a 5-second clip, you can hear the melody clearly.
  • The Method: The paper uses a "sliding window." Instead of judging the AI word-by-word, it looks at small groups of words (like a sliding window moving across a sentence) and averages the "Gap" score.
  • Why it works: This smooths out the noise. It helps the detector spot a whole section of text where the AI is struggling to align its guesses with reality, rather than getting distracted by one weird word.

What They Found (The Results)

The researchers tested their new "Gap-K%" method against the old methods on two major benchmarks (WikiMIA and MIMIR).

  • The Result: Gap-K% won almost every time. It was better at spotting memorized text, even when the text was slightly rewritten (paraphrased) or when using different sizes of AI models.
  • The Takeaway: By focusing on the "gap" between the AI's top guess and reality, and smoothing out the results over small groups of words, they created a much sharper tool for detecting what the AI has memorized.

Summary

Think of the old methods as trying to find a needle in a haystack by looking for the sharpest point. The new method (Gap-K%) looks at the shape of the whole haystack. It realizes that when an AI is reciting something it memorized, its "Top Guess" and the "Real Answer" are perfectly aligned, leaving no gap. When it's guessing on new things, that gap opens up. By measuring that gap and smoothing it out over sentences, they can tell with high accuracy if the AI has seen the text before.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →