{"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/latent-watermark-inject-and-detect-watermarks","title":"Latent Watermark: Inject and Detect Watermarks in Latent Diffusion Space","arxiv_id":"2404.00230","date":"2024-03-30","proceeding":null,"authors":["Zheling Meng","Bo Peng","Jing Dong"],"abstract":"Watermarking is a tool for actively identifying and attributing the images generated by latent diffusion models. Existing methods face the dilemma of image quality and watermark robustness. Watermarks with superior image quality usually have inferior robustness against attacks such as blurring and JPEG compression, while watermarks with superior robustness usually significantly damage image quality. This dilemma stems from the traditional paradigm where watermarks are injected and detected in pixel space, relying on pixel perturbation for watermark detection and resilience against attacks. In this paper, we highlight that an effective solution to the problem is to both inject and detect watermarks in the latent diffusion space, and propose Latent Watermark with a progressive training strategy. It weakens the direct connection between quality and robustness and thus alleviates their contradiction. We conduct evaluations on two datasets and against 10 watermark attacks. Six metrics measure the image quality and watermark robustness. Results show that compared to the recently proposed methods such as StableSignature, StegaStamp, RoSteALS, LaWa, TreeRing, and DiffuseTrace, LW not only surpasses them in terms of robustness but also offers superior image quality. Our code will be available at https://github.com/RichardSunnyMeng/LatentWatermark.","url_abs":"https://arxiv.org/abs/2404.00230v3","url_pdf":"https://arxiv.org/pdf/2404.00230v3.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":"latent-watermark-inject-and-detect-watermarks","repo_url":"https://github.com/richardsunnymeng/latentwatermark","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[],"methods":[{"method_slug":"diffusion","method_name":"Diffusion"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2404.00230","atlas_url":"https://app.syntology.ai/?focus=2404.00230","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2404.00230"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/richardsunnymeng/latentwatermark","reach":{"status":"ok"}}],"summary":{"ran":9,"ran_draft_wrong":1},"by_repo_kind":{"official":{"samples":10,"ran":10,"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":10,"samples":[{"code_sha256_prefix":"3907a9f2cba334bb","entry":"collate_fn","repo":"richardsunnymeng/latentwatermark","repo_kind":"official","path":"utils/collate_fn.py","file_url":"https://github.com/richardsunnymeng/latentwatermark/blob/HEAD/utils/collate_fn.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":"3907a9f2cba334bb"}},{"code_sha256_prefix":"2a80220dabcb742a","entry":"conv1x1","repo":"richardsunnymeng/latentwatermark","repo_kind":"official","path":"models/extractors/naive.py","file_url":"https://github.com/richardsunnymeng/latentwatermark/blob/HEAD/models/extractors/naive.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2a80220dabcb742a"}},{"code_sha256_prefix":"d33c6bd60a77ad21","entry":"conv3x3","repo":"richardsunnymeng/latentwatermark","repo_kind":"official","path":"models/extractors/naive.py","file_url":"https://github.com/richardsunnymeng/latentwatermark/blob/HEAD/models/extractors/naive.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":"d33c6bd60a77ad21"}},{"code_sha256_prefix":"1519c26f915f04ae","entry":"get_param_groups_and_shapes","repo":"richardsunnymeng/latentwatermark","repo_kind":"official","path":"utils/fp16_util.py","file_url":"https://github.com/richardsunnymeng/latentwatermark/blob/HEAD/utils/fp16_util.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":"1519c26f915f04ae"}},{"code_sha256_prefix":"0aa86a0369202eac","entry":"load_and_precess_imgs","repo":"richardsunnymeng/latentwatermark","repo_kind":"official","path":"extract.py","file_url":"https://github.com/richardsunnymeng/latentwatermark/blob/HEAD/extract.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":"0aa86a0369202eac"}},{"code_sha256_prefix":"751bef182a1751e2","entry":"make_master_params","repo":"richardsunnymeng/latentwatermark","repo_kind":"official","path":"utils/fp16_util.py","file_url":"https://github.com/richardsunnymeng/latentwatermark/blob/HEAD/utils/fp16_util.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":"751bef182a1751e2"}},{"code_sha256_prefix":"475678a8f4905fe7","entry":"msg_bce_loss","repo":"richardsunnymeng/latentwatermark","repo_kind":"official","path":"loss/loss_fn.py","file_url":"https://github.com/richardsunnymeng/latentwatermark/blob/HEAD/loss/loss_fn.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":"475678a8f4905fe7"}},{"code_sha256_prefix":"82d651ea5f8175c5","entry":"msg_lse_loss","repo":"richardsunnymeng/latentwatermark","repo_kind":"official","path":"loss/loss_fn.py","file_url":"https://github.com/richardsunnymeng/latentwatermark/blob/HEAD/loss/loss_fn.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":"82d651ea5f8175c5"}},{"code_sha256_prefix":"fa1f406db7aa603e","entry":"msg_reg_loss","repo":"richardsunnymeng/latentwatermark","repo_kind":"official","path":"loss/loss_fn.py","file_url":"https://github.com/richardsunnymeng/latentwatermark/blob/HEAD/loss/loss_fn.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":"fa1f406db7aa603e"}},{"code_sha256_prefix":"64fff1e30802b815","entry":"unflatten_master_params","repo":"richardsunnymeng/latentwatermark","repo_kind":"official","path":"utils/fp16_util.py","file_url":"https://github.com/richardsunnymeng/latentwatermark/blob/HEAD/utils/fp16_util.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":"64fff1e30802b815"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}