跳到正文
arXiv · NLP· Licheng Yu, Aiwei Liu, Songze Li·· 2026-10-14AI 评分23

Grammar-Driven Watermark:通过语法驱动机制优化 LLM 代码生成中水印质量与可检测性的权衡

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

AI 导读

针对 LLM 代码生成中低熵导致的质量与可检测性权衡难题,提出免训练的 Grammar-Driven Watermark(GDW)方法。 GDW 采用绿名单、语法有效性和结构角色三级掩码机制,通过分层调制限制注入范围并调节强度,并设计角色感知加权检测统计量。 实验显示 GDW 在现有基准中取得 SOTA 的权衡性能,且在七种语义保持攻击下保持优越表现。

来源:arXiv · NLP · arxiv.org