{"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/robust-simulation-based-inference-in","title":"Robust Simulation-Based Inference in Cosmology with Bayesian Neural Networks","arxiv_id":"2207.08435","date":"2022-07-18","proceeding":null,"authors":["Pablo Lemos","Miles Cranmer","Muntazir Abidi","ChangHoon Hahn","Michael Eickenberg","Elena Massara","David Yallup","Shirley Ho"],"abstract":"Simulation-based inference (SBI) is rapidly establishing itself as a standard machine learning technique for analyzing data in cosmological surveys. Despite continual improvements to the quality of density estimation by learned models, applications of such techniques to real data are entirely reliant on the generalization power of neural networks far outside the training distribution, which is mostly unconstrained. Due to the imperfections in scientist-created simulations, and the large computational expense of generating all possible parameter combinations, SBI methods in cosmology are vulnerable to such generalization issues. Here, we discuss the effects of both issues, and show how using a Bayesian neural network framework for training SBI can mitigate biases, and result in more reliable inference outside the training set. We introduce cosmoSWAG, the first application of Stochastic Weight Averaging to cosmology, and apply it to SBI trained for inference on the cosmic microwave background.","url_abs":"https://arxiv.org/abs/2207.08435v3","url_pdf":"https://arxiv.org/pdf/2207.08435v3.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":"robust-simulation-based-inference-in","repo_url":"https://github.com/pablo-lemos/cosmoswag","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"density-estimation","task_name":"Density Estimation"}],"methods":[{"method_slug":"stochastic-weight-averaging","method_name":"Stochastic Weight Averaging"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2207.08435","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2207.08435"}},"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/Pablo-Lemos/cosmoSWAG","reach":{"status":"ok"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/justinalsing/pydelfi","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/pablo-lemos/cosmoswag","reach":{"status":"ok"}}],"summary":{"ran_fixture":1,"ran":1,"unverified":3},"by_repo_kind":{"official":{"samples":3,"ran":2,"repositories":1},"found_in_text":{"samples":2,"ran":0,"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":5,"samples":[{"code_sha256_prefix":"c207ac63e35789a6","entry":"make_triangular","repo":"pablo-lemos/cosmoswag","repo_kind":"official","path":"cosmoswag/swag.py","file_url":"https://github.com/pablo-lemos/cosmoswag/blob/HEAD/cosmoswag/swag.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c207ac63e35789a6"}},{"code_sha256_prefix":"93128a850e9011b3","entry":"soft_clamp","repo":"pablo-lemos/cosmoswag","repo_kind":"official","path":"cosmoswag/swag.py","file_url":"https://github.com/pablo-lemos/cosmoswag/blob/HEAD/cosmoswag/swag.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":"93128a850e9011b3"}},{"code_sha256_prefix":"5e1f6a0a4341f283","entry":"ConditionalGaussianMade","repo":"justinalsing/pydelfi","repo_kind":"found_in_text","path":"pydelfi/ndes.py","file_url":"https://github.com/justinalsing/pydelfi/blob/HEAD/pydelfi/ndes.py","link_basis":"first_harvest_node","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":"5e1f6a0a4341f283"}},{"code_sha256_prefix":"5140890c625e0fd8","entry":"ConditionalMaskedAutoregressiveFlow","repo":"justinalsing/pydelfi","repo_kind":"found_in_text","path":"pydelfi/ndes.py","file_url":"https://github.com/justinalsing/pydelfi/blob/HEAD/pydelfi/ndes.py","link_basis":"first_harvest_node","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":"5140890c625e0fd8"}},{"code_sha256_prefix":"68eaf28a21166ea4","entry":"SWAGModel","repo":"pablo-lemos/cosmoswag","repo_kind":"official","path":"cosmoswag/swag.py","file_url":"https://github.com/pablo-lemos/cosmoswag/blob/HEAD/cosmoswag/swag.py","link_basis":"first_harvest_node","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":"68eaf28a21166ea4"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}