{"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/pathformer-multi-scale-transformers-with","title":"Pathformer: Multi-scale Transformers with Adaptive Pathways for Time Series Forecasting","arxiv_id":"2402.05956","date":"2024-02-04","proceeding":null,"authors":["Peng Chen","Yingying Zhang","Yunyao Cheng","Yang Shu","Yihang Wang","Qingsong Wen","Bin Yang","Chenjuan Guo"],"abstract":"Transformers for time series forecasting mainly model time series from limited or fixed scales, making it challenging to capture different characteristics spanning various scales. We propose Pathformer, a multi-scale Transformer with adaptive pathways. It integrates both temporal resolution and temporal distance for multi-scale modeling. Multi-scale division divides the time series into different temporal resolutions using patches of various sizes. Based on the division of each scale, dual attention is performed over these patches to capture global correlations and local details as temporal dependencies. We further enrich the multi-scale Transformer with adaptive pathways, which adaptively adjust the multi-scale modeling process based on the varying temporal dynamics of the input, improving the accuracy and generalization of Pathformer. Extensive experiments on eleven real-world datasets demonstrate that Pathformer not only achieves state-of-the-art performance by surpassing all current models but also exhibits stronger generalization abilities under various transfer scenarios. The code is made available at https://github.com/decisionintelligence/pathformer.","url_abs":"https://arxiv.org/abs/2402.05956v5","url_pdf":"https://arxiv.org/pdf/2402.05956v5.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":"pathformer-multi-scale-transformers-with","repo_url":"https://github.com/decisionintelligence/pathformer","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"time-series-1","task_name":"Time Series"},{"task_slug":"time-series-forecasting","task_name":"Time Series Forecasting"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/time-series-forecasting-on-etth1-336-1","task":"Time Series Forecasting","dataset":"ETTh1 (336) Multivariate","model":"Pathformer","rank_in_archive_order":40,"of":72,"metrics":{"MAE":"0.432","MSE":"0.454"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2402.05956","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.05956"}},"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/decisionintelligence/pathformer","reach":null}],"summary":{"ran":6,"unverified":5},"by_repo_kind":{"official":{"samples":11,"ran":6,"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":11,"samples":[{"code_sha256_prefix":"57d5769a83e486f0","entry":"FourierLayer","repo":"decisionintelligence/pathformer","repo_kind":"official","path":"models/PathFormer.py","file_url":"https://github.com/decisionintelligence/pathformer/blob/HEAD/models/PathFormer.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":"57d5769a83e486f0"}},{"code_sha256_prefix":"5397e51a049a1f3b","entry":"Inter_Patch_Attention","repo":"decisionintelligence/pathformer","repo_kind":"official","path":"models/PathFormer.py","file_url":"https://github.com/decisionintelligence/pathformer/blob/HEAD/models/PathFormer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5397e51a049a1f3b"}},{"code_sha256_prefix":"e958aa9130abf167","entry":"MLP","repo":"decisionintelligence/pathformer","repo_kind":"official","path":"models/PathFormer.py","file_url":"https://github.com/decisionintelligence/pathformer/blob/HEAD/models/PathFormer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e958aa9130abf167"}},{"code_sha256_prefix":"3d42d435776cf3c4","entry":"ScaledDotProductAttention","repo":"decisionintelligence/pathformer","repo_kind":"official","path":"models/PathFormer.py","file_url":"https://github.com/decisionintelligence/pathformer/blob/HEAD/models/PathFormer.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":"3d42d435776cf3c4"}},{"code_sha256_prefix":"cee6b81345eb02ab","entry":"SparseDispatcher","repo":"decisionintelligence/pathformer","repo_kind":"official","path":"models/PathFormer.py","file_url":"https://github.com/decisionintelligence/pathformer/blob/HEAD/models/PathFormer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cee6b81345eb02ab"}},{"code_sha256_prefix":"ed109c44bc91f3e3","entry":"WeightGenerator","repo":"decisionintelligence/pathformer","repo_kind":"official","path":"models/PathFormer.py","file_url":"https://github.com/decisionintelligence/pathformer/blob/HEAD/models/PathFormer.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":"ed109c44bc91f3e3"}},{"code_sha256_prefix":"c74ee05dfbc7187a","entry":"AMS","repo":"decisionintelligence/pathformer","repo_kind":"official","path":"models/PathFormer.py","file_url":"https://github.com/decisionintelligence/pathformer/blob/HEAD/models/PathFormer.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":"c74ee05dfbc7187a"}},{"code_sha256_prefix":"dd6eeb406397519e","entry":"CustomLinear","repo":"decisionintelligence/pathformer","repo_kind":"official","path":"models/PathFormer.py","file_url":"https://github.com/decisionintelligence/pathformer/blob/HEAD/models/PathFormer.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":"dd6eeb406397519e"}},{"code_sha256_prefix":"4be6529c9db61f4d","entry":"Intra_Patch_Attention","repo":"decisionintelligence/pathformer","repo_kind":"official","path":"models/PathFormer.py","file_url":"https://github.com/decisionintelligence/pathformer/blob/HEAD/models/PathFormer.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":"4be6529c9db61f4d"}},{"code_sha256_prefix":"2b101a2bdc6b2fd6","entry":"Model","repo":"decisionintelligence/pathformer","repo_kind":"official","path":"models/PathFormer.py","file_url":"https://github.com/decisionintelligence/pathformer/blob/HEAD/models/PathFormer.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":"2b101a2bdc6b2fd6"}},{"code_sha256_prefix":"13aa788bb3e1bf98","entry":"Transformer_Layer","repo":"decisionintelligence/pathformer","repo_kind":"official","path":"models/PathFormer.py","file_url":"https://github.com/decisionintelligence/pathformer/blob/HEAD/models/PathFormer.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":"13aa788bb3e1bf98"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}