# AI Text Watermarking Lab

> Generate, detect, and edit a SynthID-style statistical watermark for AI text, entirely in your browser.

- Source: https://stevenfoerster.com/lab/text-watermark/

Lab

Generate, detect, and edit a SynthID-style statistical watermark for AI text, entirely in your browser.

Research model, not a Claude detector

This lab uses a visitor-selected key and a small, transparent tournament-style generator. It teaches the mechanics of statistical text watermarking, but it does not know Anthropic's production key or detect Claude's watermark.

What this is

A keyed generation and detection experiment. The generator chooses among plausible words using the preceding context and your key. The detector recomputes those choices and asks whether the observed pattern is unlikely under a 50/50 null model.

What it demonstrates

-   The matching key reveals a distributed statistical signal.
-   A different key makes the same text look like ordinary noise.
-   Editing and shortening reduce the amount of usable evidence.

Step 1

## Choose the experiment key

The key stays in this browser tab and is not saved or transmitted.

Key fingerprint

No key selected

 Show

Generate random key

Context width Tournament layers (depth) Sample length

**Tournament depth:** each layer doubles the candidate draws and adds another keyed knockout round. Three layers means 8 draws → 4 winners → 2 finalists → 1 selected word.

Step 2

## Generate or edit a sample

No sample

Generate keyed sample Generate control sample

Experiment text

Select a key, then generate a keyed or control sample.

Analyze with this key

Step 3

## Detection result

Waiting for a sample

Generate or paste text and analyze it with the selected lab key.

z = 0 strong threshold · z = 3 z = 8+

Z-score

—

One-sided p-value

—

Positive g-values

—

Usable evidence

—

### Token evidence map

- positive
- mixed
- negative
- ineligible

#### What the key does

A color is not permanently attached to a word. For every eligible word, the detector combines four inputs and computes one binary g-value per tournament layer:

key + previous words + current word + layer → 0 or 1

Changing the key changes those bits, so the same passage gets a different color pattern. The preceding words matter too: the same word can be green in one sentence and red in another.

#### How to read the colors

- Green: At least two-thirds of its keyed bits are 1.
- Amber: Its keyed bits are mixed between 0 and 1.
- Red: At most one-third of its keyed bits are 1.
- Gray: Not scored: it is outside the lab vocabulary or repeats a context.

**Red words are expected.** The generator biases the whole passage toward candidates with more positive bits; it does not force every word to be green. Detection comes from the cumulative excess of positive bits across many eligible words, compared with the 50% null expectation.

Token-level evidence appears here after analysis.

#### Word inspector

hover · focus · tap

Normalized preceding context → selected word `Select a colored word`

Analyze a passage, then inspect a colored word to compare its alternatives.

Future integration

## Claude production watermark

The adapter is intentionally unavailable until Anthropic publishes an official detector API and response contract.

Check API status

How this generator works

At each flexible position, the generator has several plausible next words. It hashes your key, the preceding context, the candidate word, and a layer number to produce binary g-values. Candidates compete in pairs: a candidate with g = 1 defeats one with g = 0, while ties are resolved randomly. Each new round uses the next layer's g-value until one candidate remains. A control sample chooses from the same alternatives without consulting the key.

The detector repeats that calculation and tests the observed positive-g rate against an expected rate of 50%. Repeated contexts are counted only once. This is intentionally readable teaching code, not Google's or Anthropic's production implementation.

Depth

Candidate draws

Knockout rounds

Bits scored per word

1 layer

2

1

1

2 layers

4

2

2

3 layers

8

3

3

4 layers

16

4

4

More layers create stronger selection pressure and give the detector more keyed observations per eligible word. They do not mean extra writing passes or visible layers in the final text.

Try the key-swap experiment

1.  Generate a keyed sample and note its colors and z-score.
2.  Change one character in the key without changing the text.
3.  Analyze again: the colors reshuffle and the aggregate signal falls.
4.  Restore the original key and analyze once more to recover the signal.

Can I watermark text I already wrote?

Yes, but the watermark is added through word choice—not by attaching a hidden character or file marker. You need to rewrite enough flexible parts of the text using alternatives favored by your key.

1.  Choose a word or phrase that can change without changing the meaning.
2.  List several natural alternatives that fit the sentence.
3.  Score each alternative using the key, preceding context, candidate, and layer.
4.  Prefer a higher-scoring alternative that still sounds natural.
5.  Continue from left to right and periodically analyze the complete passage.

The team inspected the system.

inspected · 1/3 positive reviewed · 3/3 positive examined · 2/3 positive studied · 0/3 positive

In this hypothetical choice, the key favors “reviewed.” With another key or preceding context, the ranking would probably change.

Human judgment remains important: the highest-scoring replacement may be grammatically valid but wrong for the intended tone or meaning. This lab's generator already has curated alternatives; it does not currently create alternatives for arbitrary pasted prose.

Browse the lab's choice vocabulary

These are the generator's actual context-specific choice groups—not a general thesaurus. At each flexible position, the generator samples from one row and uses the key to favor candidates with stronger g-values.

54 choice groups · 189 unique words

Choice 1

`review` `assessment` `analysis` `evaluation`

Choice 2

`examined` `studied` `considered` `inspected`

Choice 3

`service` `system` `platform` `application`

Choice 4

`several` `multiple` `various` `some`

Choice 5

`implicit` `unstated` `informal` `unverified`

Choice 6

