{"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/gradient-guided-importance-sampling-for-1","title":"Gradient-Guided Importance Sampling for Learning Binary Energy-Based Models","arxiv_id":"2210.05782","date":"2022-10-11","proceeding":null,"authors":["Meng Liu","Haoran Liu","Shuiwang Ji"],"abstract":"Learning energy-based models (EBMs) is known to be difficult especially on discrete data where gradient-based learning strategies cannot be applied directly. Although ratio matching is a sound method to learn discrete EBMs, it suffers from expensive computation and excessive memory requirements, thereby resulting in difficulties in learning EBMs on high-dimensional data. Motivated by these limitations, in this study, we propose ratio matching with gradient-guided importance sampling (RMwGGIS). Particularly, we use the gradient of the energy function w.r.t. the discrete data space to approximately construct the provably optimal proposal distribution, which is subsequently used by importance sampling to efficiently estimate the original ratio matching objective. We perform experiments on density modeling over synthetic discrete data, graph generation, and training Ising models to evaluate our proposed method. The experimental results demonstrate that our method can significantly alleviate the limitations of ratio matching, perform more effectively in practice, and scale to high-dimensional problems. Our implementation is available at https://github.com/divelab/RMwGGIS.","url_abs":"https://arxiv.org/abs/2210.05782v2","url_pdf":"https://arxiv.org/pdf/2210.05782v2.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":"gradient-guided-importance-sampling-for-1","repo_url":"https://github.com/divelab/rmwggis","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"graph-generation","task_name":"Graph Generation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2210.05782","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2210.05782"}},"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/divelab/RMwGGIS","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/divelab/rmwggis","reach":{"status":"ok"}}],"summary":{"ran":6,"unverified":4},"by_repo_kind":{"official":{"samples":10,"ran":6,"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":10,"samples":[{"code_sha256_prefix":"83669485f9ae2314","entry":"GibbsSampler","repo":"divelab/rmwggis","repo_kind":"official","path":"RMwGGIS/main_ggis_synthetic.py","file_url":"https://github.com/divelab/rmwggis/blob/HEAD/RMwGGIS/main_ggis_synthetic.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"83669485f9ae2314"}},{"code_sha256_prefix":"da172b352fd53dfe","entry":"bin2float_new","repo":"divelab/rmwggis","repo_kind":"official","path":"RMwGGIS/main_ggis_synthetic.py","file_url":"https://github.com/divelab/rmwggis/blob/HEAD/RMwGGIS/main_ggis_synthetic.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":"da172b352fd53dfe"}},{"code_sha256_prefix":"92abdba372a4a5fb","entry":"compress_new","repo":"divelab/rmwggis","repo_kind":"official","path":"RMwGGIS/main_ggis_synthetic.py","file_url":"https://github.com/divelab/rmwggis/blob/HEAD/RMwGGIS/main_ggis_synthetic.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"92abdba372a4a5fb"}},{"code_sha256_prefix":"18b403470005270c","entry":"estimate_hamming_new","repo":"divelab/rmwggis","repo_kind":"official","path":"RMwGGIS/main_ggis_synthetic.py","file_url":"https://github.com/divelab/rmwggis/blob/HEAD/RMwGGIS/main_ggis_synthetic.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"18b403470005270c"}},{"code_sha256_prefix":"838c3f8241a4cbb2","entry":"float2bin_new","repo":"divelab/rmwggis","repo_kind":"official","path":"RMwGGIS/main_ggis_synthetic.py","file_url":"https://github.com/divelab/rmwggis/blob/HEAD/RMwGGIS/main_ggis_synthetic.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":"838c3f8241a4cbb2"}},{"code_sha256_prefix":"92e4e829443a73f6","entry":"hamming_mmd_new","repo":"divelab/rmwggis","repo_kind":"official","path":"RMwGGIS/main_ggis_synthetic.py","file_url":"https://github.com/divelab/rmwggis/blob/HEAD/RMwGGIS/main_ggis_synthetic.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":"92e4e829443a73f6"}},{"code_sha256_prefix":"715886a1e55fd6c0","entry":"gibbs_step","repo":"divelab/rmwggis","repo_kind":"official","path":"RMwGGIS/main_ggis_synthetic.py","file_url":"https://github.com/divelab/rmwggis/blob/HEAD/RMwGGIS/main_ggis_synthetic.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":"715886a1e55fd6c0"}},{"code_sha256_prefix":"5c56d942dc97b9e4","entry":"plot_heat","repo":"divelab/rmwggis","repo_kind":"official","path":"RMwGGIS/main_ggis_synthetic.py","file_url":"https://github.com/divelab/rmwggis/blob/HEAD/RMwGGIS/main_ggis_synthetic.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":"5c56d942dc97b9e4"}},{"code_sha256_prefix":"e3ea7d99e37bc581","entry":"plot_samples","repo":"divelab/rmwggis","repo_kind":"official","path":"RMwGGIS/main_ggis_synthetic.py","file_url":"https://github.com/divelab/rmwggis/blob/HEAD/RMwGGIS/main_ggis_synthetic.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":"e3ea7d99e37bc581"}},{"code_sha256_prefix":"98ad0f4bdf9cfea3","entry":"train","repo":"divelab/rmwggis","repo_kind":"official","path":"RMwGGIS/main_ggis_synthetic.py","file_url":"https://github.com/divelab/rmwggis/blob/HEAD/RMwGGIS/main_ggis_synthetic.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":"98ad0f4bdf9cfea3"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}