A Semantic Invariant Robust Watermark for Large Language Models

Aiwei Liu, Leyi Pan, Xuming Hu, Shiao Meng, Lijie Wen
2/12/2026

No official code found. Best implementation: THU-BPM/MarkLLM (1,067 stars, Apache-2.0, last commit 2026-03-17). 1 more below.

Abstract

Watermark algorithms for large language models (LLMs) have achieved extremely high accuracy in detecting text generated by LLMs. Such algorithms typically involve adding extra watermark logits to the LLM's logits at each generation step. However, prior algorithms face a trade-off between attack robustness and security robustness. This is because the watermark logits for a token are determined by a certain number of preceding tokens; a small number leads to low security robustness, while a large number results in insufficient attack robustness. In this work, we propose a semantic invariant watermarking method for LLMs that provides both attack robustness and security robustness. The watermark logits in our work are determined by the semantics of all preceding tokens. Specifically, we utilize another embedding LLM to generate semantic embeddings for all preceding tokens, and then these semantic embeddings are transformed into the watermark logits through our trained watermark model. Subsequent analyses and experiments demonstrated the attack robustness of our method in semantically invariant settings: synonym substitution and text paraphrasing settings. Finally, we also show that our watermark possesses adequate security robustness. Our code and data are available at \href{https://github.com/THU-BPM/Robust_Watermark}{https://github.com/THU-BPM/Robust\_Watermark}. Additionally, our algorithm could also be accessed through MarkLLM \citep{pan2024markllm} \footnote{https://github.com/THU-BPM/MarkLLM}.

View on arXivView PDF

Code Implementations(2)

THU-BPM/MarkLLMCommunity100%
Apache-2.0

[EMNLP 2024 Demo] MarkLLM: An Open-Source Toolkit for LLM Watermarking

1,06795Shell, CythonMay 16, 20247 months agoApache-2.0
large-language-modelsllmsafetytoolkittrustworthy-ai+1 more

[ICLR 2024] Code and data for paper "A Semantic Invariant Robust Watermark for Large Language Models".

397PythonOct 10, 20231 years ago

Similar Papers

Cite this paper

@article{liu2026semantic,
  title  = {A Semantic Invariant Robust Watermark for Large Language Models},
  author = {Aiwei Liu and Leyi Pan and Xuming Hu and Shiao Meng and Lijie Wen},
  year   = {2026},
  eprint = {2310.06356},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/pdf/2310.06356},
  journal = {ICLR 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2310.06356.svg)](https://codeofpaper.com/paper/2310.06356)

Discussion