Lion Cipher Lab

Watermark and detect LLM-generated text

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

Steps in this lab

  1. The idea in one breath
  2. Why hashing the PREVIOUS token is the whole scheme
  3. Set up a clean workspace
  4. The green-list rule, on its own
  5. Write the LogitsProcessor that biases generation
  6. Generate watermarked text
  7. Build the detector -- no model needed
  8. Run the detector on ORDINARY human text
  9. Robustness: what breaks the signal
  10. Attacks: removing and SPOOFING the watermark
  11. When it helps, when it's useless, and the ethics

Open the full interactive lab →