Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 10 min read Deep dive easyNovice

AI Watermarking 101: Tools and Techniques

AI watermarking marks generated content with visible or invisible patterns that convey provenance, applied either during generation (requires model access, more robust) or after the fact (works for closed models but not all modalities). For text, LLM watermarks split candidate tokens into "green" and "red" lists based on prior context and boost or forbid them, and detection counts token colors, so short texts yield low confidence and false positives remain a problem. Images can be watermarked at generation (IMATAG) or signed post hoc with C2PA credentials (Truepic), while audio approaches like AudioSeal jointly train an embedder and a sample-level detector that is robust to editing. Related defenses such as Glaze, Photoguard, Nightshade and Fawkes cloak or poison images, and open watermarkers or detectors make removal easier.

Related posts

  • Introducing SynthID Text

    Hugging Face mediumAdept

    SynthID Text, Google DeepMind's LLM watermarking technique, ships in Hugging Face Transformers v4.46.0. It is applied as a logits processor that uses a keyed pseudo-random g-function in tournament sampling, and detected with a trained Bayesian classifier. You enable it by passing a SynthIDTextWatermarkingConfig to model.generate(). The config needs 20–30 random private keys and an ngram_len, where 5 is the recommended default and higher values are more detectable but more brittle. Detectors need their own training set of at least 10k examples per configuration. The watermark survives cropping and mild paraphrasing but weakens on factual responses, thorough rewrites and translation.

  • Video Invisible Watermarking at Scale

    Meta Engineering mediumAdept

    Meta runs ML-based invisible video watermarking (VideoSeal-style) as a custom FFmpeg filter for provenance use cases like detecting AI-generated video and identifying first uploaders. GPU deployment suffered from CPU-GPU frame transfer overhead, missing hardware video encoders, contention across parallel requests and model loading costs, so the team moved to CPU-only inference; with tuned encoder, decoder and PyTorch threading plus sampling parameters, single-process latency came within 5% of GPU and scaled across parallel FFmpeg processes more efficiently. A frame-selection method cut an initial ~20% BD-Rate regression, and crowdsourced manual review was needed because VMAF and SSIM missed watermark artifacts.

  • Build awesome datasets for video generation

    Hugging Face mediumAdept

    A three-stage pipeline for building small video-generation fine-tuning datasets: acquisition with yt-dlp and scene splitting, per-frame filtering for watermarks, aesthetics and NSFW content plus an OpenCV motion score, and captioning with Florence-2 or a video captioner like Qwen2VL. Filtering the crush-smol dataset on pwatermark < 0.1 and aesthetic > 5.5 kept only 47 of 1493 clips. The authors conclude that averaging watermark scores across frames with a 0.2–0.3 threshold works better, and that aesthetic scores are biased toward colorful, regular shapes and suit a minimum cutoff of about 4.25–4.5. The resulting datasets were used to fine-tune CogVideoX-5B with finetrainers for effects like Crush and Cakeify.

  • Finding leaked passwords with AI: How we built Copilot secret scanning

    GitHub Engineering mediumAdept

    GitHub replaced regex-based detection of generic passwords with an LLM prompt that judges candidate secrets from their file context. The first GPT-3.5-Turbo few-shot prompt broke on unusual file types in customer repos. GitHub responded by expanding offline evals with customer reports and GPT-4-generated cases, adding GPT-4 as a confirming scanner, and adopting Microsoft's MetaReflection hybrid chain-of-thought/few-shot prompt. To scale full-history scans, they excluded low-value files and built a workload-aware rate limiter in which workloads borrow unused LLM capacity from each other. Mirror testing on preview repos showed up to a 94% drop in false positives with little recall loss.

  • How we think about text classification in the LLM era

    Medium Engineering mediumAdept

    Medium replaced its aging NSFW story classifier with a prompt-based LLM classifier that runs inside Snowflake Cortex SQL queries. It needs only a human-labelled evaluation set, oversampled to a 50/50 split, plus curator-written guidelines. Mixtral 8x7b matched or beat the legacy model on precision and recall for about $250/month, scoring only distribution-eligible stories. The team judged LLMs a poor fit for its topic and spam models. Topic labels come free from writer tags and let that model adapt to trends, while spam is an adversarial, full-volume workload where a static model and fixed prompt fall behind and costs rise.

The quest for software engineering knowledge.

Look:
Layout: