{"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/query-training-learning-and-inference-for","title":"Query Training: Learning a Worse Model to Infer Better Marginals in Undirected Graphical Models with Hidden Variables","arxiv_id":"2006.06803","date":"2020-06-11","proceeding":null,"authors":["Miguel Lázaro-Gredilla","Wolfgang Lehrach","Nishad Gothoskar","Guangyao Zhou","Antoine Dedieu","Dileep George"],"abstract":"Probabilistic graphical models (PGMs) provide a compact representation of knowledge that can be queried in a flexible way: after learning the parameters of a graphical model once, new probabilistic queries can be answered at test time without retraining. However, when using undirected PGMS with hidden variables, two sources of error typically compound in all but the simplest models (a) learning error (both computing the partition function and integrating out the hidden variables is intractable); and (b) prediction error (exact inference is also intractable). Here we introduce query training (QT), a mechanism to learn a PGM that is optimized for the approximate inference algorithm that will be paired with it. The resulting PGM is a worse model of the data (as measured by the likelihood), but it is tuned to produce better marginals for a given inference algorithm. Unlike prior works, our approach preserves the querying flexibility of the original PGM: at test time, we can estimate the marginal of any variable given any partial evidence. We demonstrate experimentally that QT can be used to learn a challenging 8-connected grid Markov random field with hidden variables and that it consistently outperforms the state-of-the-art AdVIL when tested on three undirected models across multiple datasets.","url_abs":"https://arxiv.org/abs/2006.06803v4","url_pdf":"https://arxiv.org/pdf/2006.06803v4.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":"query-training-learning-and-inference-for","repo_url":"https://github.com/vicariousinc/query_training","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[],"methods":[{"method_slug":"pgm","method_name":"PGM"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2006.06803","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2006.06803"}},"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/vicariousinc/query_training","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":9},"by_repo_kind":{"official":{"samples":9,"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":"5a6cac3beb39561a","entry":"contours_to_mess_bu","repo":"vicariousinc/query_training","repo_kind":"official","path":"query_training/cmrf/cmrf8_bo.py","file_url":"https://github.com/vicariousinc/query_training/blob/HEAD/query_training/cmrf/cmrf8_bo.py","link_basis":"first_harvest_node","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":"5a6cac3beb39561a"}},{"code_sha256_prefix":"80d39a71efb86652","entry":"get_mean_nll_single_gaussian","repo":"vicariousinc/query_training","repo_kind":"official","path":"query_training/grbm/baseline.py","file_url":"https://github.com/vicariousinc/query_training/blob/HEAD/query_training/grbm/baseline.py","link_basis":"first_harvest_node","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":"80d39a71efb86652"}},{"code_sha256_prefix":"a7a1032940f30ef3","entry":"get_mean_var_from_natural","repo":"vicariousinc/query_training","repo_kind":"official","path":"query_training/grbm/grbm_qt.py","file_url":"https://github.com/vicariousinc/query_training/blob/HEAD/query_training/grbm/grbm_qt.py","link_basis":"first_harvest_node","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":"a7a1032940f30ef3"}},{"code_sha256_prefix":"d49134e4b5c7f3ef","entry":"get_natural_from_mean_var","repo":"vicariousinc/query_training","repo_kind":"official","path":"query_training/grbm/grbm_qt.py","file_url":"https://github.com/vicariousinc/query_training/blob/HEAD/query_training/grbm/grbm_qt.py","link_basis":"first_harvest_node","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":"d49134e4b5c7f3ef"}},{"code_sha256_prefix":"43c8bb944e0c23fc","entry":"img_to_mess_bu","repo":"vicariousinc/query_training","repo_kind":"official","path":"query_training/cmrf/cmrf8_bo.py","file_url":"https://github.com/vicariousinc/query_training/blob/HEAD/query_training/cmrf/cmrf8_bo.py","link_basis":"first_harvest_node","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":"43c8bb944e0c23fc"}},{"code_sha256_prefix":"ef38d2b517533bfc","entry":"layer","repo":"vicariousinc/query_training","repo_kind":"official","path":"query_training/rbm_dbm/rbm.py","file_url":"https://github.com/vicariousinc/query_training/blob/HEAD/query_training/rbm_dbm/rbm.py","link_basis":"first_harvest_node","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":"ef38d2b517533bfc"}},{"code_sha256_prefix":"1f78f792ac9b0dbd","entry":"nudge_dataset","repo":"vicariousinc/query_training","repo_kind":"official","path":"query_training/rbm_dbm/dataset.py","file_url":"https://github.com/vicariousinc/query_training/blob/HEAD/query_training/rbm_dbm/dataset.py","link_basis":"first_harvest_node","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":"1f78f792ac9b0dbd"}},{"code_sha256_prefix":"273434ee7320eeed","entry":"propagate","repo":"vicariousinc/query_training","repo_kind":"official","path":"query_training/rbm_dbm/rbm.py","file_url":"https://github.com/vicariousinc/query_training/blob/HEAD/query_training/rbm_dbm/rbm.py","link_basis":"first_harvest_node","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":"273434ee7320eeed"}},{"code_sha256_prefix":"cf6b46f7f361d751","entry":"propagate_np","repo":"vicariousinc/query_training","repo_kind":"official","path":"query_training/rbm_dbm/rbm.py","file_url":"https://github.com/vicariousinc/query_training/blob/HEAD/query_training/rbm_dbm/rbm.py","link_basis":"first_harvest_node","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":"cf6b46f7f361d751"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}