Is The Watermarking Of LLM-Generated Code Robust?

Tarun Suresh, Shubham Ugare, Gagandeep Singh, Sasa Misailovic
3/24/2024
12 citations
cs.CRcs.LG

Official code: uiuc-arc/llm-code-watermark (20 stars, Jupyter Notebook, last commit 2024-04-19).

Abstract

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations(1)

LLM Program Watermarking

203Jupyter Notebook, PythonJun 4, 20232 years ago

Similar Papers

Cite this paper

@article{suresh2024watermarking,
  title  = {Is The Watermarking Of LLM-Generated Code Robust?},
  author = {Tarun Suresh and Shubham Ugare and Gagandeep Singh and Sasa Misailovic},
  year   = {2024},
  eprint = {2403.17983},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2403.17983v4}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2403.17983.svg)](https://codeofpaper.com/paper/2403.17983)

Discussion