{"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/a-simple-unified-framework-for-detecting-out","title":"A Simple Unified Framework for Detecting Out-of-Distribution Samples and Adversarial Attacks","arxiv_id":"1807.03888","date":"2018-07-10","proceeding":"NeurIPS 2018 12","authors":["Kimin Lee","Kibok Lee","Honglak Lee","Jinwoo Shin"],"abstract":"Detecting test samples drawn sufficiently far away from the training\ndistribution statistically or adversarially is a fundamental requirement for\ndeploying a good classifier in many real-world machine learning applications.\nHowever, deep neural networks with the softmax classifier are known to produce\nhighly overconfident posterior distributions even for such abnormal samples. In\nthis paper, we propose a simple yet effective method for detecting any abnormal\nsamples, which is applicable to any pre-trained softmax neural classifier. We\nobtain the class conditional Gaussian distributions with respect to (low- and\nupper-level) features of the deep models under Gaussian discriminant analysis,\nwhich result in a confidence score based on the Mahalanobis distance. While\nmost prior methods have been evaluated for detecting either out-of-distribution\nor adversarial samples, but not both, the proposed method achieves the\nstate-of-the-art performances for both cases in our experiments. Moreover, we\nfound that our proposed method is more robust in harsh cases, e.g., when the\ntraining dataset has noisy labels or small number of samples. Finally, we show\nthat the proposed method enjoys broader usage by applying it to\nclass-incremental learning: whenever out-of-distribution samples are detected,\nour classification rule can incorporate new classes well without further\ntraining deep models.","url_abs":"http://arxiv.org/abs/1807.03888v2","url_pdf":"http://arxiv.org/pdf/1807.03888v2.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":"a-simple-unified-framework-for-detecting-out","repo_url":"https://github.com/pokaxpoka/deep_Mahalanobis_detector","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"a-simple-unified-framework-for-detecting-out","repo_url":"https://github.com/caotians1/OD-test-master","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"a-simple-unified-framework-for-detecting-out","repo_url":"https://github.com/kimjeyoung/Mahalanobis-BERT","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"a-simple-unified-framework-for-detecting-out","repo_url":"https://github.com/lancopku/avg-avg","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"class-incremental-learning","task_name":"Class Incremental Learning"},{"task_slug":"incremental-learning","task_name":"Incremental Learning"},{"task_slug":"out-of-distribution-detection","task_name":"Out-of-Distribution Detection"},{"task_slug":"class-incremental-learning-1","task_name":"class-incremental learning"}],"methods":[{"method_slug":"softmax","method_name":"Softmax"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/out-of-distribution-detection-on-ms-1m-vs-ijb","task":"Out-of-Distribution Detection","dataset":"MS-1M vs. IJB-C","model":"ResNeXt 50 + Maha distance","rank_in_archive_order":2,"of":4,"metrics":{"AUROC":"82.5"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1807.03888","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1807.03888"}},"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/pytorch/vision","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/caotians1/OD-test-master","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/pokaxpoka/deep_Mahalanobis_detector","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/kimjeyoung/Mahalanobis-BERT","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lancopku/avg-avg","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":4,"ran":3,"ran_fixture":2,"unverified":4},"by_repo_kind":{"official":{"samples":9,"ran":6,"repositories":1},"listed":{"samples":4,"ran":3,"repositories":2}},"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":12,"samples":[{"code_sha256_prefix":"4868113bacf5fb6a","entry":"BertLinear","repo":"kimjeyoung/Mahalanobis-BERT","repo_kind":"listed","path":"models/mahalanobis.py","file_url":"https://github.com/kimjeyoung/Mahalanobis-BERT/blob/HEAD/models/mahalanobis.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4868113bacf5fb6a"}},{"code_sha256_prefix":"add2eea7681c9ce3","entry":"Classifier","repo":"kimjeyoung/Mahalanobis-BERT","repo_kind":"listed","path":"models/mahalanobis.py","file_url":"https://github.com/kimjeyoung/Mahalanobis-BERT/blob/HEAD/models/mahalanobis.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"add2eea7681c9ce3"}},{"code_sha256_prefix":"7d4b9ccab3f5129d","entry":"getNonTargetDataSet","repo":"pokaxpoka/deep_Mahalanobis_detector","repo_kind":"official","path":"OOD_Generate_Mahalanobis.py","file_url":"https://github.com/pokaxpoka/deep_Mahalanobis_detector/blob/HEAD/OOD_Generate_Mahalanobis.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":"7d4b9ccab3f5129d"}},{"code_sha256_prefix":"e126771f22bb7a57","entry":"getSVHN","repo":"pokaxpoka/deep_Mahalanobis_detector","repo_kind":"official","path":"OOD_Generate_Mahalanobis.py","file_url":"https://github.com/pokaxpoka/deep_Mahalanobis_detector/blob/HEAD/OOD_Generate_Mahalanobis.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":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e126771f22bb7a57"}},{"code_sha256_prefix":"f0d4069281238eb0","entry":"getTargetDataSet","repo":"pokaxpoka/deep_Mahalanobis_detector","repo_kind":"official","path":"OOD_Generate_Mahalanobis.py","file_url":"https://github.com/pokaxpoka/deep_Mahalanobis_detector/blob/HEAD/OOD_Generate_Mahalanobis.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":"f0d4069281238eb0"}},{"code_sha256_prefix":"ab12cb31239fb0f3","entry":"get_Mahalanobis_score","repo":"pokaxpoka/deep_Mahalanobis_detector","repo_kind":"official","path":"OOD_Generate_Mahalanobis.py","file_url":"https://github.com/pokaxpoka/deep_Mahalanobis_detector/blob/HEAD/OOD_Generate_Mahalanobis.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ab12cb31239fb0f3"}},{"code_sha256_prefix":"ddaf1f8283422da4","entry":"l2_normalize","repo":"kimjeyoung/Mahalanobis-BERT","repo_kind":"listed","path":"models/mahalanobis.py","file_url":"https://github.com/kimjeyoung/Mahalanobis-BERT/blob/HEAD/models/mahalanobis.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ddaf1f8283422da4"}},{"code_sha256_prefix":"75204880d1278c85","entry":"merge_and_generate_labels","repo":"pokaxpoka/deep_Mahalanobis_detector","repo_kind":"official","path":"OOD_Generate_Mahalanobis.py","file_url":"https://github.com/pokaxpoka/deep_Mahalanobis_detector/blob/HEAD/OOD_Generate_Mahalanobis.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"75204880d1278c85"}},{"code_sha256_prefix":"7947812fb91dd7ab","entry":"sample_estimator","repo":"pokaxpoka/deep_Mahalanobis_detector","repo_kind":"official","path":"OOD_Generate_Mahalanobis.py","file_url":"https://github.com/pokaxpoka/deep_Mahalanobis_detector/blob/HEAD/OOD_Generate_Mahalanobis.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"7947812fb91dd7ab"}},{"code_sha256_prefix":"41c7e1368b8aabb5","entry":"getCIFAR10","repo":"pokaxpoka/deep_Mahalanobis_detector","repo_kind":"official","path":"OOD_Generate_Mahalanobis.py","file_url":"https://github.com/pokaxpoka/deep_Mahalanobis_detector/blob/HEAD/OOD_Generate_Mahalanobis.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":"41c7e1368b8aabb5"}},{"code_sha256_prefix":"83c36cbef5f51c93","entry":"getCIFAR100","repo":"pokaxpoka/deep_Mahalanobis_detector","repo_kind":"official","path":"OOD_Generate_Mahalanobis.py","file_url":"https://github.com/pokaxpoka/deep_Mahalanobis_detector/blob/HEAD/OOD_Generate_Mahalanobis.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":"83c36cbef5f51c93"}},{"code_sha256_prefix":"a6cc0332f174b30c","entry":"get_Mahalanobis_score","repo":"lancopku/avg-avg","repo_kind":"listed","path":"lib/inference/maha.py","file_url":"https://github.com/lancopku/avg-avg/blob/HEAD/lib/inference/maha.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":"a6cc0332f174b30c"}},{"code_sha256_prefix":"e950644c44d7e448","entry":"main","repo":"pokaxpoka/deep_Mahalanobis_detector","repo_kind":"official","path":"OOD_Generate_Mahalanobis.py","file_url":"https://github.com/pokaxpoka/deep_Mahalanobis_detector/blob/HEAD/OOD_Generate_Mahalanobis.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":"e950644c44d7e448"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}