{"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/energy-matching-unifying-flow-matching-and","title":"Energy Matching: Unifying Flow Matching and Energy-Based Models for Generative Modeling","arxiv_id":"2504.10612","date":"2025-04-14","proceeding":null,"authors":["Michal Balcerak","Tamaz Amiranashvili","Antonio Terpin","Suprosanna Shit","Sebastian Kaltenbach","Petros Koumoutsakos","Bjoern Menze"],"abstract":"The most widely used generative models map noise and data distributions by matching flows or scores. However, they struggle to incorporate partial observations and additional priors--something energy-based models (EBMs) handle elegantly by simply adding corresponding scalar energy terms. We address this issue by proposing Energy Matching, a framework that endows flow-based approaches with the flexibility of EBMs. Far from the data manifold, samples move along curl-free, optimal transport paths from noise to data. As they approach the data manifold, an entropic energy term guides the system into a Boltzmann equilibrium distribution, explicitly capturing the underlying likelihood structure of the data. We parameterize this dynamic with a single time-independent scalar field, which serves as both a powerful generator and a flexible prior for effective regularization of inverse problems. Our method substantially outperforms existing EBMs on CIFAR-10 and ImageNet generation in terms of fidelity, while retaining simulation-free training of transport-based approaches away from the data manifold. Furthermore, we leverage the method's flexibility to introduce an interaction energy that supports diverse mode exploration, which we demonstrate in a controlled protein-generation setting. Our approach focuses on learning a scalar potential energy--without time-conditioning, auxiliary generators, or additional networks--which marks a significant departure from recent EBM methods. We believe that this simplified framework significantly advances EBMs capabilities and paves the way for their wider adoption in generative modeling across diverse domains.","url_abs":"https://arxiv.org/abs/2504.10612v2","url_pdf":"https://arxiv.org/pdf/2504.10612v2.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":[],"tasks":[],"methods":[{"method_slug":"ebm","method_name":"EBM"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2504.10612","atlas_url":"https://app.syntology.ai/?focus=2504.10612","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2504.10612"}},"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":"deterministic:regex_extraction","url":"https://github.com/m1balcerak/EnergyMatching","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_honours":1,"ran":7,"ran_violates":2,"unverified":3},"by_repo_kind":{"found_in_text":{"samples":13,"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":"7f1040f5e3991d5e","entry":"identity","repo":"m1balcerak/EnergyMatching","repo_kind":"found_in_text","path":"experiments/proteins/model_proteins.py","file_url":"https://github.com/m1balcerak/EnergyMatching/blob/HEAD/experiments/proteins/model_proteins.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":2,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7f1040f5e3991d5e"}},{"code_sha256_prefix":"13210c7a72367242","entry":"count_parameters","repo":"m1balcerak/EnergyMatching","repo_kind":"found_in_text","path":"experiments/imagenet/train_imagenet_multigpu.py","file_url":"https://github.com/m1balcerak/EnergyMatching/blob/HEAD/experiments/imagenet/train_imagenet_multigpu.py","link_basis":"harvester_set","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":"13210c7a72367242"}},{"code_sha256_prefix":"739a5d9710e2ce1f","entry":"count_parameters","repo":"m1balcerak/EnergyMatching","repo_kind":"found_in_text","path":"experiments/cifar10/train_cifar_multigpu.py","file_url":"https://github.com/m1balcerak/EnergyMatching/blob/HEAD/experiments/cifar10/train_cifar_multigpu.py","link_basis":"harvester_set","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":"739a5d9710e2ce1f"}},{"code_sha256_prefix":"20d1352a944eba7f","entry":"create_timestamped_dir","repo":"m1balcerak/EnergyMatching","repo_kind":"found_in_text","path":"utils_cifar_imagenet.py","file_url":"https://github.com/m1balcerak/EnergyMatching/blob/HEAD/utils_cifar_imagenet.py","link_basis":"harvester_set","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":"20d1352a944eba7f"}},{"code_sha256_prefix":"d1ef6b8cb9a28a53","entry":"default","repo":"m1balcerak/EnergyMatching","repo_kind":"found_in_text","path":"experiments/proteins/model_proteins.py","file_url":"https://github.com/m1balcerak/EnergyMatching/blob/HEAD/experiments/proteins/model_proteins.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d1ef6b8cb9a28a53"}},{"code_sha256_prefix":"8ca540f28a718e8e","entry":"dummy_time","repo":"m1balcerak/EnergyMatching","repo_kind":"found_in_text","path":"experiments/cifar10/network_transformer_vit.py","file_url":"https://github.com/m1balcerak/EnergyMatching/blob/HEAD/experiments/cifar10/network_transformer_vit.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8ca540f28a718e8e"}},{"code_sha256_prefix":"608e364a9d2376a3","entry":"exists","repo":"m1balcerak/EnergyMatching","repo_kind":"found_in_text","path":"experiments/proteins/model_proteins.py","file_url":"https://github.com/m1balcerak/EnergyMatching/blob/HEAD/experiments/proteins/model_proteins.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"608e364a9d2376a3"}},{"code_sha256_prefix":"02ee8105b772a74b","entry":"gibbs_sampling_time_sweep","repo":"m1balcerak/EnergyMatching","repo_kind":"found_in_text","path":"utils_cifar_imagenet.py","file_url":"https://github.com/m1balcerak/EnergyMatching/blob/HEAD/utils_cifar_imagenet.py","link_basis":"harvester_set","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":"02ee8105b772a74b"}},{"code_sha256_prefix":"c6da4dca737892c0","entry":"soft_clamp","repo":"m1balcerak/EnergyMatching","repo_kind":"found_in_text","path":"experiments/cifar10/network_transformer_vit.py","file_url":"https://github.com/m1balcerak/EnergyMatching/blob/HEAD/experiments/cifar10/network_transformer_vit.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c6da4dca737892c0"}},{"code_sha256_prefix":"ed993db42c75bec3","entry":"unpickle","repo":"m1balcerak/EnergyMatching","repo_kind":"found_in_text","path":"experiments/imagenet/dataset_imagenet32.py","file_url":"https://github.com/m1balcerak/EnergyMatching/blob/HEAD/experiments/imagenet/dataset_imagenet32.py","link_basis":"harvester_set","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":"ed993db42c75bec3"}},{"code_sha256_prefix":"ecebc813e8544d40","entry":"get_cifar10_train_loader","repo":"m1balcerak/EnergyMatching","repo_kind":"found_in_text","path":"experiments/cifar10/fid_cifar_heun_1gpu.py","file_url":"https://github.com/m1balcerak/EnergyMatching/blob/HEAD/experiments/cifar10/fid_cifar_heun_1gpu.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":"ecebc813e8544d40"}},{"code_sha256_prefix":"200add9e5ad187ee","entry":"parse_channel_mult","repo":"m1balcerak/EnergyMatching","repo_kind":"found_in_text","path":"experiments/imagenet/config_multigpu_imagenet32.py","file_url":"https://github.com/m1balcerak/EnergyMatching/blob/HEAD/experiments/imagenet/config_multigpu_imagenet32.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":"200add9e5ad187ee"}},{"code_sha256_prefix":"d72c93ebd93e4dce","entry":"sde_euler_maruyama_final","repo":"m1balcerak/EnergyMatching","repo_kind":"found_in_text","path":"utils_cifar_imagenet.py","file_url":"https://github.com/m1balcerak/EnergyMatching/blob/HEAD/utils_cifar_imagenet.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":"d72c93ebd93e4dce"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}