SEW: Style-Encoded Watermarking of LLM-Generated Code
SEW watermarks already generated LLM code using secret-keyed style rules calibrated on human-written code.
SEW embeds and detects watermarks in already generated LLM code instead of changing token selection during generation. Style rules drawn from style guides are chosen by a secret key and each program's structure, then calibrated against style probabilities from human-written code. Context-aware aggregation stops repeated applications of the same style from inflating evidence. Across three unnamed LLMs and three languages on CodeContests, mean TPR at 5% FPR improved 12.44% over baselines, with only a 0.94% mean relative drop under four non-LLM editing attacks.
- Watermarks completed code rather than altering token sampling
- Secret key and structure choose style-guide transformation rules
- Evidence is calibrated on human-written code style probabilities
- Mean TPR at 5% FPR rose 12.44% on CodeContests
From the original article
1 min read at arxiv.orgCode watermarking supports provenance tracking for code generated by LLMs. Modifying token selection to embed watermarks as an LLM generates code can create a trade-off between detectability and functional correctness. Other methods instead watermark completed code using predefined transformations or trained neural models.
By Soohan Lim · arxiv.org
A short excerpt; the article and its images belong to the publisher. Summary, key facts and assessment above are AI-written from the article and can be wrong.