{"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/fast-training-of-diffusion-models-with-masked","title":"Fast Training of Diffusion Models with Masked Transformers","arxiv_id":"2306.09305","date":"2023-06-15","proceeding":null,"authors":["Hongkai Zheng","Weili Nie","Arash Vahdat","Anima Anandkumar"],"abstract":"We propose an efficient approach to train large diffusion models with masked transformers. While masked transformers have been extensively explored for representation learning, their application to generative learning is less explored in the vision domain. Our work is the first to exploit masked training to reduce the training cost of diffusion models significantly. Specifically, we randomly mask out a high proportion (e.g., 50%) of patches in diffused input images during training. For masked training, we introduce an asymmetric encoder-decoder architecture consisting of a transformer encoder that operates only on unmasked patches and a lightweight transformer decoder on full patches. To promote a long-range understanding of full patches, we add an auxiliary task of reconstructing masked patches to the denoising score matching objective that learns the score of unmasked patches. Experiments on ImageNet-256x256 and ImageNet-512x512 show that our approach achieves competitive and even better generative performance than the state-of-the-art Diffusion Transformer (DiT) model, using only around 30% of its original training time. Thus, our method shows a promising way of efficiently training large transformer-based diffusion models without sacrificing the generative performance.","url_abs":"https://arxiv.org/abs/2306.09305v2","url_pdf":"https://arxiv.org/pdf/2306.09305v2.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":"fast-training-of-diffusion-models-with-masked","repo_url":"https://github.com/anima-lab/maskdit","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"decoder","task_name":"Decoder"},{"task_slug":"denoising","task_name":"Denoising"},{"task_slug":"representation-learning","task_name":"Representation Learning"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"denoising-score-matching","method_name":"Denoising Score Matching"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"diffusion","method_name":"Diffusion"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2306.09305","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2306.09305"}},"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/anima-lab/maskdit","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":3,"ran_honours":1,"unverified":13},"by_repo_kind":{"official":{"samples":17,"ran":4,"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":"9fcdaa6e423e8aa7","entry":"Normalize","repo":"anima-lab/maskdit","repo_kind":"official","path":"autoencoder.py","file_url":"https://github.com/anima-lab/maskdit/blob/HEAD/autoencoder.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":"9fcdaa6e423e8aa7"}},{"code_sha256_prefix":"45e941764344e7f3","entry":"calculate_fid_from_inception_stats","repo":"anima-lab/maskdit","repo_kind":"official","path":"fid.py","file_url":"https://github.com/anima-lab/maskdit/blob/HEAD/fid.py","link_basis":"plan_row","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"45e941764344e7f3"}},{"code_sha256_prefix":"03310bba324ae4fb","entry":"modulate","repo":"anima-lab/maskdit","repo_kind":"official","path":"models/maskdit.py","file_url":"https://github.com/anima-lab/maskdit/blob/HEAD/models/maskdit.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":"03310bba324ae4fb"}},{"code_sha256_prefix":"3137073275f8c21a","entry":"nonlinearity","repo":"anima-lab/maskdit","repo_kind":"official","path":"autoencoder.py","file_url":"https://github.com/anima-lab/maskdit/blob/HEAD/autoencoder.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":"3137073275f8c21a"}},{"code_sha256_prefix":"2e3cfe60a4a3fff3","entry":"ablation_sampler","repo":"anima-lab/maskdit","repo_kind":"official","path":"sample.py","file_url":"https://github.com/anima-lab/maskdit/blob/HEAD/sample.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":"2e3cfe60a4a3fff3"}},{"code_sha256_prefix":"470fc40fa010645e","entry":"decode_data","repo":"anima-lab/maskdit","repo_kind":"official","path":"train_wds.py","file_url":"https://github.com/anima-lab/maskdit/blob/HEAD/train_wds.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":"470fc40fa010645e"}},{"code_sha256_prefix":"d84d2d3b03445f34","entry":"edm_sampler","repo":"anima-lab/maskdit","repo_kind":"official","path":"sample.py","file_url":"https://github.com/anima-lab/maskdit/blob/HEAD/sample.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":"d84d2d3b03445f34"}},{"code_sha256_prefix":"335b9fe7f1be438a","entry":"get_all_files","repo":"anima-lab/maskdit","repo_kind":"official","path":"evaluator.py","file_url":"https://github.com/anima-lab/maskdit/blob/HEAD/evaluator.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":"335b9fe7f1be438a"}},{"code_sha256_prefix":"f41162e24a6af878","entry":"get_file_paths","repo":"anima-lab/maskdit","repo_kind":"official","path":"train_wds.py","file_url":"https://github.com/anima-lab/maskdit/blob/HEAD/train_wds.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":"f41162e24a6af878"}},{"code_sha256_prefix":"4dbe59e51ed9324d","entry":"get_mask","repo":"anima-lab/maskdit","repo_kind":"official","path":"models/maskdit.py","file_url":"https://github.com/anima-lab/maskdit/blob/HEAD/models/maskdit.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":"4dbe59e51ed9324d"}},{"code_sha256_prefix":"843e6dd2e975b59d","entry":"isimg","repo":"anima-lab/maskdit","repo_kind":"official","path":"evaluator.py","file_url":"https://github.com/anima-lab/maskdit/blob/HEAD/evaluator.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":"843e6dd2e975b59d"}},{"code_sha256_prefix":"eb4cf5cd12c463c2","entry":"mae_loss","repo":"anima-lab/maskdit","repo_kind":"official","path":"train_utils/loss.py","file_url":"https://github.com/anima-lab/maskdit/blob/HEAD/train_utils/loss.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":"eb4cf5cd12c463c2"}},{"code_sha256_prefix":"f97adc1ae5efb785","entry":"make_attn","repo":"anima-lab/maskdit","repo_kind":"official","path":"autoencoder.py","file_url":"https://github.com/anima-lab/maskdit/blob/HEAD/autoencoder.py","link_basis":"plan_row","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":"f97adc1ae5efb785"}},{"code_sha256_prefix":"120e8d7fdf9e788d","entry":"mask_out_token","repo":"anima-lab/maskdit","repo_kind":"official","path":"models/maskdit.py","file_url":"https://github.com/anima-lab/maskdit/blob/HEAD/models/maskdit.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":"120e8d7fdf9e788d"}},{"code_sha256_prefix":"e37dd1efa8f2e9bd","entry":"patchify","repo":"anima-lab/maskdit","repo_kind":"official","path":"train_utils/loss.py","file_url":"https://github.com/anima-lab/maskdit/blob/HEAD/train_utils/loss.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":"e37dd1efa8f2e9bd"}},{"code_sha256_prefix":"dcbc82deee40c291","entry":"png2npz","repo":"anima-lab/maskdit","repo_kind":"official","path":"evaluator.py","file_url":"https://github.com/anima-lab/maskdit/blob/HEAD/evaluator.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":"dcbc82deee40c291"}},{"code_sha256_prefix":"b9773b1c58ab9ffb","entry":"split_by_proc","repo":"anima-lab/maskdit","repo_kind":"official","path":"train_wds.py","file_url":"https://github.com/anima-lab/maskdit/blob/HEAD/train_wds.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":"b9773b1c58ab9ffb"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}