CLASP: Training-Free LLM-Assisted Source Code Watermarking via Semantic-Preserving Transformations
On the map: LLM safety and security → Watermarking generated content and models
Abstract (arXiv)
The proliferation of open-source code and large language models (LLMs) for code generation has amplified the risks of unauthorized reuse and intellectual property infringement. Source code watermarking offers a potential solution, yet existing methods typically encode watermarks through identifiers, local code patterns, or limited handcrafted edits, leaving them vulnerable to renaming, refactoring, and adaptive watermark removal. These limitations hinder the joint achievement of robustness, capacity, generalization, and deployment efficiency. We propose CLASP, a Code LLM-Assisted Semantic-Preserving watermarking framework that enables training-free, plug-and-play watermarking for source code. CLASP embeds watermark bits within a fixed space of semantics-preserving transformations, enabling automated watermark insertion with higher capacity while remaining reusable across programming languages and less dependent on brittle lexical features. To recover the watermark, CLASP uses reference-code retrieval and differential comparison to identify transformation traces, avoiding task-specific model training while improving robustness to structural edits and adaptive attacks. Experiments across multiple programming languages show that CLASP consistently outperforms existing baselines in watermark extraction accuracy and robustness, while maintaining code quality under both random removal and adaptive de-watermarking attacks.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Placed in Watermarking generated content and models, one of 12 directions in LLM safety and security. Builds on 14 of its 34 references that are in the map. First posted on arXiv 13 Oct 2025.
Builds on
14 of 34 references.
Closest ancestors · 2
Same direction, newest first
- 2024CodeIP: A Grammar-Guided Multi-Bit Watermark for Large Language Models of Code24 Apr
- 2021Tracing Text Provenance via Context-Aware Lexical Substitution15 Dec
Other references · 12
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2024A Survey on Large Language Models for Code Generationcited by 658
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 479
- 2022Multi-lingual Evaluation of Code Generation Modelscited by 159
- 2020Adversarial Watermarking Transformer: Towards Tracing Text Provenance with Data Hidingcited by 130
- 2022Repository-Level Prompt Generation for Large Language Models of Codecited by 106
- 2023How Secure is Code Generated by ChatGPT?cited by 81
- 2022NatGen: Generative pre-training by "Naturalizing" source codecited by 54
- 2021CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoningcited by 47
- 2022RoPGen: Towards Robust Code Authorship Attribution via Automatic Coding Style Transformationcited by 15
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2024Is The Watermarking Of LLM-Generated Code Robust?
- 2025Disappearing Ink: Obfuscation Breaks N-gram Code Watermarks in Theory and Practice
- 2026DuCodeMark: Dual-Purpose Code Dataset Watermarking via Style-Aware Watermark-Poison Design ↗
- 2025Marking Code Without Breaking It: Code Watermarking for Detecting LLM-Generated Code
- 2023Towards Tracing Code Provenance with Code Watermarking
- 2026PromptMark: A Prompt-Guided Iterative-Feedback Framework for Source Code Watermarking ↗
- 2026SWaRL: Safeguard Code Watermarking via Reinforcement Learning
- 2024Efficient and Universal Watermarking for LLM-Generated Code Detection