{"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/learning-physical-models-that-can-respect","title":"Learning Physical Models that Can Respect Conservation Laws","arxiv_id":"2302.11002","date":"2023-02-21","proceeding":null,"authors":["Derek Hansen","Danielle C. Maddix","Shima Alizadeh","Gaurav Gupta","Michael W. Mahoney"],"abstract":"Recent work in scientific machine learning (SciML) has focused on incorporating partial differential equation (PDE) information into the learning process. Much of this work has focused on relatively \"easy\" PDE operators (e.g., elliptic and parabolic), with less emphasis on relatively \"hard\" PDE operators (e.g., hyperbolic). Within numerical PDEs, the latter problem class requires control of a type of volume element or conservation constraint, which is known to be challenging. Delivering on the promise of SciML requires seamlessly incorporating both types of problems into the learning process. To address this issue, we propose ProbConserv, a framework for incorporating conservation constraints into a generic SciML architecture. To do so, ProbConserv combines the integral form of a conservation law with a Bayesian update. We provide a detailed analysis of ProbConserv on learning with the Generalized Porous Medium Equation (GPME), a widely-applicable parameterized family of PDEs that illustrates the qualitative properties of both easier and harder PDEs. ProbConserv is effective for easy GPME variants, performing well with state-of-the-art competitors; and for harder GPME variants it outperforms other approaches that do not guarantee volume conservation. ProbConserv seamlessly enforces physical conservation constraints, maintains probabilistic uncertainty quantification (UQ), and deals well with shocks and heteroscedasticities. In each case, it achieves superior predictive performance on downstream tasks.","url_abs":"https://arxiv.org/abs/2302.11002v4","url_pdf":"https://arxiv.org/pdf/2302.11002v4.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":"learning-physical-models-that-can-respect","repo_url":"https://github.com/amazon-science/probconserv","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"uncertainty-quantification","task_name":"Uncertainty Quantification"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2302.11002","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2302.11002"}},"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/amazon-science/probconserv","reach":null}],"summary":{"ran":5,"ran_honours":1,"ran_fixture":4,"unverified":4},"by_repo_kind":{"official":{"samples":14,"ran":10,"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":"bf3079228b4b66f8","entry":"Attention","repo":"amazon-science/probconserv","repo_kind":"official","path":"deep_pdes/attentive_neural_process/probconserv.py","file_url":"https://github.com/amazon-science/probconserv/blob/HEAD/deep_pdes/attentive_neural_process/probconserv.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"bf3079228b4b66f8"}},{"code_sha256_prefix":"5db7fd66cc15d4fe","entry":"DeterministicEncoder","repo":"amazon-science/probconserv","repo_kind":"official","path":"deep_pdes/attentive_neural_process/probconserv.py","file_url":"https://github.com/amazon-science/probconserv/blob/HEAD/deep_pdes/attentive_neural_process/probconserv.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5db7fd66cc15d4fe"}},{"code_sha256_prefix":"868f64d33b0f779e","entry":"LatentEncoder","repo":"amazon-science/probconserv","repo_kind":"official","path":"deep_pdes/attentive_neural_process/probconserv.py","file_url":"https://github.com/amazon-science/probconserv/blob/HEAD/deep_pdes/attentive_neural_process/probconserv.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"868f64d33b0f779e"}},{"code_sha256_prefix":"0c114347b4d5b3e6","entry":"Linear","repo":"amazon-science/probconserv","repo_kind":"official","path":"deep_pdes/attentive_neural_process/probconserv.py","file_url":"https://github.com/amazon-science/probconserv/blob/HEAD/deep_pdes/attentive_neural_process/probconserv.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"0c114347b4d5b3e6"}},{"code_sha256_prefix":"fc456591ed6ce764","entry":"MultiheadAttention","repo":"amazon-science/probconserv","repo_kind":"official","path":"deep_pdes/attentive_neural_process/probconserv.py","file_url":"https://github.com/amazon-science/probconserv/blob/HEAD/deep_pdes/attentive_neural_process/probconserv.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"fc456591ed6ce764"}},{"code_sha256_prefix":"f90ab48d1192a606","entry":"_get_second_deriv_mat","repo":"amazon-science/probconserv","repo_kind":"official","path":"deep_pdes/attentive_neural_process/probconserv.py","file_url":"https://github.com/amazon-science/probconserv/blob/HEAD/deep_pdes/attentive_neural_process/probconserv.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f90ab48d1192a606"}},{"code_sha256_prefix":"5edc3fc22a03e116","entry":"_get_second_derivative_var","repo":"amazon-science/probconserv","repo_kind":"official","path":"deep_pdes/attentive_neural_process/probconserv.py","file_url":"https://github.com/amazon-science/probconserv/blob/HEAD/deep_pdes/attentive_neural_process/probconserv.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5edc3fc22a03e116"}},{"code_sha256_prefix":"862c973a482ccbe4","entry":"apply_non_linear_ineq_constraint","repo":"amazon-science/probconserv","repo_kind":"official","path":"deep_pdes/attentive_neural_process/probconserv.py","file_url":"https://github.com/amazon-science/probconserv/blob/HEAD/deep_pdes/attentive_neural_process/probconserv.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"862c973a482ccbe4"}},{"code_sha256_prefix":"ebfa11fc11be9ee2","entry":"get_cov_tilde_as_projection","repo":"amazon-science/probconserv","repo_kind":"official","path":"deep_pdes/attentive_neural_process/probconserv.py","file_url":"https://github.com/amazon-science/probconserv/blob/HEAD/deep_pdes/attentive_neural_process/probconserv.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ebfa11fc11be9ee2"}},{"code_sha256_prefix":"d80230f4a8355b1f","entry":"get_mu_tilde_as_projection","repo":"amazon-science/probconserv","repo_kind":"official","path":"deep_pdes/attentive_neural_process/probconserv.py","file_url":"https://github.com/amazon-science/probconserv/blob/HEAD/deep_pdes/attentive_neural_process/probconserv.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d80230f4a8355b1f"}},{"code_sha256_prefix":"cf283110e1c4d57c","entry":"ANP","repo":"amazon-science/probconserv","repo_kind":"official","path":"deep_pdes/attentive_neural_process/probconserv.py","file_url":"https://github.com/amazon-science/probconserv/blob/HEAD/deep_pdes/attentive_neural_process/probconserv.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"cf283110e1c4d57c"}},{"code_sha256_prefix":"4d1194aa0f452075","entry":"Decoder","repo":"amazon-science/probconserv","repo_kind":"official","path":"deep_pdes/attentive_neural_process/probconserv.py","file_url":"https://github.com/amazon-science/probconserv/blob/HEAD/deep_pdes/attentive_neural_process/probconserv.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"4d1194aa0f452075"}},{"code_sha256_prefix":"8ac5d2eae63272ef","entry":"PhysNP","repo":"amazon-science/probconserv","repo_kind":"official","path":"deep_pdes/attentive_neural_process/probconserv.py","file_url":"https://github.com/amazon-science/probconserv/blob/HEAD/deep_pdes/attentive_neural_process/probconserv.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"8ac5d2eae63272ef"}},{"code_sha256_prefix":"cb5f9cc3ba938241","entry":"_apply_g","repo":"amazon-science/probconserv","repo_kind":"official","path":"deep_pdes/attentive_neural_process/probconserv.py","file_url":"https://github.com/amazon-science/probconserv/blob/HEAD/deep_pdes/attentive_neural_process/probconserv.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"cb5f9cc3ba938241"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}