{"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/diffusion-of-thoughts-chain-of-thought","title":"Diffusion of Thoughts: Chain-of-Thought Reasoning in Diffusion Language Models","arxiv_id":"2402.07754","date":"2024-02-12","proceeding":null,"authors":["Jiacheng Ye","Shansan Gong","Liheng Chen","Lin Zheng","Jiahui Gao","Han Shi","Chuan Wu","Xin Jiang","Zhenguo Li","Wei Bi","Lingpeng Kong"],"abstract":"Recently, diffusion models have garnered significant interest in the field of text processing due to their many potential advantages compared to conventional autoregressive models. In this work, we propose Diffusion-of-Thought (DoT), a novel approach that integrates diffusion models with Chain-of-Thought, a well-established technique for improving the reasoning ability of autoregressive language models. In contrast to autoregressive language models that make decisions in a left-to-right, token-by-token manner, DoT allows reasoning steps to diffuse over time through a diffusion language model and offers greater flexibility in trading-off computation for reasoning performance. Our experimental results demonstrate the effectiveness of DoT in multi-digit multiplication, boolean logic, and grade school math problems, with a small diffusion model outperforming a much larger autoregressive model in both efficiency and accuracy. In addition to that, DoT showcases promising self-correction abilities and benefits from existing reasoning-enhancing techniques like self-consistency decoding. Our findings contribute to the understanding and development of reasoning with diffusion language models.","url_abs":"https://arxiv.org/abs/2402.07754v3","url_pdf":"https://arxiv.org/pdf/2402.07754v3.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":"diffusion-of-thoughts-chain-of-thought","repo_url":"https://github.com/hkunlp/diffusion-of-thoughts","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"math","task_name":"Math"}],"methods":[{"method_slug":"diffusion","method_name":"Diffusion"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2402.07754","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.07754"}},"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/HKUNLP/diffusionof-thoughts","reach":{"status":"gone","observed_at":"2026-09-17","how":"tree_404+repo_404"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/hkunlp/diffusion-of-thoughts","reach":{"status":"ok"}}],"summary":{"ran_draft_wrong":2,"ran":13,"ran_honours":1,"unverified":1},"by_repo_kind":{"official":{"samples":17,"ran":16,"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":17,"samples":[{"code_sha256_prefix":"6a35b62fbc80f70a","entry":"interpolate_fn","repo":"hkunlp/diffusion-of-thoughts","repo_kind":"official","path":"lib/dpm_solver_pytorch.py","file_url":"https://github.com/hkunlp/diffusion-of-thoughts/blob/HEAD/lib/dpm_solver_pytorch.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":"0069140a6378a42c","entry":"chinchilla_tokens_given_params","repo":"hkunlp/diffusion-of-thoughts","repo_kind":"official","path":"lib/scalinglaw_utils.py","file_url":"https://github.com/hkunlp/diffusion-of-thoughts/blob/HEAD/lib/scalinglaw_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"0069140a6378a42c"}},{"code_sha256_prefix":"9107f75d51daf1f9","entry":"cross_entropy","repo":"hkunlp/diffusion-of-thoughts","repo_kind":"official","path":"lib/ops.py","file_url":"https://github.com/hkunlp/diffusion-of-thoughts/blob/HEAD/lib/ops.py","link_basis":"first_harvest_node","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":"9107f75d51daf1f9"}},{"code_sha256_prefix":"e6110366588c5c65","entry":"expand_dims","repo":"hkunlp/diffusion-of-thoughts","repo_kind":"official","path":"lib/dpm_solver_pytorch.py","file_url":"https://github.com/hkunlp/diffusion-of-thoughts/blob/HEAD/lib/dpm_solver_pytorch.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":"c3165980fb5a5f15","entry":"flops_per_step","repo":"hkunlp/diffusion-of-thoughts","repo_kind":"official","path":"lib/scalinglaw_utils.py","file_url":"https://github.com/hkunlp/diffusion-of-thoughts/blob/HEAD/lib/scalinglaw_utils.py","link_basis":"first_harvest_node","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":"c3165980fb5a5f15"}},{"code_sha256_prefix":"99c45a1f3fc5225f","entry":"gather_list","repo":"hkunlp/diffusion-of-thoughts","repo_kind":"official","path":"lib/ddp.py","file_url":"https://github.com/hkunlp/diffusion-of-thoughts/blob/HEAD/lib/ddp.py","link_basis":"first_harvest_node","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":"99c45a1f3fc5225f"}},{"code_sha256_prefix":"33aa1ef9e2fea9b5","entry":"gaussian_kl","repo":"hkunlp/diffusion-of-thoughts","repo_kind":"official","path":"lib/ops.py","file_url":"https://github.com/hkunlp/diffusion-of-thoughts/blob/HEAD/lib/ops.py","link_basis":"first_harvest_node","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":"33aa1ef9e2fea9b5"}},{"code_sha256_prefix":"94d525bb3171befb","entry":"get_gsm8k_dataset","repo":"hkunlp/diffusion-of-thoughts","repo_kind":"official","path":"lib/datasets.py","file_url":"https://github.com/hkunlp/diffusion-of-thoughts/blob/HEAD/lib/datasets.py","link_basis":"first_harvest_node","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":"94d525bb3171befb"}},{"code_sha256_prefix":"a94200de9f3aeda4","entry":"model_wrapper","repo":"hkunlp/diffusion-of-thoughts","repo_kind":"official","path":"lib/dpm_solver_pytorch.py","file_url":"https://github.com/hkunlp/diffusion-of-thoughts/blob/HEAD/lib/dpm_solver_pytorch.py","link_basis":"first_harvest_node","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":"a94200de9f3aeda4"}},{"code_sha256_prefix":"759753896fed3fb6","entry":"params","repo":"hkunlp/diffusion-of-thoughts","repo_kind":"official","path":"lib/scalinglaw_utils.py","file_url":"https://github.com/hkunlp/diffusion-of-thoughts/blob/HEAD/lib/scalinglaw_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"759753896fed3fb6"}},{"code_sha256_prefix":"7dacc8a9f60e97db","entry":"residual_linear","repo":"hkunlp/diffusion-of-thoughts","repo_kind":"official","path":"lib/models.py","file_url":"https://github.com/hkunlp/diffusion-of-thoughts/blob/HEAD/lib/models.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7dacc8a9f60e97db"}},{"code_sha256_prefix":"8526ce179df04bd4","entry":"rotate_half","repo":"hkunlp/diffusion-of-thoughts","repo_kind":"official","path":"lib/rotary.py","file_url":"https://github.com/hkunlp/diffusion-of-thoughts/blob/HEAD/lib/rotary.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8526ce179df04bd4"}},{"code_sha256_prefix":"3b970db7d9880566","entry":"split_5by5_target","repo":"hkunlp/diffusion-of-thoughts","repo_kind":"official","path":"lib/datasets.py","file_url":"https://github.com/hkunlp/diffusion-of-thoughts/blob/HEAD/lib/datasets.py","link_basis":"first_harvest_node","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":"3b970db7d9880566"}},{"code_sha256_prefix":"173070ccc58cf5ad","entry":"split_gsm8k_target","repo":"hkunlp/diffusion-of-thoughts","repo_kind":"official","path":"lib/datasets.py","file_url":"https://github.com/hkunlp/diffusion-of-thoughts/blob/HEAD/lib/datasets.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"173070ccc58cf5ad"}},{"code_sha256_prefix":"0059aa1faf5fc1eb","entry":"wrap_main","repo":"hkunlp/diffusion-of-thoughts","repo_kind":"official","path":"lib/ddp.py","file_url":"https://github.com/hkunlp/diffusion-of-thoughts/blob/HEAD/lib/ddp.py","link_basis":"first_harvest_node","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":"0059aa1faf5fc1eb"}},{"code_sha256_prefix":"32072d093f3fd334","entry":"wrap_main_torchrun","repo":"hkunlp/diffusion-of-thoughts","repo_kind":"official","path":"lib/ddp.py","file_url":"https://github.com/hkunlp/diffusion-of-thoughts/blob/HEAD/lib/ddp.py","link_basis":"first_harvest_node","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":"32072d093f3fd334"}},{"code_sha256_prefix":"05816c8a9ef162b5","entry":"apply_rotary_pos_emb","repo":"hkunlp/diffusion-of-thoughts","repo_kind":"official","path":"lib/rotary.py","file_url":"https://github.com/hkunlp/diffusion-of-thoughts/blob/HEAD/lib/rotary.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":"05816c8a9ef162b5"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}