{"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/bayesdag-gradient-based-posterior-sampling","title":"BayesDAG: Gradient-Based Posterior Inference for Causal Discovery","arxiv_id":"2307.13917","date":"2023-07-26","proceeding":"NeurIPS 2023 11","authors":["Yashas Annadani","Nick Pawlowski","Joel Jennings","Stefan Bauer","Cheng Zhang","Wenbo Gong"],"abstract":"Bayesian causal discovery aims to infer the posterior distribution over causal models from observed data, quantifying epistemic uncertainty and benefiting downstream tasks. However, computational challenges arise due to joint inference over combinatorial space of Directed Acyclic Graphs (DAGs) and nonlinear functions. Despite recent progress towards efficient posterior inference over DAGs, existing methods are either limited to variational inference on node permutation matrices for linear causal models, leading to compromised inference accuracy, or continuous relaxation of adjacency matrices constrained by a DAG regularizer, which cannot ensure resulting graphs are DAGs. In this work, we introduce a scalable Bayesian causal discovery framework based on a combination of stochastic gradient Markov Chain Monte Carlo (SG-MCMC) and Variational Inference (VI) that overcomes these limitations. Our approach directly samples DAGs from the posterior without requiring any DAG regularization, simultaneously draws function parameter samples and is applicable to both linear and nonlinear causal models. To enable our approach, we derive a novel equivalence to the permutation-based DAG learning, which opens up possibilities of using any relaxed gradient estimator defined over permutations. To our knowledge, this is the first framework applying gradient-based MCMC sampling for causal discovery. Empirical evaluation on synthetic and real-world datasets demonstrate our approach's effectiveness compared to state-of-the-art baselines.","url_abs":"https://arxiv.org/abs/2307.13917v2","url_pdf":"https://arxiv.org/pdf/2307.13917v2.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":"bayesdag-gradient-based-posterior-sampling","repo_url":"https://github.com/microsoft/Project-BayesDAG","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"jax","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"causal-discovery","task_name":"Causal Discovery"},{"task_slug":"variational-inference","task_name":"Variational Inference"}],"methods":[{"method_slug":"variational-inference","method_name":"Variational Inference"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2307.13917","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2307.13917"}},"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/kurowasan/GraN-DAG","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/microsoft/Project-BayesDAG","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":4,"unverified":3},"by_repo_kind":{"official":{"samples":4,"ran":3,"repositories":1},"found_in_text":{"samples":2,"ran":1,"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":1,"samples":[{"code_sha256_prefix":"e8d9b4d10fe3230b","entry":"BaseModel","repo":"kurowasan/GraN-DAG","repo_kind":"found_in_text","path":"gran_dag/models/learnables.py","file_url":"https://github.com/kurowasan/GraN-DAG/blob/HEAD/gran_dag/models/learnables.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":"e8d9b4d10fe3230b"}},{"code_sha256_prefix":"20a53997e54a0737","entry":"download_dataset","repo":"microsoft/Project-BayesDAG","repo_kind":"official","path":"src/causica/download_dataset.py","file_url":"https://github.com/microsoft/Project-BayesDAG/blob/HEAD/src/causica/download_dataset.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":"20a53997e54a0737"}},{"code_sha256_prefix":"f322162c5e45f661","entry":"split_configs","repo":"microsoft/Project-BayesDAG","repo_kind":"official","path":"src/causica/run_experiment.py","file_url":"https://github.com/microsoft/Project-BayesDAG/blob/HEAD/src/causica/run_experiment.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":"f322162c5e45f661"}},{"code_sha256_prefix":"7e67818eba876c55","entry":"untranspose_stack","repo":"microsoft/Project-BayesDAG","repo_kind":"official","path":"src/causica/models/bayesdag/generation_functions.py","file_url":"https://github.com/microsoft/Project-BayesDAG/blob/HEAD/src/causica/models/bayesdag/generation_functions.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":"7e67818eba876c55"}},{"code_sha256_prefix":"a9daf9295e1bea2b","entry":"LearnableModel","repo":"kurowasan/GraN-DAG","repo_kind":"found_in_text","path":"gran_dag/models/learnables.py","file_url":"https://github.com/kurowasan/GraN-DAG/blob/HEAD/gran_dag/models/learnables.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":"a9daf9295e1bea2b"}},{"code_sha256_prefix":"6ed7da204f2567a9","entry":"compute_A_phi","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"6ed7da204f2567a9"}},{"code_sha256_prefix":"c4e4a51a4b478e9e","entry":"create_diagonal_spline_flow","repo":"microsoft/Project-BayesDAG","repo_kind":"official","path":"src/causica/models/bayesdag/diagonal_flows.py","file_url":"https://github.com/microsoft/Project-BayesDAG/blob/HEAD/src/causica/models/bayesdag/diagonal_flows.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":"c4e4a51a4b478e9e"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}