Is The Watermarking Of LLM-Generated Code Robust?

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Suresh, Tarun, Ugare, Shubham, Singh, Gagandeep, Misailovic, Sasa
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866909743820308480
author Suresh, Tarun
Ugare, Shubham
Singh, Gagandeep
Misailovic, Sasa
author_facet Suresh, Tarun
Ugare, Shubham
Singh, Gagandeep
Misailovic, Sasa
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2403_17983
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Is The Watermarking Of LLM-Generated Code Robust?
Suresh, Tarun
Ugare, Shubham
Singh, Gagandeep
Misailovic, Sasa
Cryptography and Security
Machine Learning
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.
title Is The Watermarking Of LLM-Generated Code Robust?
topic Cryptography and Security
Machine Learning
url https://arxiv.org/abs/2403.17983