mlsanityData to 14 Oct 2026

Preserving Structure, Strengthening Signals: A Grammar-Driven Approach to Optimize the Trade-off Between Quality and Detectability in Code Watermarking

arXiv 2607.10210 ↗First posted 11 Jul 2026cs.CR cs.CLcited by 0

Not on the map. Why?

Abstract (arXiv)

Text watermarking has emerged as a crucial technique for identifying AI-generated content. However, current watermarking schemes entail a trade-off between text quality and watermark detectability, which is further intensified by the inherent low-entropy nature of code. To mitigate this dilemma, we propose Grammar-Driven Watermark (GDW), a training-free watermarking approach tailored to LLM-based code generation. GDW employs a three-level masking mechanism consisting of a green-list mask, a syntactic validity mask, and a structural role mask to regulate watermark injection. These masks are integrated through hierarchical modulation, which limits the scope of watermark injection to syntactically admissible green-list tokens and adjusts watermark strength based on structural roles through a role function. Accordingly, we design a role-aware weighted detection statistic. For comprehensive evaluation, we introduce the Area Under the Trade-off Curve (AUTC), a metric that quantifies the quality-detectability trade-off. Extensive experiments demonstrate that GDW outperforms existing baselines and achieves state-of-the-art (SOTA) trade-off performance, while maintaining superior performance under seven semantics-preserving attacks.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 16 of its 37 references that are in the map. First posted on arXiv 11 Jul 2026.

Builds on

16 of 37 references.

References · 16

  1. 2025Qwen3 Technical Reportcited by 8,820
  2. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  3. 2024Qwen2.5-Coder Technical Reportcited by 1,203
  4. 2024StarCoder 2 and The Stack v2: The Next Generationcited by 502
  5. 2023On the Reliability of Watermarks for Large Language Modelscited by 189
  6. 2023OctoPack: Instruction Tuning Code Large Language Modelscited by 189
  7. 2024An Entropy-based Text Watermarking Detection Methodcited by 75
  8. 2023Towards Codable Watermarking for Injecting Multi-bits Information to LLMscited by 54
  9. 2024Token-Specific Watermarking with Enhanced Detectability and Semantic Coherence for Large Language Modelscited by 34
  10. 2023Embarrassingly Simple Text Watermarkscited by 29
  11. 2025BiMark: Unbiased Multilayer Watermarking for Large Language Modelscited by 21
  12. 2023Necessary and Sufficient Watermark for Large Language Modelscited by 19
4 more
  1. 2023Turning Your Strength into Watermark: Watermarking Large Language Model via Knowledge Injectioncited by 10
  2. 2025Marking Code Without Breaking It: Code Watermarking for Detecting LLM-Generated Codecited by 10
  3. 2024Is The Watermarking Of LLM-Generated Code Robust?cited by 8
  4. 2024Watermarking Low-entropy Generation for Large Language Models: An Unbiased and Low-risk Methodcited by 3

Built on by

Not cited yet.

Similar, not cited

Close in wording, no citation either way

  1. 2026Grammar-Guided Code Watermarking with Green Temperature
  2. 2025Disappearing Ink: Obfuscation Breaks N-gram Code Watermarks in Theory and Practice
  3. 2026DuCodeMark: Dual-Purpose Code Dataset Watermarking via Style-Aware Watermark-Poison Design ↗
  4. 2024CodeIP: A Grammar-Guided Multi-Bit Watermark for Large Language Models of Code
  5. 2025CLASP: Training-Free LLM-Assisted Source Code Watermarking via Semantic-Preserving Transformations
  6. 2023Who Wrote this Code? Watermarking for Code Generation
  7. 2026MATRIX: Multi-Layer Code Watermarking via Dual-Channel Constrained Parity-Check Encoding ↗
  8. 2026RMCW: A Deletion-Robust Watermark Based on Reed--Muller Codes for Language Models