↑↓ move Enter open ⌘K find from any page 256 of 256 tabs
Loading the recording…

A watermark that keeps the distribution

SynthID-Text is the text watermark Google DeepMind deployed in Gemini and described in Nature in 2024. Like the green list of the Watermark tab, it hides a keyed signal in which tokens the model picks, but instead of adding a bias to some logits it changes how a token is sampled: candidates play a tournament decided by pseudo-random bits. Averaged over keys, the token it picks follows the model's own distribution exactly, so the watermark does not lower the quality of the text in expectation; with the key, a detector can still see that the picks favoured the bits.

On this page Qwen2.5-0.5B-Instruct answers the Watermark tab's 40 MT-Bench questions with the same seeds, top-k 40 at temperature 1 and at most 200 tokens, with transformers' SynthIDTextWatermarkingConfig: the 30 keys and the n-gram length 5 of transformers' SynthID example. The answers sampled without the watermark are token for token the Watermark tab's unwatermarked answers, and human text is the same 40 WikiText-2 paragraphs.

g-values: a context, a candidate and a key

Each candidate token gets one bit per layer , its g-value , from the context : the 4 tokens written before it. transformers' processor hashes the context, then the candidate, then the layer's key with a 64-bit linear congruential step, , and reads a table of random bits at . The chain over the grid in the Tournament sampling panel shows it for the selected cell; the page recomputes every g-value in exact integer arithmetic from the keys and the table stored with the recording, and they match the processor's.

Two details matter. At the start of an answer the context is padded with zeros. And when a 4-token context repeats inside the same answer, the processor leaves that step unwatermarked: the same context would give the same g-values and push the text the same way again, which would bias it and would let repeated phrases dominate the detector. Those tokens are grey in The answer, token by token, and the detector skips them.

Tournament sampling

Tournament sampling draws candidates from the model's distribution and lets them play rounds of matches; in round the candidate with the larger g-value at layer wins, a tie going to either. With two candidates per match the winner's distribution has a closed form, which is what the processor computes for every candidate at once:

A candidate with gains the share of probability held by candidates with , and loses nothing it had. The grid shows the 30 g-values of the most likely candidates at the selected step, with each one's probability before and after the tournament, and the chart under it how the top candidates' probabilities move layer by layer. Because each g-value is a fair coin over keys, at every layer: the watermark is non-distortionary for a single sample. The drawn token uses the same uniform as the unwatermarked answer, so the two answers part where the tournament moved the draw.

Non-distortion holds over keys, not for one key. With the 30 keys fixed, a step's distribution after the tournament is far sharper than the model's: on these answers its most likely candidate holds 92 % of the probability on average, against 62 % before, and in 37 % of the steps it is not the token the model found most likely. At token 5 of the answer to question 81, for example, “ is” falls from 67 % to under 1 % and “ blog” rises from 6 % to 99 %. The top p column of the table shows how this grows with the number of layers.

The detector

Without the keys the g-values of any text are independent fair coins. The Mean score of the paper averages them over the scored tokens and the layers; Google's reference code turns the count of ones into an exact p-value,

The detector panel computes both with transformers' detector utilities: compute_g_values, and the masks of repeated contexts and of tokens after the end of the answer, which leave 95 % of the answers' tokens scored. With all 30 layers the watermarked answers average a mean g-value of 0.567, against 0.500 for the unwatermarked answers and 0.501 for the human paragraphs. 39 of the 40 watermarked answers have , with a median of ; no unwatermarked answer and no human paragraph does. The one miss, the answer to MT-Bench question 90, has 85 scored tokens with a mean of 0.515 ().

The chart of the mean g-value per layer falls from 0.616 at the first layer to 0.530 at the last: every match concentrates the distribution on the candidates that won, so each later layer has less probability left to move. The paper's weighted-mean score gives early layers more weight for that reason, and its Bayesian detector learns such weights; transformers' example trains it on about 10,000 texts.

Depth and quality

The table repeats the run with the first 1, 3 and 10 keys; the step's largest probability after the tournament grows from 64 % with one layer to 66, 77 and 92 %. One layer gives the highest mean g-value, 0.631, but only one bit per token, and 34 of 40 answers reach ; with 3, 10 and 30 layers 38, 39 and 39 do, and the median p-value falls from to , and . The perplexity under the model without the watermark is 4.17 to 4.36 in every watermarked setting against 4.67 for the unwatermarked answers: on these 40 answers the watermark costs nothing measurable, as non-distortion predicts. The Watermark tab's bias of , for comparison, raised it to 5.89.

Where it came from

Dathathri et al. introduced tournament sampling, its non-distortionary and distortionary variants, a way to combine it with speculative decoding, and the mean, weighted-mean and Bayesian detectors, and reported a live experiment on nearly 20 million Gemini responses that found no loss in the quality users perceived. Earlier unbiased schemes include Kuditipudi et al.'s distortion-free watermark and Hu et al.'s reweighting watermarks; Christ et al. show that watermarks can even be cryptographically undetectable without the key. The green-list watermark of the Watermark tab, with its bias and z-test, is the scheme these build on.

Papers

  1. Scalable watermarking for identifying large language model outputs Sumanth Dathathri et al. · Nature 2024 SynthID-Text: g-values, tournament sampling, the repeated-context rule and the detectors recorded here.
  2. A Watermark for Large Language Models John Kirchenbauer et al. · ICML 2023 The green-list watermark of the sibling tab, with a bias on the logits and a z-test.
  3. Robust Distortion-free Watermarks for Language Models Rohith Kuditipudi, John Thickstun, Tatsunori Hashimoto, Percy Liang · arXiv 2023 An earlier watermark that keeps the sampling distribution, detected by aligning text and key.
  4. Unbiased Watermark for Large Language Models Zhengmian Hu et al. · ICLR 2024 Reweighting schemes that leave the output distribution unchanged in expectation over keys.
  5. Undetectable Watermarks for Language Models Miranda Christ, Sam Gunn, Or Zamir · COLT 2024 Watermarks no one without the key can tell from the model's own text, under cryptographic assumptions.
  6. Qwen2.5 Technical Report Qwen Team · arXiv 2024 The model recorded here, Qwen2.5-0.5B-Instruct.

See also