Who Wrote this Code? Watermarking for Code Generation
On the map: LLM safety and security → Watermarking generated content and models
Abstract (arXiv)
Since the remarkable generation performance of large language models raised ethical and legal concerns, approaches to detect machine-generated 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.
Key facts. Cited by 116 papers in the map (data through 7 Oct 2026). Placed in Watermarking generated content and models, one of 12 directions in LLM safety and security. Builds on 36 of its 74 references that are in the map. First posted on arXiv 24 May 2023.
Builds on
36 of 74 references.
Closest ancestors · 6
Same direction, newest first
- 2023Paraphrasing evades detectors of AI-generated text, but retrieval is an effective defense23 Mar
- 2023Can AI-Generated Text be Reliably Detected?17 Mar
- 2023A Watermark for Large Language Models24 Jan
- 2022CATER: Intellectual Property Protection on Text Generation APIs via Conditional Watermarks19 Sep
- 2021Tracing Text Provenance via Context-Aware Lexical Substitution15 Dec
- 2021Protecting Intellectual Property of Language Generation APIs with Lexical Watermark5 Dec
Other references · 30
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2023GPT-4 Technical Reportcited by 18,132
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,266
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2019The Curious Case of Neural Text Degenerationcited by 2,881
- 2020Extracting Training Data from Large Language Modelscited by 2,144
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
- 2023StarCoder: may the source be with you!cited by 790
18 more
- 2023DetectGPT: Zero-Shot Machine-Generated Text Detection using Probability Curvaturecited by 705
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
- 2019Defending Against Neural Fake Newscited by 553
- 2019Release Strategies and the Social Impacts of Language Modelscited by 505
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 492
- 2019GLTR: Statistical Detection and Visualization of Generated Textcited by 490
- 2023How Close is ChatGPT to Human Experts? Comparison Corpus, Evaluation, and Detectioncited by 472
- 2022DS-1000: A Natural and Reliable Benchmark for Data Science Code Generationcited by 442
- 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 417
- 2019Automatic Detection of Generated Text is Easiest when Humans are Fooledcited by 260
- 2022Efficient Training of Language Models to Fill in the Middlecited by 248
- 2023SantaCoder: don't reach for the stars!cited by 169
- 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 149
- 2020Adversarial Watermarking Transformer: Towards Tracing Text Provenance with Data Hidingcited by 121
- 2022Lost at C: A User Study on the Security Implications of Large Language Model Code Assistantscited by 87
- 2023ChatGPT or Human? Detect and Explain. Explaining Decisions of Machine Learning Model for Detecting Short ChatGPT-generated Textcited by 84
- 2023Origin Tracing and Detecting of LLMscited by 39
- 2021The Threat of Offensive AI to Organizationscited by 37
Built on by
Citing papers per year: 2023: 15; 2024: 28; 2025: 47; 2026: 26.
116 papers.
Sort:
By area:
- 2023Can LLM-Generated Misinformation Be Detected?cited by 173
- 2023On the Reliability of Watermarks for Large Language Modelscited by 170
- 2023A Survey of Text Watermarking in the Era of Large Language Modelscited by 102
- 2023A Semantic Invariant Robust Watermark for Large Language Modelscited by 97
- 2024MarkLLM: An Open-Source Toolkit for LLM Watermarkingcited by 80
- 2023A Survey on Detection of LLMs-Generated Contentcited by 70
- 2023Mark My Words: Analyzing and Evaluating Language Model Watermarkscited by 62
- 2024An Entropy-based Text Watermarking Detection Methodcited by 61
- 2024Adaptive Text Watermark for Large Language Modelscited by 60
- 2023An Unforgeable Publicly Verifiable Watermark for Large Language Modelscited by 54
- 2024Watermarking Makes Language Models Radioactivecited by 52
- 2023Advancing Beyond Identification: Multi-bit Watermark for Large Language Modelscited by 51
38 more
- 2023Watermarking Conditional Text Generation for AI Detection: Unveiling Challenges and a Semantic-Aware Watermark Remedycited by 45
- 2023Towards Codable Watermarking for Injecting Multi-bits Information to LLMscited by 43
- 2024SoK: Watermarking for AI-Generated Contentcited by 43
- 2024Securing Large Language Models: Threats, Vulnerabilities and Responsible Practicescited by 36
- 2024Copyright Protection in Generative AI: A Technical Perspectivecited by 35
- 2024Token-Specific Watermarking with Enhanced Detectability and Semantic Coherence for Large Language Modelscited by 30
- 2024Between Lines of Code: Unraveling the Distinct Patterns of Machine and Human Programmerscited by 27
- 2023BioCoder: A Benchmark for Bioinformatics Code Generation with Large Language Modelscited by 24
- 2023Zero-Shot Detection of Machine-Generated Codescited by 24
- 2023Grounding Foundation Models through Federated Transfer Learning: A General Frameworkcited by 24
- 2023Optimizing watermarks for large language modelscited by 22
- 2024CodeIP: A Grammar-Guided Multi-Bit Watermark for Large Language Models of Codecited by 21
- 2025Self-Evolving Multi-Agent Systems via Textual Backpropagationcited by 21
- 2024Watermarking Techniques for Large Language Models: A Surveycited by 20
- 2024Learning to Watermark LLM-generated Text via Reinforcement Learningcited by 19
- 2025Can LLM Watermarks Robustly Prevent Unauthorized Knowledge Distillation?cited by 16
- 2024A Watermark for Black-Box Language Modelscited by 14
- 2025Mark Your LLM: Detecting the Misuse of Open-Source Large Language Models via Watermarkingcited by 14
- 2024Large Language Model Watermark Stealing With Mixed Integer Programmingcited by 13
- 2024A Practical Examination of AI-Generated Text Detectors for Large Language Modelscited by 11
- 2025VLA-Mark: A cross modal watermark for large vision-language alignment modelcited by 11
- 2025Defending LLM Watermarking Against Spoofing Attacks with Contrastive Representation Learningcited by 10
- 2024WaterSeeker: Pioneering Efficient Detection of Watermarked Segments in Large Documentscited by 9
- 2025In-Context Watermarks for Large Language Modelscited by 9
- 2023Assaying on the Robustness of Zero-Shot Machine-Generated Text Detectorscited by 8
- 2024Duwak: Dual Watermarks in Large Language Modelscited by 8
- 2025DuFFin: A Dual-Level Fingerprinting Framework for LLMs IP Protectioncited by 8
- 2025Enhancing LLM Watermark Resilience Against Both Scrubbing and Spoofing Attackscited by 8
- 2024Topic-Based Watermarks for Large Language Modelscited by 7
- 2024Watermark under Fire: A Robustness Evaluation of LLM Watermarkingcited by 7
- 2025Marking Code Without Breaking It: Code Watermarking for Detecting LLM-Generated Codecited by 7
- 2025Position: LLM Watermarking Should Align Stakeholders' Incentives for Practical Adoptioncited by 7
- 2024PersonaMark: Personalized LLM watermarking for model protection and user attributioncited by 6
- 2025Detecting Benchmark Contamination Through Watermarkingcited by 6
- 2025From Trade-off to Synergy: A Versatile Symbiotic Watermarking Framework for Large Language Modelscited by 5
- 2025Invisible Entropy: Towards Safe and Efficient Low-Entropy LLM Watermarkingcited by 5
- 2025SAEMark: Steering Personalized Multilingual LLM Watermarks with Sparse Autoencoderscited by 5
- 2026AgentMark: Utility-Preserving Behavioral Watermarking for Agentscited by 5
50 most cited of 116 All 116 (JSON)
- 2026TripPattern: A Pattern-based Text Watermarking Method for Large Language Models11 Sep 2026
- 2026TrajMark: Ownership Attribution and Segment-Level Tamper Localization for Coding-Agent Trajectories9 Sep 2026
- 2026Watermarks Without Verification: AI Text Watermarking After the EU AI Act9 Sep 2026
- 2026OpenStamp: A Watermark for Open-Source Language Models28 Aug 2026
- 2026ChainMark: Model-Free LLM Watermarking with Closed-Form Calibration20 Jul 2026
- 2026LLM Watermarking as Big Data Provenance: A Deployment-Oriented Systematization11 Jul 2026
- 2026Signature filtering: a lightweight enhancement for statistical watermark detection in large language models16 Jun 2026
- 2026Stability-Aware Feature Design for Robust Watermark Detection in Machine-Generated Text9 Jun 2026
- 2026Linguistics-Aware Non-Distortionary LLM Watermarking30 May 2026
- 2026Robust LLM Watermarking with Minimal Semantic Distortion for IP Protection22 May 2026
- 2026Marking the Wrong Symptoms: Evaluating LLM Watermarks in Medical Texts16 May 2026
- 2026Watermarking Should Be Treated as a Monitoring Primitive13 May 2026
38 more
- 2026TextSeal: A Localized LLM Watermark for Provenance & Distillation Protection12 May 2026
- 2026SSG: Logit-Balanced Vocabulary Partitioning for LLM Watermarking24 Apr 2026
- 2026SOCIA-EVO: Automated Simulator Construction via Dual-Anchored Bi-Level Optimization19 Apr 2026
- 2026A Systematic Study of Training-Free Methods for Trustworthy Large Language Models17 Apr 2026
- 2026When Only the Final Text Survives: Implicit Execution Tracing for Multi-Agent Auditing18 Mar 2026
- 2026Rethinking LLM Watermark Detection in Black-Box Settings: A Non-Intrusive Third-Party Framework16 Mar 2026
- 2026Watermarking LLM Agent Trajectories21 Feb 2026
- 2026AGMark: Attention-Guided Dynamic Watermarking for Large Vision-Language Models10 Feb 2026
- 2026WorldCup Sampling for Multi-bit LLM Watermarking2 Feb 2026
- 2026Semantic Differentiation for Tackling Challenges in Watermarking Low-Entropy Constrained Generation Outputs14 Jan 2026
- 2026A Visual Semantic Adaptive Watermark grounded by Prefix-Tuning for Large Vision-Language Model12 Jan 2026
- 2026Distilling the Thought, Watermarking the Answer: A Principle Semantic Guided Watermark for Large Reasoning Models8 Jan 2026
- 2026AgentMark: Utility-Preserving Behavioral Watermarking for Agents5 Jan 2026
- 2026SWaRL: Safeguard Code Watermarking via Reinforcement Learning5 Jan 2026
- 2025How Good is Post-Hoc Watermarking With Language Model Rephrasing?18 Dec 2025
- 2025CODE ACROSTIC: Robust Watermarking for Code Generation14 Dec 2025
- 2025WaterSearch: Exploring Seed Pooling for Improving the Quality-Detectability Trade-off in LLM Watermarking30 Nov 2025
- 2025WaterMod: Modular Token-Rank Partitioning for Probability-Balanced LLM Watermarking11 Nov 2025
- 2025Adaptive Testing for Segmenting Watermarked Texts From Language Models10 Nov 2025
- 2025PVMark: Enabling Public Verifiability for LLM Watermarking Schemes30 Oct 2025
- 2025Position: LLM Watermarking Should Align Stakeholders' Incentives for Practical Adoption21 Oct 2025
- 2025Is Multilingual LLM Watermarking Truly Multilingual? Scaling Robustness to 100+ Languages via Back-Translation20 Oct 2025
- 2025Learning to Watermark: A Selective Watermarking Framework for Large Language Models via Multi-Objective Optimization13 Oct 2025
- 2025DITTO: A Spoofing Attack Framework on Watermarked LLMs via Knowledge Distillation13 Oct 2025
- 2025SimKey: A Semantically Aware Key Module for Watermarking Language Models11 Oct 2025
- 2025A Linguistics-Aware LLM Watermarking via Syntactic Predictability10 Oct 2025
- 2025LLM Unlearning on Noisy Forget Sets: A Study of Incomplete, Rewritten, and Watermarked Data10 Oct 2025
- 2025CATMark: A Context-Aware Thresholding Framework for Robust Cross-Task Watermarking in Large Language Models27 Sep 2025
- 2025LLM Watermark Evasion via Bias Inversion27 Sep 2025
- 2025Yet Another Watermark for Large Language Models16 Sep 2025
- 2025Factuality Beyond Coherence: Evaluating LLM Watermarking Methods for Medical Texts9 Sep 2025
- 2025Paladin: Defending LLM-enabled Phishing Emails with a New Trigger-Tag Paradigm8 Sep 2025
- 2025Improving Detection of Watermarked Language Models18 Aug 2025
- 2025Optimizing Token Choice for Code Watermarking: An RL Approach16 Aug 2025
- 2025SAEMark: Steering Personalized Multilingual LLM Watermarks with Sparse Autoencoders11 Aug 2025
- 2025Majority Bit-Aware Watermarking For Large Language Models5 Aug 2025
- 2025VLA-Mark: A cross modal watermark for large vision-language alignment model18 Jul 2025
- 2025Enhancing LLM Watermark Resilience Against Both Scrubbing and Spoofing Attacks8 Jul 2025
50 newest of 116 All 116 (JSON)
- 2023On the Reliability of Watermarks for Large Language Modelscited by 170
- 2023A Survey of Text Watermarking in the Era of Large Language Modelscited by 102
- 2023A Semantic Invariant Robust Watermark for Large Language Modelscited by 97
- 2024MarkLLM: An Open-Source Toolkit for LLM Watermarkingcited by 80
- 2023Mark My Words: Analyzing and Evaluating Language Model Watermarkscited by 62
- 2024An Entropy-based Text Watermarking Detection Methodcited by 61
- 2024Adaptive Text Watermark for Large Language Modelscited by 60
- 2023An Unforgeable Publicly Verifiable Watermark for Large Language Modelscited by 54
- 2024Watermarking Makes Language Models Radioactivecited by 52
- 2023Advancing Beyond Identification: Multi-bit Watermark for Large Language Modelscited by 51
- 2023Watermarking Conditional Text Generation for AI Detection: Unveiling Challenges and a Semantic-Aware Watermark Remedycited by 45
- 2023Towards Codable Watermarking for Injecting Multi-bits Information to LLMscited by 43
12 most cited of 82 All 82 (JSON)
- 2026TripPattern: A Pattern-based Text Watermarking Method for Large Language Models11 Sep 2026
- 2026Watermarks Without Verification: AI Text Watermarking After the EU AI Act9 Sep 2026
- 2026OpenStamp: A Watermark for Open-Source Language Models28 Aug 2026
- 2026ChainMark: Model-Free LLM Watermarking with Closed-Form Calibration20 Jul 2026
- 2026LLM Watermarking as Big Data Provenance: A Deployment-Oriented Systematization11 Jul 2026
- 2026Signature filtering: a lightweight enhancement for statistical watermark detection in large language models16 Jun 2026
- 2026Stability-Aware Feature Design for Robust Watermark Detection in Machine-Generated Text9 Jun 2026
- 2026Linguistics-Aware Non-Distortionary LLM Watermarking30 May 2026
- 2026Robust LLM Watermarking with Minimal Semantic Distortion for IP Protection22 May 2026
- 2026Marking the Wrong Symptoms: Evaluating LLM Watermarks in Medical Texts16 May 2026
- 2026TextSeal: A Localized LLM Watermark for Provenance & Distillation Protection12 May 2026
- 2026SSG: Logit-Balanced Vocabulary Partitioning for LLM Watermarking24 Apr 2026
12 newest of 82 All 82 (JSON)
- 2025Self-Evolving Multi-Agent Systems via Textual Backpropagationcited by 21
- 2026AgentMark: Utility-Preserving Behavioral Watermarking for Agentscited by 5
- 2026Watermarking LLM Agent Trajectoriescited by 3
- 2026TrajMark: Ownership Attribution and Segment-Level Tamper Localization for Coding-Agent Trajectoriescited by 0
- 2026TrajMark: Ownership Attribution and Segment-Level Tamper Localization for Coding-Agent Trajectories9 Sep 2026
- 2026Watermarking LLM Agent Trajectories21 Feb 2026
- 2026AgentMark: Utility-Preserving Behavioral Watermarking for Agents5 Jan 2026
- 2025Self-Evolving Multi-Agent Systems via Textual Backpropagation10 Jun 2025
- 2023Can LLM-Generated Misinformation Be Detected?cited by 173
- 2023A Survey on Detection of LLMs-Generated Contentcited by 70
- 2024Securing Large Language Models: Threats, Vulnerabilities and Responsible Practicescited by 36
- 2024Copyright Protection in Generative AI: A Technical Perspectivecited by 35
- 2024Between Lines of Code: Unraveling the Distinct Patterns of Machine and Human Programmerscited by 27
- 2023BioCoder: A Benchmark for Bioinformatics Code Generation with Large Language Modelscited by 24
- 2023Zero-Shot Detection of Machine-Generated Codescited by 24
- 2023Grounding Foundation Models through Federated Transfer Learning: A General Frameworkcited by 24
- 2024A Practical Examination of AI-Generated Text Detectors for Large Language Modelscited by 11
- 2024WaterSeeker: Pioneering Efficient Detection of Watermarked Segments in Large Documentscited by 9
- 2023Assaying on the Robustness of Zero-Shot Machine-Generated Text Detectorscited by 8
- 2025Detecting Benchmark Contamination Through Watermarkingcited by 6
12 most cited of 25 All 25 (JSON)
- 2026Watermarking Should Be Treated as a Monitoring Primitive13 May 2026
- 2026SOCIA-EVO: Automated Simulator Construction via Dual-Anchored Bi-Level Optimization19 Apr 2026
- 2026A Systematic Study of Training-Free Methods for Trustworthy Large Language Models17 Apr 2026
- 2026When Only the Final Text Survives: Implicit Execution Tracing for Multi-Agent Auditing18 Mar 2026
- 2026SWaRL: Safeguard Code Watermarking via Reinforcement Learning5 Jan 2026
- 2025Paladin: Defending LLM-enabled Phishing Emails with a New Trigger-Tag Paradigm8 Sep 2025
- 2025Disappearing Ink: Obfuscation Breaks N-gram Code Watermarks in Theory and Practice7 Jul 2025
- 2025Evaluating LLM-Contaminated Crowdsourcing Data Without Ground Truth8 Jun 2025
- 2025Zero-Shot Detection of LLM-Generated Code via Approximated Task Conditioning6 Jun 2025
- 2025Detection of LLM-Paraphrased Code and Identification of the Responsible LLM Using Coding Style Features25 Feb 2025
- 2025Detecting Benchmark Contamination Through Watermarking24 Feb 2025
- 2025Toward Copyright Integrity and Verifiability via Multi-Bit Watermarking for Intelligent Transportation Systems8 Feb 2025
12 newest of 25 All 25 (JSON)