`mapped` `traced` `documented` `charted`

Choice 7

`changed` `revised` `adjusted` `updated`

Choice 8

`design` `plan` `model` `approach`

Choice 9

`initial` `first` `early` `opening`

Choice 10

`small` `limited` `compact` `focused`

Choice 11

`inspect` `review` `examine` `study`

Choice 12

`later` `subsequent` `follow-up` `second`

Choice 13

`additional` `extra` `new` `further`

Choice 14

`responded` `behaved` `performed` `reacted`

Choice 15

`proof` `certainty` `confirmation` `fact`

Choice 16

`chosen` `selected` `configured` `declared`

Choice 17

`stronger` `clearer` `better` `greater`

Choice 18

`many` `numerous` `repeated` `additional`

Choice 19

`fewer` `limited` `scarcer` `reduced`

Choice 20

`weaker` `harder` `uncertain` `fragile`

Choice 21

`separate` `distinct` `isolated` `apart`

Choice 22

`settings` `parameters` `configuration` `options`

Choice 23

`returned` `fell` `moved` `settled`

Choice 24

`expected` `ordinary` `baseline` `normal`

Choice 25

`reduced` `weakened` `diluted` `lowered`

Choice 26

`difficult` `hard` `unlikely` `impractical`

Choice 27

`little` `minimal` `limited` `negligible`

Choice 28

`characters` `spacing` `markup` `metadata`

Choice 29

`usable` `eligible` `available` `meaningful`

Choice 30

`interpret` `understand` `evaluate` `judge`

Choice 31

`locally` `privately` `entirely` `directly`

Choice 32

`retain` `store` `upload` `transmit`

Choice 33

`simple` `small` `readable` `compact`

Choice 34

`production` `provider` `commercial` `deployed`

Choice 35

`supported` `documented` `stable` `verified`

Choice 36

`calibrated` `interpreted` `reported` `validated`

Choice 37

`disabled` `unavailable` `separate` `inactive`

Choice 38

`simulation` `demonstration` `model` `prototype`

Choice 39

`different` `new` `changed` `separate`

Choice 40

`scores` `measurements` `values` `results`

Choice 41

`visible` `concrete` `clear` `tangible`

Choice 42

`sounds` `appears` `reads` `feels`

Choice 43

`authorship` `style` `origin` `provenance`

Choice 44

`keyed` `statistical` `configured` `watermark`

Choice 45

`practical` `hands-on` `useful` `focused`

Choice 46

`private` `secret` `production` `internal`

Choice 47

`unusual` `strong` `notable` `elevated`

Choice 48

`particular` `selected` `given` `specific`

Choice 49

`observable` `interactive` `measurable` `accessible`

Choice 50

`explicit` `visible` `documented` `clear`

Choice 51

`multiple` `several` `different` `varied`

Choice 52

`broad` `general` `strong` `confident`

Choice 53

`reproduce` `repeat` `verify` `audit`

Choice 54

`inputs` `parameters` `settings` `configuration`

Common questions about the signal

### Is one green word evidence?

No. Any individual word can be green by chance. The evidence is the excess of positive bits accumulated over many eligible words.

### Is there a secret list of green words?

No. Color depends on the key, preceding context, word, and layer. A word that is green here can be red somewhere else.

### Where do the vocabulary and alternatives come from?

They are hand-curated in this lab's source code. Each flexible position has a small `choice(...)` group of plausible alternatives, such as “review,” “assessment,” “analysis,” and “evaluation.” The eligible vocabulary is the union of those groups. The lab does not call a thesaurus or language model, and the alternatives are context-specific rather than guaranteed synonyms everywhere.

### Why does changing one word affect later words?

The preceding words are part of each calculation. An edit can change the context—and therefore the colors—for several following tokens.

### How much text is enough?

This lab requires at least 80 scored observations. Observations are keyed bits, not total words, so the required passage length depends on how many words are eligible and how many layers you select.

### What happens if I edit the text?

Formatting alone usually changes little here. Replacing or removing scored words can weaken or reshape the signal, while context-changing edits can affect later scores too. Reanalyze after each edit to measure the result.

### Does the key need to stay secret?

Not for this teaching exercise. In a real provenance system, the embedding key would normally be controlled by the provider: anyone who has the key and algorithm could generate text that matches its signal.

### Can the lab detect AI writing without the key?

No. It verifies agreement with this lab's key and vocabulary model. It does not estimate whether arbitrary prose was written by AI, Claude, or a person.

Reading the statistics

The z-score measures how far the observed positive-g rate sits above the null expectation in standard-error units. The one-sided p-value asks how often an unwatermarked sample would produce a score at least this large under this lab's simplified assumptions. The lab calls z ≥ 3 strong evidence and z ≥ 2 weak evidence; fewer than 80 observations is reported as insufficient.

Limits and privacy

-   The eligible vocabulary is specific to this built-in research generator.
-   A score on arbitrary pasted prose is not an AI-authorship judgment.
-   The educational hash is deterministic but is not a cryptographic PRF.
-   Your text, key, and results remain in the browser and are not persisted.
-   The future Claude adapter currently sends no network request.

Primary references

-   [SynthID-Text paper · Nature, 2024](https://www.nature.com/articles/s41586-024-08025-4)
-   [Google DeepMind reference implementation](https://github.com/google-deepmind/synthid-text)
-   [Anthropic · How Claude's text watermark works](https://www.anthropic.com/news/claude-text-watermark)
