GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
ICML 2023

A Watermark for Large Language Models

Nudge each token toward a secret, shifting half of the vocabulary and a simple count proves a text came from your model. No human text was flagged, but short or predictable text stays invisible.

Breakdown by FDE Interviews · 13 min read · Updated

About the original · 2023
AUTHORS
Kirchenbauer, Geiping, Wen, Katz, Miers, Goldstein
FROM
University of Maryland
PUBLISHED
Jan 2023 · ICML 2023
CITED BY
1,168Semantic Scholar · Nov 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 23% of this breakdown.

01

The paper in one minute

A watermark here is a statistical pattern in which tokens a model chooses, invisible to a reader but detectable by anyone who knows the rule. The paper's rule works at the moment of sampling. Before generating each token, the model hashes the previous token to seed a random number generator, uses it to split the vocabulary into a green list (a share gamma, often half) and a red list, and adds a constant delta to the logits of green tokens. The model then samples as usual.

Detection needs no model and no API. Given a text, recompute the green list at each position from the previous token and count how many tokens are green. Human text, which knows nothing of the rule, should hit green about gamma of the time. A one-sided z-test turns the count into a p-value: at z above 4 the false-positive rate is about 3 in 100,000. For the hard version, which bans red tokens outright, 16 tokens are enough to reach z = 4.

The soft version matters because of entropy. When the model is nearly certain of the next token ("Barack" followed by "Obama"), the bonus barely changes the choice, so quality is preserved but the token carries no watermark. When many tokens are plausible, the bonus tips the choice toward green. The paper defines a "spike entropy" and proves a lower bound on the expected number of green tokens from it.

On 500 news-style prompts with OPT-1.3B, delta 2 and gamma 0.5 detected 98.4% of 200-token generations at z above 4 with multinomial sampling, and 99.2% with 8-way beam search; no human text was flagged at any setting. Larger delta raises detection and perplexity. Misses were mostly low-entropy outputs, often near-copies of text the model had memorized. The authors also describe a private mode with a secret key, discuss edits that weaken the watermark, and test replacing spans with another model: removing it took changing about 30% of tokens, at a large cost in quality.

THE IDEA, VISUALLY
SOFT GREEN-LIST WATERMARK (ALGORITHM 2) prev token hash -> seed split vocab green share gamma +delta to green logits sample next token as usual detector count green z = (green - gamma T) / sqrt(T gamma (1 - gamma)); flag if z > 4 no model or API needed to detect; only the hash and gamma DETECTED AT z > 4, 200 TOKENS (TABLE 2) delta 1, gamma 0.5 76.7% delta 1, gamma 0.25 72.9% delta 2, gamma 0.5 98.4% delta 2, gamma 0.25 99.4% delta 5, gamma 0.5 99.6% delta 5, gamma 0.25 100.0% Multinomial sampling, OPT-1.3B, about 500 texts each. No human text was flagged in any run. arXiv 2301.10226, University of Maryland, ICML 2023 OUR TOY MODEL: DETECTED AT z > 4 BY LENGTH T=16 T=32 T=64 T=128 T=200 high entropy 0% 68% 100% 100% 100% medium entropy 0% 22% 78% 100% 100% low entropy 0% 0% 3% 12% 48% Same watermark (gamma 0.5, delta 2) on every row; only the spread of the model's next-token choices differs. Little choice leaves little room to bias. 300 unwatermarked 200-token texts: highest z 2.76, none flagged. Replacing 30% of tokens at random still left 95% detected; 40% left 38%.
Left: the soft watermark. The previous token seeds a split of the vocabulary into green and red lists, green logits get a bonus delta, and detection counts green tokens with a z-test; below, Table 2's detection rates at z above 4 for 200-token texts. Right: our toy model, detection rate by length for high, medium and low entropy text.
Research notes: the problem, approach and results
98.4%

200-token generations detected at z > 4 with gamma 0.5 and delta 2, multinomial sampling (Table 2)

3.2e-5

false-positive rate at the z > 4 threshold, by the one-sided normal test; none observed in any run

22%

share of 1,000 tokens a worst-case editor must change to push z below 4 (our recomputation of Section 2)

THE PROBLEM

Providers and platforms want to tell whether a piece of text came from a particular language model, without storing every output and without a detector that falsely accuses human writers.

THE IDEA

Before each token, hash the previous token to pick a pseudo-random 'green' half (or other share) of the vocabulary and add a small bonus to those logits. Anyone with the hash rule can count green tokens and run a one-sided z-test; human text lands near the expected share.

THE RESULT

With a bonus of 2 on OPT-1.3B, 98.4% of 200-token generations were detected at z above 4 with multinomial sampling and no human text was flagged. Detection depends on entropy: predictable text, such as memorized passages, carries little watermark.

02

Why it matters to an FDE

It is the provenance tool with a real false-positive guarantee. Unlike AI-text classifiers, the z-test gives a p-value that does not depend on how fluent or formulaic the human writer is. If a customer needs to show which outputs came from their own deployment (a support bot's replies, generated reports), a watermark applied at generation time is the defensible option.

It only works on models you control. The watermark is added while sampling. It says nothing about text from other models, and detection requires the same hash rule and vocabulary. "Detect AI-written applications" is a different problem, covered by the next paper on this site.

Short and predictable text is the blind spot. A one-line answer, a code snippet, a form letter or a memorized quote has little entropy and few tokens. In our toy run, the same watermark detected 100% of 64-token high-entropy texts and 3% of low-entropy ones. Set expectations per output type before promising detection.

Editing weakens it gradually, not instantly. Our toy run still detected 95% of texts with 30% of tokens replaced at random, and 38% at 40%. A determined person who rewrites heavily will remove it. Present it as evidence for unedited or lightly edited text, not proof of absence.

Keep the key private if detection matters for enforcement. A public rule lets anyone check text, and also lets anyone study which tokens are green. The paper's private mode keeps the key behind an API and rate-limits detection queries. Decide which matters more for the customer.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 290 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    The rule, the test, entropy's role, the quality cost, private mode and robustness limits

    Free account
  2. 04How it works

    The hard and soft rules, the detection test, the entropy bound, private mode and span replacement

    Premium
  3. 05The numbers that matter

    Table 2's detection rates, the quality cost by delta, Theorem 4.2's bound, and Figure 1 recomputed

    Premium
  4. 06Try it yourself

    Recompute the z-test numbers, then watermark a toy model and measure length, entropy and edits

    Premium
  5. 07Where it breaks

    Low entropy, short text, edits and paraphrase, one small model, and open questions about keys

    Premium
  6. 08Using it on a deployment

    Decide the provenance claim, set delta per output type, test detection on real outputs

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →