Existing car-following models can be categorized into mathematical models and data-driven models [
3]. Mathematical car-following models are rigorously defined, with most parameters holding precise physical meanings. However, integrating diversified factors into these models increases its complexity, leading to challenges in the calibration model parameters and resulting in significant errors in the results. This complexity makes it difficult to accurately describe driving behavior [
4]. With the advancements in data collection technology and the development of machine learning, data-driven car-following models have been developed [
5]. These models exhibit strong capabilities in fitting nonlinear data, automatically capturing the features of trajectory data, and exploring the underlying patterns of car-following behavior, thus achieving model optimization and improvement. Similarly, as an essential branch of machine learning, deep learning has been applied to study car-following behavior. Wei and Liu used the self-learning support vector regression method to build a car-following model. They found the ‘neutral line’ phenomenon caused by the intensity difference between acceleration and deceleration [
6]. Zhou et al. proposed a car-following model based on recurrent neural networks (RNNs) and demonstrated its superiority over the intelligent driving model in predicting traffic oscillation [
7]. Two variants of RNN, namely long short-term memory (LSTM) and GRUs, are also applied to car-following behavior modeling. Wang et al. proposed a car-following model based on GRUs, which integrates the driver memory effect and more input variables, and its simulation accuracy is higher than that of the RNN and IDM models [
8]. Huang et al. proposed a car-following model based on LSTM and studied the impact of asymmetric driving behavior on traffic flow. The results showed that the model can effectively simulate traffic flow characteristics and perform better than other models [
9]. Additionally, Wang et al. studied the hysteresis phenomenon of stop-and-go waves. The findings reveal that only the car-following model with a long memory, utilizing LSTM, can accurately simulate the hysteresis phenomenon, highlighting the applicability of LSTM in car-following behavior modeling [
10]. Wu et al. used deep learning to mimic human drivers’ memory, attention, and prediction mechanisms, establishing a car-following model based on MAP. The results demonstrate that the model can generate a time–space map similar to actual traffic volumes [
11]. Lin et al. adopted the LSTM model structure of planned sampling and one-way interconnection, which reduced the time and space error propagation in the car-following model [
12]. Ma et al. proposed a car-following model based on multi-sequence pairs and multi-sequences, which realized multi-step prediction. This model is superior to IDM and LSTM models in reproducing trajectories and capturing heterogeneous driving behaviors. It can produce different hysteresis levels and improve simulation accuracy and the stability of traffic flow [
13]. Mo et al. proposed a car-following model based on a neural network that combines the strengths of physical and deep learning models. The model proves capable of predicting acceleration, accurately determining model parameters, and exhibiting excellent performance [
14]. Qu et al. established a car-following model based on CNN-BiLSTM-Attention for trajectory prediction, showing high prediction accuracy [
15]. Naing et al. introduced a new JTPG-LSTM neural network capable of capturing precise and safe driving behaviors, verified in a dynamic data-driven simulation system [
16]. Lu et al. established a car-following model using an improved sequence-to-sequence deep learning framework, considering the kinematic information of multiple leading vehicles. This enhancement improves the model’s ability to learn heterogeneous driving behaviors and reshape traffic oscillation [
17]. Qin et al. proposed a new car-following model combining CNN and LSTM, which can predict the speed of the following vehicle more accurately [
18].
Deep learning-based car-following models have achieved significant progress. However, these methods are mainly limited by their reliance on experience, extensive experimentation, and the manual setting of network hyperparameters. Such parameter settings are highly random and may lead to a decrease in the model’s predictive performance. In addition, the research on car-following models’ transferability needs to be improved. The transferability of the model means that the model trained on one dataset can perform well on another without retraining [
19]. Road types, traffic rules, and cultural backgrounds can influence driving behavior, leading to varied car-following behaviors in different spatial locations or countries. Directly applying a model trained on trajectory data from one road segment to trajectory data from other parts or another country may introduce significant errors, limiting the model’s practical application. Therefore, it is essential to verify whether the model can perform well on entirely new road segments. This verification process is crucial for providing a reliable theoretical reference for the decision-making of intelligent driving vehicles and for reducing the costs associated with model development.
Therefore, this paper proposes a car-following model utilizing the particle swarm optimization (PSO) algorithm to optimize the hyperparameters of the GRU. The objective is to further enhance the GRU’s understanding of human driving behavior in traffic flow, enabling its adaptation to different datasets and ensuring high spatial and regional transferability. The main contributions of this paper are as follows: firstly, the PSO-GRU car-following model in this paper combines the PSO algorithm with the GRU and makes full use of the advantages of both. By optimizing the number of hidden layer neurons, the dropout rate, and the batch size of the GRU, the shortcomings of manually determining the hyperparameters of the GRU model are overcome, and the workload is reduced. Secondly, the experimental results show that the PSO-GRU car-following model has a higher prediction accuracy than the IDM and GRU car-following models, and the mean squared error (MSE) for following vehicle speed simulation is reduced by 88.36% and 72.92%, respectively, and the mean absolute percentage error (MAPE) is reduced by 64.81% and 50.14%, respectively. Finally, the spatial and regional transferability of the GRU car-following model and the PSO-GRU car-following model are compared and verified using dataset 3 of the UAV video trajectory database of Southeast University and the I-80 dataset of NGSIM. The experimental results show that the transferability of the PSO-GRU car-following model is better than that of the GRU car-following model.