{"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/hamiltonian-neural-networks","title":"Hamiltonian Neural Networks","arxiv_id":"1906.01563","date":"2019-06-04","proceeding":"NeurIPS 2019 12","authors":["Sam Greydanus","Misko Dzamba","Jason Yosinski"],"abstract":"Even though neural networks enjoy widespread use, they still struggle to learn the basic laws of physics. How might we endow them with better inductive biases? In this paper, we draw inspiration from Hamiltonian mechanics to train models that learn and respect exact conservation laws in an unsupervised manner. We evaluate our models on problems where conservation of energy is important, including the two-body problem and pixel observations of a pendulum. Our model trains faster and generalizes better than a regular neural network. An interesting side effect is that our model is perfectly reversible in time.","url_abs":"https://arxiv.org/abs/1906.01563v3","url_pdf":"https://arxiv.org/pdf/1906.01563v3.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":"hamiltonian-neural-networks","repo_url":"https://github.com/AlphaGergedan/Sampling-HNNs","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":null},{"paper_slug":"hamiltonian-neural-networks","repo_url":"https://github.com/MilesCranmer/lagrangian_nns","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"jax","reach":null},{"paper_slug":"hamiltonian-neural-networks","repo_url":"https://github.com/ayushgarg31/HNN-Neurips2019","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok"}},{"paper_slug":"hamiltonian-neural-networks","repo_url":"https://github.com/eikehmueller/mlconservation_code","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":null},{"paper_slug":"hamiltonian-neural-networks","repo_url":"https://github.com/greydanus/hamiltonian-nn","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"hamiltonian-neural-networks","repo_url":"https://github.com/rickyHong/Hamiltonian-NN-repl","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/1906.01563","atlas_url":"https://app.syntology.ai/?focus=1906.01563","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1906.01563"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/rickyHong/Hamiltonian-NN-repl","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/MilesCranmer/lagrangian_nns","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ayushgarg31/HNN-Neurips2019","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/eikehmueller/mlconservation_code","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/greydanus/hamiltonian-nn","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/AlphaGergedan/Sampling-HNNs","reach":null}],"summary":{"ran":1,"ran_draft_wrong":3,"unverified":3},"by_repo_kind":{"listed":{"samples":7,"ran":4,"repositories":3}},"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":2,"samples":[{"code_sha256_prefix":"bfb9452ce6fe3c52","entry":"HNN","repo":"greydanus/hamiltonian-nn","repo_kind":"listed","path":"hnn.py","file_url":"https://github.com/greydanus/hamiltonian-nn/blob/HEAD/hnn.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"bfb9452ce6fe3c52"}},{"code_sha256_prefix":"88a9847a8a323147","entry":"lagrangian_eom","repo":"MilesCranmer/lagrangian_nns","repo_kind":"listed","path":"lnn/core.py","file_url":"https://github.com/MilesCranmer/lagrangian_nns/blob/HEAD/lnn/core.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"88a9847a8a323147"}},{"code_sha256_prefix":"f367bad0bdf8c16d","entry":"raw_lagrangian_eom","repo":"MilesCranmer/lagrangian_nns","repo_kind":"listed","path":"lnn/core.py","file_url":"https://github.com/MilesCranmer/lagrangian_nns/blob/HEAD/lnn/core.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f367bad0bdf8c16d"}},{"code_sha256_prefix":"3f8b9827bda70ac8","entry":"unconstrained_eom","repo":"MilesCranmer/lagrangian_nns","repo_kind":"listed","path":"lnn/core.py","file_url":"https://github.com/MilesCranmer/lagrangian_nns/blob/HEAD/lnn/core.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"3f8b9827bda70ac8"}},{"code_sha256_prefix":"2d9524e322df3463","entry":"LagrangianDynamicalSystem","repo":"eikehmueller/mlconservation_code","repo_kind":"listed","path":"src/conservative_nn/nn_lagrangian_model.py","file_url":"https://github.com/eikehmueller/mlconservation_code/blob/HEAD/src/conservative_nn/nn_lagrangian_model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"2d9524e322df3463"}},{"code_sha256_prefix":"a4bfe3de6390ef4b","entry":"NNLagrangianModel","repo":"eikehmueller/mlconservation_code","repo_kind":"listed","path":"src/conservative_nn/nn_lagrangian_model.py","file_url":"https://github.com/eikehmueller/mlconservation_code/blob/HEAD/src/conservative_nn/nn_lagrangian_model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"GPL-3.0","inline_ok":false,"mcp_get_code":{"code_sha256":"a4bfe3de6390ef4b"}},{"code_sha256_prefix":"17a5fed7d8573e71","entry":"rk4","repo":"greydanus/hamiltonian-nn","repo_kind":"listed","path":"hnn.py","file_url":"https://github.com/greydanus/hamiltonian-nn/blob/HEAD/hnn.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":"17a5fed7d8573e71"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}