Traffic flow prediction method based on cooperation of machine learning and large model
By employing a collaborative approach combining machine learning and large models, a multimodal dataset is constructed and dynamically spatiotemporally aligned. This enables the establishment of a collaborative architecture and intelligent routing scheduling, resolving the complex spatiotemporal dependencies and multi-source data fusion issues in traffic flow prediction. The result is high-precision, low-latency traffic flow prediction, supporting traffic control decisions and improving road network operational efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GANSU PROVINCE TRANSPORTATION PLANNING SURVEY & DESIGN INST
- Filing Date
- 2026-02-12
- Publication Date
- 2026-05-19
AI Technical Summary
Existing traffic flow prediction methods have shortcomings in complex spatiotemporal dependency modeling, multi-source data fusion, model adaptability and real-time performance. They are difficult to achieve effective coordination between global and local aspects, resulting in insufficient prediction accuracy and real-time performance, and thus failing to meet the needs of traffic management.
By employing a collaborative approach of machine learning and large models, through the construction of multimodal datasets, dynamic spatiotemporal alignment, collaborative architecture building, and intelligent routing scheduling, we achieve unified representation and dynamic resource allocation of multi-source data. Combined with the collaborative work of general large models and vertical small models, we can achieve efficient prediction.
It significantly improves the modeling capabilities for complex traffic flow forecasting scenarios, achieving high-precision and low-latency forecast results, providing scientific decision support for traffic guidance and control, reducing traffic congestion, and improving road network operation efficiency.
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent transportation and artificial intelligence integrated treatment technology, and in particular to a traffic flow prediction method that combines machine learning and large-scale models. Background Technology
[0002] With the advancement of digital transformation in the transportation industry, traffic flow forecasting, as one of the core technologies of intelligent transportation, directly impacts road network operational efficiency and public travel experience through its accuracy and real-time performance. Traditional traffic flow forecasting methods mainly rely on statistical models (such as ARIMA) and single machine learning models (such as LSTM), but they face many limitations in practical applications: First, there is insufficient modeling of complex spatiotemporal dependencies. Highway traffic flow is affected by multiple factors such as road network topology, road segment relationships, and spatiotemporal evolution patterns. Traditional models struggle to capture the coupling dependencies between the global and local contexts, and prediction accuracy drops significantly, especially in complex scenarios such as peak hours and sudden accidents.
[0003] Secondly, the ability to fuse multi-source data is weak. Traffic flow prediction involves multi-modal data such as traffic flow, weather, road conditions, and events. Existing methods mostly use simple data splicing or single-modal input, which fails to solve the problems of temporal asynchrony, spatial heterogeneity, and semantic gap of multi-source data, resulting in insufficient data value mining.
[0004] Third, there is a contradiction between model adaptability and real-time performance. While general-purpose large models have powerful global semantic understanding capabilities, they consume a lot of computational resources and have high response latency, making it difficult to meet the real-time prediction needs of roadside equipment. On the other hand, traditional vertical small models, although lightweight, have weak generalization ability and cannot cope with the dynamic changes in complex traffic scenarios.
[0005] Fourth, there is a lack of collaborative optimization mechanisms. Existing technologies mostly adopt a single model architecture, which fails to achieve effective collaboration between global pattern analysis and accurate local prediction. As a result, the prediction results are difficult to take into account both macro trends and micro details, and cannot provide comprehensive decision support for traffic management.
[0006] Therefore, there is an urgent need to develop a traffic flow prediction method that takes into account multi-source data fusion, complex spatiotemporal modeling, real-time response, and high-precision prediction, in order to solve the pain points of traditional technologies and promote the evolution of traffic systems towards intelligent and preventive management. Summary of the Invention
[0007] The purpose of this invention is to address the shortcomings of existing technologies by proposing a traffic flow prediction method that combines machine learning with large models.
[0008] To achieve the above objectives, the present invention adopts the following technical solution: A traffic flow prediction method that combines machine learning with large models includes the following steps: Step S1: Construction of multimodal dataset: Collect multi-source data of all elements of highway traffic, realize unified representation of multi-source heterogeneous data through dynamic spatiotemporal alignment technology, and form a standardized multimodal dataset after cleaning, enhancement and labeling; Step S2, Collaborative Architecture Construction: Construct a three-level collaborative architecture of "General Large Model - Vertical Small Model - Model Routing". The general large model is responsible for parsing the fusion of global traffic patterns and industry knowledge. The vertical small model performs lightweight optimization of local traffic prediction. The model routing is the scheduling hub to realize dual-model collaboration and dynamic resource allocation. Step S3, Intelligent Routing and Scheduling: Based on task feature evaluation and model performance monitoring, dynamically generate scheduling strategies, call the general large model, vertical small model or dual model collaborative mode as needed, and output fusion prediction results; Step S4, Real-time Interaction and Feedback Optimization: Through low-latency data interaction between edge computing devices and the cloud platform, real-time output of prediction results, feedback for management and control decisions, and online iterative updates of the model are achieved; Preferably, in step S1, the multi-source data includes, but is not limited to: Traffic flow basic data: traffic volume, vehicle speed, traffic density, and vehicle type distribution collected by roadside radar and loop detectors, with a sampling frequency of 1-5 minutes / time; Meteorological and environmental data: temperature, relative humidity, visibility, precipitation type, precipitation intensity, wind speed, and wind direction are collected by meteorological sensors, with a sampling frequency of 10-30 minutes / time; Road condition data: Road surface smoothness PCI, crack rate, defect type, defect location, and defect area are collected through road surface testing equipment and maintenance records. The collection frequency is 1-3 months / time. Road network topology data: Structured data built on high-precision maps, including road segment length, number of lanes, road segment connection relationships, toll station / interchange locations, and tunnel / bridge parameters; Text event data: unstructured data, including traffic incident logs, construction notices, control instructions, and holiday schedules; Video / radar trajectory data: Vehicle trajectories, queue lengths, and headway distances are collected via high-definition cameras and millimeter-wave radar. The video frame rate is 25-30fps, and the radar sampling frequency is 10Hz.
[0009] Preferably, in step S1, the dynamic spatiotemporal alignment technology includes the following steps: (1) Spatiotemporal reference calibration: GPS / BeiDou dual-mode positioning module and high-precision map are used to calibrate the spatiotemporal coordinates of multi-source acquisition devices and establish the mapping relationship between device ID and road network segments. The high-precision map has a scale of less than 1:1000 and a road centerline error of ≤0.5m. The multi-source acquisition devices include cameras, radar and sensors. (2) Time synchronization processing: Time synchronization of data from multiple devices is achieved based on the network time protocol. The linear interpolation method is used to correct the sampling time difference between different devices to ensure that the data timestamp error of the same spatiotemporal node is ≤100ms; (3) Spatial coordinate mapping: The video pixel coordinates and radar polar coordinate data are mapped to the geodetic coordinate system through perspective transformation and coordinate transformation formula, so as to unify the spatial coordinates with the road network topology data; Cross-modal semantic association: Construct a cross-modal association model based on graph neural networks. Using the road network topology as the graph structure, each modal data is used as a node feature. The association weights between modalities are calculated through an attention mechanism, and the output is a spatiotemporal feature vector with uniform dimensionality. For example, the negative correlation weight between precipitation intensity and vehicle speed, and the causal weight between accident time and traffic flow change are calculated. Preferably, in step S1, the dataset construction further includes the following processing steps: (A) Data cleaning: Data cleaning: The 3σ criterion is used to filter abnormal data caused by sensor failure and transmission interference. Local weighted regression is used to smooth time series data noise. K-nearest neighbor interpolation is used to complete missing data. When the missing data rate is ≤20%, the completion accuracy is ≥95%. (B) Data Augmentation: A data augmentation model is built based on generative adversarial networks. The generator adopts the U-Net architecture and the discriminator adopts the CNN architecture. Long-tail traffic event samples, such as low-frequency events like fog, multi-vehicle collisions, and extreme precipitation, are generated through adversarial training. The sample augmentation ratio is 1:3-1:5. At the same time, image rotation, brightness adjustment, and temporal data interpolation, such as linear / cubic splines, are used to improve data diversity. (C) Data Labeling: A hybrid labeling strategy of "active learning + weakly supervised learning" is adopted, which includes: selecting 10% of the original data for manual labeling, the labeling content includes traffic level, event type and impact range, and training the initial weakly supervised model; using the weakly supervised model to pre-label the remaining 90% of unlabeled data, and selecting pre-labeled data with confidence ≥0.85; manually verifying the pre-labeled data, with a verification ratio ≤30%, and correcting erroneous labels; expanding the verified labeled data into the training set, iteratively optimizing the weakly supervised model, and improving the labeling efficiency by 2-3 times. (D) Dataset partitioning: The dataset is divided into training set, validation set and test set in a ratio of 7:1.5:1.5. Stratified sampling is used to ensure the consistency of scene distribution in each dataset, such as the ratio of peak / off-peak / special time period and the distribution ratio of event type.
[0010] Preferably, in step S2, the construction and optimization process of the general large model includes the following steps: (a) Basic model selection: Select open-source large models with multimodal understanding capabilities, including but not limited to DeepSeek-R1, Wenxin Yiyan, and Hunyuan large models. The models are required to support input and semantic understanding of text, images, and time series data. (b) Industry knowledge graph injection: Construct a knowledge graph in the transportation field, covering the entity layer such as road network, equipment, events, policies, the relationship layer such as road segment connection, event impact, policy constraints, and the attribute layer such as entity attributes and relationship weights. The knowledge graph has a scale of ≥100,000 triples. The knowledge graph is transformed into a vector representation through knowledge embedding technology and integrated into the pre-training process of the large model. (c) Domain-adaptive pre-training: Based on the constructed multimodal dataset, a joint training strategy of "contrastive learning + spatiotemporal modeling" is adopted. The pre-training tasks include: spatiotemporal feature alignment task, aligning multimodal features of the same spatiotemporal node; traffic event prediction task, predicting the probability of future events based on historical data; and global trend modeling task, learning the evolution law of regional road network traffic. (d) Model fine-tuning: Adjust model parameters based on validation set performance, adopt early stopping strategy to prevent overfitting, stop training when the validation set prediction error does not decrease for 10 consecutive rounds, and finally form a general large model adapted to the traffic field with a global traffic pattern resolution accuracy of ≥92%.
[0011] Preferably, in step S2, the design and lightweighting of the vertical mini-model includes the following steps: First, the basic architecture design adopts the "LSTM+GCN" fusion architecture, where the LSTM module has 2-4 layers and 128-256 hidden units, and is responsible for capturing the long-term and short-term temporal dependencies of traffic flow. The GCN module has 2-3 layers and the activation function is ReLU, which is responsible for modeling the spatial dependencies of the road network topology. The output layer adopts a fully connected layer with an output dimension of 1, corresponding to the traffic prediction value. Second, knowledge distillation transfer: using the optimized general large model as the teacher model and the vertical small model as the student model, the "soft label distillation" strategy is adopted, and the output probability distribution of the teacher model is combined with the real label as the training target. The distillation temperature T=5-10 and the distillation loss weight=0.3-0.5. Third, lightweight optimization: Model pruning: Structured pruning technology is used to remove redundant connections in the network with an absolute weight value ≤1e-4, with a pruning rate of 30%-50%; Model quantization: 8-bit integer quantization technology is used to convert model parameters from 32-bit floating-point to INT8, compressing model storage volume by 75%; Layer fusion: Convolutional layers and batch normalization layers are fused into a single computation layer to reduce memory access overhead during inference; After lightweighting, the number of model parameters is ≤10 million, and the inference latency is ≤500ms; Fourth, personalized fine-tuning: For different road sections with traffic characteristics, such as tunnels, bridges, toll stations and other special road sections, personalized fine-tuning is carried out based on historical data of local road sections. The optimization goal is to minimize the prediction error. The number of fine-tuning iterations is 30-50 rounds, and the learning rate is 1e-4.
[0012] Preferably, in step S2, the design and interaction mechanism of the model routing module includes: Unified interface standard: The Protobuf 3.0 protocol is used to define the interaction interface between the general large model and the vertical small model, including data input format, such as feature vector, task type, parameter configuration, and data output format; Task evaluation model: Construct a task evaluation model based on random forest. Input features include prediction time period type, prediction duration, data scale, real-time requirements, accuracy requirements, and output task type label. Collaborative interaction mechanism: For global trend prediction tasks, the general large model runs independently, outputting macroscopic results such as regional road network traffic distribution and peak hour peaks; for local precise prediction tasks, the vertical small models run independently, outputting short-term traffic prediction values for single road segments; for complex scenario prediction tasks, the general large model outputs prior knowledge such as the scope of event impact and traffic evolution trends, while the vertical small models combine local real-time data for refined prediction. Model routing is achieved through weighted fusion, with weights dynamically adjusted based on model confidence, and the final result is output. Model performance monitoring: Real-time collection of operational metrics for both models, including prediction accuracy, response time, CPU / GPU utilization, and memory usage, with a monitoring frequency of once per second. A model performance early warning mechanism is established, triggering an alarm when metrics exceed preset thresholds, such as accuracy below 90% or response time exceeding 500ms.
[0013] Preferably, in step S3, the intelligent routing scheduling strategy includes the following steps: First, strategy initialization: Based on historical task data and model performance data, train the routing decision model and determine the initial scheduling rules for different task types; Secondly, dynamic scheduling decision-making: receiving prediction task requests, identifying task types through task evaluation models; querying model performance monitoring data to determine whether the current model status meets task requirements; generating scheduling schemes; if a single model meets the requirements, directly calling the corresponding model; if a single model does not meet the requirements, such as insufficient accuracy of vertical small models in complex scenarios, triggering dual-model collaboration. Secondly, scheduling weight optimization: The scheduling weight is optimized based on the reinforcement learning algorithm, with the reward function being "maximizing prediction accuracy + minimizing response time". The state space includes task features and model performance indicators, and the action space includes model selection and weight allocation. The scheduling strategy is updated every 100 tasks. Finally, load balancing control: When the model routing detects that a certain model is overloaded, in this embodiment, when the CPU utilization rate is ≥80% and the memory utilization rate is ≥85%, some tasks are dynamically allocated to another model, or the model instance is expanded to ensure overall system load balancing.
[0014] Preferably, in step S4, the implementation of the real-time interaction and feedback optimization includes the following steps: (I) Edge-Cloud Deployment Architecture: Edge Layer: Roadside units deploy edge computing devices to run vertical small models, data acquisition modules, and real-time prediction modules, and are responsible for local data processing and rapid response; Cloud Layer: Deploy cloud server clusters to run general large models, dataset management modules, global optimization modules, and decision feedback modules, and are responsible for model training, global analysis, and decision generation. (II) Data transmission protocol: Edge devices and cloud platforms interact with each other via MQTT 3.1.1 protocol, using TCP / IP transmission, with a message QoS level of 2 to ensure that messages are delivered exactly once, a transmission bandwidth of ≥100Mbps, and an end-to-end latency of ≤200ms; critical data is transmitted using AES-256 encryption to ensure data security. (III) Closed-loop optimization mechanism: Decision feedback: The cloud platform generates traffic control decisions based on the prediction results, including signal timing adjustment schemes, variable lane guidance information, and emergency response route planning, and pushes them to users and control terminals through V2X communication, traffic guidance screens, and navigation APP; Model iteration: Every 24 hours, the cloud platform collects real-time data and prediction errors uploaded by edge devices, and uses incremental learning algorithms to update the parameters of the general large model and vertical small model to ensure that the model adapts to the dynamic changes in traffic flow; Anomaly handling: When the edge device detects abnormal data collection or model operation failure, it automatically switches to the backup model or the cloud model to ensure continuous system operation.
[0015] Preferably, the evaluation includes a model performance assessment step, and the assessment metrics include: Prediction accuracy indicators: mean absolute error, root mean square error, and mean absolute percentage error. Among them, mean absolute percentage error ≤ 10% is excellent, 10% < mean absolute percentage error ≤ 15% is good, and 15% < mean absolute percentage error ≤ 20% is acceptable. Real-time performance indicator: response time, which is the total time from receiving data to outputting the prediction result. A response time ≤ 300ms is excellent, 300ms < response time ≤ 500ms is good, and 500ms < response time ≤ 1000ms is acceptable. Robustness index: The decrease in prediction accuracy when the data missing rate is 10% / 20% / 30%. A decrease of ≤5% is excellent, 5% < decrease ≤10% is good, and 10% < decrease ≤15% is acceptable. Scalability index: The change in system response time when adding 10 / 20 / 50 road segments. A change of ≤10% is excellent, a change of 10% < change of ≤20% is good, and a change of 20% < change of ≤30% is acceptable. The beneficial effects of this invention are: This invention addresses the temporal asynchrony and spatial heterogeneity issues of multimodal data through dynamic spatiotemporal alignment technology. Combined with data augmentation and standardization, it achieves deep fusion of all traffic element data, providing rich, high-quality data support for predictive models and significantly enhancing modeling capabilities in complex scenarios. It utilizes the global semantic understanding capabilities of a general-purpose large model to analyze traffic flow evolution patterns, while achieving accurate local predictions through lightweight vertical small models. Combined with intelligent routing scheduling strategies, it ensures prediction accuracy while meeting the low-latency requirements of edge devices, achieving high-precision and forward-looking traffic flow prediction. This provides scientific decision support for traffic guidance, resource allocation, and emergency response, effectively reducing traffic congestion, improving road network operational efficiency, and lowering management costs. It promotes the transformation of transportation systems from "experience-driven" to "data-intelligent driven," contributing to the construction of smart transportation. Detailed Implementation
[0016] A traffic flow prediction method that combines machine learning with large models includes the following steps: Step S1: Construction of multimodal dataset: Collect multi-source data of all elements of highway traffic, realize unified representation of multi-source heterogeneous data through dynamic spatiotemporal alignment technology, and form a standardized multimodal dataset after cleaning, enhancement and labeling.
[0017] The multi-source data includes, but is not limited to: Traffic flow basic data: Traffic volume, vehicle speed, traffic density, and vehicle type distribution are collected by roadside radar and loop detectors, with a sampling frequency of 1-5 minutes / time. In this embodiment, millimeter-wave radar, model: RS-400, is selected, with a detection range of 0-400m, a speed measurement range of 0-250km / h, and an accuracy of ±1km / h. Loop detectors, model: LD-200, are selected, with a sampling frequency of 5Hz and a counting accuracy of ±1pcu. They are deployed in the middle of the road segment, at toll station entrances and exits, and at interchange ramps, with one set deployed every 2-3 kilometers to ensure full coverage of the road segment. Meteorological environmental data: Temperature, relative humidity, visibility, precipitation type, precipitation intensity, wind speed, and wind direction are collected by meteorological sensors at a sampling frequency of 10-30 minutes / time. In this embodiment, an integrated meteorological sensor, model WS-600, is selected. The measurement parameters include 8 indicators such as temperature, humidity, and visibility. The temperature accuracy is ±0.2℃, and the visibility accuracy is ±10m. It is deployed on roadside guardrails and toll plazas, with one set deployed every 5-10 kilometers. In special road sections, such as areas prone to fog and mountainous sections, the deployment is increased. Road condition data: Road surface smoothness PCI, crack rate, defect type, defect location, and defect area are collected through road surface inspection equipment and maintenance records, with a collection frequency of 1-3 months / time; In this embodiment, a vehicle-mounted road surface inspection device, model: Pavement-3000, is selected, with a detection speed of 0-80km / h and a smoothness measurement accuracy of ±0.1mm / m. A drone, model: DJIMatrice350RTK, is selected, equipped with a high-definition camera and LiDAR, with a detection accuracy of ±1cm. The entire road section is inspected regularly, with plain road sections inspected every 3 months and special road sections such as mountainous areas and tunnels inspected every month; Road network topology data: Structured data built on high-precision maps, including road segment length, number of lanes, road segment connection relationships, toll station / interchange locations, and tunnel / bridge parameters; Text event data: unstructured data, including traffic incident logs, construction notices, control instructions, and holiday schedules; Video / radar trajectory data: Vehicle trajectories, queue lengths, and headway distances are collected via high-definition cameras and millimeter-wave radar. The video frame rate is 25-30fps, and the radar sampling frequency is 10Hz. In this embodiment, high-definition network cameras are selected, model: IPC-9800, with a resolution of 2560×1440, a frame rate of 30fps, and a night vision distance of ≥100m. They are deployed on roadside poles and at tunnel entrances and exits, with one set deployed every 1-2 kilometers to ensure no blind spots in monitoring.
[0018] It should be noted that the dynamic spatiotemporal alignment technology includes the following steps: (1) Spatiotemporal reference calibration: GPS / BeiDou dual-mode positioning module and high-precision map are used to calibrate the spatiotemporal coordinates of multi-source acquisition devices and establish the mapping relationship between device ID and road network segments. The high-precision map has a scale of less than 1:1000 and a road centerline error of ≤0.5m. The multi-source acquisition devices include cameras, radar and sensors. (2) Time synchronization processing: Time synchronization of data from multiple devices is achieved based on the network time protocol. The linear interpolation method is used to correct the sampling time difference between different devices to ensure that the data timestamp error of the same spatiotemporal node is ≤100ms; (3) Spatial coordinate mapping: The video pixel coordinates and radar polar coordinate data are mapped to the geodetic coordinate system through perspective transformation and coordinate transformation formula, so as to unify the spatial coordinates with the road network topology data; (4) Cross-modal semantic association: Construct a cross-modal association model based on graph neural network, take the road network topology as the graph structure, take each modal data as the node feature, calculate the association weight between modalities through the attention mechanism, and output a spatiotemporal feature vector with unified dimension, such as calculating the negative correlation weight between precipitation intensity and vehicle speed, and the causal weight between accident time and traffic flow change.
[0019] Furthermore, the dataset construction also includes the following processing steps: (A) Data Cleaning: Data cleaning: The 3σ criterion is used to filter abnormal data caused by sensor failure and transmission interference. Local weighted regression (LOWESS) is used to smooth time series data noise. K-nearest neighbor (KNN) interpolation method is used to complete missing data. When the missing rate is ≤20%, the completion accuracy is ≥95%. (B) Data Augmentation: A data augmentation model is built based on Generative Adversarial Network (GAN). The generator adopts the U-Net architecture, and the discriminator adopts the CNN architecture. Long-tail traffic event samples, such as low-frequency events like fog, multi-vehicle collisions, and extreme precipitation, are generated through adversarial training. The sample augmentation ratio is 1:3-1:5. At the same time, image rotation, brightness adjustment, and temporal data interpolation, such as linear / cubic splines, are used to improve data diversity. (C) Data Labeling: A hybrid labeling strategy of "active learning + weakly supervised learning" is adopted, which includes: selecting 10% of the original data for manual labeling, the labeling content includes traffic level, event type and impact range, and training the initial weakly supervised model; using the weakly supervised model to pre-label the remaining 90% of unlabeled data, and selecting pre-labeled data with confidence ≥0.85; manually verifying the pre-labeled data, with a verification ratio ≤30%, and correcting erroneous labels; expanding the verified labeled data into the training set, iteratively optimizing the weakly supervised model, and improving the labeling efficiency by 2-3 times. (D) Dataset partitioning: The dataset is divided into training set, validation set and test set in a ratio of 7:1.5:1.5. Stratified sampling is used to ensure the consistency of scene distribution in each dataset, such as the ratio of peak / off-peak / special time period and the distribution ratio of event type.
[0020] Step S2, Collaborative Architecture Setup: Construct a three-level collaborative architecture consisting of a "general large model - vertical small model - model routing". The general large model is responsible for parsing the fusion of global traffic patterns and industry knowledge. The vertical small model performs lightweight optimization of local traffic prediction. The model routing serves as the scheduling hub to realize dual-model collaboration and dynamic resource allocation.
[0021] The construction and optimization process of the general large model includes the following steps: (a) Basic model selection: Select open-source large models with multimodal understanding capabilities, including but not limited to DeepSeek-R1 (10B-100B parameters), Wenxin Yiyan (ERNIE4.0), and mixed-source large models. The models are required to support input and semantic understanding of text, images, and time-series data. (b) Industry knowledge graph injection: Construct a knowledge graph in the transportation field, covering the entity layer such as road network, equipment, events, policies, the relationship layer such as road segment connection, event impact, policy constraints, and the attribute layer such as entity attributes and relationship weights. The knowledge graph has a scale of ≥100,000 triples. The knowledge graph is transformed into a vector representation through knowledge embedding technology and integrated into the pre-training process of the large model. (c) Domain-Adaptive Pre-training: Based on the constructed multimodal dataset, a joint training strategy of "contrastive learning + spatiotemporal modeling" is adopted. The pre-training tasks include: spatiotemporal feature alignment task, aligning multimodal features of the same spatiotemporal node; traffic event prediction task, predicting the probability of future events based on historical data; global trend modeling task, learning the evolution law of regional road network traffic. The pre-training hyperparameters are set as follows: batch size = 32-64, learning rate = 1e-5-5e-5, number of iterations = 100-200 rounds, the optimizer is AdamW, and the weight decay = 0.01. (d) Model fine-tuning: Adjust model parameters based on validation set performance, adopt early stopping strategy to prevent overfitting, stop training when the validation set prediction error (MAE) does not decrease for 10 consecutive rounds, and finally form a general large model adapted to the traffic field with a global traffic pattern resolution accuracy ≥92%.
[0022] It should be noted that the design and lightweighting of the aforementioned vertical mini-model includes the following steps: First, the basic architecture design adopts the "LSTM+GCN" fusion architecture, where the LSTM module has 2-4 layers and 128-256 hidden units, and is responsible for capturing the long-term and short-term temporal dependencies of traffic flow. The GCN module has 2-3 layers and the activation function is ReLU, which is responsible for modeling the spatial dependencies of the road network topology. The output layer adopts a fully connected layer with an output dimension of 1, corresponding to the traffic prediction value. Second, knowledge distillation transfer: using the optimized general large model as the teacher model and the vertical small model as the student model, the "soft label distillation" strategy is adopted, and the output probability distribution of the teacher model is combined with the real label as the training target. The distillation temperature T=5-10 and the distillation loss weight=0.3-0.5. Third, lightweight optimization: Model pruning: Structured pruning technology is used to remove redundant connections with absolute weight values ≤1e-4, with a pruning rate of 30%-50%; Model quantization: 8-bit integer (INT8) quantization technology is used to convert model parameters from 32-bit floating-point (FP32) to INT8, compressing model storage volume by 75%; Layer fusion: Convolutional layers and batch normalization (BN) layers are fused into a single computation layer to reduce memory access overhead during inference; After lightweighting, the number of model parameters is ≤10 million, and the inference latency is ≤500ms; Fourth, personalized fine-tuning: For different road sections with traffic characteristics, such as tunnels, bridges, toll stations and other special road sections, personalized fine-tuning is carried out based on historical data of local road sections. The optimization objective is to minimize the prediction error (MAPE). The number of fine-tuning iterations is 30-50 rounds, and the learning rate is 1e-4.
[0023] Furthermore, the design and interaction mechanism of the model routing module includes: Unified Interface Standard: The Protobuf 3.0 protocol is used to define the interaction interface between general large models and vertical small models, including data input formats such as feature vectors, task types, parameter configurations, data output formats such as prediction results, confidence scores, response times, and status feedback formats such as model load and running status, to ensure the compatibility and efficiency of data transmission. Task evaluation model: Construct a task evaluation model based on random forest. Input features include prediction time period type, such as morning peak / evening peak / off-peak / night / special time period, prediction duration, such as 5 / 15 / 30 / 60 minutes, data scale, such as single road segment / multiple road segments / regional road network, real-time requirements, such as latency threshold: 100 / 300 / 500ms, and accuracy requirements, such as MAPE threshold: 5% / 10% / 15%. Output task type label, such as global trend prediction / local accurate prediction / complex scene prediction. Collaborative interaction mechanism: For global trend prediction tasks, the general large model runs independently, outputting macroscopic results such as regional road network traffic distribution and peak hour peaks; for local precise prediction tasks, the vertical small models run independently, outputting short-term traffic prediction values for single road segments; for complex scenario prediction tasks, the general large model outputs prior knowledge such as the scope of event impact and traffic evolution trends, while the vertical small models combine local real-time data for refined prediction. Model routing is achieved through weighted fusion, with weights dynamically adjusted based on model confidence, and the final result is output. Model performance monitoring: Real-time collection of operational metrics for both models, including prediction accuracy, response time, CPU / GPU utilization, and memory usage, with a monitoring frequency of once per second. A model performance early warning mechanism is established, triggering an alarm when metrics exceed preset thresholds, such as accuracy below 90% or response time exceeding 500ms.
[0024] Step S3, Intelligent Routing and Scheduling: Based on task feature evaluation and model performance monitoring, dynamically generate scheduling strategies, call the general large model, vertical small model or dual-model collaborative mode as needed, and output fused prediction results.
[0025] The intelligent routing scheduling strategy includes the following steps: First, strategy initialization: Based on historical task data and model performance data, train the routing decision model and determine the initial scheduling rules for different task types; Secondly, dynamic scheduling decision-making: receiving prediction task requests, identifying task types through task evaluation models; querying model performance monitoring data to determine whether the current model status meets task requirements; generating scheduling schemes; if a single model meets the requirements, directly calling the corresponding model; if a single model does not meet the requirements, such as insufficient accuracy of vertical small models in complex scenarios, triggering dual-model collaboration. Secondly, scheduling weight optimization: The scheduling weight is optimized based on the reinforcement learning algorithm, with the reward function being "maximizing prediction accuracy + minimizing response time". The state space includes task features and model performance indicators, and the action space includes model selection and weight allocation. The scheduling strategy is updated every 100 tasks. Finally, load balancing control: When the model routing detects that a certain model is overloaded, in this embodiment, when the CPU utilization rate is ≥80% and the memory utilization rate is ≥85%, some tasks are dynamically allocated to another model, or the model instance is expanded to ensure overall system load balancing.
[0026] Step S4, Real-time Interaction and Feedback Optimization: Through low-latency data interaction between edge computing devices and the cloud platform, real-time output of prediction results, feedback for management and control decisions, and online iterative updates of the model are achieved.
[0027] It should be noted that the implementation of the real-time interaction and feedback optimization includes the following steps: (I) Edge-Cloud Deployment Architecture: Edge Layer: Roadside units (RSUs) deploy edge computing devices with CPU: Intel Core i7-12700H / AMD Ryzen 7 6800H, GPU: NVIDIA RTX 3060 / 3070, memory ≥ 32GB, running vertical small models, data acquisition modules, and real-time prediction modules, responsible for local data processing and quick response; Cloud Layer: Deploy a cloud server cluster with CPU: Intel Xeon Gold 6348, GPU: NVIDIA A100 × 4, memory ≥ 256GB, running general large models, dataset management modules, global optimization modules, and decision feedback modules, responsible for model training, global analysis, and decision generation; (II) Data Transmission Protocol: Edge devices and the cloud platform interact data through the MQTT 3.1.1 protocol, using TCP / IP transmission, with the message QoS level being 2 to ensure that messages are delivered exactly once, transmission bandwidth ≥ 100Mbps, end-to-end latency ≤ 200ms; For key data such as accident events and prediction results, AES-256 encryption transmission is used to ensure data security; (III) Closed-loop Optimization Mechanism: Decision Feedback: The cloud platform generates traffic control decisions based on prediction results, including signal timing adjustment plans, variable lane guidance information, and emergency response path planning, and pushes them to users and control terminals through V2X communication, traffic guidance screens, and navigation APPs; Model Iteration: Every 24 hours, the cloud platform collects real-time data and prediction errors uploaded by edge devices and updates the parameters of general large models and vertical small models using incremental learning algorithms to ensure that the models adapt to the dynamic changes of traffic flow; Exception Handling: When edge devices detect abnormal data acquisition or model operation failures, they automatically switch to backup models or cloud models to ensure continuous system operation.
[0028] It should be noted that a traffic flow prediction method that combines machine learning and large models also includes a model performance evaluation step, and the evaluation metrics include: Prediction Accuracy Metrics: Mean Absolute Error (MAE), Root Mean Square Error (RMSE), Mean Absolute Percentage Error (MAPE), where MAPE ≤ 10% is excellent, 10% < MAPE ≤ 15% is good, and 15% < MAPE ≤ 20% is qualified; Real-time Metrics: Response time, which is the total duration from receiving data to outputting prediction results. Response time ≤ 300ms is excellent, 300ms < response time ≤ 500ms is good, and 500ms < response time ≤ 1000ms is qualified; Robustness index: The decrease in prediction accuracy when the data missing rate is 10% / 20% / 30%. A decrease of ≤5% is excellent, 5% < decrease ≤10% is good, and 10% < decrease ≤15% is acceptable. Scalability index: The change in system response time when the number of new road segments (10 / 20 / 50) increases. A change of ≤10% is excellent, 10% < change ≤20% is good, and 20% < change ≤30% is acceptable.
[0029] This invention addresses the temporal asynchrony and spatial heterogeneity issues of multimodal data through dynamic spatiotemporal alignment technology. Combined with data augmentation and standardization, it achieves deep fusion of all traffic element data, providing rich and high-quality data support for prediction models. This significantly enhances modeling capabilities in complex scenarios. It utilizes the global semantic understanding capabilities of a general-purpose large model to analyze traffic flow evolution patterns, while achieving accurate local predictions through lightweight vertical small models. Combined with intelligent routing scheduling strategies, it ensures prediction accuracy while meeting the low-latency requirements of edge devices, achieving high-precision and forward-looking prediction of traffic flow. This provides scientific decision support for traffic guidance, resource allocation, and emergency response, effectively reducing traffic congestion, improving road network operational efficiency, and lowering management costs. It promotes the transformation of the transportation system from "experience-driven" to "data-intelligent driven," contributing to the construction of smart transportation.
Claims
1. A traffic flow prediction method that combines machine learning with a large model, characterized in that, Includes the following steps: Step S1: Construction of multimodal dataset: Collect multi-source data of all elements of highway traffic, realize unified representation of multi-source heterogeneous data through dynamic spatiotemporal alignment technology, and form a standardized multimodal dataset after cleaning, enhancement and labeling; Step S2, Collaborative Architecture Construction: Construct a three-level collaborative architecture of "General Large Model - Vertical Small Model - Model Routing". The general large model is responsible for parsing the fusion of global traffic patterns and industry knowledge. The vertical small model performs lightweight optimization of local traffic prediction. The model routing is the scheduling hub to realize dual-model collaboration and dynamic resource allocation. Step S3, Intelligent Routing and Scheduling: Based on task feature evaluation and model performance monitoring, dynamically generate scheduling strategies, call the general large model, vertical small model or dual model collaborative mode as needed, and output fusion prediction results; Step S4, Real-time Interaction and Feedback Optimization: Through low-latency data interaction between edge computing devices and the cloud platform, real-time output of prediction results, feedback for management and control decisions, and online iterative updates of the model are achieved.
2. The traffic flow prediction method based on the collaboration of machine learning and large models according to claim 1, characterized in that, In step S1, the multi-source data includes, but is not limited to: Traffic flow basic data: traffic volume, vehicle speed, traffic density, and vehicle type distribution collected by roadside radar and loop detectors, with a sampling frequency of 1-5 minutes / time; Meteorological and environmental data: temperature, relative humidity, visibility, precipitation type, precipitation intensity, wind speed, and wind direction are collected by meteorological sensors, with a sampling frequency of 10-30 minutes / time; Road condition data: Road surface smoothness PCI, crack rate, defect type, defect location, and defect area are collected through road surface testing equipment and maintenance records. The collection frequency is 1-3 months / time. Road network topology data: Structured data built on high-precision maps, including road segment length, number of lanes, road segment connection relationships, toll station / interchange locations, and tunnel / bridge parameters; Text event data: unstructured data, including traffic incident logs, construction notices, control instructions, and holiday schedules; Video / radar trajectory data: Vehicle trajectories, queue lengths, and headway distances are collected via high-definition cameras and millimeter-wave radar. The video frame rate is 25-30fps, and the radar sampling frequency is 10Hz.
3. The traffic flow prediction method based on the collaboration of machine learning and large models according to claim 1, characterized in that, In step S1, the dynamic spatiotemporal alignment technology includes the following steps: Spatiotemporal reference calibration: Using a GPS / BeiDou dual-mode positioning module and a high-precision map, the spatiotemporal coordinates of the multi-source acquisition devices are calibrated to establish the mapping relationship between device ID and road network segments. The high-precision map has a scale of less than 1:1000 and a road centerline error of ≤0.5m. The multi-source acquisition devices include cameras, radar, and sensors. Time synchronization processing: Based on the network time protocol, the time synchronization of data from multiple devices is achieved. The linear interpolation method is used to correct the sampling time difference between different devices to ensure that the data timestamp error at the same spatiotemporal node is ≤100ms. Spatial coordinate mapping: The video pixel coordinates and radar polar coordinate data are mapped to the geodetic coordinate system through perspective transformation and coordinate transformation formulas, so as to unify the spatial coordinates with the road network topology data; Cross-modal semantic association: Construct a cross-modal association model based on graph neural network, using the road network topology as the graph structure, taking each modal data as node features, calculating the association weights between modalities through the attention mechanism, and outputting a spatiotemporal feature vector with unified dimensions, such as calculating the negative correlation weight between precipitation intensity and vehicle speed, and the causal weight between accident time and traffic flow change.
4. The traffic flow prediction method based on the collaboration of machine learning and large models according to claim 1, characterized in that, In step S1, the dataset construction further includes the following processing steps: (A) Data cleaning: Data cleaning: The 3σ criterion is used to filter abnormal data caused by sensor failure and transmission interference. Local weighted regression is used to smooth time series data noise. K-nearest neighbor interpolation is used to complete missing data. When the missing data rate is ≤20%, the completion accuracy is ≥95%. (B) Data Augmentation: A data augmentation model is built based on generative adversarial networks. The generator adopts the U-Net architecture and the discriminator adopts the CNN architecture. Long-tail traffic event samples, such as low-frequency events like fog, multi-vehicle collisions, and extreme precipitation, are generated through adversarial training. The sample augmentation ratio is 1:3-1:
5. At the same time, image rotation, brightness adjustment, and temporal data interpolation, such as linear / cubic splines, are used to improve data diversity. (C) Data labeling: A hybrid labeling strategy of "active learning + weak supervision learning" is adopted, which includes: selecting 10% of the original data for manual labeling, the labeling content includes traffic level, event type and impact range, and training the initial weak supervision model; using the weak supervision model to pre-label the remaining 90% of unlabeled data, and screening pre-labeled data with confidence ≥0.85; Manually verify the pre-labeled data, with a verification rate of ≤30%, and correct erroneous labels; expand the verified labeled data into the training set, iteratively optimize the weakly supervised model, and improve labeling efficiency by 2-3 times; (D) Dataset partitioning: The dataset is divided into training set, validation set and test set in a ratio of 7:1.5:1.
5. Stratified sampling is used to ensure the consistency of scene distribution in each dataset, such as the ratio of peak / off-peak / special time period and the distribution ratio of event type.
5. The traffic flow prediction method based on the collaboration of machine learning and large models according to claim 1, characterized in that, In step S2, the construction and optimization process of the general large model includes the following steps: (a) Basic model selection: Select open-source large models with multimodal understanding capabilities, including but not limited to DeepSeek-R1, Wenxin Yiyan, and Hunyuan large models. The models are required to support input and semantic understanding of text, images, and time series data. (b) Industry knowledge graph injection: Construct a knowledge graph in the transportation field, covering the entity layer such as road network, equipment, events, policies, the relationship layer such as road segment connection, event impact, policy constraints, and the attribute layer such as entity attributes and relationship weights. The knowledge graph has a scale of ≥100,000 triples. The knowledge graph is transformed into a vector representation through knowledge embedding technology and integrated into the pre-training process of the large model. (c) Domain-adaptive pre-training: Based on the constructed multimodal dataset, a joint training strategy of "contrastive learning + spatiotemporal modeling" is adopted. The pre-training tasks include: spatiotemporal feature alignment task, aligning multimodal features of the same spatiotemporal node; traffic event prediction task, predicting the probability of future events based on historical data; and global trend modeling task, learning the evolution law of regional road network traffic. (d) Model fine-tuning: Adjust model parameters based on validation set performance, adopt early stopping strategy to prevent overfitting, stop training when the validation set prediction error does not decrease for 10 consecutive rounds, and finally form a general large model adapted to the traffic field with a global traffic pattern resolution accuracy of ≥92%.
6. The traffic flow prediction method based on the collaboration of machine learning and large models according to claim 1, characterized in that, In step S2, the design and lightweighting of the vertical mini-model includes the following steps: First, the basic architecture design adopts the "LSTM+GCN" fusion architecture, where the LSTM module has 2-4 layers and 128-256 hidden units, and is responsible for capturing the long-term and short-term temporal dependencies of traffic flow. The GCN module has 2-3 layers and the activation function is ReLU, which is responsible for modeling the spatial dependencies of the road network topology. The output layer adopts a fully connected layer with an output dimension of 1, corresponding to the traffic prediction value. Second, knowledge distillation transfer: using the optimized general large model as the teacher model and the vertical small model as the student model, the "soft label distillation" strategy is adopted, and the output probability distribution of the teacher model is combined with the real label as the training target. The distillation temperature T=5-10 and the distillation loss weight=0.3-0.
5. Third, lightweight optimization: Model pruning: Structured pruning technology is used to remove redundant connections in the network with an absolute weight value ≤1e-4, with a pruning rate of 30%-50%; Model quantization: 8-bit integer quantization technology is used to convert model parameters from 32-bit floating-point to INT8, compressing model storage volume by 75%; Layer fusion: Convolutional layers and batch normalization layers are fused into a single computation layer to reduce memory access overhead during inference; After lightweighting, the number of model parameters is ≤10 million, and the inference latency is ≤500ms; Fourth, personalized fine-tuning: For different road sections with traffic characteristics, such as tunnels, bridges, toll stations and other special road sections, personalized fine-tuning is carried out based on historical data of local road sections. The optimization goal is to minimize the prediction error. The number of fine-tuning iterations is 30-50 rounds, and the learning rate is 1e-4.
7. The traffic flow prediction method based on the collaboration of machine learning and large models according to claim 1, characterized in that, In step S2, the design and interaction mechanism of the model routing module includes: Unified interface standard: The Protobuf 3.0 protocol is used to define the interaction interface between the general large model and the vertical small model, including data input format, such as feature vector, task type, parameter configuration, and data output format; Task evaluation model: Construct a task evaluation model based on random forest. Input features include prediction time period type, prediction duration, data scale, real-time requirements, accuracy requirements, and output task type label. Collaborative interaction mechanism: For global trend prediction tasks, the general large model runs independently, outputting macroscopic results such as regional road network traffic distribution and peak hour peaks; for local precise prediction tasks, the vertical small models run independently, outputting short-term traffic prediction values for single road segments; for complex scenario prediction tasks, the general large model outputs prior knowledge such as the scope of event impact and traffic evolution trends, while the vertical small models combine local real-time data for refined prediction. Model routing is achieved through weighted fusion, with weights dynamically adjusted based on model confidence, and the final result is output. Model performance monitoring: Real-time collection of operational metrics for both models, including prediction accuracy, response time, CPU / GPU utilization, and memory usage, with a monitoring frequency of once per second. A model performance early warning mechanism is established, triggering an alarm when metrics exceed preset thresholds, such as accuracy below 90% or response time exceeding 500ms.
8. The traffic flow prediction method based on the collaboration of machine learning and large models according to claim 1, characterized in that, In step S3, the intelligent routing scheduling strategy includes the following steps: First, strategy initialization: Based on historical task data and model performance data, train the routing decision model and determine the initial scheduling rules for different task types; Secondly, dynamic scheduling decision-making: receiving prediction task requests, identifying task types through task evaluation models; querying model performance monitoring data to determine whether the current model status meets task requirements; generating scheduling schemes; if a single model meets the requirements, directly calling the corresponding model; if a single model does not meet the requirements, such as insufficient accuracy of vertical small models in complex scenarios, triggering dual-model collaboration. Secondly, scheduling weight optimization: The scheduling weight is optimized based on the reinforcement learning algorithm, with the reward function being "maximizing prediction accuracy + minimizing response time". The state space includes task features and model performance indicators, and the action space includes model selection and weight allocation. The scheduling strategy is updated every 100 tasks. Finally, load balancing control: When the model routing detects that a certain model is overloaded, in this embodiment, when the CPU utilization rate is ≥80% and the memory utilization rate is ≥85%, some tasks are dynamically allocated to another model, or the model instance is expanded to ensure overall system load balancing.
9. The traffic flow prediction method based on the collaboration of machine learning and large models according to claim 1, characterized in that, In step S4, the implementation of the real-time interaction and feedback optimization includes the following steps: (I) Edge-Cloud Deployment Architecture: Edge Layer: Roadside units deploy edge computing devices to run vertical small models, data acquisition modules, and real-time prediction modules, and are responsible for local data processing and rapid response; Cloud Layer: Deploy cloud server clusters to run general large models, dataset management modules, global optimization modules, and decision feedback modules, and are responsible for model training, global analysis, and decision generation. (II) Data transmission protocol: Edge devices and cloud platforms interact with each other via MQTT 3.1.1 protocol, using TCP / IP transmission, with a message QoS level of 2 to ensure that messages are delivered exactly once, a transmission bandwidth of ≥100Mbps, and an end-to-end latency of ≤200ms; critical data is transmitted using AES-256 encryption to ensure data security. (III) Closed-loop optimization mechanism: Decision feedback: The cloud platform generates traffic control decisions based on the prediction results, including signal timing adjustment schemes, variable lane guidance information, and emergency response route planning, and pushes them to users and control terminals through V2X communication, traffic guidance screens, and navigation APP; Model iteration: Every 24 hours, the cloud platform collects real-time data and prediction errors uploaded by edge devices, and uses incremental learning algorithms to update the parameters of the general large model and vertical small model to ensure that the model adapts to the dynamic changes in traffic flow; Anomaly handling: When the edge device detects abnormal data collection or model operation failure, it automatically switches to the backup model or the cloud model to ensure continuous system operation.
10. The traffic flow prediction method based on the collaboration of machine learning and large models according to claim 1, characterized in that, This includes model performance evaluation steps, and the evaluation metrics include: Prediction accuracy indicators: mean absolute error, root mean square error, and mean absolute percentage error. Among them, mean absolute percentage error ≤ 10% is excellent, 10% < mean absolute percentage error ≤ 15% is good, and 15% < mean absolute percentage error ≤ 20% is acceptable. Real-time performance indicator: response time, which is the total time from receiving data to outputting the prediction result. A response time ≤ 300ms is excellent, 300ms < response time ≤ 500ms is good, and 500ms < response time ≤ 1000ms is acceptable. Robustness index: The decrease in prediction accuracy when the data missing rate is 10% / 20% / 30%. A decrease of ≤5% is excellent, 5% < decrease ≤10% is good, and 10% < decrease ≤15% is acceptable. Scalability index: The change in system response time when the number of new road segments (10 / 20 / 50) increases. A change of ≤10% is excellent, 10% < change ≤20% is good, and 20% < change ≤30% is acceptable.