{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/a-watermark-for-large-language-models","title":"A Watermark for Large Language Models","arxiv_id":"2301.10226","date":"2023-01-24","proceeding":null,"authors":["John Kirchenbauer","Jonas Geiping","Yuxin Wen","Jonathan Katz","Ian Miers","Tom Goldstein"],"abstract":"Potential harms of large language models can be mitigated by watermarking model output, i.e., embedding signals into generated text that are invisible to humans but algorithmically detectable from a short span of tokens. We propose a watermarking framework for proprietary language models. The watermark can be embedded with negligible impact on text quality, and can be detected using an efficient open-source algorithm without access to the language model API or parameters. The watermark works by selecting a randomized set of \"green\" tokens before a word is generated, and then softly promoting use of green tokens during sampling. We propose a statistical test for detecting the watermark with interpretable p-values, and derive an information-theoretic framework for analyzing the sensitivity of the watermark. We test the watermark using a multi-billion parameter model from the Open Pretrained Transformer (OPT) family, and discuss robustness and security.","url_abs":"https://arxiv.org/abs/2301.10226v4","url_pdf":"https://arxiv.org/pdf/2301.10226v4.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"a-watermark-for-large-language-models","repo_url":"https://github.com/jwkirchenbauer/lm-watermarking","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"a-watermark-for-large-language-models","repo_url":"https://github.com/BrianPulfer/LMWatermark","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"a-watermark-for-large-language-models","repo_url":"https://github.com/Xieyangxinyu/Unbiased-Watermark-via-Maximal-Coupling","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"a-watermark-for-large-language-models","repo_url":"https://github.com/chengez/adversarial-paraphrasing","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"a-watermark-for-large-language-models","repo_url":"https://github.com/eva-giboulot/watermax","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"a-watermark-for-large-language-models","repo_url":"https://github.com/facebookresearch/three_bricks","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"a-watermark-for-large-language-models","repo_url":"https://github.com/fyyfu/semantic-watermark","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"a-watermark-for-large-language-models","repo_url":"https://github.com/huggingface/text-generation-inference","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"test","method_name":"Test"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2301.10226","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2301.10226"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/jwkirchenbauer/lm-watermarking","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/chengez/adversarial-paraphrasing","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Xieyangxinyu/Unbiased-Watermark-via-Maximal-Coupling","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/fyyfu/semantic-watermark","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/eva-giboulot/watermax","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/facebookresearch/three_bricks","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/BrianPulfer/LMWatermark","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/huggingface/text-generation-inference","reach":null}],"summary":{"ran":8,"ran_honours":1,"ran_draft_wrong":1,"ran_violates":1,"unverified":5},"by_repo_kind":{"official":{"samples":3,"ran":2,"repositories":1},"listed":{"samples":13,"ran":9,"repositories":6}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":5,"samples":[{"code_sha256_prefix":"f26efcccf5a3772f","entry":"ContextMasking","repo":"Xieyangxinyu/Unbiased-Watermark-via-Maximal-Coupling","repo_kind":"listed","path":"wm/coupling.py","file_url":"https://github.com/Xieyangxinyu/Unbiased-Watermark-via-Maximal-Coupling/blob/HEAD/wm/coupling.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f26efcccf5a3772f"}},{"code_sha256_prefix":"42f6923bf0733dbe","entry":"CouplingGenerator","repo":"Xieyangxinyu/Unbiased-Watermark-via-Maximal-Coupling","repo_kind":"listed","path":"wm/coupling.py","file_url":"https://github.com/Xieyangxinyu/Unbiased-Watermark-via-Maximal-Coupling/blob/HEAD/wm/coupling.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"42f6923bf0733dbe"}},{"code_sha256_prefix":"e4a6e1de65880ce7","entry":"MarylandGenerator","repo":"facebookresearch/three_bricks","repo_kind":"listed","path":"wm/generator.py","file_url":"https://github.com/facebookresearch/three_bricks/blob/HEAD/wm/generator.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"e4a6e1de65880ce7"}},{"code_sha256_prefix":"b773c77757980226","entry":"OpenaiGenerator","repo":"Xieyangxinyu/Unbiased-Watermark-via-Maximal-Coupling","repo_kind":"listed","path":"wm/coupling.py","file_url":"https://github.com/Xieyangxinyu/Unbiased-Watermark-via-Maximal-Coupling/blob/HEAD/wm/coupling.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b773c77757980226"}},{"code_sha256_prefix":"63e6607939ea84a0","entry":"WatermarkLogitsProcessor","repo":"jwkirchenbauer/lm-watermarking","repo_kind":"official","path":"watermark_processor.py","file_url":"https://github.com/jwkirchenbauer/lm-watermarking/blob/HEAD/watermark_processor.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"63e6607939ea84a0"}},{"code_sha256_prefix":"13b864aa60fdbcdd","entry":"WmGenerator","repo":"eva-giboulot/watermax","repo_kind":"listed","path":"models/wm.py","file_url":"https://github.com/eva-giboulot/watermax/blob/HEAD/models/wm.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"13b864aa60fdbcdd"}},{"code_sha256_prefix":"84002164ce29edb7","entry":"WmGenerator","repo":"facebookresearch/three_bricks","repo_kind":"listed","path":"wm/generator.py","file_url":"https://github.com/facebookresearch/three_bricks/blob/HEAD/wm/generator.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"84002164ce29edb7"}},{"code_sha256_prefix":"1df0136501003b60","entry":"WmGenerator","repo":"Xieyangxinyu/Unbiased-Watermark-via-Maximal-Coupling","repo_kind":"listed","path":"wm/coupling.py","file_url":"https://github.com/Xieyangxinyu/Unbiased-Watermark-via-Maximal-Coupling/blob/HEAD/wm/coupling.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1df0136501003b60"}},{"code_sha256_prefix":"bdea8c3520cb2de0","entry":"default_hash_fn","repo":"BrianPulfer/LMWatermark","repo_kind":"listed","path":"src/watermarking.py","file_url":"https://github.com/BrianPulfer/LMWatermark/blob/HEAD/src/watermarking.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bdea8c3520cb2de0"}},{"code_sha256_prefix":"e8a3bc02d0c28ef0","entry":"generate","repo":"BrianPulfer/LMWatermark","repo_kind":"listed","path":"src/watermarking.py","file_url":"https://github.com/BrianPulfer/LMWatermark/blob/HEAD/src/watermarking.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e8a3bc02d0c28ef0"}},{"code_sha256_prefix":"678874b625786116","entry":"str2bool","repo":"jwkirchenbauer/lm-watermarking","repo_kind":"official","path":"demo_watermark.py","file_url":"https://github.com/jwkirchenbauer/lm-watermarking/blob/HEAD/demo_watermark.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"678874b625786116"}},{"code_sha256_prefix":"ba3557aac9e7bf4c","entry":"WatermarkBase","repo":"jwkirchenbauer/lm-watermarking","repo_kind":"official","path":"watermark_processor.py","file_url":"https://github.com/jwkirchenbauer/lm-watermarking/blob/HEAD/watermark_processor.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ba3557aac9e7bf4c"}},{"code_sha256_prefix":"dd584304f6d90615","entry":"WatermarkBase","repo":"fyyfu/semantic-watermark","repo_kind":"listed","path":"watermark_processor.py","file_url":"https://github.com/fyyfu/semantic-watermark/blob/HEAD/watermark_processor.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"dd584304f6d90615"}},{"code_sha256_prefix":"19f3e32f390a20ae","entry":"WatermarkBase","repo":"chengez/adversarial-paraphrasing","repo_kind":"listed","path":"kgw_wm/extended_watermark_processor.py","file_url":"https://github.com/chengez/adversarial-paraphrasing/blob/HEAD/kgw_wm/extended_watermark_processor.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"19f3e32f390a20ae"}},{"code_sha256_prefix":"a74f13e55a5c37a6","entry":"WatermarkLogitsProcessor","repo":"fyyfu/semantic-watermark","repo_kind":"listed","path":"watermark_processor.py","file_url":"https://github.com/fyyfu/semantic-watermark/blob/HEAD/watermark_processor.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a74f13e55a5c37a6"}},{"code_sha256_prefix":"51fae2306a5ebeda","entry":"WatermarkLogitsProcessor","repo":"chengez/adversarial-paraphrasing","repo_kind":"listed","path":"kgw_wm/extended_watermark_processor.py","file_url":"https://github.com/chengez/adversarial-paraphrasing/blob/HEAD/kgw_wm/extended_watermark_processor.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"51fae2306a5ebeda"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}