Statistical watermarks put evidence inside the content. A provenance manifest puts evidence beside it. The construction is conceptual and simple. A generating tool computes a cryptographic hash of the content bytes, assembles a statement (which tool, which settings, what edits so far, a pointer to the previous manifest), and signs the statement with a private key; anyone with the matching public key can check the signature, and anyone can recompute the hash. A chain of such manifests, each naming the previous one, records edits. Standard references are Diffie and Hellman (1976) for public-key signatures and Bellare, Canetti and Krawczyk (1996) for keyed hashing. The standard library does not provide public-key signatures, so Listing 9.13 uses a keyed MAC (HMAC) as a stand-in: with a MAC the verifier needs the same secret as the signer, so the demonstration shows the data flow and the tamper evidence, not the trust model.
Statistical watermarks put evidence inside the content. A provenance manifest puts evidence beside it. The construction is conceptual and simple. A generating tool computes a cryptographic hash of the content bytes, assembles a statement (which tool, which settings, what edits so far, a pointer to the previous manifest), and signs the statement with a private key; anyone with the matching public key can check the signature, and anyone can recompute the hash. A chain of such manifests, each naming the previous one, records edits. Standard references are Diffie and Hellman (1976) for public-key signatures and Bellare, Canetti and Krawczyk (1996) for keyed hashing. The standard library does not provide public-key signatures, so the companion book example uses a keyed MAC (HMAC) as a stand-in: with a MAC the verifier needs the same secret as the signer, so the demonstration shows the data flow and the tamper evidence, not the trust model.
The listing signs an 8x8 generated image. Verification returns (signature valid, content matches) = (True, True). Flipping one bit of one pixel gives (True, False), and so does requantizing to 16 levels, a change of at most 15 out of 255 that nobody would see. Editing the claims under the old signature, or verifying with a different key, gives (False, True). Three properties follow, none of them a defect. A manifest is exact and fragile, tied to the bytes. It says nothing about content that has none, because stripping a manifest, or never having one, is the normal state of most content. And it asserts what the signer asserts, not what is true: it is only as good as the signer’s key management and honesty.
The watermark has the opposite profile. A change that breaks every hash (10 percent of tokens substituted: 0.000 of texts remain byte-identical) leaves 0.907 of the watermarked texts detected. It is robust and probabilistic, the generating party can apply it without the cooperation of whoever publishes the text, and regeneration erases it. The two mechanisms compose: the manifest carries rich claims and exact integrity, the watermark survives when the manifest is lost, and neither survives a determined adversary who regenerates the content with a tool that adds neither.
The statistics of acting on a flag deserve a closing calculation, because a false-positive rate is not the quantity a person facing an accusation cares about. With the exact binomial false-positive rate at 200 tokens and (6.15e-05) and the measured detection rate (0.994), the probability that a flagged text is watermarked is a function of the base rate. The listing prints it for four hypothetical shares of watermarked texts among all texts: 0.5 gives 0.9999, 0.01 gives 0.9939, gives 0.6176 and gives 0.0159. A test with a one-in-sixteen-thousand false-positive rate is nearly useless when the thing it looks for is a one-in-a-million event, and the idealized rate of Theorem 9.4 is itself optimistic for text that repeats.
Continue with the book
Explore the full treatment, worked examples, and exercises in Applied AI for Generation and Control.
Companion article for Applied AI for Generation and Control, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.
