{"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/distilling-cognitive-backdoor-patterns-within","title":"Distilling Cognitive Backdoor Patterns within an Image","arxiv_id":"2301.10908","date":"2023-01-26","proceeding":null,"authors":["Hanxun Huang","Xingjun Ma","Sarah Erfani","James Bailey"],"abstract":"This paper proposes a simple method to distill and detect backdoor patterns within an image: \\emph{Cognitive Distillation} (CD). The idea is to extract the \"minimal essence\" from an input image responsible for the model's prediction. CD optimizes an input mask to extract a small pattern from the input image that can lead to the same model output (i.e., logits or deep features). The extracted pattern can help understand the cognitive mechanism of a model on clean vs. backdoor images and is thus called a \\emph{Cognitive Pattern} (CP). Using CD and the distilled CPs, we uncover an interesting phenomenon of backdoor attacks: despite the various forms and sizes of trigger patterns used by different attacks, the CPs of backdoor samples are all surprisingly and suspiciously small. One thus can leverage the learned mask to detect and remove backdoor examples from poisoned training datasets. We conduct extensive experiments to show that CD can robustly detect a wide range of advanced backdoor attacks. We also show that CD can potentially be applied to help detect potential biases from face datasets. Code is available at \\url{https://github.com/HanxunH/CognitiveDistillation}.","url_abs":"https://arxiv.org/abs/2301.10908v4","url_pdf":"https://arxiv.org/pdf/2301.10908v4.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":"distilling-cognitive-backdoor-patterns-within","repo_url":"https://github.com/HanxunH/CognitiveDistillation","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2301.10908","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2301.10908"}},"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/HanxunH/CognitiveDistillation","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":2,"unverified":7},"by_repo_kind":{"official":{"samples":9,"ran":2,"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":"d9def42110729a85","entry":"conv1x1","repo":"HanxunH/CognitiveDistillation","repo_kind":"official","path":"models/celeba_resnet.py","file_url":"https://github.com/HanxunH/CognitiveDistillation/blob/HEAD/models/celeba_resnet.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d9def42110729a85"}},{"code_sha256_prefix":"fac5364e2f53c6db","entry":"conv3x3","repo":"HanxunH/CognitiveDistillation","repo_kind":"official","path":"models/celeba_resnet.py","file_url":"https://github.com/HanxunH/CognitiveDistillation/blob/HEAD/models/celeba_resnet.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"fac5364e2f53c6db"}},{"code_sha256_prefix":"e373de9d160d08e8","entry":"AttributesResNet18","repo":"HanxunH/CognitiveDistillation","repo_kind":"official","path":"models/celeba_resnet.py","file_url":"https://github.com/HanxunH/CognitiveDistillation/blob/HEAD/models/celeba_resnet.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":"e373de9d160d08e8"}},{"code_sha256_prefix":"40836f4c4a8ff937","entry":"all_gather","repo":"HanxunH/CognitiveDistillation","repo_kind":"official","path":"misc.py","file_url":"https://github.com/HanxunH/CognitiveDistillation/blob/HEAD/misc.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":"40836f4c4a8ff937"}},{"code_sha256_prefix":"a5fe7b4f20024573","entry":"all_reduce_mean","repo":"HanxunH/CognitiveDistillation","repo_kind":"official","path":"misc.py","file_url":"https://github.com/HanxunH/CognitiveDistillation/blob/HEAD/misc.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":"a5fe7b4f20024573"}},{"code_sha256_prefix":"a5d90d5d76eeda7d","entry":"bd_evaluate","repo":"HanxunH/CognitiveDistillation","repo_kind":"official","path":"evaluate.py","file_url":"https://github.com/HanxunH/CognitiveDistillation/blob/HEAD/evaluate.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":"a5d90d5d76eeda7d"}},{"code_sha256_prefix":"ed8ab5aad375eef2","entry":"extract_predictions","repo":"HanxunH/CognitiveDistillation","repo_kind":"official","path":"detect_analysis.py","file_url":"https://github.com/HanxunH/CognitiveDistillation/blob/HEAD/detect_analysis.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":"ed8ab5aad375eef2"}},{"code_sha256_prefix":"76ffb8e3a9fd6049","entry":"load_train_loss","repo":"HanxunH/CognitiveDistillation","repo_kind":"official","path":"detect_analysis.py","file_url":"https://github.com/HanxunH/CognitiveDistillation/blob/HEAD/detect_analysis.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":"76ffb8e3a9fd6049"}},{"code_sha256_prefix":"5760695588a80258","entry":"min_max_normalization","repo":"HanxunH/CognitiveDistillation","repo_kind":"official","path":"detect_analysis.py","file_url":"https://github.com/HanxunH/CognitiveDistillation/blob/HEAD/detect_analysis.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":"5760695588a80258"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}