Skip to content
aiqbench takeAI Safety

aiqbench analysis

This research addresses the critical quality-detectability trade-off in AI-generated code by introducing Grammar-Driven Watermark (GDW), a training-free method that leverages syntactic constraints to enhance watermark robustness against semantics-preserving attacks. By defining a new metric called Area Under the Trade-off Curve (AUTC), the study provides a rigorous framework for evaluating watermarking efficacy specifically within low-entropy code generation contexts.
Source coveringarXiv
What this isA model's reading of the article and related coverage, written for aiqbench. Not the publisher's words.

Preserving Structure, Strengthening Signals: A Grammar-Driven Approach to Optimize the Trade-off Between Quality and Detectability in Code Watermarking

arXiv2 min read

arXiv:2607.10210v2 Announce Type: replace-cross Abstract: Text watermarking has emerged as a crucial technique for identifying AI-generated content. However, current watermarking schemes entail a trade-off between text quality and watermark detectability, which is further intensified by the inherent low-entropy nature of code. To mitigate this dilemma, we propose Grammar-Driven Watermark (GDW), a training-free watermarking approach tailored to LLM-based code generation. GDW employs a three-level masking mechanism consisting of a green-list mask, a syntactic validity mask, and a structural role mask to regulate watermark injection. These masks are integrated through hierarchical modulation, which limits the scope of watermark injection to syntactically admissible green-list tokens and adjusts watermark strength based on structural roles through a role function. Accordingly, we design a role-aware weighted detection statistic. For comprehensive evaluation, we introduce the Area Under the Trade-off Curve (AUTC), a metric that quantifies the quality-detectability trade-off. Extensive experiments demonstrate that GDW outperforms existing baselines and achieves state-of-the-art (SOTA) trade-off performance, while maintaining superior performance under seven semantics-preserving attacks.

Abstract:Text watermarking has emerged as a crucial technique for identifying AI-generated content. However, current watermarking schemes entail a trade-off between text quality and watermark detectability, which is further intensified by the inherent low-entropy nature of code. To mitigate this dilemma, we propose Grammar-Driven Watermark (GDW), a training-free watermarking approach tailored to LLM-based code generation. GDW employs a three-level masking mechanism consisting of a green-list mask, a syntactic validity mask, and a structural role mask to regulate watermark injection. These masks are integrated through hierarchical modulation, which limits the scope of watermark injection to syntactically admissible green-list tokens and adjusts watermark strength based on structural roles through a role function. Accordingly, we design a role-aware weighted detection statistic. For comprehensive evaluation, we introduce the Area Under the Trade-off Curve (AUTC), a metric that quantifies the quality-detectability trade-off. Extensive experiments demonstrate that GDW outperforms existing baselines and achieves state-of-the-art (SOTA) trade-off performance, while maintaining superior performance under seven semantics-preserving attacks.

Cryptography and Security (cs.CR); Computation and Language (cs.CL)

arXiv:2607.10210 [cs.CR]

(or arXiv:2607.10210v2 [cs.CR] for this version)

https://doi.org/10.48550/arXiv.2607.10210 Focus to learn more arXiv-issued DOI via DataCite

arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.

Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.

Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs.

Full text under the publisher's open licence · 255 words

Related coverage