{"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/variational-sparse-coding-with-learned","title":"Variational Sparse Coding with Learned Thresholding","arxiv_id":"2205.03665","date":"2022-05-07","proceeding":null,"authors":["Kion Fallah","Christopher J. Rozell"],"abstract":"Sparse coding strategies have been lauded for their parsimonious representations of data that leverage low dimensional structure. However, inference of these codes typically relies on an optimization procedure with poor computational scaling in high-dimensional problems. For example, sparse inference in the representations learned in the high-dimensional intermediary layers of deep neural networks (DNNs) requires an iterative minimization to be performed at each training step. As such, recent, quick methods in variational inference have been proposed to infer sparse codes by learning a distribution over the codes with a DNN. In this work, we propose a new approach to variational sparse coding that allows us to learn sparse distributions by thresholding samples, avoiding the use of problematic relaxations. We first evaluate and analyze our method by training a linear generator, showing that it has superior performance, statistical efficiency, and gradient estimation compared to other sparse distributions. We then compare to a standard variational autoencoder using a DNN generator on the Fashion MNIST and CelebA datasets","url_abs":"https://arxiv.org/abs/2205.03665v2","url_pdf":"https://arxiv.org/pdf/2205.03665v2.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":"variational-sparse-coding-with-learned","repo_url":"https://github.com/kfallah/variational-sparse-coding","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":null},{"paper_slug":"variational-sparse-coding-with-learned","repo_url":"https://github.com/kfallah/manifold-contrastive","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"variational-inference","task_name":"Variational Inference"}],"methods":[{"method_slug":"variational-inference","method_name":"Variational Inference"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2205.03665","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2205.03665"}},"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/kfallah/manifold-contrastive","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/kfallah/variational-sparse-coding","reach":null}],"summary":{"ran":4,"ran_draft_wrong":2,"unverified":10},"by_repo_kind":{"official":{"samples":8,"ran":3,"repositories":1},"listed":{"samples":8,"ran":3,"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":16,"samples":[{"code_sha256_prefix":"903ea2efea36342b","entry":"ConvEncoder","repo":"kfallah/variational-sparse-coding","repo_kind":"official","path":"model/lista.py","file_url":"https://github.com/kfallah/variational-sparse-coding/blob/HEAD/model/lista.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"903ea2efea36342b"}},{"code_sha256_prefix":"06232d415e12a510","entry":"MLPEncoder","repo":"kfallah/variational-sparse-coding","repo_kind":"official","path":"model/lista.py","file_url":"https://github.com/kfallah/variational-sparse-coding/blob/HEAD/model/lista.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"06232d415e12a510"}},{"code_sha256_prefix":"6c049df661812c5c","entry":"draw_noise_samples","repo":"kfallah/manifold-contrastive","repo_kind":"listed","path":"src/model/manifold/vi_encoder.py","file_url":"https://github.com/kfallah/manifold-contrastive/blob/HEAD/src/model/manifold/vi_encoder.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":"6c049df661812c5c"}},{"code_sha256_prefix":"3522556f6aac7d0a","entry":"reparameterize","repo":"kfallah/manifold-contrastive","repo_kind":"listed","path":"src/model/manifold/vi_encoder.py","file_url":"https://github.com/kfallah/manifold-contrastive/blob/HEAD/src/model/manifold/vi_encoder.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":"3522556f6aac7d0a"}},{"code_sha256_prefix":"b082bfb3081bcf63","entry":"soft_threshold","repo":"kfallah/variational-sparse-coding","repo_kind":"official","path":"model/lista.py","file_url":"https://github.com/kfallah/variational-sparse-coding/blob/HEAD/model/lista.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b082bfb3081bcf63"}},{"code_sha256_prefix":"63e0ab2c6652828b","entry":"soft_threshold","repo":"kfallah/manifold-contrastive","repo_kind":"listed","path":"src/model/manifold/vi_encoder.py","file_url":"https://github.com/kfallah/manifold-contrastive/blob/HEAD/src/model/manifold/vi_encoder.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"63e0ab2c6652828b"}},{"code_sha256_prefix":"693c2208d67c25f2","entry":"CoefficientEncoder","repo":"kfallah/manifold-contrastive","repo_kind":"listed","path":"src/model/manifold/vi_encoder.py","file_url":"https://github.com/kfallah/manifold-contrastive/blob/HEAD/src/model/manifold/vi_encoder.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":"693c2208d67c25f2"}},{"code_sha256_prefix":"09a8466928f23739","entry":"DistributionData","repo":"kfallah/manifold-contrastive","repo_kind":"listed","path":"src/model/manifold/vi_encoder.py","file_url":"https://github.com/kfallah/manifold-contrastive/blob/HEAD/src/model/manifold/vi_encoder.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":"09a8466928f23739"}},{"code_sha256_prefix":"b5cc5a076789ea2e","entry":"VIEncoder","repo":"kfallah/variational-sparse-coding","repo_kind":"official","path":"model/lista.py","file_url":"https://github.com/kfallah/variational-sparse-coding/blob/HEAD/model/lista.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":"b5cc5a076789ea2e"}},{"code_sha256_prefix":"bb9d074b88eaaf89","entry":"VIEncoderLISTA","repo":"kfallah/variational-sparse-coding","repo_kind":"official","path":"model/lista.py","file_url":"https://github.com/kfallah/variational-sparse-coding/blob/HEAD/model/lista.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":"bb9d074b88eaaf89"}},{"code_sha256_prefix":"77036ddc9499e731","entry":"VariationalEncoderConfig","repo":"kfallah/manifold-contrastive","repo_kind":"listed","path":"src/model/manifold/vi_encoder.py","file_url":"https://github.com/kfallah/manifold-contrastive/blob/HEAD/src/model/manifold/vi_encoder.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":"77036ddc9499e731"}},{"code_sha256_prefix":"592a9f533df33a85","entry":"compute_kl","repo":"kfallah/variational-sparse-coding","repo_kind":"official","path":"model/reparameterization.py","file_url":"https://github.com/kfallah/variational-sparse-coding/blob/HEAD/model/reparameterization.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":"592a9f533df33a85"}},{"code_sha256_prefix":"81df6932691462ff","entry":"compute_loss","repo":"kfallah/manifold-contrastive","repo_kind":"listed","path":"src/model/manifold/vi_encoder.py","file_url":"https://github.com/kfallah/manifold-contrastive/blob/HEAD/src/model/manifold/vi_encoder.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":"81df6932691462ff"}},{"code_sha256_prefix":"9c18a4838eab1610","entry":"fixed_kl","repo":"kfallah/variational-sparse-coding","repo_kind":"official","path":"model/reparameterization.py","file_url":"https://github.com/kfallah/variational-sparse-coding/blob/HEAD/model/reparameterization.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":"9c18a4838eab1610"}},{"code_sha256_prefix":"ee0aa4c2748a9421","entry":"infer_coefficients","repo":"kfallah/manifold-contrastive","repo_kind":"listed","path":"src/model/manifold/vi_encoder.py","file_url":"https://github.com/kfallah/manifold-contrastive/blob/HEAD/src/model/manifold/vi_encoder.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":"ee0aa4c2748a9421"}},{"code_sha256_prefix":"f293d4bd17b84527","entry":"vamp_kl","repo":"kfallah/variational-sparse-coding","repo_kind":"official","path":"model/reparameterization.py","file_url":"https://github.com/kfallah/variational-sparse-coding/blob/HEAD/model/reparameterization.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":"f293d4bd17b84527"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}