{"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/magnet-we-never-know-how-text-to-image","title":"Magnet: We Never Know How Text-to-Image Diffusion Models Work, Until We Learn How Vision-Language Models Function","arxiv_id":"2409.19967","date":"2024-09-30","proceeding":null,"authors":["Chenyi Zhuang","Ying Hu","Pan Gao"],"abstract":"Text-to-image diffusion models particularly Stable Diffusion, have revolutionized the field of computer vision. However, the synthesis quality often deteriorates when asked to generate images that faithfully represent complex prompts involving multiple attributes and objects. While previous studies suggest that blended text embeddings lead to improper attribute binding, few have explored this in depth. In this work, we critically examine the limitations of the CLIP text encoder in understanding attributes and investigate how this affects diffusion models. We discern a phenomenon of attribute bias in the text space and highlight a contextual issue in padding embeddings that entangle different concepts. We propose \\textbf{Magnet}, a novel training-free approach to tackle the attribute binding problem. We introduce positive and negative binding vectors to enhance disentanglement, further with a neighbor strategy to increase accuracy. Extensive experiments show that Magnet significantly improves synthesis quality and binding accuracy with negligible computational cost, enabling the generation of unconventional and unnatural concepts.","url_abs":"https://arxiv.org/abs/2409.19967v1","url_pdf":"https://arxiv.org/pdf/2409.19967v1.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":"magnet-we-never-know-how-text-to-image","repo_url":"https://github.com/i2-multimedia-lab/magnet","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"attribute","task_name":"Attribute"},{"task_slug":"disentanglement","task_name":"Disentanglement"}],"methods":[{"method_slug":"clip","method_name":"CLIP"},{"method_slug":"diffusion","method_name":"Diffusion"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2409.19967","atlas_url":"https://app.syntology.ai/?focus=2409.19967","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2409.19967"}},"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":"deterministic:regex_extraction","url":"https://github.com/I2-Multimedia-Lab/Magnet","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/i2-multimedia-lab/magnet","reach":{"status":"ok"}}],"summary":{"ran":9,"ran_honours":1,"ran_draft_wrong":1,"unverified":6},"by_repo_kind":{"official":{"samples":17,"ran":11,"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":17,"samples":[{"code_sha256_prefix":"a020c1a6b1012624","entry":"aggregate_attention","repo":"I2-Multimedia-Lab/Magnet","repo_kind":"official","path":"utils/ptp_utils.py","file_url":"https://github.com/I2-Multimedia-Lab/Magnet/blob/HEAD/utils/ptp_utils.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":"a020c1a6b1012624"}},{"code_sha256_prefix":"6d5cc44492ef32f9","entry":"check_emb_len","repo":"I2-Multimedia-Lab/Magnet","repo_kind":"official","path":"emb_swap_cases.py","file_url":"https://github.com/I2-Multimedia-Lab/Magnet/blob/HEAD/emb_swap_cases.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":"6d5cc44492ef32f9"}},{"code_sha256_prefix":"a868f49a58f3b0c1","entry":"check_prompt","repo":"I2-Multimedia-Lab/Magnet","repo_kind":"official","path":"utils/magnet_utils.py","file_url":"https://github.com/I2-Multimedia-Lab/Magnet/blob/HEAD/utils/magnet_utils.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":"a868f49a58f3b0c1"}},{"code_sha256_prefix":"eb532e7a9ef53248","entry":"get_eot","repo":"i2-multimedia-lab/magnet","repo_kind":"official","path":"utils/magnet.py","file_url":"https://github.com/i2-multimedia-lab/magnet/blob/HEAD/utils/magnet.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"eb532e7a9ef53248"}},{"code_sha256_prefix":"0078d117f74b7c20","entry":"get_image_grid","repo":"I2-Multimedia-Lab/Magnet","repo_kind":"official","path":"utils/vis_utils.py","file_url":"https://github.com/I2-Multimedia-Lab/Magnet/blob/HEAD/utils/vis_utils.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":"0078d117f74b7c20"}},{"code_sha256_prefix":"7dece29f90f88c51","entry":"get_span","repo":"I2-Multimedia-Lab/Magnet","repo_kind":"official","path":"utils/magnet_utils.py","file_url":"https://github.com/I2-Multimedia-Lab/Magnet/blob/HEAD/utils/magnet_utils.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":"7dece29f90f88c51"}},{"code_sha256_prefix":"4af52c62cce564b4","entry":"modify_prompt","repo":"I2-Multimedia-Lab/Magnet","repo_kind":"official","path":"utils/magnet_utils.py","file_url":"https://github.com/I2-Multimedia-Lab/Magnet/blob/HEAD/utils/magnet_utils.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":"4af52c62cce564b4"}},{"code_sha256_prefix":"bea2d776a332f2b0","entry":"rescale_noise_cfg","repo":"I2-Multimedia-Lab/Magnet","repo_kind":"official","path":"pipeline_sdxl.py","file_url":"https://github.com/I2-Multimedia-Lab/Magnet/blob/HEAD/pipeline_sdxl.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"bea2d776a332f2b0"}},{"code_sha256_prefix":"35717b791550ecb2","entry":"retrieve_timesteps","repo":"I2-Multimedia-Lab/Magnet","repo_kind":"official","path":"pipeline_sdxl.py","file_url":"https://github.com/I2-Multimedia-Lab/Magnet/blob/HEAD/pipeline_sdxl.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":"35717b791550ecb2"}},{"code_sha256_prefix":"d9c8674eef29679e","entry":"text_under_image","repo":"I2-Multimedia-Lab/Magnet","repo_kind":"official","path":"utils/ptp_utils.py","file_url":"https://github.com/I2-Multimedia-Lab/Magnet/blob/HEAD/utils/ptp_utils.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":"d9c8674eef29679e"}},{"code_sha256_prefix":"e7fa6472a34f3407","entry":"view_images","repo":"I2-Multimedia-Lab/Magnet","repo_kind":"official","path":"utils/ptp_utils.py","file_url":"https://github.com/I2-Multimedia-Lab/Magnet/blob/HEAD/utils/ptp_utils.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":"e7fa6472a34f3407"}},{"code_sha256_prefix":"d2e162bceb23fb8b","entry":"get_depth","repo":"I2-Multimedia-Lab/Magnet","repo_kind":"official","path":"run_with_controlnet.py","file_url":"https://github.com/I2-Multimedia-Lab/Magnet/blob/HEAD/run_with_controlnet.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":"d2e162bceb23fb8b"}},{"code_sha256_prefix":"cbf4b4066353af0f","entry":"get_magnet_direction","repo":"i2-multimedia-lab/magnet","repo_kind":"official","path":"utils/magnet.py","file_url":"https://github.com/i2-multimedia-lab/magnet/blob/HEAD/utils/magnet.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":"cbf4b4066353af0f"}},{"code_sha256_prefix":"998dcc4cecba3160","entry":"get_prompt_embeds","repo":"I2-Multimedia-Lab/Magnet","repo_kind":"official","path":"utils/magnet.py","file_url":"https://github.com/I2-Multimedia-Lab/Magnet/blob/HEAD/utils/magnet.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":"998dcc4cecba3160"}},{"code_sha256_prefix":"7baabbc4bf6672c9","entry":"get_prompt_embeds_with_eid","repo":"i2-multimedia-lab/magnet","repo_kind":"official","path":"utils/magnet.py","file_url":"https://github.com/i2-multimedia-lab/magnet/blob/HEAD/utils/magnet.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":"7baabbc4bf6672c9"}},{"code_sha256_prefix":"dce65a9d6d0c8f13","entry":"load_bert","repo":"I2-Multimedia-Lab/Magnet","repo_kind":"official","path":"utils/magnet.py","file_url":"https://github.com/I2-Multimedia-Lab/Magnet/blob/HEAD/utils/magnet.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":"dce65a9d6d0c8f13"}},{"code_sha256_prefix":"53e98bbf6844233a","entry":"show_image_relevance","repo":"I2-Multimedia-Lab/Magnet","repo_kind":"official","path":"utils/vis_utils.py","file_url":"https://github.com/I2-Multimedia-Lab/Magnet/blob/HEAD/utils/vis_utils.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":"53e98bbf6844233a"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}