{"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/discrete-diffusion-language-modeling-by","title":"Discrete Diffusion Modeling by Estimating the Ratios of the Data Distribution","arxiv_id":"2310.16834","date":"2023-10-25","proceeding":null,"authors":["Aaron Lou","Chenlin Meng","Stefano Ermon"],"abstract":"Despite their groundbreaking performance for many generative modeling tasks, diffusion models have fallen short on discrete data domains such as natural language. Crucially, standard diffusion models rely on the well-established theory of score matching, but efforts to generalize this to discrete structures have not yielded the same empirical gains. In this work, we bridge this gap by proposing score entropy, a novel loss that naturally extends score matching to discrete spaces, integrates seamlessly to build discrete diffusion models, and significantly boosts performance. Experimentally, we test our Score Entropy Discrete Diffusion models (SEDD) on standard language modeling tasks. For comparable model sizes, SEDD beats existing language diffusion paradigms (reducing perplexity by $25$-$75$\\%) and is competitive with autoregressive models, in particular outperforming GPT-2. Furthermore, compared to autoregressive mdoels, SEDD generates faithful text without requiring distribution annealing techniques like temperature scaling (around $6$-$8\\times$ better generative perplexity than un-annealed GPT-2), can trade compute and quality (similar quality with $32\\times$ fewer network evaluations), and enables controllable infilling (matching nucleus sampling quality while enabling other strategies besides left to right prompting).","url_abs":"https://arxiv.org/abs/2310.16834v3","url_pdf":"https://arxiv.org/pdf/2310.16834v3.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":"discrete-diffusion-language-modeling-by","repo_url":"https://github.com/louaaron/score-entropy-discrete-diffusion","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"discrete-diffusion-language-modeling-by","repo_url":"https://github.com/gabeguo/any-order-speculative-decoding","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"discrete-diffusion-language-modeling-by","repo_url":"https://github.com/lingxiaoshawn/usd3","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"discrete-diffusion-language-modeling-by","repo_url":"https://github.com/ozekri/SEPO","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"denoising","task_name":"Denoising"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"}],"methods":[{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"cosine-annealing","method_name":"Cosine Annealing"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"diffusion","method_name":"Diffusion"},{"method_slug":"discriminative-fine-tuning","method_name":"Discriminative Fine-Tuning"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"gpt-2","method_name":"GPT-2"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"linear-warmup-with-cosine-annealing","method_name":"Linear Warmup With Cosine Annealing"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"weight-decay","method_name":"Weight Decay"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/language-modelling-on-openwebtext","task":"Language Modelling","dataset":"OpenWebText","model":"SEDD","rank_in_archive_order":12,"of":12,"metrics":{"eval_perplexity":"24.10","parameters":"131M"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2310.16834","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2310.16834"}},"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/louaaron/Score-Entropy-Discrete-Diffusion","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/louaaron/score-entropy-discrete-diffusion","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/gabeguo/any-order-speculative-decoding","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lingxiaoshawn/usd3","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ozekri/SEPO","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":10,"ran_draft_wrong":1,"ran_honours":1,"ran_fixture":1,"unverified":5},"by_repo_kind":{"official":{"samples":18,"ran":13,"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":"0bb0f3f46e52f14d","entry":"bias_dropout_add_scale","repo":"louaaron/Score-Entropy-Discrete-Diffusion","repo_kind":"official","path":"model/fused_add_dropout_scale.py","file_url":"https://github.com/louaaron/Score-Entropy-Discrete-Diffusion/blob/HEAD/model/fused_add_dropout_scale.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":"0bb0f3f46e52f14d"}},{"code_sha256_prefix":"06f8b66017690883","entry":"get_bias_dropout_add_scale","repo":"louaaron/Score-Entropy-Discrete-Diffusion","repo_kind":"official","path":"model/fused_add_dropout_scale.py","file_url":"https://github.com/louaaron/Score-Entropy-Discrete-Diffusion/blob/HEAD/model/fused_add_dropout_scale.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":"06f8b66017690883"}},{"code_sha256_prefix":"4a58edfade53c8c1","entry":"get_model_fn","repo":"louaaron/Score-Entropy-Discrete-Diffusion","repo_kind":"official","path":"model/utils.py","file_url":"https://github.com/louaaron/Score-Entropy-Discrete-Diffusion/blob/HEAD/model/utils.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":"4a58edfade53c8c1"}},{"code_sha256_prefix":"576e1b9b9bcae8ff","entry":"lm1b_detokenizer","repo":"louaaron/Score-Entropy-Discrete-Diffusion","repo_kind":"official","path":"data.py","file_url":"https://github.com/louaaron/Score-Entropy-Discrete-Diffusion/blob/HEAD/data.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"576e1b9b9bcae8ff"}},{"code_sha256_prefix":"03310bba324ae4fb","entry":"modulate","repo":"louaaron/Score-Entropy-Discrete-Diffusion","repo_kind":"official","path":"model/transformer.py","file_url":"https://github.com/louaaron/Score-Entropy-Discrete-Diffusion/blob/HEAD/model/transformer.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":"819cf4771f4eebf0","entry":"modulate","repo":"louaaron/Score-Entropy-Discrete-Diffusion","repo_kind":"official","path":"model/fused_add_dropout_scale.py","file_url":"https://github.com/louaaron/Score-Entropy-Discrete-Diffusion/blob/HEAD/model/fused_add_dropout_scale.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"819cf4771f4eebf0"}},{"code_sha256_prefix":"9b714e281bb784b7","entry":"optimization_manager","repo":"louaaron/Score-Entropy-Discrete-Diffusion","repo_kind":"official","path":"losses.py","file_url":"https://github.com/louaaron/Score-Entropy-Discrete-Diffusion/blob/HEAD/losses.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":"9b714e281bb784b7"}},{"code_sha256_prefix":"9f7fbdbe7ca280e0","entry":"ptb_detokenizer","repo":"louaaron/Score-Entropy-Discrete-Diffusion","repo_kind":"official","path":"data.py","file_url":"https://github.com/louaaron/Score-Entropy-Discrete-Diffusion/blob/HEAD/data.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9f7fbdbe7ca280e0"}},{"code_sha256_prefix":"e1d1b19d3f2e9f49","entry":"residual_linear","repo":"louaaron/Score-Entropy-Discrete-Diffusion","repo_kind":"official","path":"model/transformer.py","file_url":"https://github.com/louaaron/Score-Entropy-Discrete-Diffusion/blob/HEAD/model/transformer.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e1d1b19d3f2e9f49"}},{"code_sha256_prefix":"8526ce179df04bd4","entry":"rotate_half","repo":"louaaron/Score-Entropy-Discrete-Diffusion","repo_kind":"official","path":"model/rotary.py","file_url":"https://github.com/louaaron/Score-Entropy-Discrete-Diffusion/blob/HEAD/model/rotary.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8526ce179df04bd4"}},{"code_sha256_prefix":"172aa319a831b3ab","entry":"sample_categorical","repo":"louaaron/Score-Entropy-Discrete-Diffusion","repo_kind":"official","path":"catsample.py","file_url":"https://github.com/louaaron/Score-Entropy-Discrete-Diffusion/blob/HEAD/catsample.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"172aa319a831b3ab"}},{"code_sha256_prefix":"f3598c5ced32bdac","entry":"unsqueeze_as","repo":"louaaron/Score-Entropy-Discrete-Diffusion","repo_kind":"official","path":"graph_lib.py","file_url":"https://github.com/louaaron/Score-Entropy-Discrete-Diffusion/blob/HEAD/graph_lib.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":"f3598c5ced32bdac"}},{"code_sha256_prefix":"46c10627206a7795","entry":"wt_detokenizer","repo":"louaaron/Score-Entropy-Discrete-Diffusion","repo_kind":"official","path":"data.py","file_url":"https://github.com/louaaron/Score-Entropy-Discrete-Diffusion/blob/HEAD/data.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"46c10627206a7795"}},{"code_sha256_prefix":"05816c8a9ef162b5","entry":"apply_rotary_pos_emb","repo":"louaaron/Score-Entropy-Discrete-Diffusion","repo_kind":"official","path":"model/rotary.py","file_url":"https://github.com/louaaron/Score-Entropy-Discrete-Diffusion/blob/HEAD/model/rotary.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":"05816c8a9ef162b5"}},{"code_sha256_prefix":"c7a7325b30d3491b","entry":"get_noise","repo":"louaaron/Score-Entropy-Discrete-Diffusion","repo_kind":"official","path":"noise_lib.py","file_url":"https://github.com/louaaron/Score-Entropy-Discrete-Diffusion/blob/HEAD/noise_lib.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":"c7a7325b30d3491b"}},{"code_sha256_prefix":"32fa27b9da9341dc","entry":"get_optimizer","repo":"louaaron/Score-Entropy-Discrete-Diffusion","repo_kind":"official","path":"losses.py","file_url":"https://github.com/louaaron/Score-Entropy-Discrete-Diffusion/blob/HEAD/losses.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":"32fa27b9da9341dc"}},{"code_sha256_prefix":"660f0f7bb11e9f74","entry":"get_score_fn","repo":"louaaron/Score-Entropy-Discrete-Diffusion","repo_kind":"official","path":"model/utils.py","file_url":"https://github.com/louaaron/Score-Entropy-Discrete-Diffusion/blob/HEAD/model/utils.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":"660f0f7bb11e9f74"}},{"code_sha256_prefix":"a017bf60b761f427","entry":"gumbel_softmax","repo":"louaaron/Score-Entropy-Discrete-Diffusion","repo_kind":"official","path":"catsample.py","file_url":"https://github.com/louaaron/Score-Entropy-Discrete-Diffusion/blob/HEAD/catsample.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":"a017bf60b761f427"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}