{"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/enhancing-diversity-in-bayesian-deep-learning","title":"Enhancing Diversity in Bayesian Deep Learning via Hyperspherical Energy Minimization of CKA","arxiv_id":"2411.00259","date":"2024-10-31","proceeding":null,"authors":["David Smerkous","Qinxun Bai","Fuxin Li"],"abstract":"Particle-based Bayesian deep learning often requires a similarity metric to compare two networks. However, naive similarity metrics lack permutation invariance and are inappropriate for comparing networks. Centered Kernel Alignment (CKA) on feature kernels has been proposed to compare deep networks but has not been used as an optimization objective in Bayesian deep learning. In this paper, we explore the use of CKA in Bayesian deep learning to generate diverse ensembles and hypernetworks that output a network posterior. Noting that CKA projects kernels onto a unit hypersphere and that directly optimizing the CKA objective leads to diminishing gradients when two networks are very similar. We propose adopting the approach of hyperspherical energy (HE) on top of CKA kernels to address this drawback and improve training stability. Additionally, by leveraging CKA-based feature kernels, we derive feature repulsive terms applied to synthetically generated outlier examples. Experiments on both diverse ensembles and hypernetworks show that our approach significantly outperforms baselines in terms of uncertainty quantification in both synthetic and realistic outlier detection tasks.","url_abs":"https://arxiv.org/abs/2411.00259v1","url_pdf":"https://arxiv.org/pdf/2411.00259v1.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":"enhancing-diversity-in-bayesian-deep-learning","repo_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"deep-learning","task_name":"Deep Learning"},{"task_slug":"diversity","task_name":"Diversity"},{"task_slug":"outlier-detection","task_name":"Outlier Detection"},{"task_slug":"uncertainty-quantification","task_name":"Uncertainty Quantification"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2411.00259","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2411.00259"}},"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/Deep-Machine-Vision/he-cka-ensembles","reach":null}],"summary":{"ran":1,"ran_fixture":4,"ran_draft_wrong":1,"ran_honours":1,"unverified":12},"by_repo_kind":{"official":{"samples":19,"ran":7,"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":"9036f42b36c62bb0","entry":"EMA","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9036f42b36c62bb0"}},{"code_sha256_prefix":"17277f273917cf17","entry":"detach_diagonal","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"17277f273917cf17"}},{"code_sha256_prefix":"09adcb1ba247435b","entry":"hyperenergy_gram","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"09adcb1ba247435b"}},{"code_sha256_prefix":"189230e658112733","entry":"hyperspherical_energy","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"189230e658112733"}},{"code_sha256_prefix":"42842f48a3537257","entry":"register_model_kernel","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"42842f48a3537257"}},{"code_sha256_prefix":"0f4775316d8a360b","entry":"unit_vector_rows","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0f4775316d8a360b"}},{"code_sha256_prefix":"ad9c14c7c7ee4c60","entry":"vectorize_grams","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ad9c14c7c7ee4c60"}},{"code_sha256_prefix":"97d771b52d7d258e","entry":"BaseModelKernel","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.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":"97d771b52d7d258e"}},{"code_sha256_prefix":"68f7b9162c05d546","entry":"FeatureKernel","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.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":"68f7b9162c05d546"}},{"code_sha256_prefix":"893c6101f062d6e1","entry":"HEModelKernel","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.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":"893c6101f062d6e1"}},{"code_sha256_prefix":"0323344675a6cdd0","entry":"batched_gram","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.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":"0323344675a6cdd0"}},{"code_sha256_prefix":"88020a1f65b635e9","entry":"build_model_kernel","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.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":"88020a1f65b635e9"}},{"code_sha256_prefix":"b2174c8f0519c0cd","entry":"center_gram","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.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":"b2174c8f0519c0cd"}},{"code_sha256_prefix":"e1d0a2d50b1be24c","entry":"cossim_gram","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.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":"e1d0a2d50b1be24c"}},{"code_sha256_prefix":"6a5ac817802e3767","entry":"laplacian_gram","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.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":"6a5ac817802e3767"}},{"code_sha256_prefix":"53fdc3e076551676","entry":"learned_gram","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.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":"53fdc3e076551676"}},{"code_sha256_prefix":"c76a29ddc6955622","entry":"linear_gram","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.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":"c76a29ddc6955622"}},{"code_sha256_prefix":"79d630fbd2b5a65b","entry":"log_gram","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.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":"79d630fbd2b5a65b"}},{"code_sha256_prefix":"7b85bee07d9485cd","entry":"rbf_gram","repo":"Deep-Machine-Vision/he-cka-ensembles","repo_kind":"official","path":"hyper/diversity/model_kernels.py","file_url":"https://github.com/Deep-Machine-Vision/he-cka-ensembles/blob/HEAD/hyper/diversity/model_kernels.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":"7b85bee07d9485cd"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}