Lune

FSE2023Top-tier venue

CodeMark: Imperceptible Watermarking for Code Datasets against Neural Code Completion Models

Zhensu Sun, Xiaoning Du, Fu Song, Li Li

Abstract

Code datasets are of immense value for training neural-network-based code completion models, where companies or organizations have made substantial investments to establish and process these datasets. Unluckily, these datasets, either built for proprietary or public usage, face the high risk of unauthorized exploits, resulting from data leakages, license violations, etc. Even worse, the "black-box" nature of neural models sets a high barrier for externals to audit their training datasets, which further connives these unauthorized usages. Currently, watermarking methods have been proposed to prohibit inappropriate usage of image and natural language datasets. However, due to domain specificity, they are not directly applicable to code datasets, leaving the copyright protection of this emerging and important field of code data still exposed to threats. To fill this gap, we propose a method, named CodeMark, to embed user-defined imperceptible watermarks into code datasets to trace their usage in training neural code completion models. CodeMark is based on adaptive semantic-preserving transformations, which preserve the exact functionality of the code data and keep the changes covert against rule-breakers. We implement CodeMark in a toolkit and conduct an extensive evaluation of code completion models. CodeMark is validated to fulfill all desired properties of practical watermarks, including harmlessness to model accuracy, verifiability, robustness, and imperceptibility.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

15 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Natural Attack for Pre-trained Models of Code cites Adversarial examples for models of code
  • Natural Attack for Pre-trained Models of Code cites Generating Adversarial Examples for Holding Robustness of Source Code Processing Models
  • Natural Attack for Pre-trained Models of Code cites You Autocomplete Me: Poisoning Vulnerabilities in Neural Code Completion
  • You Autocomplete Me: Poisoning Vulnerabilities in Neural Code Completion cites Adversarial examples for models of code
  • WaterMod: Modular Token-Rank Partitioning for Probability-Balanced LLM Watermarking cites Inevitable Trade-off between Watermark Strength and Speculative Sampling Efficiency for Language Models
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers15

  1. Inevitable Trade-off between Watermark Strength and Speculative Sampling Efficiency for Language ModelsZhengmian Hu, Heng HuangNeurIPS 2024 · 10 citations
  2. Between Lines of Code: Unraveling the Distinct Patterns of Machine and Human ProgrammersYuling Shi, Hongyu Zhang, Chengcheng Wan, Xiaodong GuICSE 2025 · 9 citations
  3. WaterMod: Modular Token-Rank Partitioning for Probability-Balanced LLM WatermarkingShinwoo Park, Hyejin Park, Hyeseon Ahn, Yo-Sub HanAAAI 2026 · 6 citations
  4. Paladin: Defending LLM-enabled Phishing Emails with a New Trigger-Tag ParadigmYan Pang, Wenlong Meng, Xiaojing Liao, Tianhao WangNDSS 2026 · 5 citations
  5. Watermarking LLM Agent TrajectoriesWenlong Meng, Chen GONG, Terry Yue Zhuo, Fan Zhang et al.ICML 2026 · 2 citations

Builds on10

  1. Turning Your Weakness Into a Strength: Watermarking Deep Neural Networks by BackdooringYossi Adi, Carsten Baum, Moustapha Cissé, Benny Pinkas et al.USENIX Security 2018 · 832 citations
  2. You Autocomplete Me: Poisoning Vulnerabilities in Neural Code CompletionRoei Schuster, Congzheng Song, Eran Tromer, Vitaly ShmatikovUSENIX Security 2021 · 199 citations
  3. Adversarial examples for models of codeNoam Yefet, Uri Alon, Eran YahavOOPSLA 2020 · 162 citations
  4. Natural Attack for Pre-trained Models of CodeZhou Yang, Jieke Shi, Junda He, David LoICSE 2022 · 150 citations
  5. Generating Adversarial Examples for Holding Robustness of Source Code Processing ModelsHuangzhao Zhang, Zhuo Li, Ge Li, Lei Ma et al.AAAI 2020 · 148 citations

Related papers

  1. DuCodeMark: Dual-Purpose Code Dataset Watermarking via Style-Aware Watermark-Poison DesignYuchen Chen, Yuan Xiao, Chunrong Fang, Zhenyu Chen et al.FSE 2026
  2. Beyond Dataset Watermarking: Model-Level Copyright Protection for Code Summarization ModelsJiale Zhang, Haoxuan Li, Di Wu, Xiaobing Sun et al.WWW 2025 · 2 citations
  3. PuzzleMark: Implicit Jigsaw Learning for Robust Code Dataset Watermarking in Neural Code Completion ModelsHaocheng Huang, Yuchen Chen, Weisong Sun, Peizhuo Lv et al.FSE 2026
  4. CodeGenGuard: A Watermark for Code Generation ModelsBorui Yang, Mingxuan Ma, Liyao Xiang, Nan Chen et al.ICLR 2026
  5. SrcMarker: Dual-Channel Source Code Watermarking via Scalable Code TransformationsBorui Yang, Wei Li, Liyao Xiang, Bo LiS&P 2024 · 21 citations
Dusk over the sea between two cliffs drawn in fine vertical lines