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.
Mark Your LLM: Detecting the Misuse of Open-Source Large Language Models via Watermarking
The Hong Kong University of Science and Technology (Guangzhou)(香港科技大学(广州));Tsinghua University(清华大学);The Hong Kong University of Science and Technology(香港科技大学)
Institute of Information Engineering, Chinese Academy of Sciences(中国科学院信息工程研究所);School of Cyber Security, University of Chinese Academy of Sciences(中国科学院大学网络与信息安全学院)
University of California, Berkeley(加州大学伯克利分校);Columbia University(哥伦比亚大学);Cornell University(康奈尔大学);Anthropic;Oregon State University(俄勒冈州立大学);Google DeepMind(谷歌DeepMind);ETH Zurich(苏黎世联邦理工学院);University of Wisconsin–Madison(威斯康星大学麦迪逊分校);Carnegie Mellon University(卡内基梅隆大学);University of California, San Diego(加州大学圣地亚哥分校)
Towards Better Statistical Understanding of Watermarking LLMs
Imperial College Business School, Imperial College London(帝国理工学院商学院,帝国理工学院);The University of Sydney Business School, The University of Sydney(悉尼大学商学院,悉尼大学);Grado Department of Industrial and Systems Engineering, Virginia Tech(弗吉尼亚理工大学工业与系统工程系)
Efficient and Universal Watermarking for LLM-Generated Code Detection
College of Computer Science and Technology, Harbin Engineering University(哈尔滨工程大学计算机科学与技术学院);School of Computing and Information Systems, Singapore Management University(新加坡管理大学计算与信息学院)
MarkLLM: An Open-Source Toolkit for LLM Watermarking
Tsinghua University(清华大学);Shanghai Jiao Tong University(上海交通大学);The University of Sydney(悉尼大学);UC Santa Barbara(加州大学圣巴巴拉分校);The Chinese University of Hong Kong(香港中文大学);The Hong Kong University of Science and Technology (Guangzhou)(香港科技大学(广州));The Hong Kong University of Science and Technology(香港科技大学);University of Illinois at Chicago(芝加哥大学伊利诺伊分校)
Implicit Identity Technologies for LLMs: Fingerprinting and Watermarking across Datasets, Models, and Generated Content
School of Cyber Science and Engineering, Xi’an Jiaotong University, Xi’an, China(西安交通大学计算机科学与工程学院);State Grid Henan Marketing Service Center, Henan, China(国网河南营销服务中心);Institute of Information Engineering, Chinese Academy of Sciences, Beijing, China(中国科学院信息工程研究所);School of Cyber Security, University of Chinese Academy of Sciences, Beijing, China(中国科学院大学网络安全学院);School of Information Technology, Deakin University, Geelong, Australia(迪金大学信息技术学院)
MirrorMark: Generalizable Mirrored Sampling for Multi-bit LLM Watermarking
George Mason University(乔治·马歇尔大学);Department of Computer Science(计算机科学系);Wireless Cyber Center(无线网络安全中心);Department of Electrical and Computer Engineering(电气与计算机工程系)
RTLMarker: Protecting LLM-Generated RTL Copyright via a Hardware Watermarking Framework
Institute of Computing Technology, Chinese Academy of Sciences(中国科学院计算技术研究所);Hangzhou Institute for Advanced Study, University of Chinese Academy of Sciences(中国科学院大学杭州高等研究院);University of Chinese Academy of Sciences(中国科学院大学)
Revealing Weaknesses in Text Watermarking Through Self-Information Rewrite Attacks
University of British Columbia(不列颠哥伦比亚大学);Vector Institute for AI(向量人工智能研究所);University of Cambridge(剑桥大学);Canada CIFAR AI Chair(加拿大CIFAR人工智能主席);NSERC CRC Chair(NSERC加拿大研究主席)
Blind PRNG Hijacking: An Undetectable Integrity-Preserving Attack Against LLM Watermarking
Fujian Provincial Key Laboratory of Automotive Electronics and Electric Drive(福建省汽车电子与电力驱动重点实验室);School of Electronic, Electrical and Physics(电子、电气与物理学院);Fujian University of Technology(福建理工大学);School of Humanities(人文学院);Institute of Applied Physics and Materials Engineering(应用物理与材料工程学院);University of Macau(澳门大学)