{"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/glide-towards-photorealistic-image-generation","title":"GLIDE: Towards Photorealistic Image Generation and Editing with Text-Guided Diffusion Models","arxiv_id":"2112.10741","date":"2021-12-20","proceeding":null,"authors":["Alex Nichol","Prafulla Dhariwal","Aditya Ramesh","Pranav Shyam","Pamela Mishkin","Bob McGrew","Ilya Sutskever","Mark Chen"],"abstract":"Diffusion models have recently been shown to generate high-quality synthetic images, especially when paired with a guidance technique to trade off diversity for fidelity. We explore diffusion models for the problem of text-conditional image synthesis and compare two different guidance strategies: CLIP guidance and classifier-free guidance. We find that the latter is preferred by human evaluators for both photorealism and caption similarity, and often produces photorealistic samples. Samples from a 3.5 billion parameter text-conditional diffusion model using classifier-free guidance are favored by human evaluators to those from DALL-E, even when the latter uses expensive CLIP reranking. Additionally, we find that our models can be fine-tuned to perform image inpainting, enabling powerful text-driven image editing. We train a smaller model on a filtered dataset and release the code and weights at https://github.com/openai/glide-text2im.","url_abs":"https://arxiv.org/abs/2112.10741v3","url_pdf":"https://arxiv.org/pdf/2112.10741v3.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":"glide-towards-photorealistic-image-generation","repo_url":"https://github.com/openai/glide-text2im","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"glide-towards-photorealistic-image-generation","repo_url":"https://github.com/ermongroup/SDEdit","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"diversity","task_name":"Diversity"},{"task_slug":"image-generation","task_name":"Image Generation"},{"task_slug":"image-inpainting","task_name":"Image Inpainting"},{"task_slug":"reranking","task_name":"Reranking"},{"task_slug":"text-to-image-generation","task_name":"Text-to-Image Generation"},{"task_slug":"zero-shot-text-to-image-generation","task_name":"Zero-Shot Text-to-Image Generation"}],"methods":[{"method_slug":"clip","method_name":"CLIP"},{"method_slug":"diffusion","method_name":"Diffusion"},{"method_slug":"glide","method_name":"GLIDE"}],"datasets_introduced":[],"methods_introduced":[{"slug":"glide","name":"GLIDE","full_name":"Guided Language to Image Diffusion for Generation and Editing"}],"results":[{"leaderboard":"/sota/text-to-image-generation-on-coco","task":"Text-to-Image Generation","dataset":"COCO (Common Objects in Context)","model":"GLIDE (zero-shot)","rank_in_archive_order":31,"of":69,"metrics":{"FID":"12.24"},"uses_additional_data":true}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2112.10741","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2112.10741"}},"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/ermongroup/SDEdit","reach":null},{"provenance":"deterministic:regex_extraction","url":"https://github.com/openai/glide-text2im","reach":null}],"summary":{"ran":8,"ran_draft_wrong":1,"unverified":6},"by_repo_kind":{"official":{"samples":15,"ran":9,"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":0,"samples":[{"code_sha256_prefix":"afad4c14b97816a5","entry":"GroupNorm32","repo":"openai/glide-text2im","repo_kind":"official","path":"glide_text2im/text2im_model.py","file_url":"https://github.com/openai/glide-text2im/blob/HEAD/glide_text2im/text2im_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"afad4c14b97816a5"}},{"code_sha256_prefix":"b4ca43deda023234","entry":"LayerNorm","repo":"openai/glide-text2im","repo_kind":"official","path":"glide_text2im/text2im_model.py","file_url":"https://github.com/openai/glide-text2im/blob/HEAD/glide_text2im/text2im_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b4ca43deda023234"}},{"code_sha256_prefix":"1df304371337469d","entry":"MLP","repo":"openai/glide-text2im","repo_kind":"official","path":"glide_text2im/text2im_model.py","file_url":"https://github.com/openai/glide-text2im/blob/HEAD/glide_text2im/text2im_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1df304371337469d"}},{"code_sha256_prefix":"001daee6f2379723","entry":"MultiheadAttention","repo":"openai/glide-text2im","repo_kind":"official","path":"glide_text2im/text2im_model.py","file_url":"https://github.com/openai/glide-text2im/blob/HEAD/glide_text2im/text2im_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"001daee6f2379723"}},{"code_sha256_prefix":"84ffe49eed5f64f8","entry":"QKVAttention","repo":"openai/glide-text2im","repo_kind":"official","path":"glide_text2im/text2im_model.py","file_url":"https://github.com/openai/glide-text2im/blob/HEAD/glide_text2im/text2im_model.py","link_basis":"first_harvest_node","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":"84ffe49eed5f64f8"}},{"code_sha256_prefix":"be1f454b2f7a88fc","entry":"QKVMultiheadAttention","repo":"openai/glide-text2im","repo_kind":"official","path":"glide_text2im/text2im_model.py","file_url":"https://github.com/openai/glide-text2im/blob/HEAD/glide_text2im/text2im_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"be1f454b2f7a88fc"}},{"code_sha256_prefix":"240a712d20a01f00","entry":"ResidualAttentionBlock","repo":"openai/glide-text2im","repo_kind":"official","path":"glide_text2im/text2im_model.py","file_url":"https://github.com/openai/glide-text2im/blob/HEAD/glide_text2im/text2im_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"240a712d20a01f00"}},{"code_sha256_prefix":"d67f9d0e7ed82f5f","entry":"Transformer","repo":"openai/glide-text2im","repo_kind":"official","path":"glide_text2im/text2im_model.py","file_url":"https://github.com/openai/glide-text2im/blob/HEAD/glide_text2im/text2im_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d67f9d0e7ed82f5f"}},{"code_sha256_prefix":"c93ddadd4581c6e6","entry":"normalization","repo":"openai/glide-text2im","repo_kind":"official","path":"glide_text2im/text2im_model.py","file_url":"https://github.com/openai/glide-text2im/blob/HEAD/glide_text2im/text2im_model.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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c93ddadd4581c6e6"}},{"code_sha256_prefix":"267115dc63f308a8","entry":"AttentionBlock","repo":"openai/glide-text2im","repo_kind":"official","path":"glide_text2im/text2im_model.py","file_url":"https://github.com/openai/glide-text2im/blob/HEAD/glide_text2im/text2im_model.py","link_basis":"first_harvest_node","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":"267115dc63f308a8"}},{"code_sha256_prefix":"86554561a414fdb7","entry":"ResBlock","repo":"openai/glide-text2im","repo_kind":"official","path":"glide_text2im/text2im_model.py","file_url":"https://github.com/openai/glide-text2im/blob/HEAD/glide_text2im/text2im_model.py","link_basis":"first_harvest_node","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":"86554561a414fdb7"}},{"code_sha256_prefix":"e25a725bbd980bac","entry":"Text2ImUNet","repo":"openai/glide-text2im","repo_kind":"official","path":"glide_text2im/text2im_model.py","file_url":"https://github.com/openai/glide-text2im/blob/HEAD/glide_text2im/text2im_model.py","link_basis":"first_harvest_node","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":"e25a725bbd980bac"}},{"code_sha256_prefix":"ebfd51a2d88f9da8","entry":"TimestepEmbedSequential","repo":"openai/glide-text2im","repo_kind":"official","path":"glide_text2im/text2im_model.py","file_url":"https://github.com/openai/glide-text2im/blob/HEAD/glide_text2im/text2im_model.py","link_basis":"first_harvest_node","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":"ebfd51a2d88f9da8"}},{"code_sha256_prefix":"e28a6df0e478f28e","entry":"UNetModel","repo":"openai/glide-text2im","repo_kind":"official","path":"glide_text2im/text2im_model.py","file_url":"https://github.com/openai/glide-text2im/blob/HEAD/glide_text2im/text2im_model.py","link_basis":"first_harvest_node","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":"e28a6df0e478f28e"}},{"code_sha256_prefix":"503bb7076a4bd667","entry":"convert_module_to_f16","repo":"openai/glide-text2im","repo_kind":"official","path":"glide_text2im/text2im_model.py","file_url":"https://github.com/openai/glide-text2im/blob/HEAD/glide_text2im/text2im_model.py","link_basis":"first_harvest_node","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":"503bb7076a4bd667"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}