{"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/efficient-large-scale-traffic-forecasting","title":"Efficient Large-Scale Traffic Forecasting with Transformers: A Spatial Data Management Perspective","arxiv_id":"2412.09972","date":"2024-12-13","proceeding":null,"authors":["Yuchen Fang","Yuxuan Liang","Bo Hui","Zezhi Shao","Liwei Deng","Xu Liu","Xinke Jiang","Kai Zheng"],"abstract":"Road traffic forecasting is crucial in real-world intelligent transportation scenarios like traffic dispatching and path planning in city management and personal traveling. Spatio-temporal graph neural networks (STGNNs) stand out as the mainstream solution in this task. Nevertheless, the quadratic complexity of remarkable dynamic spatial modeling-based STGNNs has become the bottleneck over large-scale traffic data. From the spatial data management perspective, we present a novel Transformer framework called PatchSTG to efficiently and dynamically model spatial dependencies for large-scale traffic forecasting with interpretability and fidelity. Specifically, we design a novel irregular spatial patching to reduce the number of points involved in the dynamic calculation of Transformer. The irregular spatial patching first utilizes the leaf K-dimensional tree (KDTree) to recursively partition irregularly distributed traffic points into leaf nodes with a small capacity, and then merges leaf nodes belonging to the same subtree into occupancy-equaled and non-overlapped patches through padding and backtracking. Based on the patched data, depth and breadth attention are used interchangeably in the encoder to dynamically learn local and global spatial knowledge from points in a patch and points with the same index of patches. Experimental results on four real world large-scale traffic datasets show that our PatchSTG achieves train speed and memory utilization improvements up to $10\\times$ and $4\\times$ with the state-of-the-art performance.","url_abs":"https://arxiv.org/abs/2412.09972v2","url_pdf":"https://arxiv.org/pdf/2412.09972v2.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":"efficient-large-scale-traffic-forecasting","repo_url":"https://github.com/lmissher/patchstg","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"efficient-large-scale-traffic-forecasting","repo_url":"https://github.com/lmissher/stgnn","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"efficient-large-scale-traffic-forecasting","repo_url":"https://github.com/lmissher/stwave","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"management","task_name":"Management"},{"task_slug":"traffic-prediction","task_name":"Traffic Prediction"}],"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":"patching","method_name":"Patching"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"speed","method_name":"SPEED"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/traffic-prediction-on-largest","task":"Traffic Prediction","dataset":"LargeST","model":"PatchSTG","rank_in_archive_order":1,"of":6,"metrics":{"CA MAE":"17.35","GBA MAE":"19.50","GLA MAE":"18.96","SD MAE":"16.90"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2412.09972","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2412.09972"}},"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/lmissher/stwave","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lmissher/patchstg","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lmissher/stgnn","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_fixture":1,"ran_violates":1,"ran_honours":1,"unverified":3},"by_repo_kind":{"official":{"samples":3,"ran":3,"repositories":1},"listed":{"samples":3,"ran":0,"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":"f7098c6cfe715469","entry":"masked_mae","repo":"lmissher/patchstg","repo_kind":"official","path":"lib/utils.py","file_url":"https://github.com/lmissher/patchstg/blob/HEAD/lib/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f7098c6cfe715469"}},{"code_sha256_prefix":"5b230abb2d7a66c3","entry":"metric","repo":"lmissher/patchstg","repo_kind":"official","path":"lib/utils.py","file_url":"https://github.com/lmissher/patchstg/blob/HEAD/lib/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5b230abb2d7a66c3"}},{"code_sha256_prefix":"ddd6682056aa7c9b","entry":"read_meta","repo":"lmissher/patchstg","repo_kind":"official","path":"lib/utils.py","file_url":"https://github.com/lmissher/patchstg/blob/HEAD/lib/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ddd6682056aa7c9b"}},{"code_sha256_prefix":"78c234f574a9d6a2","entry":"loadData","repo":"lmissher/stgnn","repo_kind":"listed","path":"utils.py","file_url":"https://github.com/lmissher/stgnn/blob/HEAD/utils.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":"78c234f574a9d6a2"}},{"code_sha256_prefix":"1ba47a23adf07065","entry":"metric","repo":"lmissher/stgnn","repo_kind":"listed","path":"utils.py","file_url":"https://github.com/lmissher/stgnn/blob/HEAD/utils.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":"1ba47a23adf07065"}},{"code_sha256_prefix":"3fc58cdee460bc5d","entry":"seq2instance","repo":"lmissher/stgnn","repo_kind":"listed","path":"utils.py","file_url":"https://github.com/lmissher/stgnn/blob/HEAD/utils.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":"3fc58cdee460bc5d"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}