{"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/token-specific-watermarking-with-enhanced","title":"Token-Specific Watermarking with Enhanced Detectability and Semantic Coherence for Large Language Models","arxiv_id":"2402.18059","date":"2024-02-28","proceeding":null,"authors":["Mingjia Huo","Sai Ashish Somayajula","Youwei Liang","Ruisi Zhang","Farinaz Koushanfar","Pengtao Xie"],"abstract":"Large language models generate high-quality responses with potential misinformation, underscoring the need for regulation by distinguishing AI-generated and human-written texts. Watermarking is pivotal in this context, which involves embedding hidden markers in texts during the LLM inference phase, which is imperceptible to humans. Achieving both the detectability of inserted watermarks and the semantic quality of generated texts is challenging. While current watermarking algorithms have made promising progress in this direction, there remains significant scope for improvement. To address these challenges, we introduce a novel multi-objective optimization (MOO) approach for watermarking that utilizes lightweight networks to generate token-specific watermarking logits and splitting ratios. By leveraging MOO to optimize for both detection and semantic objective functions, our method simultaneously achieves detectability and semantic integrity. Experimental results show that our method outperforms current watermarking techniques in enhancing the detectability of texts generated by LLMs while maintaining their semantic coherence. Our code is available at https://github.com/mignonjia/TS_watermark.","url_abs":"https://arxiv.org/abs/2402.18059v3","url_pdf":"https://arxiv.org/pdf/2402.18059v3.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":"token-specific-watermarking-with-enhanced","repo_url":"https://github.com/mignonjia/ts_watermark","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"misinformation","task_name":"Misinformation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2402.18059","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.18059"}},"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/mignonjia/ts_watermark","reach":{"status":"ok"}}],"summary":{"ran":11,"ran_violates":1,"unverified":3},"by_repo_kind":{"official":{"samples":15,"ran":12,"repositories":1}},"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":15,"samples":[{"code_sha256_prefix":"6f3e19b647ed821b","entry":"calculate_entropy","repo":"mignonjia/ts_watermark","repo_kind":"official","path":"utils/generation.py","file_url":"https://github.com/mignonjia/ts_watermark/blob/HEAD/utils/generation.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":"6f3e19b647ed821b"}},{"code_sha256_prefix":"4ea6b15c91ca13a0","entry":"conditional_no_check_args","repo":"mignonjia/ts_watermark","repo_kind":"official","path":"utils/evaluation.py","file_url":"https://github.com/mignonjia/ts_watermark/blob/HEAD/utils/evaluation.py","link_basis":"harvester_set","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":"4ea6b15c91ca13a0"}},{"code_sha256_prefix":"ee0a7309525621bf","entry":"data_loader","repo":"mignonjia/ts_watermark","repo_kind":"official","path":"utils/data_loader.py","file_url":"https://github.com/mignonjia/ts_watermark/blob/HEAD/utils/data_loader.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":"ee0a7309525621bf"}},{"code_sha256_prefix":"55a42447218367a6","entry":"flatten_dict","repo":"mignonjia/ts_watermark","repo_kind":"official","path":"utils/submitit.py","file_url":"https://github.com/mignonjia/ts_watermark/blob/HEAD/utils/submitit.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":"55a42447218367a6"}},{"code_sha256_prefix":"c34d2d98e001e81a","entry":"format_names","repo":"mignonjia/ts_watermark","repo_kind":"official","path":"eval/pos_tag/inference_phase2_loss_delta_analysis.py","file_url":"https://github.com/mignonjia/ts_watermark/blob/HEAD/eval/pos_tag/inference_phase2_loss_delta_analysis.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c34d2d98e001e81a"}},{"code_sha256_prefix":"d474025fbccd785b","entry":"gumbel_softmax","repo":"mignonjia/ts_watermark","repo_kind":"official","path":"utils/generation.py","file_url":"https://github.com/mignonjia/ts_watermark/blob/HEAD/utils/generation.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":"d474025fbccd785b"}},{"code_sha256_prefix":"a10c064d5a6fa969","entry":"hf_read_jsonlines","repo":"mignonjia/ts_watermark","repo_kind":"official","path":"utils/io.py","file_url":"https://github.com/mignonjia/ts_watermark/blob/HEAD/utils/io.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":"a10c064d5a6fa969"}},{"code_sha256_prefix":"b5b35a58375952bb","entry":"list_format_scores","repo":"mignonjia/ts_watermark","repo_kind":"official","path":"eval/pos_tag/inference_phase2_loss_delta_analysis.py","file_url":"https://github.com/mignonjia/ts_watermark/blob/HEAD/eval/pos_tag/inference_phase2_loss_delta_analysis.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":"b5b35a58375952bb"}},{"code_sha256_prefix":"131fdd3faaf439a2","entry":"rle_F_succ_T_runs","repo":"mignonjia/ts_watermark","repo_kind":"official","path":"utils/hypothesis_testing.py","file_url":"https://github.com/mignonjia/ts_watermark/blob/HEAD/utils/hypothesis_testing.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":"131fdd3faaf439a2"}},{"code_sha256_prefix":"728890eedd651e54","entry":"rle_T_and_F_runs","repo":"mignonjia/ts_watermark","repo_kind":"official","path":"utils/hypothesis_testing.py","file_url":"https://github.com/mignonjia/ts_watermark/blob/HEAD/utils/hypothesis_testing.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":"728890eedd651e54"}},{"code_sha256_prefix":"e1ed301d401de50d","entry":"rle_T_succ_F_runs","repo":"mignonjia/ts_watermark","repo_kind":"official","path":"utils/hypothesis_testing.py","file_url":"https://github.com/mignonjia/ts_watermark/blob/HEAD/utils/hypothesis_testing.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":"e1ed301d401de50d"}},{"code_sha256_prefix":"7c508037b40522af","entry":"str2bool","repo":"mignonjia/ts_watermark","repo_kind":"official","path":"utils/submitit.py","file_url":"https://github.com/mignonjia/ts_watermark/blob/HEAD/utils/submitit.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7c508037b40522af"}},{"code_sha256_prefix":"81cef8be4a138b63","entry":"load_jsonlines","repo":"mignonjia/ts_watermark","repo_kind":"official","path":"utils/io.py","file_url":"https://github.com/mignonjia/ts_watermark/blob/HEAD/utils/io.py","link_basis":"harvester_set","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":"81cef8be4a138b63"}},{"code_sha256_prefix":"8d0aa0b282b57db6","entry":"load_model","repo":"mignonjia/ts_watermark","repo_kind":"official","path":"utils/generation.py","file_url":"https://github.com/mignonjia/ts_watermark/blob/HEAD/utils/generation.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":"8d0aa0b282b57db6"}},{"code_sha256_prefix":"afbb28c04b32db08","entry":"resolve_globs","repo":"mignonjia/ts_watermark","repo_kind":"official","path":"utils/io.py","file_url":"https://github.com/mignonjia/ts_watermark/blob/HEAD/utils/io.py","link_basis":"harvester_set","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":"afbb28c04b32db08"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}