Lune

ACL2024Top-tier venue

Who Wrote this Code? Watermarking for Code Generation

Taehyun Lee, Seokhee Hong, Jaewoo Ahn, Ilgee Hong, Hwaran Lee, Sangdoo Yun, Jamin Shin, Gunhee Kim

Abstract

Since the remarkable generation performance of large language models raised ethical and legal concerns, approaches to detect machinegenerated text by embedding watermarks are being developed. However, we discover that the existing works fail to function appropriately in code generation tasks due to the task's nature of having low entropy. Extending a logit-modifying watermark method, we propose Selective WatErmarking via Entropy Thresholding (SWEET), which enhances detection ability and mitigates code quality degeneration by removing low-entropy segments at generating and detecting watermarks. Our experiments show that SWEET significantly improves code quality preservation while outperforming all baselines, including post-hoc detection methods, in detecting machine-generated code text. Our code is available in https:// github.com/hongcheki/sweet-watermark .

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.

54 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

  • A Semantic Invariant Robust Watermark for Large Language Models cites Paraphrasing evades detectors of AI-generated text, but retrieval is an effective defense
  • Paraphrasing evades detectors of AI-generated text, but retrieval is an effective defense cites A Semantic Invariant Robust Watermark for Large Language Models
  • A Semantic Invariant Robust Watermark for Large Language Models cites On the Reliability of Watermarks for Large Language Models
  • Adaptive Code Watermarking Through Reinforcement Learning cites Paraphrasing evades detectors of AI-generated text, but retrieval is an effective defense
  • Adaptive Code Watermarking Through Reinforcement Learning cites DetectGPT: Zero-Shot Machine-Generated Text Detection using Probability Curvature
  • Adaptive Code Watermarking Through Reinforcement Learning cites On the Reliability of Watermarks for Large Language Models
  • Paraphrasing evades detectors of AI-generated text, but retrieval is an effective defense cites DetectGPT: Zero-Shot Machine-Generated Text Detection using Probability Curvature
  • DetectGPT: Zero-Shot Machine-Generated Text Detection using Probability Curvature cites Paraphrasing evades detectors of AI-generated text, but retrieval is an effective defense
  • Paraphrasing evades detectors of AI-generated text, but retrieval is an effective defense cites On the Reliability of Watermarks for Large Language Models
  • On the Reliability of Watermarks for Large Language Models cites Paraphrasing evades detectors of AI-generated text, but retrieval is an effective defense
  • Paraphrasing evades detectors of AI-generated text, but retrieval is an effective defense cites The Curious Case of Neural Text Degeneration
  • Watermarking Makes Language Models Radioactive cites A Semantic Invariant Robust Watermark for Large Language Models
  • Watermarking Makes Language Models Radioactive cites Watermarking Conditional Text Generation for AI Detection: Unveiling Challenges and a Semantic-Aware Watermark Remedy
  • Watermarking Makes Language Models Radioactive cites On the Reliability of Watermarks for Large Language Models
  • Watermarking Makes Language Models Radioactive cites The Curious Case of Neural Text Degeneration
  • Watermarking Conditional Text Generation for AI Detection: Unveiling Challenges and a Semantic-Aware Watermark Remedy cites DetectGPT: Zero-Shot Machine-Generated Text Detection using Probability Curvature
  • On the Reliability of Watermarks for Large Language Models cites DetectGPT: Zero-Shot Machine-Generated Text Detection using Probability Curvature
  • On the Reliability of Watermarks for Large Language Models cites The Curious Case of Neural Text Degeneration
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers54

  1. On the Reliability of Watermarks for Large Language ModelsJohn Kirchenbauer, Jonas Geiping, Yuxin Wen, Manli Shu et al.ICLR 2024 · 202 citations
  2. A Semantic Invariant Robust Watermark for Large Language ModelsAiwei Liu, Leyi Pan, Xuming Hu, Shiao Meng et al.ICLR 2024 · 108 citations
  3. Adaptive Code Watermarking Through Reinforcement LearningZhimeng Guo, Huaisheng Zhu, Siyuan Xu, Hangfan Zhang et al.ICML 2026 · 73 citations
  4. Watermarking Makes Language Models RadioactiveTom Sander, Pierre Fernandez, Alain Durmus, Matthijs Douze et al.NeurIPS 2024 · 68 citations
  5. Watermarking Conditional Text Generation for AI Detection: Unveiling Challenges and a Semantic-Aware Watermark RemedyYu Fu, Deyi Xiong, Yue DongAAAI 2024 · 66 citations

Builds on22

  1. The Curious Case of Neural Text DegenerationAri Holtzman, Jan Buys, Li Du, Maxwell Forbes et al.ICLR 2020 · 4,112 citations
  2. DetectGPT: Zero-Shot Machine-Generated Text Detection using Probability CurvatureEric Mitchell, Yoonho Lee, Alexander Khazatsky, Christopher D. Manning et al.ICML 2023 · 988 citations
  3. WizardCoder: Empowering Code Large Language Models with Evol-InstructZiyang Luo, Can Xu, Pu Zhao, Qingfeng Sun et al.ICLR 2024 · 945 citations
  4. Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code ContributionsHammond Pearce, Baleegh Ahmad, Benjamin Tan, Brendan Dolan-Gavitt et al.S&P 2022 · 725 citations
  5. Paraphrasing evades detectors of AI-generated text, but retrieval is an effective defenseKalpesh Krishna, Yixiao Song, Marzena Karpinska, John Wieting et al.NeurIPS 2023 · 657 citations

Related papers

  1. From Trade-off to Synergy: A Versatile Symbiotic Watermarking Framework for Large Language ModelsYidan Wang, Yubing Ren, Yanan Cao, Binxing FangACL 2025 · 4 citations
  2. Adaptive Text Watermark for Large Language ModelsYepeng Liu, Yuheng BuICML 2024 · 63 citations
  3. An Entropy-based Text Watermarking Detection MethodYijian Lu, Aiwei Liu, Dianzhi Yu, Jingjing Li et al.ACL 2024 · 14 citations
  4. Token-Specific Watermarking with Enhanced Detectability and Semantic Coherence for Large Language ModelsMingjia Huo, Sai Ashish Somayajula, Youwei Liang, Ruisi Zhang et al.ICML 2024 · 37 citations
  5. HeavyWater and SimplexWater: Distortion-free LLM Watermarks for Low-Entropy DistributionsDor Tsur, Carol Xuan Long, Claudio Mayrink Verdun, Sajani Vithana et al.NeurIPS 2025 · 9 citations
Dusk over the sea between two cliffs drawn in fine vertical lines