Google's SynthID watermarks AI-generated text so it can be identified later. The mechanism is simpler than most coverage suggests - and this tutorial builds it from scratch.
The core problem: how do you mark text without degrading quality or making the mark obvious? The answer is elegant. A language model generates scores for 50,257 tokens at once. Before sampling, you split the vocabulary into green and red lists using a secret key and the previous token. Add a small constant to green tokens. The sampler picks from slightly-biased scores. The finished text contains more green tokens than chance predicts - but only if you have the key.
This tutorial builds that green-list watermark on GPT-2 and detects it from plain text alone at p = 3.07e-56. You'll measure how many tokens detection needs and how much editing it survives. By the end you'll run a detector that reads text and answers: watermarked or not, with statistical confidence.
The approach uses Kirchenbauer's green-list algorithm - not Google's tournament sampling, but the right thing to build first because you can implement, detect, and break it in an afternoon. Hugging Face transformers ships it natively so you can check your work. The closing section explains how the real thing differs.
Budget 45 minutes. You need Python 3.13, 1.5 GB of free disk, and no API keys. Everything is open source and runs locally.
Read the full walkthrough here:
https://ranjankumar.in/how-googles-synthid-actually-works-a-visual-breakdown
Follow for more practitioner-focused AI engineering guides.
Top comments (0)