{"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/learning-with-mixture-of-prototypes-for-out","title":"Learning with Mixture of Prototypes for Out-of-Distribution Detection","arxiv_id":"2402.02653","date":"2024-02-05","proceeding":null,"authors":["Haodong Lu","Dong Gong","Shuo Wang","Jason Xue","Lina Yao","Kristen Moore"],"abstract":"Out-of-distribution (OOD) detection aims to detect testing samples far away from the in-distribution (ID) training data, which is crucial for the safe deployment of machine learning models in the real world. Distance-based OOD detection methods have emerged with enhanced deep representation learning. They identify unseen OOD samples by measuring their distances from ID class centroids or prototypes. However, existing approaches learn the representation relying on oversimplified data assumptions, e.g, modeling ID data of each class with one centroid class prototype or using loss functions not designed for OOD detection, which overlook the natural diversities within the data. Naively enforcing data samples of each class to be compact around only one prototype leads to inadequate modeling of realistic data and limited performance. To tackle these issues, we propose PrototypicAl Learning with a Mixture of prototypes (PALM) which models each class with multiple prototypes to capture the sample diversities, and learns more faithful and compact samples embeddings to enhance OOD detection. Our method automatically identifies and dynamically updates prototypes, assigning each sample to a subset of prototypes via reciprocal neighbor soft assignment weights. PALM optimizes a maximum likelihood estimation (MLE) loss to encourage the sample embeddings to be compact around the associated prototypes, as well as a contrastive loss on all prototypes to enhance intra-class compactness and inter-class discrimination at the prototype level. Moreover, the automatic estimation of prototypes enables our approach to be extended to the challenging OOD detection task with unlabelled ID data. Extensive experiments demonstrate the superiority of PALM, achieving state-of-the-art average AUROC performance of 93.82 on the challenging CIFAR-100 benchmark. Code is available at https://github.com/jeff024/PALM.","url_abs":"https://arxiv.org/abs/2402.02653v1","url_pdf":"https://arxiv.org/pdf/2402.02653v1.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":"learning-with-mixture-of-prototypes-for-out","repo_url":"https://github.com/jeff024/palm","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"ood-detection","task_name":"Out of Distribution (OOD) Detection"},{"task_slug":"out-of-distribution-detection","task_name":"Out-of-Distribution Detection"},{"task_slug":"representation-learning","task_name":"Representation Learning"}],"methods":[{"method_slug":"palm","method_name":"PaLM"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2402.02653","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.02653"}},"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/jeff024/PALM","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/jeff024/palm","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":6,"ran_violates":1,"unverified":5},"by_repo_kind":{"official":{"samples":12,"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":"f259e39041e0c932","entry":"compute_average_results","repo":"jeff024/PALM","repo_kind":"official","path":"util/evaluations/metrics.py","file_url":"https://github.com/jeff024/PALM/blob/HEAD/util/evaluations/metrics.py","link_basis":"first_harvest_node","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":"f259e39041e0c932"}},{"code_sha256_prefix":"b02d7d54e0689e5d","entry":"get_encoder_dim","repo":"jeff024/PALM","repo_kind":"official","path":"util/loaders/model_loader.py","file_url":"https://github.com/jeff024/PALM/blob/HEAD/util/loaders/model_loader.py","link_basis":"first_harvest_node","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":"b02d7d54e0689e5d"}},{"code_sha256_prefix":"d017fdfac229b3be","entry":"get_normalizer","repo":"jeff024/PALM","repo_kind":"official","path":"util/loaders/data_loader.py","file_url":"https://github.com/jeff024/PALM/blob/HEAD/util/loaders/data_loader.py","link_basis":"first_harvest_node","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":"d017fdfac229b3be"}},{"code_sha256_prefix":"361914e4b87a86ce","entry":"get_optimizer","repo":"jeff024/PALM","repo_kind":"official","path":"util/train_utils.py","file_url":"https://github.com/jeff024/PALM/blob/HEAD/util/train_utils.py","link_basis":"first_harvest_node","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":"361914e4b87a86ce"}},{"code_sha256_prefix":"8fccd664858970c5","entry":"get_transform_eval","repo":"jeff024/PALM","repo_kind":"official","path":"util/loaders/data_loader.py","file_url":"https://github.com/jeff024/PALM/blob/HEAD/util/loaders/data_loader.py","link_basis":"first_harvest_node","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":"8fccd664858970c5"}},{"code_sha256_prefix":"cba4892d1837c843","entry":"get_transform_test","repo":"jeff024/PALM","repo_kind":"official","path":"util/loaders/data_loader.py","file_url":"https://github.com/jeff024/PALM/blob/HEAD/util/loaders/data_loader.py","link_basis":"first_harvest_node","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":"cba4892d1837c843"}},{"code_sha256_prefix":"7c508037b40522af","entry":"str2bool","repo":"jeff024/PALM","repo_kind":"official","path":"util/loaders/args_loader.py","file_url":"https://github.com/jeff024/PALM/blob/HEAD/util/loaders/args_loader.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7c508037b40522af"}},{"code_sha256_prefix":"ce4297de7af20dcf","entry":"PALM","repo":"jeff024/palm","repo_kind":"official","path":"util/loss_functions.py","file_url":"https://github.com/jeff024/palm/blob/HEAD/util/loss_functions.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":"ce4297de7af20dcf"}},{"code_sha256_prefix":"913d82af53065418","entry":"accuracy","repo":"jeff024/PALM","repo_kind":"official","path":"util/train_utils.py","file_url":"https://github.com/jeff024/PALM/blob/HEAD/util/train_utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"913d82af53065418"}},{"code_sha256_prefix":"a81c47f74ffdeafe","entry":"cal_metric","repo":"jeff024/PALM","repo_kind":"official","path":"util/evaluations/metrics.py","file_url":"https://github.com/jeff024/PALM/blob/HEAD/util/evaluations/metrics.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":"a81c47f74ffdeafe"}},{"code_sha256_prefix":"4af821a58b36ebf4","entry":"get_criterion","repo":"jeff024/PALM","repo_kind":"official","path":"util/loaders/model_loader.py","file_url":"https://github.com/jeff024/PALM/blob/HEAD/util/loaders/model_loader.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":"4af821a58b36ebf4"}},{"code_sha256_prefix":"7d491ca6c7c6459b","entry":"get_curve","repo":"jeff024/PALM","repo_kind":"official","path":"util/evaluations/metrics.py","file_url":"https://github.com/jeff024/PALM/blob/HEAD/util/evaluations/metrics.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":"7d491ca6c7c6459b"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}