mlsanityData to 13 Oct 2026

Is The Watermarking Of LLM-Generated Code Robust?

arXiv 2403.17983 ↗First posted 24 Mar 2024cs.CR cs.LGcited by 8

On the map: LLM safety and security → Watermarking generated content and models

Abstract (arXiv)

We present the first in depth study on the robustness of existing watermarking techniques applied to code generated by large language models (LLMs). As LLMs increasingly contribute to software development, watermarking has emerged as a potential solution for detecting AI generated code and mitigating misuse, such as plagiarism or the automated generation of malicious programs. While previous research has demonstrated the resilience of watermarking in the text setting, our work reveals that watermarking techniques are significantly more fragile in code-based contexts. Specifically, we show that simple semantic-preserving transformations, such as variable renaming and dead code insertion, can effectively erase watermarks without altering the program's functionality. To systematically evaluate watermark robustness, we develop an algorithm that traverses the Abstract Syntax Tree (AST) of a watermarked program and applies a sequence of randomized, semantics-preserving transformations. Our experimental results, conducted on Python code generated by different LLMs, indicate that even minor modifications can drastically reduce watermark detectability, with true positive rates (TPR) dropping below 50% in many cases. Our code is publicly available at https://github.com/uiuc-arc/llm-code-watermark.

Key facts. Cited by 8 papers in the map (data through 13 Oct 2026). Placed in Watermarking generated content and models, one of 12 directions in LLM safety and security. Builds on 8 of its 24 references that are in the map. First posted on arXiv 24 Mar 2024.

Builds on

8 of 24 references.

Closest ancestors · 3

Same direction, newest first

  1. 2023Publicly-Detectable Watermarking for Language Models27 Oct
  2. 2023Provable Robust Watermarking for AI-Generated Text30 Jun
  3. 2023A Watermark for Large Language Models24 Jan

Other references · 5

  1. 2021Evaluating Large Language Models Trained on Codecited by 8,205
  2. 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 3,064
  3. 2024SynCode: LLM Generation with Grammar Augmentationcited by 69
  4. 2023Certified Robustness for Large Language Models with Self-Denoisingcited by 23
  5. 2023Incremental Verification of Neural Networkscited by 14

Built on by

Cited by year (2026 to 13 Oct)

Citing papers per year: 2024: 1; 2025: 4; 2026: 3.

8 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025CLASP: Training-Free LLM-Assisted Source Code Watermarking via Semantic-Preserving Transformations
  2. 2024Efficient and Universal Watermarking for LLM-Generated Code Detection
  3. 2025Marking Code Without Breaking It: Code Watermarking for Detecting LLM-Generated Code
  4. 2025Disappearing Ink: Obfuscation Breaks N-gram Code Watermarks in Theory and Practice
  5. 2024CodeIP: A Grammar-Guided Multi-Bit Watermark for Large Language Models of Code
  6. 2024Watermarking Large Language Models and the Generated Content: Opportunities and Challenges
  7. 2026PromptMark: A Prompt-Guided Iterative-Feedback Framework for Source Code Watermarking ↗
  8. 2026MATRIX: Multi-Layer Code Watermarking via Dual-Channel Constrained Parity-Check Encoding ↗