{"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/patchad-patch-based-mlp-mixer-for-time-series","title":"PatchAD: A Lightweight Patch-based MLP-Mixer for Time Series Anomaly Detection","arxiv_id":"2401.09793","date":"2024-01-18","proceeding":null,"authors":["Zhijie Zhong","Zhiwen Yu","Yiyuan Yang","Weizheng Wang","Kaixiang Yang"],"abstract":"Anomaly detection in time series analysis is a pivotal task, yet it poses the challenge of discerning normal and abnormal patterns in label-deficient scenarios. While prior studies have largely employed reconstruction-based approaches, which limits the models' representational capacities. Moreover, existing deep learning-based methods are not sufficiently lightweight. Addressing these issues, we present PatchAD, our novel, highly efficient multiscale patch-based MLP-Mixer architecture that utilizes contrastive learning for representation extraction and anomaly detection. With its four distinct MLP Mixers and innovative dual project constraint module, PatchAD mitigates potential model degradation and offers a lightweight solution, requiring only $3.2$MB. Its efficacy is demonstrated by state-of-the-art results across $9$ datasets sourced from different application scenarios, outperforming over $30$ comparative algorithms. PatchAD significantly improves the classical F1 score by $50.5\\%$, the Aff-F1 score by $7.8\\%$, and the AUC by $10.0\\%$. The code is publicly available. \\url{https://github.com/EmorZz1G/PatchAD}","url_abs":"https://arxiv.org/abs/2401.09793v5","url_pdf":"https://arxiv.org/pdf/2401.09793v5.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":"patchad-patch-based-mlp-mixer-for-time-series","repo_url":"https://github.com/emorzz1g/patchad","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"anomaly-detection","task_name":"Anomaly Detection"},{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"time-series-1","task_name":"Time Series"},{"task_slug":"time-series","task_name":"Time Series Analysis"},{"task_slug":"time-series-anomaly-detection","task_name":"Time Series Anomaly Detection"}],"methods":[{"method_slug":"average-pooling","method_name":"Average Pooling"},{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"global-average-pooling","method_name":"Global Average Pooling"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"mlp-mixer","method_name":"MLP-Mixer"},{"method_slug":"residual-connection","method_name":"Residual Connection"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2401.09793","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2401.09793"}},"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/emorzz1g/patchad","reach":null}],"summary":{"ran_draft_wrong":3},"by_repo_kind":{"official":{"samples":3,"ran":3,"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":"a796cc280a357f67","entry":"get_activation","repo":"emorzz1g/patchad","repo_kind":"official","path":"patchad_model/models.py","file_url":"https://github.com/emorzz1g/patchad/blob/HEAD/patchad_model/models.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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"a796cc280a357f67"}},{"code_sha256_prefix":"fd8f9e2508c19b01","entry":"get_norm","repo":"emorzz1g/patchad","repo_kind":"official","path":"patchad_model/models.py","file_url":"https://github.com/emorzz1g/patchad/blob/HEAD/patchad_model/models.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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"fd8f9e2508c19b01"}},{"code_sha256_prefix":"df419d99ba758d40","entry":"print_params","repo":"emorzz1g/patchad","repo_kind":"official","path":"main_ad.py","file_url":"https://github.com/emorzz1g/patchad/blob/HEAD/main_ad.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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"df419d99ba758d40"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}