SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2301.07945 · AAAI · 2023

PDFormer: Propagation Delay-Aware Dynamic Long-Range Transformer for Traffic Flow Prediction

Wayne Zhao, Jingyuan Wang, Jiawei Jiang, Chengkai Han

arXiv · PDF · Open in the Atlas

Code that ran

6 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (6 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 0 failures of our instrument; 2 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2301.07945.json · badge: /api/ran/2301.07945.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
BUAABIGSCity/PDFormer marked official in Papers with Code
Papers with Code archive
6 ran · 2 no recorded run
FunctionStatusWhere it lives
AbstractModel Ran
ran on a synthesized input · constructed an object; no result was computed
BUAABIGSCity/PDFormer/libcity/model/traffic_flow_prediction/PDFormer.py
code served (permissive licence) · get_code("0e6afce580fb1502")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, AbstractModel: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Define a minimal config dict
config = {
    "input_dim": 4,
    "hidden_dim": 8,
    "output_dim": 3,
}

# Define a minimal Batch class that holds the required data
class Batch:
    def __init__(self):
        self.x = torch.randn(2, 4)  # batch_size=2, input_dim=4
        self.y = torch.randint(0, 3, (2,))  # batch_size=2, 3 classes

# Create a batch instance
batch = Batch()

# Define data_feature - can be a simple dict or object describing features
data_feature = {
    "input_dim": 4,
    "output_dim": 3,
}

ARGS = {
    "config": config,
    "data_feature": data_feature,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AbstractModel — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a AbstractModel output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
AbstractTrafficStateModel Ran
ran on a synthesized input · constructed an object; no result was computed
BUAABIGSCity/PDFormer/libcity/model/traffic_flow_prediction/PDFormer.py
code served (permissive licence) · get_code("6ba9f3eb4fae249f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, AbstractTrafficStateModel: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Minimal config dict
config = {
    "batch_size": 2,
    "hidden_dim": 4,
    "output_dim": 3,
    "learning_rate": 0.001
}

# Minimal data_feature dict
data_feature = {
    "scaler": None,
    "adj_mx": None,
    "num_nodes": 5,
    "feature_dim": 4,
    "output_dim": 3,
    "num_time_steps": 6
}

ARGS = {
    "config": config,
    "data_feature": data_feature
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AbstractTrafficStateModel — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a AbstractTrafficStateModel output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
DataEmbedding Ran
ran on a synthesized input · constructed an object; no result was computed
BUAABIGSCity/PDFormer/libcity/model/traffic_flow_prediction/PDFormer.py
code served (permissive licence) · get_code("6f259d5e72269ce1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, DataEmbedding: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import math

torch.manual_seed(0)

# Create a small adjacency matrix (laplacian positional encoding matrix)
# lape_dim should match the second dimension of lap_mx
lape_dim = 5
adj_mx = torch.randn(3, lape_dim)

# Feature dimension
feature_dim = 4

# Embedding dimension
embed_dim = 6

# Create input tensor x with shape (batch, time, nodes, features + optional extra channels)
# batch=2, time=3, nodes=3, features=4 + 2 for time_in_day and day_in_week
batch_size = 2
time_steps = 3
num_nodes = 3
# First 4 channels are features, 5th is time_in_day (normalized 0-1), 
# next 7 are day_in_week one-hot
x = torch.randn(batch_size, time_steps, num_nodes, feature_dim + 1 + 7)
# Ensure time_in_day channel is in [0, 1] range
x[:, :, :, feature_dim] = torch.rand(batch_size, time_steps, num_nodes)
# Ensure day_in_week is one-hot
day_in_week = torch.zeros(batch_size, time_steps, num_nodes, 7)
for b in range(batch_size):
    for t in range(time_steps):
        for n in range(num_nodes):
            day_in_week[b, t, n, torch.randint(0, 7, (1,))] = 1.0
x[:, :, :, feature_dim + 1:feature_dim + 8] = day_in_week

ARGS = {
    'feature_dim': feature_dim,
    'embed_dim': embed_dim,
    'lape_dim': lape_dim,
    'adj_mx': adj_mx,
    'drop': 0.1,
    'add_time_in_day': True,
    'add_day_in_week': True,
    'device': torch.device('cpu')
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataEmbedding — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a DataEmbedding output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
PositionalEncoding Ran
ran on a synthesized input · constructed an object; no result was computed
BUAABIGSCity/PDFormer/libcity/model/traffic_flow_prediction/PDFormer.py
code served (permissive licence) · get_code("1a87dd511edbc83b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, PositionalEncoding: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
import math

torch.manual_seed(0)

# The PositionalEncoding.__init__ takes:
# - embed_dim: dimension of embeddings
# - max_len: maximum sequence length (default 100)

# The forward method takes:
# - x: input tensor, expected to be 3D (batch, seq_len, embed_dim)
#   and it uses x.size(1) to get sequence length

# Create a small input tensor for testing
# Shape: (batch_size=2, seq_len=3, embed_dim=4)
x = torch.randn(2, 3, 4)

ARGS = {
    'embed_dim': 4,
    'max_len': 100
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PositionalEncoding — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a PositionalEncoding output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
STSelfAttention Ran
ran on a synthesized input · constructed an object; no result was computed
BUAABIGSCity/PDFormer/libcity/model/traffic_flow_prediction/PDFormer.py
code served (permissive licence) · get_code("cab1f3e5eb569e31")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, STSelfAttention: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Define dimensions and sizes
dim = 8  # Must be divisible by (geo_num_heads + sem_num_heads + t_num_heads) = 8
geo_num_heads = 4
sem_num_heads = 2
t_num_heads = 2
s_attn_size = 5
t_attn_size = 3
output_dim = 2

# Create input tensors
B, T, N, D = 2, 3, 4, dim
x = torch.randn(B, T, N, D)

# x_patterns shape: (B, T, N, output_dim) or similar for pattern matching
x_patterns = torch.randn(B, T, N, output_dim)

# pattern_keys shape: (B, T, N, output_dim) or similar
pattern_keys = torch.randn(B, T, N, output_dim)

# Optional masks
geo_mask = None
sem_mask = None

# Device
device = torch.device('cpu')

ARGS = {
    'dim': dim,
    's_attn_size': s_attn_size,
    't_attn_size': t_attn_size,
    'geo_num_heads': geo_num_heads,
    'sem_num_heads': sem_num_heads,
    't_num_heads': t_num_heads,
    'qkv_bias': False,
    'attn_drop': 0.1,
    'proj_drop': 0.1,
    'device': device,
    'output_dim': output_dim,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type STSelfAttention — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a STSelfAttention output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
TokenEmbedding Ran
ran on a synthesized input · constructed an object; no result was computed
BUAABIGSCity/PDFormer/libcity/model/traffic_flow_prediction/PDFormer.py
code served (permissive licence) · get_code("77819d970a28b38d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, TokenEmbedding: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Analyze the function:
# - __init__ takes: input_dim, embed_dim, norm_layer
# - forward takes: x (a tensor)
# - norm_layer is called with embed_dim as argument if not None
# - self.token_embed is nn.Linear(input_dim, embed_dim, bias=True)
# - self.norm is either norm_layer(embed_dim) or nn.Identity()
# - forward does: x = self.token_embed(x); x = self.norm(x); return x

# Create a small norm_layer that accepts embed_dim
norm_layer = nn.LayerNorm

ARGS = {
    "input_dim": 4,
    "embed_dim": 3,
    "norm_layer": norm_layer,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TokenEmbedding — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a TokenEmbedding output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
PDFormer Not yet run
unverified (harvested, no recorded run)
BUAABIGSCity/PDFormer/libcity/model/traffic_flow_prediction/PDFormer.py
code served (permissive licence) · get_code("767dff4849d872ef")
How it ran

no invocation recorded.

STEncoderBlock Not yet run
unverified (harvested, no recorded run)
BUAABIGSCity/PDFormer/libcity/model/traffic_flow_prediction/PDFormer.py
code served (permissive licence) · get_code("fcf9e522129aec3a")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 7 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
AbstractModel
brick of this paper's assembly: helper
1 other paper
1 dated earlier
1301.3781 (2013-01)
Efficient Estimation of Word Representations in Vector Space

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

As a core technology of Intelligent Transportation System, traffic flow prediction has a wide range of applications. The fundamental challenge in traffic flow prediction is to effectively model the complex spatial-temporal dependencies in traffic data. Spatial-temporal Graph Neural Network (GNN) models have emerged as one of the most promising methods to solve this problem. However, GNN-based models have three major limitations for traffic prediction: i) Most methods model spatial dependencies in a static manner, which limits the ability to learn dynamic urban traffic patterns; ii) Most methods only consider short-range spatial information and are unable to capture long-range spatial dependencies; iii) These methods ignore the fact that the propagation of traffic conditions between locations has a time delay in traffic systems. To this end, we propose a novel Propagation Delayaware dynamic long-range transFormer, namely PDFormer, for accurate traffic flow prediction. Specifically, we design a spatial self-attention module to capture the dynamic spatial dependencies. Then, two graph masking matrices are introduced to highlight spatial dependencies from short-and longrange views. Moreover, a traffic delay-aware feature transformation module is proposed to empower PDFormer with the capability of explicitly modeling the time delay of spatial information propagation. Extensive experimental results on six real-world public traffic datasets show that our method can not only achieve state-of-the-art performance but also exhibit competitive computational efficiency. Moreover, we visualize the learned spatial-temporal attention map to make our model highly interpretable.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2301.07945")
get_code_for_paper("2301.07945")
have("2301.07945")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2301.07945.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2301.07945.svg)](https://syntology.ai/paper/2301.07945)

Connect an agent — have() is free.