COSTA: Code Watermarking via Statement-Level ASTs for Large Language Models
Anonymous authors
ICLR 2027
TL;DR. We design a novel LLM watermark scheme tailored to code generation.
Abstract. Large language models exhibit strong code generation capabilities, accelerating software development and widespread adoption of AI coding assistants. As generated code becomes harder to distinguish from human-written code, legal, ethical, and security concerns motivate watermarking for provenance tracing. However, existing generation-time code watermarking methods rely mainly on token-level biases that can compromise functional correctness, while sentence-level text watermarking remains difficult to transfer directly from natural language to constrained code space. In this paper, we introduce COSTA, the first generation-time, statement-level code watermarking framework that encodes provenance in the abstract syntax trees (ASTs) of complete statements. Specifically, a secret key and a locality-sensitive hash of the preceding statement jointly determine the target parity of a selected AST node count. The generator requires no model retraining and embeds watermark signal through three stages: sample, repair, and bridge. The detector tests whether keyed parity matches occur more often than chance, requiring neither the original prompt nor access to the generator. Extensive experiments across models, benchmarks, programming languages, and code transformations demonstrate that COSTA combines strong detectability and robust watermark retention while largely preserving the quality of generated code.
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperedit · history
ICLR 2027
Under review · 3 reviews · OpenReview
Updated 24 Nov 2026, 16:45 UTC.
- Rating
- 2/4
- Confidence
- 3/4
- Soundness
- 2/3
- Presentation
- 2/3
- Informativeness
- 2/3
Read review
Summary
This paper proposes COSTA, a training-free statement-level code watermarking framework that embeds watermark signals into the parity of AST node statistics rather than directly modifying token probabilities. The method consists of three stages—sampling, LLM-based repair, and bridge insertion—to make generated statements satisfy keyed structural constraints. The authors evaluate COSTA across multiple code-generation models, benchmarks, programming languages, and code transformations.
Strengths
The main idea is novel, and using complete code statements and their AST structures as watermark carriers is an interesting departure from existing token-level code watermarking methods. In particular, the choice of watermark embedding position is innovative, and the paper provides extensive experiments showing that such structural signals can achieve strong detectability while largely preserving functional correctness.
Weaknesses
My main concern is the practical cost of the proposed framework. COSTA requires repeated statement-level resampling and, when sampling fails, additional LLM calls for Direct/Split/Merge repair, which introduces substantial inference overhead. Such a cost may be difficult to justify in realistic large-scale deployment, where watermarking is expected to introduce only limited additional latency and computation. Meanwhile, lightweight token-level watermarking methods such as SynthID are designed to introduce watermark signals with little or no degradation in generation quality and can also be applied to code generation. Therefore, the paper needs to more clearly justify why a substantially more expensive statement-level design is necessary. A second concern is that the robustness evaluation is not sufficiently adaptive to COSTA’s watermark structure. Several evaluated transformations, such as comment deletion and variable renaming, are inherently unlikely to affect AST-parity signals, while the detector explicitly filters some inserted dead-code patterns. Stronger structure-aware attacks that preserve functionality but directly perturb statement boundaries or AST parity would provide a more convincing robustness evaluation.
Questions for the authors
Can COSTA work without LLM-based Repair and even without repeated resampling? In particular, how would a much cheaper single-sample + Bridge variant perform? Since Bridge can connect an unmatched statement without rewriting it, this seems to be an important efficiency baseline that is currently missing. How robust is COSTA against a structure-aware attacker who knows that the watermark is encoded in AST parity but does not know the secret key? For example, can semantics-preserving statement splitting, merging, temporary-variable insertion, or systematic AST rewriting substantially reduce detection performance?
5 comments
Response to Reviewer SmaUv (2/2)
W2 & Q2. Structure-aware attacks
We agree that comment deletion and variable renaming provide limited evidence against an attacker who knows that COSTA uses AST parity. We therefore tested dead-code insertion with filtering disabled and evaluated an adaptive attack that directly targets AST parity. In both tables, each cell reports Llama3-8B / Qwen2.5-Coder-14B.
1. Dead-code insertion. We disabled dead-code filtering so that the detector processed the inserted statements. COSTA achieved higher AUC than both SWEET and STONE on all six model–dataset combinations at 10% and 25% insertion and on four of six at 50% insertion.
| Insertion Ratio | Method | MBPP+ F1 | MBPP+ AUC | HumanEval+ F1 | HumanEval+ AUC | APPS F1 | APPS AUC |
|---|---|---|---|---|---|---|---|
| 0% | COSTA | 0.8934 / 0.7113 | 0.9780 / 0.9701 | 0.8248 / 0.8613 | 0.9866 / 0.9728 | 0.9077 / 0.9000 | 0.9663 / 0.9792 |
| SWEET | 0.7575 / 0.5425 | 0.9096 / 0.8546 | 0.7158 / 0.4785 | 0.9125 / 0.8076 | 0.8170 / 0.7375 | 0.8794 / 0.8733 | |
| STONE | 0.5951 / 0.3407 | 0.8274 / 0.7317 | 0.5030 / 0.2185 | 0.8319 / 0.7719 | 0.6782 / 0.4103 | 0.8869 / 0.8045 | |
| 10% | COSTA | 0.5386 / 0.5361 | 0.9283 / 0.9216 | 0.6161 / 0.5002 | 0.9179 / 0.9320 | 0.9028 / 0.8108 | 0.9702 / 0.9598 |
| SWEET | 0.6977 / 0.3799 | 0.8824 / 0.7772 | 0.6354 / 0.3554 | 0.8634 / 0.7529 | 0.7930 / 0.7192 | 0.8824 / 0.8698 | |
| STONE | 0.5052 / 0.2326 | 0.8025 / 0.7179 | 0.3725 / 0.2623 | 0.7861 / 0.7530 | 0.6714 / 0.4505 | 0.8810 / 0.7890 | |
| 25% | COSTA | 0.3761 / 0.2641 | 0.8958 / 0.8882 | 0.3665 / 0.2433 | 0.8840 / 0.9032 | 0.8830 / 0.8216 | 0.9596 / 0.9516 |
| SWEET | 0.6764 / 0.3604 | 0.8882 / 0.7578 | 0.5859 / 0.2977 | 0.8477 / 0.7202 | 0.7902 / 0.6787 | 0.8959 / 0.8782 | |
| STONE | 0.3721 / 0.2055 | 0.7789 / 0.6994 | 0.2670 / 0.2011 | 0.7600 / 0.7451 | 0.6126 / 0.3690 | 0.8667 / 0.7899 | |
| 50% | COSTA | 0.2389 / 0.1497 | 0.8079 / 0.7950 | 0.2033 / 0.2009 | 0.7838 / 0.8008 | 0.6664 / 0.6048 | 0.9080 / 0.8976 |
| SWEET | 0.6222 / 0.2423 | 0.8557 / 0.7275 | 0.4778 / 0.2678 | 0.8262 / 0.7021 | 0.7868 / 0.6035 | 0.8793 / 0.8600 | |
| STONE | 0.3517 / 0.1483 | 0.7431 / 0.6839 | 0.2700 / 0.2487 | 0.7316 / 0.6829 | 0.5723 / 0.3304 | 0.8476 / 0.7892 | |
2. Adaptive parity flipping. The attacker knows that COSTA encodes its watermark in AST parity but lacks the secret key. We randomly selected 10%, 25%, 50%, or 100% of each program’s statements and prompted an LLM to flip a specified parity while preserving functionality. The prompt allowed statement splitting, statement merging, temporary-variable insertion, and systematic AST rewriting. We targeted total, leaf, and inner node counts separately and also tested choosing the count randomly for each selected statement. AUC remained above 0.91 in every setting at 25% targeting. Although targeting every statement (100%) reduced AUC below 0.73 in all settings, attempting to rewrite the entire program while preserving functionality is costly for the attacker.
| Dataset | Target AST node | 10% statements | 25% statements | 50% statements | 100% statements |
|---|---|---|---|---|---|
| MBPP+ | Total node | 0.9781 / 0.9748 | 0.9338 / 0.9466 | 0.8233 / 0.8455 | 0.6368 / 0.7052 |
| Leaf node | 0.9783 / 0.9758 | 0.9450 / 0.9121 | 0.7740 / 0.7318 | 0.6127 / 0.6846 | |
| Inner node | 0.9781 / 0.9748 | 0.9338 / 0.9466 | 0.8233 / 0.8455 | 0.6368 / 0.7052 | |
| Random node | 0.9781 / 0.9748 | 0.9354 / 0.9422 | 0.8014 / 0.8180 | 0.5916 / 0.7020 | |
| HumanEval+ | Total node | 0.9871 / 0.9723 | 0.9382 / 0.9548 | 0.8006 / 0.7953 | 0.6655 / 0.6990 |
| Leaf node | 0.9874 / 0.9704 | 0.9329 / 0.9213 | 0.7509 / 0.7125 | 0.6778 / 0.6591 | |
| Inner node | 0.9871 / 0.9723 | 0.9382 / 0.9548 | 0.8006 / 0.7953 | 0.6655 / 0.6990 | |
| Random node | 0.9870 / 0.9723 | 0.9331 / 0.9532 | 0.7876 / 0.7756 | 0.6479 / 0.6652 | |
| APPS | Total node | 0.9655 / 0.9772 | 0.9545 / 0.9569 | 0.8546 / 0.9086 | 0.6026 / 0.7076 |
| Leaf node | 0.9605 / 0.9778 | 0.9366 / 0.9496 | 0.7164 / 0.7115 | 0.6937 / 0.6194 | |
| Inner node | 0.9655 / 0.9772 | 0.9545 / 0.9569 | 0.8546 / 0.9086 | 0.6026 / 0.7076 | |
| Random node | 0.9619 / 0.9788 | 0.9492 / 0.9566 | 0.8355 / 0.8741 | 0.6625 / 0.7210 | |
Overall, these experiments support COSTA’s robustness to both attacks for two reasons. First, the attacker does not know whether COSTA checks the parity of the leaf, non-leaf, or total node count. Second, the secret key and the LSH of the preceding statement conceal the target parity, limiting the attacker’s ability to disrupt a match reliably. We hope these additional experiments and clarifications address reviewer's concerns about COSTA’s cost and robustness.
With the rebuttal deadline approaching, we would appreciate further feedback from the reviewer so that we can address any remaining questions promptly. If our responses have resolved the concerns raised, we hope these clarifications will inform the final assessment, and we sincerely thank the reviewer for the time and consideration.
- Rating
- 2/4
- Confidence
- 2/4
- Soundness
- 2/3
- Presentation
- 3/3
- Informativeness
- 2/3
Read review
Summary
This paper presents a training-free framework named COSTA to watermark LLM-generated code at the statement level. It uses keyed AST-node parity and a three-stage process (sample, repair, bridge). The watermark can be detected without access to the generator or original prompt. The experimental results show that COSTA outperforms several generation-time baselines.
Strengths
- This paper conducted a relatively extensive empirical study.
- This paper proposed a novel and meaningful technical design for LM watermarking in code data. The watermarks in statements is better than tokens in reflecting structural and functional constraints.
Weaknesses
- The trade-off is not very convincing (for example, Table 2), which is likely to indicate limited contributions and affects the actual practical values. How much are the additional cost and the correctness loss caused in the stages of repair and bridge? The authors can report a detailed effectiveness-efficiency trade-off in a fixed budget, or show potentials in avoiding the trade-off.
- The case study examples in Appendix show that the produced code could be much longer than the unwatermarked samples, which indicates bad code smells that should be avoided in program development and maintenance.
- The paper writing needs further refinements, for example, the results in tables are hard to recognize, so do figure details.
Questions for the authors
How much are the additional cost and the correctness loss caused in the stages of repair and bridge? The authors can report a detailed effectiveness-efficiency trade-off in a fixed budget, or show potentials in avoiding the trade-off.
3 comments
Response to Reviewer of74
We appreciate the reviewer’s recognition of our empirical study and the motivation for embedding watermarks at the statement level. We address each concern below with additional analysis and experiments.
W1 & Q1: Repair and bridge cost
To quantify the additional generation time and any loss in functional correctness associated with Repair and Bridge, we compared statement-level sampling alone (S), sampling with Repair (S + R), and sampling with both Repair and Bridge (S + R + B). The results below show how these costs compare with the detection gains at each stage.
| Dataset | Model | Configuration | AUROC | Pass@1 (%) | Pass@1 (pp) | Generation time (s) | Time (s) |
|---|---|---|---|---|---|---|---|
| MBPP+ | Llama3-8B/Qwen2.5-Coder-14B | S | 0.6246 / 0.5332 | 68.00 / 76.00 | 2.80 / 5.18 | ||
| Llama3-8B/Qwen2.5-Coder-14B | S + R | 0.8356 / 0.9064 | 66.00 / 70.00 | -2.00 / -6.00 | 4.60 / 8.37 | +1.80 / +3.18 | |
| Llama3-8B/Qwen2.5-Coder-14B | S + R + B | 0.8356 / 0.9068 | 67.00 / 69.00 | -1.00 / -7.00 | 4.95 / 8.65 | +2.15 / +3.47 | |
| HumanEval+ | Llama3-8B/Qwen2.5-Coder-14B | S | 0.5610 / 0.5752 | 54.00 / 92.00 | 4.91 / 6.88 | ||
| Llama3-8B/Qwen2.5-Coder-14B | S + R | 0.9330 / 0.9414 | 50.00 / 84.00 | -4.00 / -8.00 | 9.36 / 12.65 | +4.45 / +5.76 | |
| Llama3-8B/Qwen2.5-Coder-14B | S + R + B | 0.9428 / 0.9519 | 48.00 / 82.00 | -6.00 / -10.00 | 9.42 / 12.73 | +4.51 / +5.84 | |
| APPS | Llama3-8B/Qwen2.5-Coder-14B | S | 0.7468 / 0.5972 | 20.00 / 22.00 | 9.37 / 12.59 | ||
| Llama3-8B/Qwen2.5-Coder-14B | S + R | 0.9102 / 0.9532 | 19.00 / 21.00 | -1.00 / -1.00 | 19.26 / 19.90 | + 9.89 / +7.32 | |
| Llama3-8B/Qwen2.5-Coder-14B | S + R + B | 0.9236 / 0.9637 | 18.00 / 20.00 | -2.00 / -2.00 | 20.72 / 19.98 | +11.35 / +7.39 | |
The results demonstrate that Repair accounts for most of the improvement in detection and most of the additional generation time. Although Bridge provides a smaller detection gain, it can also help verify the integrity of longer programs. Each retained Bridge statement carries an authentication value bound to the preceding code, so a failed check can indicate that part of that code has been deleted or modified. We hope these results address the reviewer’s concerns about the additional generation time and loss of functional correctness at each stage.
W2: Watermarked code length
Table 2 shows that COSTA produces shorter code on average than other watermarking methods. Specifically, COSTA averages 91.95 tokens per solution, compared with 94.58 to 102.37 for the baselines, and exceeds the unwatermarked code average by only 8.96 tokens. Thus, the few longer examples in Appendix J are insufficient to conclude that excessive verbosity is a common code smell in code generated by COSTA. We will clarify this variation in the discussion of the case studies.
W3: Presentation
We will improve the readability of the tables and figures by increasing the font size and enlarging the markers in the figures.
With the rebuttal deadline approaching, we would appreciate further feedback from the reviewer so that we can address any remaining questions promptly. If our responses have resolved the concerns raised, we hope these clarifications will inform the final assessment, and we sincerely thank the reviewer for the time and consideration.
Dear Reviewer,
With about 1 hours remaining in the rebuttal period, we would be grateful if you could take a moment to review our responses. Thank you again for your time and thoughtful feedback.
Best wishes,
The Authors
- Rating
- 2/4
- Confidence
- 3/4
- Soundness
- 1/3
- Presentation
- 3/3
- Informativeness
- 2/3
Read review
Summary
This work proposes COSTA, a statement-level code watermarking framework that encodes provenance in ASTs.
The authors propose some new technical idea directions and conduct the corresponding experiments. The paper is well-written and is easy to follow.
However, I consider the contribution of the paper is not enough for publication at ICLR.
Strengths
(1) The paper is well-written and easy to follow.
(2) COSTA is a training-free watermarking framework that requires only code for testing, without requiring access to the original generation model or prompt.
Weaknesses
My main concern on the work is regarding the method design and experiments of this work, especially the robustness.
(1) COSTA relies on AST node-count parity to encode watermark signals, making it inherently fragile, even simple semantics-preserving code modifications can flip node parity and disrupt watermark detection.
(2) The robustness evaluation is unconvincing because the defense is crafted for the tested attacks. For example, the detector explicitly removes dead code, making the dead-code insertion attack largely ineffective by design. The experimental design is not enough to demonstrate the robustness of the method.
Based on the above, I consider the proposed method being fragile and showing limited robustness, with the lack of application values.
Questions for the authors
Please kindly answer the questions in the above weaknesses (1) and (2).
5 comments
Response to Reviewer fmtf
We thank the reviewer for the careful reading and constructive suggestions. We address each concern below with additional analysis and experiments.
W1: Parity-flipping attack
COSTA has two mechanisms that make parity-flipping attack more difficult. First, the detector selects among three AST node counts (total, leaf, and inner). Although a statement’s AST reveals all three parities, it does not reveal which one is checked. Moreover, because the total count equals the sum of the leaf and inner counts, no rewrite can flip all three parities simultaneously. Second, the target parity depends on the LSH of the preceding statement and a secret key. Without the key, an attacker cannot determine whether a rewritten statement’s parity matches the target.
To evaluate this adaptive attack, we randomly selected statements and used an LLM to rewrite their expressions to flip the parity of the total, leaf, or inner node count. In the random setting, the target count was sampled independently for each statement. Each cell reports AUC for Llama3-8B / Qwen2.5-Coder-14B.
| Dataset | Target AST node | 10% statements | 25% statements | 50% statements | 100% statements |
|---|---|---|---|---|---|
| MBPP+ | Total node | 0.9781 / 0.9748 | 0.9338 / 0.9466 | 0.8233 / 0.8455 | 0.6368 / 0.7052 |
| Leaf node | 0.9783 / 0.9758 | 0.9450 / 0.9121 | 0.7740 / 0.7318 | 0.6127 / 0.6846 | |
| Inner node | 0.9781 / 0.9748 | 0.9338 / 0.9466 | 0.8233 / 0.8455 | 0.6368 / 0.7052 | |
| Random node | 0.9781 / 0.9748 | 0.9354 / 0.9422 | 0.8014 / 0.8180 | 0.5916 / 0.7020 | |
| HumanEval+ | Total node | 0.9871 / 0.9723 | 0.9382 / 0.9548 | 0.8006 / 0.7953 | 0.6655 / 0.6990 |
| Leaf node | 0.9874 / 0.9704 | 0.9329 / 0.9213 | 0.7509 / 0.7125 | 0.6778 / 0.6591 | |
| Inner node | 0.9871 / 0.9723 | 0.9382 / 0.9548 | 0.8006 / 0.7953 | 0.6655 / 0.6990 | |
| Random node | 0.9870 / 0.9723 | 0.9331 / 0.9532 | 0.7876 / 0.7756 | 0.6479 / 0.6652 | |
| APPS | Total node | 0.9655 / 0.9772 | 0.9545 / 0.9569 | 0.8546 / 0.9086 | 0.6026 / 0.7076 |
| Leaf node | 0.9605 / 0.9778 | 0.9366 / 0.9496 | 0.7164 / 0.7115 | 0.6937 / 0.6194 | |
| Inner node | 0.9655 / 0.9772 | 0.9545 / 0.9569 | 0.8546 / 0.9086 | 0.6026 / 0.7076 | |
| Random node | 0.9619 / 0.9788 | 0.9492 / 0.9566 | 0.8355 / 0.8741 | 0.6625 / 0.7210 | |
Among the attack budgets tested, only rewriting all statements reduces AUC below 0.73 across every setting. This imposes a substantial attack cost, especially for long programs, as it requires rewriting the entire program while preserving functionality. Under more common edits such as variable renaming and comment removal, COSTA outperforms the evaluated token-level watermarks, supporting its practical utility.
W2: Dead-code insertion
We agree that removing inserted dead code before detection may overestimate COSTA’s robustness. Our original preprocessing was motivated by the availability of static analysis tools for identifying common dead code, allowing COSTA to focus on statements suitable as watermark carriers. To address this concern directly, we repeated the attack without dead-code removal. The results reported in each cell for Llama3-8B / Qwen2.5-Coder-14B show that COSTA still achieves the highest AUC in most settings.
| Insertion Ratio | Method | MBPP+ F1 | MBPP+ AUC | HumanEval+ F1 | HumanEval+ AUC | APPS F1 | APPS AUC |
|---|---|---|---|---|---|---|---|
| 0% | COSTA | 0.8934 / 0.7113 | 0.9780 / 0.9701 | 0.8248 / 0.8613 | 0.9866 / 0.9728 | 0.9077 / 0.9000 | 0.9663 / 0.9792 |
| SWEET | 0.7575 / 0.5425 | 0.9096 / 0.8546 | 0.7158 / 0.4785 | 0.9125 / 0.8076 | 0.8170 / 0.7375 | 0.8794 / 0.8733 | |
| STONE | 0.5951 / 0.3407 | 0.8274 / 0.7317 | 0.5030 / 0.2185 | 0.8319 / 0.7719 | 0.6782 / 0.4103 | 0.8869 / 0.8045 | |
| 10% | COSTA | 0.5386 / 0.5361 | 0.9283 / 0.9216 | 0.6161 / 0.5002 | 0.9179 / 0.9320 | 0.9028 / 0.8108 | 0.9702 / 0.9598 |
| SWEET | 0.6977 / 0.3799 | 0.8824 / 0.7772 | 0.6354 / 0.3554 | 0.8634 / 0.7529 | 0.7930 / 0.7192 | 0.8824 / 0.8698 | |
| STONE | 0.5052 / 0.2326 | 0.8025 / 0.7179 | 0.3725 / 0.2623 | 0.7861 / 0.7530 | 0.6714 / 0.4505 | 0.8810 / 0.7890 | |
| 25% | COSTA | 0.3761 / 0.2641 | 0.8958 / 0.8882 | 0.3665 / 0.2433 | 0.8840 / 0.9032 | 0.8830 / 0.8216 | 0.9596 / 0.9516 |
| SWEET | 0.6764 / 0.3604 | 0.8882 / 0.7578 | 0.5859 / 0.2977 | 0.8477 / 0.7202 | 0.7902 / 0.6787 | 0.8959 / 0.8782 | |
| STONE | 0.3721 / 0.2055 | 0.7789 / 0.6994 | 0.2670 / 0.2011 | 0.7600 / 0.7451 | 0.6126 / 0.3690 | 0.8667 / 0.7899 | |
| 50% | COSTA | 0.2389 / 0.1497 | 0.8079 / 0.7950 | 0.2033 / 0.2009 | 0.7838 / 0.8008 | 0.6664 / 0.6048 | 0.9080 / 0.8976 |
| SWEET | 0.6222 / 0.2423 | 0.8557 / 0.7275 | 0.4778 / 0.2678 | 0.8262 / 0.7021 | 0.7868 / 0.6035 | 0.8793 / 0.8600 | |
| STONE | 0.3517 / 0.1483 | 0.7431 / 0.6839 | 0.2700 / 0.2487 | 0.7316 / 0.6829 | 0.5723 / 0.3304 | 0.8476 / 0.7892 | |
In summary, our additional experiments demonstrate COSTA’s robustness to parity flipping attack and dead-code insertion even without dead-code removal. Combined with Fig. 4 on comment removal, variable renaming, mixed edits, and LLM rephrasing, these results support its robustness across all five attacks. We sincerely hope they address the reviewer’s concerns and respectfully ask for a reassessment of our contributions.
With the rebuttal deadline approaching, we would appreciate further feedback from the reviewer so that we can address any remaining questions promptly. If our responses have resolved the concerns raised, we hope these clarifications will inform the final assessment, and we sincerely thank the reviewer for the time and consideration.
Thanks for the response from authors
The additional experiments partially address my concerns.
However, the F1 degradation under increasing dead-code insertion ratios and the lack of evidence regarding the actual success rate and functionality preservation of parity-flipping attacks leave the practical robustness insufficiently established.
Please clarify whether detection thresholds are fixed or recalibrated after attacks, and provide TPR results at 1% FPR using an independent calibration set.
Moreover, please provide the parity-flipping success rate and corresponding functionality-preservation rate to demonstrate the robustness claims.
Comments on the paper
1 comment
Rebuttal Summary
We thank the reviewers and the Area Chair for their careful assessment and constructive feedback. We summarize our responses below:
- Statement-level watermarking (SmaU). We clarified the motivation for statement-level watermarking and its trade-offs in functional correctness, robustness to routine code edits, and generation cost.
- Robustness to structural attacks (fmtf, SmaU). We added dead-code insertion experiments with detector filtering disabled and targeted AST parity-flipping attacks, evaluating COSTA’s robustness across different attack intensities.
- Generation efficiency (of74, SmaU). We quantified the costs and detection gains of Repair and Bridge, evaluated offline Repair templates that reduced generation time while maintaining or improving AUROC, and added the proposed single-sample + Bridge baseline.
- Code length (of74). We clarified that COSTA produces shorter code on average than the evaluated watermarking baselines and that the longer illustrative examples do not establish excessive verbosity as a general issue.
We hope our additional experiments and clarifications address the remaining concerns and would greatly appreciate the ACs’, SACs’, and PCs’ consideration.
From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.
Loading the discussion…
Response to Reviewer SmaUv (1/2)
We thank the reviewer for the thoughtful questions about generation cost and robustness. We address each concern below with additional analysis and experiments.
W1: COSTA motivation
[1] How Good is Post-Hoc Watermarking With Language Model Rephrasing?
W1 & Q1: Repair overhead
1. Offline Repair. COSTA can skip both resampling and Repair, but accepting the first statement leaves parity mismatches unresolved and yields weak detection. To accelerate generation, we used an LLM to prepare reusable rewrite templates offline, following the examples in Appendix G.3. COSTA applies the templates locally, and the library can be expanded as new patterns arise. One drawback is that a leaked library would expose the rewrite patterns to attackers. In our experiments, offline templates eliminated online Repair calls and substantially reduced generation time while matching or improving AUROC. The results are shown below, with each metric reported as Llama-3.1-8B / Qwen2.5-Coder-14B.
2. Single-sample + Bridge. We evaluated the suggested baseline by sampling each statement once and using Bridge to connect unmatched statements. It was faster than full COSTA, and a higher Bridge cap allowed it to surpass full COSTA’s clean AUROC in most settings. Because attackers can recognize and remove Bridge statements without changing program behavior, COSTA embeds most of its watermark in ordinary statements. Beyond improving detection at low generation cost, we use Bridge to verify the integrity of longer programs. Each retained Bridge authenticates the preceding code and helps determine whether an attacker has modified it.