{"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/vargrad-a-low-variance-gradient-estimator-for","title":"VarGrad: A Low-Variance Gradient Estimator for Variational Inference","arxiv_id":"2010.10436","date":"2020-10-20","proceeding":"NeurIPS 2020 12","authors":["Lorenz Richter","Ayman Boustati","Nikolas Nüsken","Francisco J. R. Ruiz","Ömer Deniz Akyildiz"],"abstract":"We analyse the properties of an unbiased gradient estimator of the ELBO for variational inference, based on the score function method with leave-one-out control variates. We show that this gradient estimator can be obtained using a new loss, defined as the variance of the log-ratio between the exact posterior and the variational approximation, which we call the $\\textit{log-variance loss}$. Under certain conditions, the gradient of the log-variance loss equals the gradient of the (negative) ELBO. We show theoretically that this gradient estimator, which we call $\\textit{VarGrad}$ due to its connection to the log-variance loss, exhibits lower variance than the score function method in certain settings, and that the leave-one-out control variate coefficients are close to the optimal ones. We empirically demonstrate that VarGrad offers a favourable variance versus computation trade-off compared to other state-of-the-art estimators on a discrete VAE.","url_abs":"https://arxiv.org/abs/2010.10436v2","url_pdf":"https://arxiv.org/pdf/2010.10436v2.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":"vargrad-a-low-variance-gradient-estimator-for","repo_url":"https://github.com/aboustati/vargrad","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"jax","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"variational-inference","task_name":"Variational Inference"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2010.10436","atlas_url":"https://app.syntology.ai/?focus=2010.10436","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2010.10436"}},"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":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/aboustati/vargrad","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"unverified":19},"by_repo_kind":{"official":{"samples":19,"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":"fe9915d4c3e50a53","entry":"change_learning_rate","repo":"aboustati/vargrad","repo_kind":"official","path":"experiments/vargrad_experiments/discrete_vae/config.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/experiments/vargrad_experiments/discrete_vae/config.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"fe9915d4c3e50a53"}},{"code_sha256_prefix":"5bf6ae65c27a84b7","entry":"change_path","repo":"aboustati/vargrad","repo_kind":"official","path":"experiments/vargrad_experiments/discrete_vae/config.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/experiments/vargrad_experiments/discrete_vae/config.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5bf6ae65c27a84b7"}},{"code_sha256_prefix":"11564269193fd678","entry":"change_training_seed","repo":"aboustati/vargrad","repo_kind":"official","path":"experiments/vargrad_experiments/discrete_vae/config.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/experiments/vargrad_experiments/discrete_vae/config.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"11564269193fd678"}},{"code_sha256_prefix":"eaea1bbb60313d70","entry":"conditional_sample","repo":"aboustati/vargrad","repo_kind":"official","path":"vargrad/distributions/binary_concrete.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/vargrad/distributions/binary_concrete.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"eaea1bbb60313d70"}},{"code_sha256_prefix":"4fc51fcaff50f27e","entry":"conditional_sample","repo":"aboustati/vargrad","repo_kind":"official","path":"vargrad/distributions/binary_relaxed.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/vargrad/distributions/binary_relaxed.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"4fc51fcaff50f27e"}},{"code_sha256_prefix":"9a3faf80f939fb16","entry":"fori_loop","repo":"aboustati/vargrad","repo_kind":"official","path":"vargrad/discrete_vae/utilities.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/vargrad/discrete_vae/utilities.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"9a3faf80f939fb16"}},{"code_sha256_prefix":"9f917c4035c94cea","entry":"generate_negative_elbo","repo":"aboustati/vargrad","repo_kind":"official","path":"vargrad/discrete_vae/two_layer_objectives.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/vargrad/discrete_vae/two_layer_objectives.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"9f917c4035c94cea"}},{"code_sha256_prefix":"f2ff37104e831e78","entry":"generate_negative_elbo","repo":"aboustati/vargrad","repo_kind":"official","path":"vargrad/discrete_vae/objectives.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/vargrad/discrete_vae/objectives.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f2ff37104e831e78"}},{"code_sha256_prefix":"2493e2fccccb1611","entry":"generate_score_function_objective","repo":"aboustati/vargrad","repo_kind":"official","path":"vargrad/discrete_vae/two_layer_objectives.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/vargrad/discrete_vae/two_layer_objectives.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"2493e2fccccb1611"}},{"code_sha256_prefix":"dde442b8095695aa","entry":"generate_score_function_objective","repo":"aboustati/vargrad","repo_kind":"official","path":"vargrad/discrete_vae/objectives.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/vargrad/discrete_vae/objectives.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"dde442b8095695aa"}},{"code_sha256_prefix":"27e122b570e527f9","entry":"generate_variance_loss_objective","repo":"aboustati/vargrad","repo_kind":"official","path":"vargrad/discrete_vae/two_layer_objectives.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/vargrad/discrete_vae/two_layer_objectives.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"27e122b570e527f9"}},{"code_sha256_prefix":"da1b7d08884188b5","entry":"generate_variance_loss_objective","repo":"aboustati/vargrad","repo_kind":"official","path":"vargrad/discrete_vae/objectives.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/vargrad/discrete_vae/objectives.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"da1b7d08884188b5"}},{"code_sha256_prefix":"624810d1981de662","entry":"logpdf","repo":"aboustati/vargrad","repo_kind":"official","path":"vargrad/distributions/binary_concrete.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/vargrad/distributions/binary_concrete.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"624810d1981de662"}},{"code_sha256_prefix":"b62664bcd7b69aeb","entry":"logpmf","repo":"aboustati/vargrad","repo_kind":"official","path":"vargrad/distributions/bernoulli.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/vargrad/distributions/bernoulli.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b62664bcd7b69aeb"}},{"code_sha256_prefix":"b08eaa978b0e8144","entry":"mnist","repo":"aboustati/vargrad","repo_kind":"official","path":"vargrad/datasets.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/vargrad/datasets.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b08eaa978b0e8144"}},{"code_sha256_prefix":"7c4b2e4da8105181","entry":"omniglot","repo":"aboustati/vargrad","repo_kind":"official","path":"vargrad/datasets.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/vargrad/datasets.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"7c4b2e4da8105181"}},{"code_sha256_prefix":"ea712673f75d17f9","entry":"sample","repo":"aboustati/vargrad","repo_kind":"official","path":"vargrad/distributions/bernoulli.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/vargrad/distributions/bernoulli.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ea712673f75d17f9"}},{"code_sha256_prefix":"829c661dd26bef5b","entry":"sample","repo":"aboustati/vargrad","repo_kind":"official","path":"vargrad/distributions/binary_concrete.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/vargrad/distributions/binary_concrete.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"829c661dd26bef5b"}},{"code_sha256_prefix":"369211dfef704bde","entry":"sample","repo":"aboustati/vargrad","repo_kind":"official","path":"vargrad/distributions/binary_relaxed.py","file_url":"https://github.com/aboustati/vargrad/blob/HEAD/vargrad/distributions/binary_relaxed.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"369211dfef704bde"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}