← Lab /Security & privacy

Dual-channel code watermarking reaches 99.2% detection with <0.14% functionality loss

MATRIX achieves 99.20% watermark detection accuracy, 0-0.14% functionality loss, and 7.70-26.67% improved robustness against attacks

Security & privacy arXiv 17 Apr 2026 Method Simulation evidence Threat model

Published as “MATRIX: Multi-Layer Code Watermarking via Dual-Channel Constrained Parity-Check Encoding”

Why it matters

Enables reliable attribution of LLM-generated code, helping detect plagiarism and enforce copyright without harming code quality.

Summary

MATRIX attains an average watermark detection accuracy of 99.20% while preserving code functionality with a loss rate between 0% and 0.14%. It expands watermark coverage by up to 6× versus prior black-box methods and remains robust, keeping detection rates of 96-98.67% under variable-renaming attacks and near-perfect (97-100%) under formatting attacks. The evidence comes from experiments on thousands of Python snippets from APPS, HumanEval and MBPP, compared against ACW and SWEET baselines.

What they found 7

  1. Minimal functional impact

    “loss rate between 0% and 0.14%”

  2. Near-perfect extraction

    “and attains up to 100.0% watermark information extraction accuracy.”

  3. Improved robustness over attacks

    “MATRIX maintains TPRs of 96-98.67%, far exceeding ACW (72.00%) and SWEET (20.98%).”

  4. Higher false-positive trade-off due to dual-channel backup

    “the FPR is slightly higher due to the backup mechanism, where a watermark is considered present if either channel detects it.”

  5. Expanded watermarkable sample set

    “MATRIX significantly expand the watermarking coverage by approximately 6 times compared to ACW on APPS, and twice as many on HumanEval and MBPP.”

  6. Low mutual information leakage

    “MI is similarly low (avg. 0.0479 nats)”

  7. Negligible degradation of test pass rate

    “on APPS, the pass rate drops by only 0.14%”

Caveats 1

  • The false-positive rate can reach 1.34% on APPS-G (Table III), reflecting the trade-off of the dual-channel backup mechanism.

What’s new here 4

  • Dual-channel design (natural variable-renaming and formal semantic-preserving transformations) providing backup redundancy
  • Encoding watermarks as solutions to constrained parity-check matrix equations
  • Use of BCH error-correction codes to increase covertness against statistical analysis
  • Multi-layer provenance support without changing system-level settings, enabling organization- and individual-level attribution

Threat model stated by the source

Adversarystrong end-user adversary
Capabilitycan apply variable renaming, rule-based refactoring, LLM-based rewriting, and code reformatting
Assumesattacker sees only watermarked code; knows high-level framework but not concrete transformation rules or anchor definitions