MATRIX: Multi-Layer Code Watermarking via Dual-Channel Constrained Parity-Check Encoding

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Nie, Yuqing, Wang, Chong, Xu, Guosheng, Xu, Guoai, Wang, Chenyu, Wang, Haoyu, Wang, Kailong
Format: Preprint
Published: 2026
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866908973925400576
author Nie, Yuqing
Wang, Chong
Xu, Guosheng
Xu, Guoai
Wang, Chenyu
Wang, Haoyu
Wang, Kailong
author_facet Nie, Yuqing
Wang, Chong
Xu, Guosheng
Xu, Guoai
Wang, Chenyu
Wang, Haoyu
Wang, Kailong
contents Code Large Language Models (Code LLMs) have revolutionized software development but raised critical concerns regarding code provenance, copyright protection, and security. Existing code watermarking approaches suffer from two fundamental limitations: black-box methods either exhibit detectable syntactic patterns vulnerable to statistical analysis or rely on implicit neural embedding behaviors that weaken interpretability, auditability, and precise control, while white-box methods lack code-aware capabilities that may compromise functionality. Moreover, current single-layer watermarking schemes fail to address increasingly complex provenance requirements such as multi-level attribution and version tracking. We present MATRIX, a novel code watermarking framework that formulates watermark encoding as solving constrained parity-check matrix equations. MATRIX employs dual-channel watermarking through variable naming and semantic-preserving transformations, enhancing watermark coverage across a wider range of code while ensuring mutual backup for robustness. By integrating BCH error-correction codes with solution space diversity, our approach achieves robustness against statistical analysis. Extensive evaluation on Python code generated by multiple Code LLMs demonstrates that MATRIX achieves an average watermark detection accuracy of 99.20% with minimal functionality loss (0-0.14%), improves robustness by 7.70-26.67% against various attacks, and increases watermarking applicability by 2-6x compared with existing methods. These results establish MATRIX as an effective solution for complex code provenance scenarios while balancing among detectability, fidelity, and robustness.
format Preprint
id arxiv_https___arxiv_org_abs_2604_16001
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle MATRIX: Multi-Layer Code Watermarking via Dual-Channel Constrained Parity-Check Encoding
Nie, Yuqing
Wang, Chong
Xu, Guosheng
Xu, Guoai
Wang, Chenyu
Wang, Haoyu
Wang, Kailong
Cryptography and Security
Code Large Language Models (Code LLMs) have revolutionized software development but raised critical concerns regarding code provenance, copyright protection, and security. Existing code watermarking approaches suffer from two fundamental limitations: black-box methods either exhibit detectable syntactic patterns vulnerable to statistical analysis or rely on implicit neural embedding behaviors that weaken interpretability, auditability, and precise control, while white-box methods lack code-aware capabilities that may compromise functionality. Moreover, current single-layer watermarking schemes fail to address increasingly complex provenance requirements such as multi-level attribution and version tracking. We present MATRIX, a novel code watermarking framework that formulates watermark encoding as solving constrained parity-check matrix equations. MATRIX employs dual-channel watermarking through variable naming and semantic-preserving transformations, enhancing watermark coverage across a wider range of code while ensuring mutual backup for robustness. By integrating BCH error-correction codes with solution space diversity, our approach achieves robustness against statistical analysis. Extensive evaluation on Python code generated by multiple Code LLMs demonstrates that MATRIX achieves an average watermark detection accuracy of 99.20% with minimal functionality loss (0-0.14%), improves robustness by 7.70-26.67% against various attacks, and increases watermarking applicability by 2-6x compared with existing methods. These results establish MATRIX as an effective solution for complex code provenance scenarios while balancing among detectability, fidelity, and robustness.
title MATRIX: Multi-Layer Code Watermarking via Dual-Channel Constrained Parity-Check Encoding
topic Cryptography and Security
url https://arxiv.org/abs/2604.16001