{"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-generative-networks","title":"Hamiltonian Generative Networks","arxiv_id":"1909.13789","date":"2019-09-30","proceeding":"ICLR 2020 1","authors":["Peter Toth","Danilo Jimenez Rezende","Andrew Jaegle","Sébastien Racanière","Aleksandar Botev","Irina Higgins"],"abstract":"The Hamiltonian formalism plays a central role in classical and quantum physics. Hamiltonians are the main tool for modelling the continuous time evolution of systems with conserved quantities, and they come equipped with many useful properties, like time reversibility and smooth interpolation in time. These properties are important for many machine learning problems - from sequence prediction to reinforcement learning and density modelling - but are not typically provided out of the box by standard tools such as recurrent neural networks. In this paper, we introduce the Hamiltonian Generative Network (HGN), the first approach capable of consistently learning Hamiltonian dynamics from high-dimensional observations (such as images) without restrictive domain assumptions. Once trained, we can use HGN to sample new trajectories, perform rollouts both forward and backward in time and even speed up or slow down the learned dynamics. We demonstrate how a simple modification of the network architecture turns HGN into a powerful normalising flow model, called Neural Hamiltonian Flow (NHF), that uses Hamiltonian dynamics to model expressive densities. We hope that our work serves as a first practical demonstration of the value that the Hamiltonian formalism can bring to deep learning.","url_abs":"https://arxiv.org/abs/1909.13789v2","url_pdf":"https://arxiv.org/pdf/1909.13789v2.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-generative-networks","repo_url":"https://github.com/CampusAI/Hamiltonian-Generative-Networks","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"reinforcement-learning","task_name":"Reinforcement Learning"}],"methods":[{"method_slug":"speed","method_name":"SPEED"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1909.13789","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1909.13789"}},"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/CampusAI/Hamiltonian-Generative-Networks","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":4},"by_repo_kind":{"listed":{"samples":4,"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":0,"samples":[{"code_sha256_prefix":"253a022abec093ab","entry":"geco_constraint","repo":"CampusAI/Hamiltonian-Generative-Networks","repo_kind":"listed","path":"utilities/losses.py","file_url":"https://github.com/CampusAI/Hamiltonian-Generative-Networks/blob/HEAD/utilities/losses.py","link_basis":"harvester_set","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":"253a022abec093ab"}},{"code_sha256_prefix":"67acfaf9f37115f7","entry":"generate_and_save","repo":"CampusAI/Hamiltonian-Generative-Networks","repo_kind":"listed","path":"generate_data.py","file_url":"https://github.com/CampusAI/Hamiltonian-Generative-Networks/blob/HEAD/generate_data.py","link_basis":"harvester_set","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":"67acfaf9f37115f7"}},{"code_sha256_prefix":"bb2ef593efda5b4b","entry":"kld_loss","repo":"CampusAI/Hamiltonian-Generative-Networks","repo_kind":"listed","path":"utilities/losses.py","file_url":"https://github.com/CampusAI/Hamiltonian-Generative-Networks/blob/HEAD/utilities/losses.py","link_basis":"harvester_set","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":"bb2ef593efda5b4b"}},{"code_sha256_prefix":"d9c3d07bc45f1c13","entry":"reconstruction_loss","repo":"CampusAI/Hamiltonian-Generative-Networks","repo_kind":"listed","path":"utilities/losses.py","file_url":"https://github.com/CampusAI/Hamiltonian-Generative-Networks/blob/HEAD/utilities/losses.py","link_basis":"harvester_set","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":"d9c3d07bc45f1c13"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}