## 6 Discussion  
### Discussion: RNNs vs. Transformer Families  
With the increasing popularity of transformer families' models, it is necessary to explore the comparison of the traffic prediction effects between RNNs and transformer families and their respective advantages and disadvantages. It is also important to explore whether RNNs are really outdated and a failure compared to transformer families. Both RNNs and transformer families have demonstrated unique strengths and limitations in traffic prediction. The RNNs and their variants are well suited for handling time series data due to their built-in memory mechanism, allowing them to retain historical input information. This characteristic enables RNNs to exhibit stable and robust performance in traffic prediction, particularly in forecasting future traffic flow and events. However, RNNs also have certain limitations. Firstly, there is the gradient problem. RNNs often encounter the issue of vanishing or exploding gradients when dealing with long sequences, although LSTMs and GRUs partially mitigate this problem. Secondly, their parallel processing capability is limited. Due to the recursive nature of RNNs, they are slower compared to models with stronger parallelization capabilities, which restricts their efficiency when applied to large-scale datasets. Transformer families have certain advantages over RNNs in terms of parallel processing capability and capturing long-term dependencies. Firstly, in terms of parallel processing capability, transformers are entirely based on self-attention mechanisms, enabling them to process the entire sequence simultaneously, greatly improving both training and inference speed. Secondly, in terms of capturing long-term dependencies, with the help of multi-head attention mechanisms, transformers can effectively capture long-distance dependencies within sequences, regardless of how far apart those dependencies are. However, transformer families also have certain drawbacks. Firstly, the significant computational resources required for the extensive self-attention calculations in transformer models, particularly for long sequence data, may limit their application in resource-constrained environments. Secondly, for small-scale datasets, the complexity of transformer models may lead to overfitting issues, necessitating carefully designed regularization strategies. Additionally, unlike RNNs, transformers do not naturally handle the sequential order of sequences, requiring additional positional encodings to maintain the order relationships between elements in the sequence. In order to systematically compare the performance of RNNs and transformer families in traffic prediction, several experiments have been conducted. Existing studies demonstrated that transformer families outperform RNNs in prediction tasks on large datasets [134; 135; 136]. [PERSON] et al. [134] compared LSTMs, GRUs, and transformer families for traffic flow prediction. The study is conducted on the PeMS dataset, which covers traffic data from over 39,000 individual detectors on the interstate system in California. The transformer-based model shows improvements of 32.4% and 33.9% in MAPE compared to the LSTM and GRU, respectively. However, in terms of training time, the transformer model requires 172.76% more training time than the LSTM or GRU. However, we also find that on some smaller-scale datasets, RNNs outperform transformer families [137; 138; 139]. To validate this viewpoint, we use passenger flow data extracted from the Automatic Fare Collection (AFC) system of Shenzhen Metro Company, spanning 53 days from August 5 to September 26, 2019, to conduct short-term passenger flow prediction models. By 2019, there are eight metro lines and 166 stations in the Shenzhen Metro network. Based on the metro's operating hours from 6:00 to 24:00, we process the AFC data within this timeframe. The experimental dataset is aggregated at station-level passenger inflow and outflow at 10 min intervals from a total of 166 stations.