{"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/mastering-text-to-image-diffusion","title":"Mastering Text-to-Image Diffusion: Recaptioning, Planning, and Generating with Multimodal LLMs","arxiv_id":"2401.11708","date":"2024-01-22","proceeding":null,"authors":["Ling Yang","Zhaochen Yu","Chenlin Meng","Minkai Xu","Stefano Ermon","Bin Cui"],"abstract":"Diffusion models have exhibit exceptional performance in text-to-image generation and editing. However, existing methods often face challenges when handling complex text prompts that involve multiple objects with multiple attributes and relationships. In this paper, we propose a brand new training-free text-to-image generation/editing framework, namely Recaption, Plan and Generate (RPG), harnessing the powerful chain-of-thought reasoning ability of multimodal LLMs to enhance the compositionality of text-to-image diffusion models. Our approach employs the MLLM as a global planner to decompose the process of generating complex images into multiple simpler generation tasks within subregions. We propose complementary regional diffusion to enable region-wise compositional generation. Furthermore, we integrate text-guided image generation and editing within the proposed RPG in a closed-loop fashion, thereby enhancing generalization ability. Extensive experiments demonstrate our RPG outperforms state-of-the-art text-to-image diffusion models, including DALL-E 3 and SDXL, particularly in multi-category object composition and text-image semantic alignment. Notably, our RPG framework exhibits wide compatibility with various MLLM architectures (e.g., MiniGPT-4) and diffusion backbones (e.g., ControlNet). Our code is available at: https://github.com/YangLing0818/RPG-DiffusionMaster","url_abs":"https://arxiv.org/abs/2401.11708v3","url_pdf":"https://arxiv.org/pdf/2401.11708v3.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":"mastering-text-to-image-diffusion","repo_url":"https://github.com/yangling0818/rpg-diffusionmaster","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"diffusion-personalization-tuning-free","task_name":"Diffusion Personalization Tuning Free"},{"task_slug":"image-generation","task_name":"Image Generation"},{"task_slug":"large-language-model","task_name":"Large Language Model"},{"task_slug":"text-to-image-generation-1","task_name":"Text to Image Generation"},{"task_slug":"text-to-image-generation","task_name":"Text-to-Image Generation"}],"methods":[{"method_slug":"diffusion","method_name":"Diffusion"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2401.11708","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2401.11708"}},"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":"deterministic:regex_extraction","url":"https://github.com/huggingface/diffusers","reach":null},{"provenance":"deterministic:regex_extraction","url":"https://github.com/CompVis/stable-diffusion","reach":{"status":"ok","spdx":"NOASSERTION"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/YangLing0818/RPG-DiffusionMaster","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/hako-mikan/sd-webui-regional-prompter","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/yangling0818/rpg-diffusionmaster","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_honours":2,"ran_draft_wrong":9,"ran_violates":3,"ran":6,"unverified":4},"by_repo_kind":{"official":{"samples":10,"ran":7,"repositories":1},"found_in_text":{"samples":14,"ran":13,"repositories":2}},"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":14,"samples":[{"code_sha256_prefix":"72867247ca40fc4d","entry":"floatdef","repo":"hako-mikan/sd-webui-regional-prompter","repo_kind":"found_in_text","path":"scripts/regions.py","file_url":"https://github.com/hako-mikan/sd-webui-regional-prompter/blob/HEAD/scripts/regions.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":2,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"AGPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"72867247ca40fc4d"}},{"code_sha256_prefix":"6a35b62fbc80f70a","entry":"interpolate_fn","repo":"CompVis/stable-diffusion","repo_kind":"found_in_text","path":"ldm/models/diffusion/dpm_solver/dpm_solver.py","file_url":"https://github.com/CompVis/stable-diffusion/blob/HEAD/ldm/models/diffusion/dpm_solver/dpm_solver.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":2,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6a35b62fbc80f70a"}},{"code_sha256_prefix":"fe5dd5258046898c","entry":"always","repo":"CompVis/stable-diffusion","repo_kind":"found_in_text","path":"ldm/modules/x_transformer.py","file_url":"https://github.com/CompVis/stable-diffusion/blob/HEAD/ldm/modules/x_transformer.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fe5dd5258046898c"}},{"code_sha256_prefix":"424012cb37b31172","entry":"default","repo":"CompVis/stable-diffusion","repo_kind":"found_in_text","path":"ldm/modules/attention.py","file_url":"https://github.com/CompVis/stable-diffusion/blob/HEAD/ldm/modules/attention.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"424012cb37b31172"}},{"code_sha256_prefix":"4cb732f513d69dfd","entry":"disabled_train","repo":"CompVis/stable-diffusion","repo_kind":"found_in_text","path":"ldm/models/diffusion/classifier.py","file_url":"https://github.com/CompVis/stable-diffusion/blob/HEAD/ldm/models/diffusion/classifier.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":"4cb732f513d69dfd"}},{"code_sha256_prefix":"aa5486a3650902d8","entry":"exists","repo":"CompVis/stable-diffusion","repo_kind":"found_in_text","path":"ldm/modules/attention.py","file_url":"https://github.com/CompVis/stable-diffusion/blob/HEAD/ldm/modules/attention.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":"aa5486a3650902d8"}},{"code_sha256_prefix":"e6110366588c5c65","entry":"expand_dims","repo":"CompVis/stable-diffusion","repo_kind":"found_in_text","path":"ldm/models/diffusion/dpm_solver/dpm_solver.py","file_url":"https://github.com/CompVis/stable-diffusion/blob/HEAD/ldm/models/diffusion/dpm_solver/dpm_solver.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e6110366588c5c65"}},{"code_sha256_prefix":"9b32f5c5fdc1fed6","entry":"floatdef","repo":"YangLing0818/RPG-DiffusionMaster","repo_kind":"official","path":"matrix.py","file_url":"https://github.com/YangLing0818/RPG-DiffusionMaster/blob/HEAD/matrix.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9b32f5c5fdc1fed6"}},{"code_sha256_prefix":"8a3533b6e18fc64e","entry":"get_params_dict","repo":"YangLing0818/RPG-DiffusionMaster","repo_kind":"official","path":"mllm.py","file_url":"https://github.com/YangLing0818/RPG-DiffusionMaster/blob/HEAD/mllm.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8a3533b6e18fc64e"}},{"code_sha256_prefix":"98feb4cf3a68bbf2","entry":"is_l2","repo":"YangLing0818/RPG-DiffusionMaster","repo_kind":"official","path":"matrix.py","file_url":"https://github.com/YangLing0818/RPG-DiffusionMaster/blob/HEAD/matrix.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"98feb4cf3a68bbf2"}},{"code_sha256_prefix":"44c2fbeedf9741bb","entry":"l2_count","repo":"YangLing0818/RPG-DiffusionMaster","repo_kind":"official","path":"matrix.py","file_url":"https://github.com/YangLing0818/RPG-DiffusionMaster/blob/HEAD/matrix.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"44c2fbeedf9741bb"}},{"code_sha256_prefix":"caef5f29201552d2","entry":"lange","repo":"hako-mikan/sd-webui-regional-prompter","repo_kind":"found_in_text","path":"scripts/regions.py","file_url":"https://github.com/hako-mikan/sd-webui-regional-prompter/blob/HEAD/scripts/regions.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"AGPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"caef5f29201552d2"}},{"code_sha256_prefix":"f48ba5307635aedf","entry":"mode2tabs","repo":"hako-mikan/sd-webui-regional-prompter","repo_kind":"found_in_text","path":"scripts/rp.py","file_url":"https://github.com/hako-mikan/sd-webui-regional-prompter/blob/HEAD/scripts/rp.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"AGPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"f48ba5307635aedf"}},{"code_sha256_prefix":"c38c4cd486f7a766","entry":"model_wrapper","repo":"CompVis/stable-diffusion","repo_kind":"found_in_text","path":"ldm/models/diffusion/dpm_solver/dpm_solver.py","file_url":"https://github.com/CompVis/stable-diffusion/blob/HEAD/ldm/models/diffusion/dpm_solver/dpm_solver.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":"c38c4cd486f7a766"}},{"code_sha256_prefix":"bea2d776a332f2b0","entry":"rescale_noise_cfg","repo":"YangLing0818/RPG-DiffusionMaster","repo_kind":"official","path":"RegionalDiffusion_base.py","file_url":"https://github.com/YangLing0818/RPG-DiffusionMaster/blob/HEAD/RegionalDiffusion_base.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bea2d776a332f2b0"}},{"code_sha256_prefix":"63e7d99da5ea137f","entry":"retrieve_timesteps","repo":"YangLing0818/RPG-DiffusionMaster","repo_kind":"official","path":"RegionalDiffusion_xl.py","file_url":"https://github.com/YangLing0818/RPG-DiffusionMaster/blob/HEAD/RegionalDiffusion_xl.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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"63e7d99da5ea137f"}},{"code_sha256_prefix":"6cccd001a059f194","entry":"retrieve_timesteps","repo":"YangLing0818/RPG-DiffusionMaster","repo_kind":"official","path":"RegionalDiffusion_base.py","file_url":"https://github.com/YangLing0818/RPG-DiffusionMaster/blob/HEAD/RegionalDiffusion_base.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6cccd001a059f194"}},{"code_sha256_prefix":"488d8298f13237c8","entry":"split_l2","repo":"hako-mikan/sd-webui-regional-prompter","repo_kind":"found_in_text","path":"scripts/regions.py","file_url":"https://github.com/hako-mikan/sd-webui-regional-prompter/blob/HEAD/scripts/regions.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"AGPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"488d8298f13237c8"}},{"code_sha256_prefix":"d48d8354986e3b0e","entry":"uniform_on_device","repo":"CompVis/stable-diffusion","repo_kind":"found_in_text","path":"ldm/models/diffusion/ddpm.py","file_url":"https://github.com/CompVis/stable-diffusion/blob/HEAD/ldm/models/diffusion/ddpm.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d48d8354986e3b0e"}},{"code_sha256_prefix":"9a299fe5ae09e407","entry":"uniq","repo":"CompVis/stable-diffusion","repo_kind":"found_in_text","path":"ldm/modules/attention.py","file_url":"https://github.com/CompVis/stable-diffusion/blob/HEAD/ldm/modules/attention.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9a299fe5ae09e407"}},{"code_sha256_prefix":"24399db18bc9c34f","entry":"GPT4","repo":"YangLing0818/RPG-DiffusionMaster","repo_kind":"official","path":"mllm.py","file_url":"https://github.com/YangLing0818/RPG-DiffusionMaster/blob/HEAD/mllm.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"24399db18bc9c34f"}},{"code_sha256_prefix":"4533e43e06a12dc5","entry":"download_models","repo":"CompVis/stable-diffusion","repo_kind":"found_in_text","path":"notebook_helpers.py","file_url":"https://github.com/CompVis/stable-diffusion/blob/HEAD/notebook_helpers.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":"4533e43e06a12dc5"}},{"code_sha256_prefix":"0861ce73c0e98185","entry":"local_llm","repo":"YangLing0818/RPG-DiffusionMaster","repo_kind":"official","path":"mllm.py","file_url":"https://github.com/YangLing0818/RPG-DiffusionMaster/blob/HEAD/mllm.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0861ce73c0e98185"}},{"code_sha256_prefix":"56156523c6123e73","entry":"split_dims","repo":"YangLing0818/RPG-DiffusionMaster","repo_kind":"official","path":"cross_attention.py","file_url":"https://github.com/YangLing0818/RPG-DiffusionMaster/blob/HEAD/cross_attention.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"56156523c6123e73"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}