{"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/masked-diffusion-models-are-fast-learners","title":"Masked Diffusion Models Are Fast Distribution Learners","arxiv_id":"2306.11363","date":"2023-06-20","proceeding":null,"authors":["Jiachen Lei","Qinglong Wang","Peng Cheng","Zhongjie Ba","Zhan Qin","Zhibo Wang","Zhenguang Liu","Kui Ren"],"abstract":"Diffusion model has emerged as the \\emph{de-facto} model for image generation, yet the heavy training overhead hinders its broader adoption in the research community. We observe that diffusion models are commonly trained to learn all fine-grained visual information from scratch. This paradigm may cause unnecessary training costs hence requiring in-depth investigation. In this work, we show that it suffices to train a strong diffusion model by first pre-training the model to learn some primer distribution that loosely characterizes the unknown real image distribution. Then the pre-trained model can be fine-tuned for various generation tasks efficiently. In the pre-training stage, we propose to mask a high proportion (e.g., up to 90\\%) of input images to approximately represent the primer distribution and introduce a masked denoising score matching objective to train a model to denoise visible areas. In subsequent fine-tuning stage, we efficiently train diffusion model without masking. Utilizing the two-stage training framework, we achieves significant training acceleration and a new FID score record of 6.27 on CelebA-HQ $256 \\times 256$ for ViT-based diffusion models. The generalizability of a pre-trained model further helps building models that perform better than ones trained from scratch on different downstream datasets. For instance, a diffusion model pre-trained on VGGFace2 attains a 46\\% quality improvement when fine-tuned on a different dataset that contains only 3000 images. Our code is available at \\url{https://github.com/jiachenlei/maskdm}.","url_abs":"https://arxiv.org/abs/2306.11363v4","url_pdf":"https://arxiv.org/pdf/2306.11363v4.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":"masked-diffusion-models-are-fast-learners","repo_url":"https://github.com/jiachenlei/maskdm","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"denoising","task_name":"Denoising"},{"task_slug":"image-generation","task_name":"Image Generation"}],"methods":[{"method_slug":"denoising-score-matching","method_name":"Denoising Score Matching"},{"method_slug":"diffusion","method_name":"Diffusion"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2306.11363","atlas_url":"https://app.syntology.ai/?focus=2306.11363","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2306.11363"}},"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/jiachenlei/maskdm","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_honours":2,"ran_violates":2,"ran_fixture":1,"ran_draft_wrong":1,"unverified":5},"by_repo_kind":{"official":{"samples":11,"ran":6,"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":"7f1040f5e3991d5e","entry":"identity","repo":"jiachenlei/maskdm","repo_kind":"official","path":"utils/helper.py","file_url":"https://github.com/jiachenlei/maskdm/blob/HEAD/utils/helper.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":2,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7f1040f5e3991d5e"}},{"code_sha256_prefix":"d1ef6b8cb9a28a53","entry":"default","repo":"jiachenlei/maskdm","repo_kind":"official","path":"utils/helper.py","file_url":"https://github.com/jiachenlei/maskdm/blob/HEAD/utils/helper.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d1ef6b8cb9a28a53"}},{"code_sha256_prefix":"608e364a9d2376a3","entry":"exists","repo":"jiachenlei/maskdm","repo_kind":"official","path":"utils/helper.py","file_url":"https://github.com/jiachenlei/maskdm/blob/HEAD/utils/helper.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"608e364a9d2376a3"}},{"code_sha256_prefix":"482723f534770483","entry":"linear_beta_schedule","repo":"jiachenlei/maskdm","repo_kind":"official","path":"gaussian_ddpm.py","file_url":"https://github.com/jiachenlei/maskdm/blob/HEAD/gaussian_ddpm.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"482723f534770483"}},{"code_sha256_prefix":"9cf076a2ae913f94","entry":"patchify","repo":"jiachenlei/maskdm","repo_kind":"official","path":"models/mask_uvit.py","file_url":"https://github.com/jiachenlei/maskdm/blob/HEAD/models/mask_uvit.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9cf076a2ae913f94"}},{"code_sha256_prefix":"b494dd297ded5960","entry":"timestep_embedding","repo":"jiachenlei/maskdm","repo_kind":"official","path":"models/mask_uvit.py","file_url":"https://github.com/jiachenlei/maskdm/blob/HEAD/models/mask_uvit.py","link_basis":"plan_row","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":"b494dd297ded5960"}},{"code_sha256_prefix":"2a421bd3e3e98703","entry":"combine","repo":"jiachenlei/maskdm","repo_kind":"official","path":"utils/config.py","file_url":"https://github.com/jiachenlei/maskdm/blob/HEAD/utils/config.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":"2a421bd3e3e98703"}},{"code_sha256_prefix":"0bd8c65f1839edbf","entry":"cosine_beta_schedule","repo":"jiachenlei/maskdm","repo_kind":"official","path":"gaussian_ddpm.py","file_url":"https://github.com/jiachenlei/maskdm/blob/HEAD/gaussian_ddpm.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":"0bd8c65f1839edbf"}},{"code_sha256_prefix":"7dff50b3dd446750","entry":"get_sinusoid_encoding_table","repo":"jiachenlei/maskdm","repo_kind":"official","path":"models/mask_uvit.py","file_url":"https://github.com/jiachenlei/maskdm/blob/HEAD/models/mask_uvit.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":"7dff50b3dd446750"}},{"code_sha256_prefix":"5f118351f15bd3f6","entry":"parse_yml","repo":"jiachenlei/maskdm","repo_kind":"official","path":"utils/config.py","file_url":"https://github.com/jiachenlei/maskdm/blob/HEAD/utils/config.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":"5f118351f15bd3f6"}},{"code_sha256_prefix":"ea28bd6049050f3b","entry":"shuffle_along_axis","repo":"jiachenlei/maskdm","repo_kind":"official","path":"datasets/masking_generator.py","file_url":"https://github.com/jiachenlei/maskdm/blob/HEAD/datasets/masking_generator.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":"ea28bd6049050f3b"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}