{"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/optimal-scaling-for-locally-balanced","title":"Optimal Scaling for Locally Balanced Proposals in Discrete Spaces","arxiv_id":"2209.08183","date":"2022-09-16","proceeding":null,"authors":["Haoran Sun","Hanjun Dai","Dale Schuurmans"],"abstract":"Optimal scaling has been well studied for Metropolis-Hastings (M-H) algorithms in continuous spaces, but a similar understanding has been lacking in discrete spaces. Recently, a family of locally balanced proposals (LBP) for discrete spaces has been proved to be asymptotically optimal, but the question of optimal scaling has remained open. In this paper, we establish, for the first time, that the efficiency of M-H in discrete spaces can also be characterized by an asymptotic acceptance rate that is independent of the target distribution. Moreover, we verify, both theoretically and empirically, that the optimal acceptance rates for LBP and random walk Metropolis (RWM) are $0.574$ and $0.234$ respectively. These results also help establish that LBP is asymptotically $O(N^\\frac{2}{3})$ more efficient than RWM with respect to model dimension $N$. Knowledge of the optimal acceptance rate allows one to automatically tune the neighborhood size of a proposal distribution in a discrete space, directly analogous to step-size control in continuous spaces. We demonstrate empirically that such adaptive M-H sampling can robustly improve sampling in a variety of target distributions in discrete spaces, including training deep energy based models.","url_abs":"https://arxiv.org/abs/2209.08183v2","url_pdf":"https://arxiv.org/pdf/2209.08183v2.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":"optimal-scaling-for-locally-balanced","repo_url":"https://github.com/ha0ransun/lbp_scale","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2209.08183","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2209.08183"}},"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/ha0ransun/lbp_scale","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":3,"ran_honours":1,"unverified":6},"by_repo_kind":{"official":{"samples":10,"ran":4,"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":"a01b6bf3d5c907c2","entry":"conv3x3","repo":"ha0ransun/lbp_scale","repo_kind":"official","path":"lbp/model/dnn.py","file_url":"https://github.com/ha0ransun/lbp_scale/blob/HEAD/lbp/model/dnn.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":"a01b6bf3d5c907c2"}},{"code_sha256_prefix":"abe28c18ca27abc1","entry":"conv_transpose_3x3","repo":"ha0ransun/lbp_scale","repo_kind":"official","path":"lbp/model/dnn.py","file_url":"https://github.com/ha0ransun/lbp_scale/blob/HEAD/lbp/model/dnn.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":"abe28c18ca27abc1"}},{"code_sha256_prefix":"9910e2fc297f8665","entry":"identity","repo":"ha0ransun/lbp_scale","repo_kind":"official","path":"lbp/data_util/data_loader.py","file_url":"https://github.com/ha0ransun/lbp_scale/blob/HEAD/lbp/data_util/data_loader.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9910e2fc297f8665"}},{"code_sha256_prefix":"646a9f9fd82940a8","entry":"mlp_ebm","repo":"ha0ransun/lbp_scale","repo_kind":"official","path":"lbp/model/dnn.py","file_url":"https://github.com/ha0ransun/lbp_scale/blob/HEAD/lbp/model/dnn.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":"646a9f9fd82940a8"}},{"code_sha256_prefix":"d14e95b9443ebb30","entry":"get_binary_data_loader","repo":"ha0ransun/lbp_scale","repo_kind":"official","path":"lbp/data_util/data_loader.py","file_url":"https://github.com/ha0ransun/lbp_scale/blob/HEAD/lbp/data_util/data_loader.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":"d14e95b9443ebb30"}},{"code_sha256_prefix":"443e30fa4cee1ada","entry":"get_rate_stats","repo":"ha0ransun/lbp_scale","repo_kind":"official","path":"lbp/common/rate_stats.py","file_url":"https://github.com/ha0ransun/lbp_scale/blob/HEAD/lbp/common/rate_stats.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":"443e30fa4cee1ada"}},{"code_sha256_prefix":"10ec5dcad59f3e85","entry":"load_dynamic_mnist","repo":"ha0ransun/lbp_scale","repo_kind":"official","path":"lbp/data_util/raw_dataset.py","file_url":"https://github.com/ha0ransun/lbp_scale/blob/HEAD/lbp/data_util/raw_dataset.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":"10ec5dcad59f3e85"}},{"code_sha256_prefix":"fe47fc8dbdb874c4","entry":"load_omniglot","repo":"ha0ransun/lbp_scale","repo_kind":"official","path":"lbp/data_util/raw_dataset.py","file_url":"https://github.com/ha0ransun/lbp_scale/blob/HEAD/lbp/data_util/raw_dataset.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":"fe47fc8dbdb874c4"}},{"code_sha256_prefix":"41c71b384e5548f7","entry":"load_static_mnist","repo":"ha0ransun/lbp_scale","repo_kind":"official","path":"lbp/data_util/raw_dataset.py","file_url":"https://github.com/ha0ransun/lbp_scale/blob/HEAD/lbp/data_util/raw_dataset.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":"41c71b384e5548f7"}},{"code_sha256_prefix":"16f406586bb9e7d2","entry":"process_categorical_data","repo":"ha0ransun/lbp_scale","repo_kind":"official","path":"lbp/data_util/data_loader.py","file_url":"https://github.com/ha0ransun/lbp_scale/blob/HEAD/lbp/data_util/data_loader.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":"16f406586bb9e7d2"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}