{"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/arxiv-2602-23013","title":"SubspaceAD: Training-Free Few-Shot Anomaly Detection via Subspace Modeling","arxiv_id":"2602.23013","date":"2026-02-26","proceeding":null,"authors":["Camile Lendering","Erkut Akdag","Egor Bondarev"],"abstract":"Detecting visual anomalies in industrial inspection often requires training with only a few normal images per category. Recent few-shot methods achieve strong results employing foundation-model features, but typically rely on memory banks, auxiliary datasets, or multi-modal tuning of vision-language models. We therefore question whether such complexity is necessary given the feature representations of vision foundation models. To answer this question, we introduce SubspaceAD, a training-free method, that operates in two simple stages. First, patch-level features are extracted from a small set of normal images by a frozen DINOv2 backbone. Second, a Principal Component Analysis (PCA) model is fit to these features to estimate the low-dimensional subspace of normal variations. At inference, anomalies are detected via the reconstruction residual with respect to this subspace, producing interpretable and statistically grounded anomaly scores. Despite its simplicity, SubspaceAD achieves state-of-the-art performance across one-shot and few-shot settings without training, prompt tuning, or memory banks. In the one-shot anomaly detection setting, SubspaceAD achieves image-level and pixel-level AUROC of 97.1% and 97.5% on the MVTec-AD dataset, and 93.2% and 98.2% on the VisA dataset, respectively, surpassing prior state-of-the-art results. Code and demo are available at https://github.com/CLendering/SubspaceAD.","url_abs":"https://arxiv.org/abs/2602.23013","url_pdf":"https://arxiv.org/pdf/2602.23013","source":{"archive":null,"snapshot":"2025-07-28","note":"not in the Papers with Code archive (frozen at the snapshot)","row_kind":"graph","title_abstract_authors_date":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)"},"code_links":[],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2602.23013","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2602.23013"}},"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":[{"mentioned_in_github":null,"is_official":null,"provenance":"deterministic:regex_extraction","mentioned_in_paper":null,"url":"https://github.com/CLendering/SubspaceAD","reach":null}],"summary":{"ran":4,"ran_fixture":3,"ran_violates":1,"ran_honours":3,"unverified":3},"by_repo_kind":{"found_in_text":{"samples":14,"ran":11,"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":"b71cd95b05c2fa69","entry":"_calculate_kpca_scores","repo":"CLendering/SubspaceAD","repo_kind":"found_in_text","path":"src/subspacead/core/patching.py","file_url":"https://github.com/CLendering/SubspaceAD/blob/HEAD/src/subspacead/core/patching.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"b71cd95b05c2fa69"}},{"code_sha256_prefix":"ea52b1a1192a9b12","entry":"_calculate_pca_scores","repo":"CLendering/SubspaceAD","repo_kind":"found_in_text","path":"src/subspacead/core/patching.py","file_url":"https://github.com/CLendering/SubspaceAD/blob/HEAD/src/subspacead/core/patching.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ea52b1a1192a9b12"}},{"code_sha256_prefix":"3c8e1c01c6e9ae62","entry":"_get_patch_background_mask","repo":"CLendering/SubspaceAD","repo_kind":"found_in_text","path":"src/subspacead/core/patching.py","file_url":"https://github.com/CLendering/SubspaceAD/blob/HEAD/src/subspacead/core/patching.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"3c8e1c01c6e9ae62"}},{"code_sha256_prefix":"43d3180001d136a4","entry":"_kernel_self_dot","repo":"CLendering/SubspaceAD","repo_kind":"found_in_text","path":"src/subspacead/core/patching.py","file_url":"https://github.com/CLendering/SubspaceAD/blob/HEAD/src/subspacead/core/patching.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"43d3180001d136a4"}},{"code_sha256_prefix":"e22c585bb16ac152","entry":"_row_l2","repo":"CLendering/SubspaceAD","repo_kind":"found_in_text","path":"src/subspacead/core/patching.py","file_url":"https://github.com/CLendering/SubspaceAD/blob/HEAD/src/subspacead/core/patching.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e22c585bb16ac152"}},{"code_sha256_prefix":"6f1ac8fb13b62b63","entry":"calculate_anomaly_scores","repo":"CLendering/SubspaceAD","repo_kind":"found_in_text","path":"src/subspacead/core/patching.py","file_url":"https://github.com/CLendering/SubspaceAD/blob/HEAD/src/subspacead/core/patching.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"6f1ac8fb13b62b63"}},{"code_sha256_prefix":"552643557a224e45","entry":"get_patch_coords","repo":"CLendering/SubspaceAD","repo_kind":"found_in_text","path":"src/subspacead/core/patching.py","file_url":"https://github.com/CLendering/SubspaceAD/blob/HEAD/src/subspacead/core/patching.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"552643557a224e45"}},{"code_sha256_prefix":"2982e3d05b76622d","entry":"parse_grouped_layers","repo":"CLendering/SubspaceAD","repo_kind":"found_in_text","path":"src/subspacead/core/patching.py","file_url":"https://github.com/CLendering/SubspaceAD/blob/HEAD/src/subspacead/core/patching.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"2982e3d05b76622d"}},{"code_sha256_prefix":"e65cd60368582d7b","entry":"parse_layer_indices","repo":"CLendering/SubspaceAD","repo_kind":"found_in_text","path":"src/subspacead/core/patching.py","file_url":"https://github.com/CLendering/SubspaceAD/blob/HEAD/src/subspacead/core/patching.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e65cd60368582d7b"}},{"code_sha256_prefix":"30a77f2f75e458a9","entry":"pca_reconstruct","repo":"CLendering/SubspaceAD","repo_kind":"found_in_text","path":"src/subspacead/core/patching.py","file_url":"https://github.com/CLendering/SubspaceAD/blob/HEAD/src/subspacead/core/patching.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"30a77f2f75e458a9"}},{"code_sha256_prefix":"74366f11856cc2c5","entry":"post_process_map","repo":"CLendering/SubspaceAD","repo_kind":"found_in_text","path":"src/subspacead/core/patching.py","file_url":"https://github.com/CLendering/SubspaceAD/blob/HEAD/src/subspacead/core/patching.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"DEP_MISSING","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"74366f11856cc2c5"}},{"code_sha256_prefix":"640289a44a7ef6de","entry":"FeatureExtractor","repo":"CLendering/SubspaceAD","repo_kind":"found_in_text","path":"src/subspacead/core/patching.py","file_url":"https://github.com/CLendering/SubspaceAD/blob/HEAD/src/subspacead/core/patching.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"640289a44a7ef6de"}},{"code_sha256_prefix":"e0d57393d0a6c133","entry":"_process_single_image_patched","repo":"CLendering/SubspaceAD","repo_kind":"found_in_text","path":"src/subspacead/core/patching.py","file_url":"https://github.com/CLendering/SubspaceAD/blob/HEAD/src/subspacead/core/patching.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e0d57393d0a6c133"}},{"code_sha256_prefix":"d9ab8d4ca34b2c10","entry":"_stitch_patches_to_canvas","repo":"CLendering/SubspaceAD","repo_kind":"found_in_text","path":"src/subspacead/core/patching.py","file_url":"https://github.com/CLendering/SubspaceAD/blob/HEAD/src/subspacead/core/patching.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d9ab8d4ca34b2c10"}}]},"arxiv_metadata":{"licence":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)","fields":["title","abstract","authors","date"],"primary_category":"cs.LG","source":"arxiv_2026.jsonl"},"syntology_extracted_results":null}