Lion Cipher Lab
Watermark and detect LLM-generated text
- AI Security
- Advanced
- ~75 min
- Free · no account required
Why it matters
As machine-written text floods the internet, providers want to prove which text their own model produced -- for provenance, abuse tracing, and keeping AI text out of the next model's training data. A statistical watermark is the leading way to do it WITHOUT storing every output: you skew generation toward a secret, per-position 'green' set of words so subtly that a human can't see it, then anyone with the secret can run a cheap statistical test to spot it. Building the watermark and its detector by hand teaches you exactly what these systems can and cannot prove -- which matters most the…
What you'll learn
- The green-list / red-list watermark scheme (Kirchenbauer et al.)
- Writing a custom Hugging Face LogitsProcessor to bias generation
- Building a model-free statistical detector
- One-proportion z-test and reading a z-score / p-value
- Judging watermark robustness, low-entropy limits, and spoofing
- The ethics of provenance claims about human authorship
Steps in this lab
- The idea in one breath
- Why hashing the PREVIOUS token is the whole scheme
- Set up a clean workspace
- The green-list rule, on its own
- Write the LogitsProcessor that biases generation
- Generate watermarked text
- Build the detector -- no model needed
- Run the detector on ORDINARY human text
- Robustness: what breaks the signal
- Attacks: removing and SPOOFING the watermark
- When it helps, when it's useless, and the ethics