mlsanityData to 14 Oct 2026

Grammar-Guided Code Watermarking with Green Temperature

arXiv 2610.05323 ↗First posted 4 Oct 2026cs.CR cs.AIcited by 0

Not on the map. Why?

Abstract (arXiv)

Large language model watermarking embeds detectable statistical signals during decoding, but the resulting changes to token probabilities can degrade generation quality. This trade-off is particularly important for code, where small changes in token selection can break syntax or alter program behavior. Existing code watermarking methods mitigate this risk through entropy-based insertion or syntax-aware token selection, but they do not directly construct the watermark over the set of continuations admitted by the current grammar state. We propose Grammar-Guided Code Watermarking with Green Temperature (GTCW), which integrates grammar-constrained decoding with probability-aware watermarking. At each decoding step, GTCW restricts the candidate set to grammar-admissible tokens and partitions this support into keyed green and red subsets. At eligible high-entropy positions, green temperature reweights the green tokens according to the model's relative preferences, strengthening the watermark signal while retaining the grammar constraint. Across five models and five benchmarks spanning four programming languages, GTCW achieves a mean AUROC of 73.61%, compared with 67.83% for the strongest baseline, while maintaining a mean Pass@1 of 59.18% versus 59.58% for unwatermarked generation. Our implementation is available at https://github.com/hyundong98/GTCW .

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

Builds on

14 of 18 references.

References · 14

  1. 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,391
  2. 2023A Watermark for Large Language Modelscited by 725
  3. 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 399
  4. 2023Robust Distortion-free Watermarks for Language Modelscited by 320
  5. 2023Provable Robust Watermarking for AI-Generated Textcited by 299
  6. 2023OctoPack: Instruction Tuning Code Large Language Modelscited by 189
  7. 2023Who Wrote this Code? Watermarking for Code Generationcited by 141
  8. 2024XGrammar: Flexible and Efficient Structured Generation Engine for Large Language Modelscited by 75
  9. 2024SynCode: LLM Generation with Grammar Augmentationcited by 69
  10. 2024CodeIP: A Grammar-Guided Multi-Bit Watermark for Large Language Models of Codecited by 24
  11. 2025MorphMark: Flexible Adaptive Watermarking for Large Language Modelscited by 24
  12. 2024Permute-and-Flip: An optimally stable and watermarkable decoder for LLMscited by 22
2 more
  1. 2025Improved Unbiased Watermark for Large Language Modelscited by 17
  2. 2025Marking Code Without Breaking It: Code Watermarking for Detecting LLM-Generated Codecited by 10

Built on by

Not cited yet.

Similar, not cited

Close in wording, no citation either way

  1. 2026Preserving Structure, Strengthening Signals: A Grammar-Driven Approach to Optimize the Trade-off Between Quality and Detectability in Code Watermarking
  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. 2025CLASP: Training-Free LLM-Assisted Source Code Watermarking via Semantic-Preserving Transformations
  5. 2023Towards Tracing Code Provenance with Code Watermarking
  6. 2026PromptMark: A Prompt-Guided Iterative-Feedback Framework for Source Code Watermarking ↗
  7. 2024Is The Watermarking Of LLM-Generated Code Robust?
  8. 2026Improving the Trade-off Between Watermark Strength and Speculative Sampling Efficiency for Language Models