← Back to brief
ResearchOfficialPreprintarXiv Cryptography and Security

Grammar-Driven Watermark (GDW) Improves Code Watermarking Trade-off for LLMs

Jul 14, 2026

A new preprint introduces Grammar-Driven Watermark (GDW), a code watermarking technique for large language models (LLMs) that uses grammar-guided masking and structural role-aware modulation. GDW aims to preserve code quality while enhancing watermark detectability, and experiments across several programming languages and models indicate it achieves a better balance between quality and detectability than previous methods. The method also demonstrates robustness against variable-renaming attacks.

Why it matters: Improving watermarking for machine-generated code without sacrificing quality is important for reliably identifying AI-generated code in real-world applications.

Full story at: arXiv Cryptography and Security