Highway network multi-traffic flow spatio-temporal prediction method based on large language model
Patent Information
- Application Number
- CN202610759864.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-29
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2046-05-29
AI Technical Summary
然而,当处理大规模高速路网站点时,这些时空图神经网络在𝑁个节点上产生O(N2)复杂度也大幅增加
[0044] (1) This invention proposes a spatiotemporal prediction network model based on a hybrid expert architecture. In view of the extreme nonstationarity of the highway network, an invertible instance adaptive normalization is introduced. Combined with a parallel hybrid expert module based on node bias, it realizes efficient purification and weighted fusion of complex heterogeneous network features, and generates a preliminary prediction tensor that is highly adapted to the microstate of nodes. The global collaborative situation is aggregated upward through a cross-spatiotemporal cross attention mechanism and adaptively distributed downward to each local station.
Smart Images

Figure CN122336995B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of traffic flow prediction technology, specifically to a spatiotemporal prediction method for multivariate traffic flow in highway networks based on a large language model. Background Technology
[0002] Three main methods are used for highway traffic flow prediction: statistical analysis, machine learning, and deep learning. Early research utilized statistical analysis-based prediction methods to analyze historical traffic flow data to predict future traffic flow. However, the distribution of traffic flow across different regions and vehicle types on highways exhibits extreme non-stationarity. The effectiveness of these statistical analysis-based methods heavily relies on the assumption of data stationarity and requires high-quality historical data series. In recent years, machine learning has been widely applied in traffic flow prediction. Shallow machine learning techniques, such as support vector machines and random forests, have been used for traffic flow prediction. However, when faced with the large-scale and highly heterogeneous highway network, the spatiotemporal features extracted by these shallow techniques are relatively coarse, resulting in low prediction accuracy and generalization ability.
[0003] To improve prediction accuracy, researchers have attempted to apply deep learning models to their research. For example, studies have constructed spatiotemporal graph neural networks, such as DCRNN and STGCN, combining graph neural networks with sequence models to capture spatial and temporal dependencies. Later improvements included the introduction of graph attention mechanisms, temporal Transformers, and neural graph ODEs to improve short-term accuracy. However, when dealing with large-scale highway site locations, these spatiotemporal graph neural networks produce O(N) errors on 𝑁 nodes. 2 The complexity also increases significantly. Furthermore, existing research rarely delves into the impact of sudden traffic events, extreme weather, and holidays on the evolution of road network traffic flow. Drastic changes in these high-dimensional external environmental parameters often lead to abrupt changes in road network traffic, thus severely impacting the model's prediction accuracy.
[0004] In summary, existing technologies still have the following key shortcomings, which limit the performance and robustness of prediction systems in practical highway management applications:
[0005] (1) When dealing with the up and down traffic flow of different vehicle types on highways, existing traditional spatiotemporal graph neural networks often mix multiple variables as inputs, making it difficult to decouple the differentiated traffic flow patterns between different vehicle types, and are highly susceptible to interference from non-stationary data distributions. More seriously, when traditional spatial graph convolution is extended to large-scale road networks and long-term prediction, the computational resources and memory consumption increase exponentially, and it relies excessively on preset, fixed physical topology structures, making it difficult to adaptively capture long-distance dynamic relationships between nodes with similar traffic flow patterns but far apart in physical space. This results in the model facing serious bottlenecks in computational scalability and expressive power when dealing with complex road networks with strong temporal nonlinearity and spatial heterogeneity.
[0006] (2) Existing time series prediction models rely heavily on the historical sequence domain of pure numerical data. They are black-box systems lacking physical mapping and cannot effectively perceive and integrate high-dimensional external dynamic shocks such as sudden traffic events, extreme weather, and holidays. They also cannot provide engineering logic support behind the prediction results. In addition, although large language models have powerful multi-source data fusion and reasoning capabilities, traditional large language model fine-tuning relies only on discrete autoregressive cross-entropy loss. They lack sensitivity to continuous physical numerical absolute errors. Directly applying them to traffic flow prediction can easily produce numerical illusions and make it difficult to achieve logical interpretability. Summary of the Invention
[0007] To address the aforementioned shortcomings in existing technologies, this invention provides a spatiotemporal prediction method for multivariate traffic flow in highway networks based on a large language model. By integrating an innovative architecture that incorporates an adaptive spatiotemporal hybrid expert prediction network, multi-source knowledge fusion, and logical calibration of the large language model's thought chain, this method systematically overcomes the bottlenecks of existing technologies in areas such as complex heterogeneity modeling of highways, perception of high-dimensional external dynamic environments, and consistency of prediction results with engineering common sense.
[0008] To achieve the above-mentioned objectives, the technical solution adopted by this invention is as follows:
[0009] A spatiotemporal prediction method for multivariate traffic flow in highway networks based on a large language model includes the following steps:
[0010] Obtain historical multivariate traffic flow time series data for the target highway network;
[0011] Historical multivariate traffic flow time series data are input into a spatiotemporal prediction network model based on a hybrid expert architecture to obtain a preliminary prediction sequence of traffic flow within the prediction period.
[0012] Acquire external multi-source environmental data corresponding to the forecast period and transform the external multi-source environmental data into structured explicit physical indicators;
[0013] The preliminary prediction sequence, structured explicit physical indicators, and static attribute information of target stations in the target highway network are combined into structured prompt words.
[0014] The structured prompts are input into a fine-tuned large language model. The large language model is then used to output a final prediction result after calibrating the initial prediction sequence based on thought chain reasoning. The final prediction result includes logical deduction text and calibrated traffic flow prediction results.
[0015] Furthermore, the spatiotemporal prediction network model based on a hybrid expert architecture includes:
[0016] The channel independence processing module is used to decouple features from the input historical multivariate traffic flow time series data.
[0017] The parallel hybrid expert module is used to perform node-adaptive weighted fusion of decoupled features based on a dynamic gated routing mechanism to generate a deep spatiotemporal representation.
[0018] The bidirectional spatiotemporal attention module is used to capture the global spatiotemporal dependencies of the target highway network through a cross-attention mechanism based on a set of learnable virtual node proxies.
[0019] Furthermore, the channel independence processing module is specifically used for:
[0020] Reversible instance-level normalization is performed on historical multivariate traffic flow time series data along the time series dimension.
[0021] The normalized data is split into multiple independent feature flows according to the channel dimension corresponding to different traffic flow indicators;
[0022] Inject a learnable absolute position encoding vector into each historical time step;
[0023] Inject a learnable spatial topological feature embedding vector into each station in the target highway network.
[0024] Furthermore, the parallel hybrid expert module is specifically used for:
[0025] For the site At time step Input features Calculate its dynamic routing probability matrix ;in for, This is the routing weight matrix. For site adaptive parameters;
[0026] Input features Shared high-dimensional weight matrix After linear transformation and decomposition, gating activation is performed to obtain the expert output tensor. ;in To change the shape of a tensor, For the Sigmoid activation function, , This is the intermediate tensor obtained after splitting. The product of Hadama;
[0027] Using dynamic routing probability matrix Output tensor to experts Perform tensor contraction operation to obtain the fused features. As a representation of deep spatiotemporal space; among which To follow the expert dimension Perform weighted summation and retain feature dimensions Tensor contraction operation.
[0028] Furthermore, the bidirectional cross-temporal attention module is specifically used for:
[0029] Using learnable virtual node proxies as query vectors and deep spatiotemporal representations as key and value vectors, information from the entire network is aggregated to virtual node proxies through first attention computation.
[0030] Using deep spatiotemporal representation as the query vector and virtual node proxies with aggregated information as key and value vectors, global context information is distributed and fused back into the features of each site through second attention computation.
[0031] Furthermore, the spatiotemporal prediction network model based on the hybrid expert architecture uses multi-scale residual connections to alternately stack the channel independence processing module, the parallel hybrid expert module, and the bidirectional cross-spatiotemporal attention module.
[0032] Furthermore, acquiring external multi-source environmental data corresponding to the prediction period and transforming this data into structured explicit physical indicators includes:
[0033] The data-driven intelligent agent automatically collects and predicts external multi-source environmental data corresponding to the time period, wherein the external multi-source environmental data includes at least meteorological data and dynamic event tags;
[0034] By leveraging data-driven intelligent agents, semantic parsing is performed on collected external multi-source environmental data to generate a dictionary of physical indicators with clear engineering significance.
[0035] Furthermore, data-driven intelligent agents include:
[0036] The planning module is used to break down data acquisition requirements into atomic tasks;
[0037] Multiple dedicated automated operators are used to perform atomic tasks to collect raw data from different data sources;
[0038] The semantic parsing unit is used to parse the collected unstructured text and extract it into structured physical indicators.
[0039] Furthermore, the fine-tuning methods for large language models include:
[0040] Construct a fine-tuning dataset of thought chain instructions containing prior rules in the transportation domain; where the input of each sample is a structured cue word, and the output is a thought chain text containing standard logical reasoning steps and a final predicted numerical sequence.
[0041] A low-rank adaptive method combined with a joint loss function is used to fine-tune the pre-trained large language model.
[0042] Furthermore, the joint loss function includes a cross-entropy loss to constrain the logicality of the output text, and a mean squared error loss to constrain the accuracy of the output predicted numerical values.
[0043] The present invention has the following beneficial effects:
[0044] (1) This invention proposes a spatiotemporal prediction network model based on a hybrid expert architecture. In view of the extreme nonstationarity of the highway network, an invertible instance adaptive normalization is introduced. Combined with a parallel hybrid expert module based on node bias, it realizes efficient purification and weighted fusion of complex heterogeneous network features, and generates a preliminary prediction tensor that is highly adapted to the microstate of nodes. The global collaborative situation is aggregated upward through a cross-spatiotemporal cross attention mechanism and adaptively distributed downward to each local station.
[0045] (2) This invention proposes an interpretable fine-tuning method for prediction models based on multi-source knowledge injection of large model thinking chain. It relies on the OpenClaw engine to build a data-driven intelligent agent, automatically collects regional surface meteorological data and explicit physical indicators such as dynamic event labels, and jointly maps them with the backbone network's preliminary prediction tensor to semantic prompt. It innovatively constructs a joint loss fine-tuning mechanism based on semantic logic and explicit numerical dual constraints, guiding the large language model to carry out rigorous step-by-step deduction using knowledge representation and multi-step sequence generation logic. This mechanism performs secondary fine calibration on the preliminary prediction results, effectively avoiding the illusion of continuous numerical generation of large models, while significantly enhancing the real physical rationality of the final output and the interpretability of the prediction results. Attached Figure Description
[0046] Figure 1 This is a schematic diagram of the spatiotemporal prediction method for multivariate traffic flow in a high-speed road network based on a large language model, according to the present invention.
[0047] Figure 2This is a schematic diagram comparing the predicted uphill traffic flow of cars with the actual observed traffic flow.
[0048] Figure 3 This is a schematic diagram comparing the predicted downhill traffic flow of cars with the actual observed traffic flow.
[0049] Figure 4 This is a schematic diagram comparing the predicted uphill truck traffic flow of this invention with the actual observed traffic flow.
[0050] Figure 5 This is a schematic diagram comparing the predicted downhill truck traffic flow of this invention with the actual observed traffic flow. Detailed Implementation
[0051] The specific embodiments of the present invention are described below to enable those skilled in the art to understand the present invention. However, it should be understood that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the present invention as defined and determined by the appended claims. All inventions utilizing the concept of the present invention are protected.
[0052] like Figure 1 As shown in the figure, the present invention provides a method for spatiotemporal prediction of multivariate traffic flow in highway networks based on a large language model, comprising the following steps S1 to S5:
[0053] S1. Obtain historical multivariate traffic flow time series data of the target highway network;
[0054] S2. Input historical multivariate traffic flow time series data into a spatiotemporal prediction network model based on a hybrid expert architecture to obtain a preliminary prediction sequence of traffic flow within the prediction period.
[0055] In an optional embodiment of the present invention, step S2, constructing a spatiotemporal prediction network model based on a hybrid expert architecture, includes:
[0056] The channel independence processing module is used to decouple features from the input historical multivariate traffic flow time series data.
[0057] The parallel hybrid expert module is used to perform node-adaptive weighted fusion of decoupled features based on a dynamic gated routing mechanism to generate a deep spatiotemporal representation.
[0058] The bidirectional spatiotemporal attention module is used to capture the global spatiotemporal dependencies of the target highway network through a cross-attention mechanism based on a set of learnable virtual node proxies.
[0059] Specifically, the channel independence processing module is used for:
[0060] Reversible instance-level normalization is performed on historical multivariate traffic flow time series data along the time series dimension.
[0061] The normalized data is split into multiple independent feature flows according to the channel dimension corresponding to different traffic flow indicators;
[0062] Inject a learnable absolute position encoding vector into each historical time step;
[0063] Inject a learnable spatial topological feature embedding vector into each station in the target highway network.
[0064] The parallel hybrid expert module is specifically used for:
[0065] For the site At time step Input features Calculate its dynamic routing probability matrix ;in for, This is the routing weight matrix. For site adaptive parameters;
[0066] Input features Shared high-dimensional weight matrix After linear transformation and decomposition, gating activation is performed to obtain the expert output tensor. ;in To change the shape of a tensor, For the Sigmoid activation function, , This is the intermediate tensor obtained after splitting. The product of Hadama;
[0067] Using dynamic routing probability matrix Output tensor to experts Perform tensor contraction operation to obtain the fused features. As a representation of deep spatiotemporal space; among which To follow the expert dimension Perform weighted summation and retain feature dimensions Tensor contraction operation.
[0068] The bidirectional, cross-temporal attention module is specifically used for:
[0069] Using learnable virtual node proxies as query vectors and deep spatiotemporal representations as key and value vectors, information from the entire network is aggregated to virtual node proxies through first attention computation.
[0070] Using deep spatiotemporal representation as the query vector and virtual node proxies with aggregated information as key and value vectors, global context information is distributed and fused back into the features of each site through second attention computation.
[0071] This embodiment aims to construct a spatiotemporal prediction model capable of processing multivariate traffic flow data from large-scale highway networks. Its goal is to address the computational cost and memory consumption issues faced when performing multivariate time-series predictions at various stations in large-scale road networks, thereby improving the accuracy and computational efficiency of long-term predictions.
[0072] First, to address the non-stationarity of multi-dimensional time-series data on the uplink and downlink traffic of various vehicle types on the highway network, this embodiment performs independent instance-level standardization (reversible instance adaptive normalization) on the input multi-dimensional historical sequence along the time dimension. Based on channel independence, the traffic of different vehicle types and directions is decomposed into independent feature streams for parallel processing. At the same time, learnable location codes are injected into each time step to embed spatial topological features for each station.
[0073] This embodiment employs a reversible instance-adaptive normalization method to perform independent instance-level normalization on the input multivariate traffic history sequence along the time series dimension. To decouple complex features between different vehicle types or traffic indicators, the model decomposes multivariate time-series data features into independent feature streams based on channel independence. Subsequently, the system abandons traditional manual timestamp encoding and introduces a learnable absolute position encoding network to dynamically inject position identifiers into each discrete time step. In addition, a node spatial embedding vector is introduced. This mechanism can accurately distinguish traffic flow patterns of different toll station entities and different vehicle types distributed in a unified latent space on the highway network.
[0074] Then, given the strong temporal nonlinearity and spatial heterogeneity of road network traffic, this embodiment designs a dynamic gated routing mechanism to calculate the expert assignment probabilities related to each station in order to efficiently integrate node-specific knowledge. It also constructs a parallel expert database with a shared high-dimensional weight matrix. Through tensor partitioning, gated activation, and shrinkage operations, efficient and adaptive fusion of multi-expert knowledge is achieved. This embodiment constructs a parallel hybrid expert module based on dynamic gated routing to calculate a station-specific dynamic routing probability matrix for the current input features.
[0075] ;
[0076] in, For normalization function, This is the routing weight matrix. For site adaptive parameters; by fusing specific site adaptive parameters This enables the routing allocation strategy to have node-aware capabilities. Subsequently, the parallel hybrid expert module is activated, and the input features are distributed to an expert pool composed of multiple independent neural networks equipped with gated linear units. To avoid computational inefficiency caused by independent computation by multiple experts, the system merges the feature maps into a high-dimensional fully connected layer and performs tensor splitting and nonlinear gated activation.
[0077] ;
[0078] ;
[0079] in, and High-dimensional weights and biases shared by all experts. To divide the tensor equally along the feature dimension, To modify the shape of a tensor, thereby generating a three-dimensional tensor containing independent expert dimensions. ; For the Sigmoid activation function, , This is the intermediate tensor obtained after splitting. The product of Hadama;
[0080] Finally, the local outputs of each expert are subjected to tensor shrinkage operations based on the routing probability matrix to obtain the expert output tensor:
[0081] ;
[0082] in, To change the shape of a tensor, For the Sigmoid activation function, , This is the intermediate tensor obtained after splitting. It is a Hadamard product; thereby achieving adaptive weighted fusion of multi-domain expert knowledge and outputting a deep temporal representation that is highly adapted to the current node.
[0083] Secondly, to address the exponentially increasing resource demands of traditional spatial graph convolution when processing large-scale long-term graph prediction, this embodiment introduces a set of learnable virtual node proxies S to capture global spatiotemporal dependencies with low complexity. First, using S as the query and the features of each site as the key, information from the entire network is aggregated to S through cross-attention. Then, using the features of each site as the query and the aggregated S as the key, the global context is distributed back to each site through attention, forming a bidirectional information flow.
[0084] This embodiment innovatively introduces a set of high-dimensional learnable node proxies. A bidirectional, spatiotemporal attention graph is constructed. This is achieved by using the feature matrices of all sites across the entire network. Generate key-value pairs via linear projection And project the virtual proxy nodes into query vectors. By calculating the cross-attention score of the scaled dot product, local information scattered across various nodes in the road network is aggregated upwards into the proxy node pool, thereby macroscopically extracting the collaborative features of the entire network. The aggregated attention matrix is calculated as follows:
[0085]
[0086] ,
[0087] in, and This is a learnable projection weight matrix. By calculating cross-attention scores, local information scattered across various nodes in the road network is aggregated upwards to the proxy node pool, thereby macroscopically extracting the collaborative features of the entire network.
[0088] Subsequently, the proxy node carrying global information is used as the key-value pair. The characteristics of each local site are used as query vectors Distribute the attention matrix The calculation is as follows:
[0089]
[0090] ,
[0091] in, and The projection weight matrix is learnable. Through the dot product attention mechanism, global context features are accurately and adaptively distributed downwards and fused back to each local station, enabling nodes with high similarity in traffic flow patterns but far apart in physical space to form strong associations in the implicit topology graph.
[0092] Finally, the aforementioned hybrid expert module and adaptive graph proxy network employ multi-scale residual connection technology, alternately stacked within the model to form a multi-level feature iteration space. At the output terminal, the multi-scale features captured across layers are fully concatenated and stitched along the channel dimension, input into the multilayer perceptron, and mapped to generate a standard prediction sequence within a specified future time window. Finally, the normalized inverse operator is invoked to perform physical dimension inversion, utilizing the statistical mean and variance cached in the input stage to restore the relative features of the latent space to the true physical dimension domain of the road network, outputting preliminary multivariate traffic flow predictions.
[0093] This embodiment addresses the multivariate time-series traffic flow of various vehicle types on highways. Based on channel independence constraints, instance normalization is used to achieve independent standardization of each sequence. Subsequently, the mixed multidimensional traffic features are decoupled and decomposed. Simultaneously, learnable absolute position codes are adaptively injected into each discrete historical time step to supplement temporal dependency information. Spatial topological features are embedded and encoded for each node in the highway network to obtain the initial input feature sequence for the prediction model, providing a foundation for subsequent dynamic routing, hybrid expert, and global attention prediction. Furthermore, a dynamic routing probability matrix with node-aware capabilities is calculated, activating the parallel hybrid expert module to perform feature extraction and weighted fusion. Finally, a high-dimensional learnable virtual node agent is established. By calculating cross-attention and dot-product attention, the upward aggregation and downward adaptive distribution of global traffic features across the entire network are achieved, generating an implicit topology graph unrestricted by physical distance. Then, through multi-scale traffic feature fusion and splicing, and by performing inverse reconstruction calculations on the previous reversible normalization results, preliminary traffic flow prediction values are generated.
[0094] This embodiment addresses the strong non-stationarity and feature confusion issues of traffic flow data for different vehicle types on highways. It introduces a channel independence mechanism to decompose multi-dimensional temporal features into independent feature streams, achieving physical-semantic decoupling of heterogeneous traffic flows. To overcome the technical shortcomings of traditional spatial graph convolution, which relies excessively on fixed physical topology and whose resource consumption increases exponentially with graph size, a dynamic-gated parallel hybrid expert module is designed. This system merges multi-expert feature mappings into a high-dimensional tensor contraction operation, significantly overcoming the bottleneck of computational resource consumption and accurately capturing the complex spatiotemporal evolution patterns of large-scale road networks. Furthermore, it innovatively introduces high-dimensional learnable virtual nodes and a bidirectional cross-spatiotemporal graph attention mechanism into the backbone network, overcoming the obstacle of traditional Euclidean distance and achieving adaptive perception of global traffic flow patterns with extremely low computational complexity.
[0095] S3. Obtain external multi-source environmental data corresponding to the prediction period and transform the external multi-source environmental data into structured explicit physical indicators;
[0096] In an optional embodiment of the present invention, step S3 includes:
[0097] The data-driven intelligent agent automatically collects and predicts external multi-source environmental data corresponding to the time period, wherein the external multi-source environmental data includes at least meteorological data and dynamic event tags;
[0098] By leveraging data-driven intelligent agents, semantic parsing is performed on collected external multi-source environmental data to generate a dictionary of physical indicators with clear engineering significance.
[0099] Data-driven intelligent agents include:
[0100] The planning module is used to break down data acquisition requirements into atomic tasks;
[0101] Multiple dedicated automated operators are used to perform atomic tasks to collect raw data from different data sources;
[0102] The semantic parsing unit is used to parse the collected unstructured text and extract it into structured physical indicators.
[0103] To achieve automated and structured acquisition of heterogeneous data from multiple external sources, this embodiment designs an OpenClaw data-driven agent. Driven by a large model, it calls specialized operators to crawl data and utilizes the semantic parsing capabilities of the large model to transform unstructured text into an explicit physical indicator dictionary. This embodiment establishes a data-driven agent by deploying the OpenClaw automated data acquisition and fusion engine, automatically collecting regional meteorological data and explicit physical indicators such as emergency / holiday tags from various nodes of the Hunan expressway network.
[0104] Specifically, given that the core computation flow of the aforementioned spatiotemporal prediction network model based on a hybrid expert architecture only seeks evolution patterns within the pure numerical time series data domain and lacks the ability to perceive high-dimensional external factors such as sudden events, meteorological environment, and inherent attributes of road and station sites, this embodiment aims to introduce generalized environmental parameters and use a large language model to perform interpretable secondary fine-tuning on the initial prediction results output by the model.
[0105] This embodiment introduces OpenClaw to establish a data-driven intelligent agent and an automated data acquisition and fusion engine, performing multi-dimensional collaborative data collection within the training and prediction time window. The OpenClaw data-driven intelligent agent receives input data based on requirements, which is automatically broken down and routed to corresponding automated operators by a planning module driven by a large language model. For example, it calls the meteorological monitoring network crawling operator to acquire regional meteorological data; and it calls the traffic event aggregation operator to crawl dynamic event tags such as sudden traffic accidents and holidays. For the crawled, complex unstructured web pages or natural language text, the agent's built-in deep semantic parsing skills based on a large language model are activated. Through powerful entity recognition and extraction capabilities, complex road condition reports or lengthy weather forecasts are forcibly reduced in dimensionality and rigorously transformed into explicit physical indicators with clear engineering guidance significance. The cleaned explicit physical indicators (such as regional weather data, dynamic event tags such as sudden traffic accidents / holidays, etc.) are packaged into dictionary objects and jointly mapped with the preliminary prediction values output by the front-end network into a unified semantic space, accurately injected into the corresponding slots to form structured prompt words. This approach completely avoids the ambiguity of black-box implicit representations, providing an absolutely objective external data foundation for subsequent fine-tuning. The following is the core instruction design for the large model at this stage:
[0106] "<|begin_of_text|><|start_header_id|>system<|end_header_id|>;
[0107] You are a professional highway traffic flow refiner.
[0108] Refine:
[0109] 1. Station: {Spatial topology hierarchy of the target toll station and static attribute matrix of surrounding POIs};
[0110] 2. Feature: {Specific traffic flow indicators under the current channel independence, such as: passenger car upbound traffic flow};
[0111] 3. Time: {Prediction start time} to {Prediction end time} | DayType: {Weekday / Holiday};
[0112] 4. Flow Pattern: {Description of the fluctuation evolution pattern of historical and nearby sequences};
[0113] 5. Weather: {Regional spatial meteorological characteristics, such as: regional areal rainfall coverage, weather warning level};
[0114] 6. Event: {Dynamic emergency event tags, such as: road construction, traffic accident warning};
[0115] 7. Preliminary prediction results: {Preliminary predicted numerical tensors output by the hybrid expert spatiotemporal prediction network};
[0116] <|eot_id|><|start_header_id|>assistant<|end_header_id|>".
[0117] S4. Combine the preliminary prediction sequence, structured explicit physical indicators, and static attribute information of target stations in the target highway network into structured prompt words.
[0118] In an optional embodiment of the present invention, step S4 jointly maps the collected multi-source environmental parameters and the preliminary traffic flow prediction tensor output by the backbone network to a unified semantic space to generate structured core prompt words.
[0119] S5. Input the structured prompt words into the fine-tuned large language model, and use the large language model to output the final prediction result after calibrating the preliminary prediction sequence based on the thought chain reasoning. The final prediction result includes the logical deduction text and the calibrated traffic flow prediction result.
[0120] In an optional embodiment of the present invention, the fine-tuning method of the large language model includes:
[0121] Construct a fine-tuning dataset of thought chain instructions containing prior rules in the transportation domain; where the input of each sample is a structured cue word, and the output is a thought chain text containing standard logical reasoning steps and a final predicted numerical sequence.
[0122] A low-rank adaptive method combined with a joint loss function is used to fine-tune the pre-trained large language model.
[0123] The joint loss function includes cross-entropy loss, which constrains the logicality of the output text, and mean squared error loss, which constrains the accuracy of the output predicted values.
[0124] To enable interpretable numerical calibration of the large model, this embodiment combines information instructions such as target station attributes, dynamic event labels, meteorological conditions, and preliminary predicted values. It then integrates these with the thought chain reasoning process to construct a thought chain instruction fine-tuning dataset containing prior rules from the transportation domain. Low-rank adaptive techniques are employed to fine-tune the large model, and a joint loss function is designed to constrain both the logical consistency of the output thought chain text (cross-entropy loss) and the accuracy of the final parsed predicted values (mean squared error loss).
[0125] To guide the large language model to strictly follow the evolutionary logic of traffic engineering in its step-by-step deduction, this embodiment constructs an explicit thought chain instruction fine-tuning dataset that integrates prior traffic operation rules. For example, passenger car traffic is significantly affected by weather, time of day, holidays, GDP, population, and special events; truck traffic decreases during holiday traffic restrictions; sunny days, holidays, peak hours, and high GDP areas lead to increased passenger car traffic; rain, snow, fog, nighttime, and low GDP areas lead to decreased passenger car traffic; and upward and downward traffic generally follow the same trend. Based on the above rule system, the multi-source objective environmental indicators obtained by OpenClaw are assembled with the preliminary predictions of the pre-built hybrid expert model to synthesize fine-tuning sample pairs with rigorous causal logic in batches. The output of the fine-tuning samples is strictly limited to thought chain reasoning text containing standard logical steps.
[0126] This embodiment incorporates the previously established large-scale traffic prediction model into a large-scale language model, fine-tuning it using a low-rank adaptive method. Simultaneously, it introduces a mean squared error loss constraint to ensure the predicted traffic approximates the actual physical observations, forming a joint loss function with dual constraints of textual logic and numerical accuracy, thus avoiding the illusion of continuously generated numerical values. When deploying the fine-tuned large-scale language model inference service, after receiving a high-speed traffic test set and structured prompts, the large-scale language model is forced to activate its structured thought chain. Through logically consistent deduction of macro and micro traffic mechanisms, it ultimately outputs interpretable text and high-precision traffic prediction values that are supported by rigorous engineering logic.
[0127] This embodiment, after constructing the structured thought chain instruction fine-tuning dataset, combines low-rank adaptive fine-tuning to fine-tune the large language model, resulting in a final output with a detailed logical evolution process for the fine-tuned prediction. Furthermore, it employs a combined fine-tuning loss of cross-entropy loss and mean squared error loss, with cross-entropy loss... The system employs a dedicated thought chain text to constrain the output, ensuring a high degree of logical consistency between the reasoning steps and expert annotation instructions. Simultaneously, the system removes the textual attributes from the final quantitative correction results, parsing them into purely explicit numerical indicators and utilizing mean squared error loss. Calculate the quadratic variance between the predicted value and the true value directly. Overall loss function. Defined as:
[0128]
[0129] This dual-constraint mechanism mandates that large language models, while generating high-quality explanatory text, must accurately approximate absolute traffic flow indicators with clear physical meaning. This effectively avoids the numerical illusion phenomenon that can easily occur when simple language models generate continuous numerical values. Ultimately, by outputting structured white-box inference text, this mechanism not only improves the accuracy of numerical predictions but also provides traffic management departments with an evolutionary mechanism explanation and early warning basis supported by rigorous engineering logic.
[0130] This embodiment addresses the shortcomings of traditional spatiotemporal prediction models, which only search for patterns within pure numerical sequences and lack the ability to perceive high-dimensional external environments. It introduces the OpenClaw automated data acquisition and fusion engine to perform comprehensive collaborative collection of multi-source heterogeneous data, such as sudden traffic accidents and weather data, and rigorously transforms this data into input prompts for a large-scale model. To address the black-box limitations of traditional deep learning models due to the lack of engineering knowledge representation, this invention introduces the powerful sequence generation and multi-source knowledge capabilities of large language models into the prediction calibration stage. By constructing a structured prompt engineering model, external environmental indicators and the preliminary numerical prediction results of a hybrid expert network are mapped to a unified semantic space. This forcibly activates the structured thought chain reasoning paradigm of the large-scale model. Combined with a joint loss fine-tuning mechanism of semantic logic and explicit numerical values, this effectively avoids the illusion of continuous numerical generation while providing interpretable traffic flow predictions with rigorous engineering logic support for traffic management.
[0131] This invention demonstrates significant and comprehensive benefits in urban rail transit passenger flow forecasting, particularly in scenarios facing data challenges and requiring extremely high forecast reliability. To verify the method of this invention, we conducted experiments on the Hunan Province expressway traffic flow dataset. This dataset includes traffic flow data for cars and trucks traveling in both directions at 157 stations, with a sampling granularity of 1 hour.
[0132] First, the prediction results of the spatiotemporal prediction network for multivariate traffic flow in high-speed road networks based on a hybrid expert model. Figures 2 to 5 The temporal changes of the predicted values (red dashed lines) of the traffic flow for cars going up and down, trucks going up and down, and actual observed traffic flow (blue solid lines) of the present invention were compared with those of the actual traffic flow over a time window.
[0133] Finally, through the domain knowledge injection module, the preliminary numerical prediction results of the multi-dimensional traffic flow spatiotemporal prediction network based on the hybrid expert model, along with external information descriptions generated based on OpenClaw (including the current prediction time period, weather information, emergency information, holiday information, etc.), are jointly encoded into structured prompt words. The reasoning ability of the large language model is then used to perform a secondary calibration of the preliminary prediction results. This innovative design ensures that the final output conforms to real-world constraints, avoiding the possibility of predictions that violate real-world constraints due to a lack of domain knowledge in traditional numerical models. This makes the prediction results closer to reality, significantly enhancing the model's interpretability and prediction accuracy.
[0134] Next, to further demonstrate the effectiveness and advancement of the proposed large-model-based highway traffic flow prediction method, the mainstream large-model-based time series prediction models Lag-Llama and MOMENT were selected as comparative methods. Taking the upbound and downbound traffic flows of cars / trucks in the highway network as the prediction objects, the mean absolute error (MAE), root mean square error (RMSE), and mean absolute percentage error (MAPE) were used as evaluation indicators for comparative experiments. The results are shown in Table 1. The experimental results show that the proposed method achieved the best prediction performance in all test scenarios. In the scenario of predicting upbound and downbound traffic flows of cars, compared with the Lag-Llama and MOMENT models, the MAE, RMSE, and MAPE indicators of the proposed method were significantly reduced. Specifically, the MAPE indicator for upbound traffic flow prediction decreased from 61.41% and 22.94% to 18.08%, and the MAPE indicator for downbound traffic flow prediction decreased from 63.32% and 119.24% to 18.44%, significantly improving prediction accuracy and stability.
[0135] Meanwhile, considering the complex and highly volatile nature of truck traffic flow patterns, the method of this invention still maintains significant advantages. Compared to the comparative model, the MAE index is reduced by approximately 20%–60%, the RMSE index by approximately 30%–58%, and the MAPE index by approximately 10%–30%, demonstrating good robustness and generalization ability. In summary, the method of this invention effectively overcomes the problems of large errors and poor stability in traffic flow prediction of traditional large models by efficiently modeling and capturing the temporal characteristics of highway network traffic flow. The prediction accuracy and generalization ability are significantly better than existing mainstream methods, verifying the advanced nature and practicality of the technical solution of this invention.
[0136] Table 1 Comparison of prediction results of various methods
[0137]
[0138] The results of implementation in prediction tasks show that the method proposed in this invention improves the accuracy of traffic flow prediction for highway networks in scenarios with data challenges and extremely high requirements for prediction reliability. It also provides interpretable decision-making basis, which helps to improve the overall operational efficiency and service quality of highway traffic systems. It has broad application prospects and significant socio-economic benefits.
[0139] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0140] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0141] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0142] Specific embodiments have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.
[0143] Those skilled in the art will recognize that the embodiments described herein are intended to help the reader understand the principles of the invention, and should be understood that the scope of protection of the invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific modifications and combinations based on the technical teachings disclosed in this invention without departing from the spirit of the invention, and these modifications and combinations are still within the scope of protection of this invention.
Claims
1. A method for spatiotemporal prediction of multivariate traffic flow in highway networks based on a large language model, characterized in that, Includes the following steps: Obtain historical multi-dimensional traffic flow time series data for each vehicle type in both directions for the target highway network; Historical multivariate traffic flow time series data are input into a spatiotemporal prediction network model based on a hybrid expert architecture to obtain a preliminary prediction sequence of traffic flow for different vehicle types and directions within the prediction period. Spatiotemporal prediction network models based on hybrid expert architecture include: The channel independence processing module is used to decouple the features of the input multi-dimensional traffic flow time series data for each vehicle type in both directions; The parallel hybrid expert module is used to perform node-adaptive weighted fusion of decoupled features based on a dynamic gated routing mechanism to generate a deep spatiotemporal representation. A bidirectional spatiotemporal attention module is used to capture the global spatiotemporal dependencies of the target highway network based on a set of learnable virtual node proxies through the first and second cross-attention mechanisms. The channel independence processing module is specifically used for: Reversible instance-level adaptive normalization is performed on historical multivariate traffic flow time series data along the time series dimension. The normalized data is split into multiple independent feature flows according to the channel dimension corresponding to different traffic flow indicators; Inject a learnable absolute position encoding vector into each historical time step; Inject a learnable spatial topological feature embedding vector into each station in the target highway network; The parallel hybrid expert module is specifically used for: For the site At time step Input features Calculate its dynamic routing probability matrix ;in For normalization function, This is the routing weight matrix. For site adaptive parameters; Input features Shared high-dimensional weight matrix After linear transformation and decomposition, gating activation is performed to obtain the expert output tensor. ;in To change the shape of a tensor, For the Sigmoid activation function, , This is the intermediate tensor obtained after splitting. The product of Hadama; Using dynamic routing probability matrix Output tensor to experts Perform tensor contraction operation to obtain the fused features. As a representation of deep spatiotemporal space; among which To follow the expert dimension Perform weighted summation and retain feature dimensions Tensor contraction operation; The bidirectional, cross-temporal attention module is specifically used for: Using learnable virtual node proxies as query vectors and deep spatiotemporal representations as key and value vectors, information from the entire network is aggregated to virtual node proxies through first attention computation. Using deep spatiotemporal representation as the query vector and virtual node proxies with aggregated information as the key and value vectors, global context information is distributed and fused back into the features of each site through second attention computation. Data-driven intelligent agents are used to acquire external multi-source environmental data corresponding to the prediction period, and the external multi-source environmental data is transformed into structured explicit physical indicators. The preliminary prediction sequence, structured explicit physical indicators, and static attribute information of target stations in the target highway network are combined into structured prompt words. Structured prompts are input into a fine-tuned large language model. The large language model, based on thought chain reasoning, outputs a final prediction result after calibrating the initial prediction sequence. The final prediction result includes logical deduction text and calibrated traffic flow prediction results. The fine-tuning method of the large language model includes: constructing a thought chain instruction fine-tuning dataset containing prior rules in the traffic domain; wherein the input of each sample is a structured prompt, and the output is a thought chain text containing standard logical reasoning steps and a final prediction numerical sequence; and a low-rank adaptive method combined with a joint loss function is used to fine-tune the pre-trained large language model.
2. The method for spatiotemporal prediction of multivariate traffic flow in highway networks based on a large language model according to claim 1, characterized in that, The spatiotemporal prediction network model based on a hybrid expert architecture uses multi-scale residual connections to alternately stack the channel independence processing module, the parallel hybrid expert module, and the bidirectional cross-spatiotemporal attention module.
3. The method for spatiotemporal prediction of multivariate traffic flow in high-speed networks based on a large language model according to claim 1, characterized in that, Acquiring external multi-source environmental data corresponding to the forecast period and transforming this data into structured explicit physical indicators includes: The data-driven intelligent agent automatically collects and predicts external multi-source environmental data corresponding to the time period. The external multi-source environmental data includes at least regional meteorological data of each node of the highway network and emergency / holiday tags. By leveraging data-driven intelligent agents, semantic parsing is performed on collected external multi-source environmental data to generate a dictionary of physical indicators with clear engineering significance.
4. The spatiotemporal prediction method for multivariate traffic flow in highway networks based on a large language model according to claim 3, characterized in that, Data-driven intelligent agents include: The planning module is used to break down data acquisition requirements into atomic tasks; Multiple dedicated automated operators are used to perform atomic tasks to collect raw data from different data sources; The semantic parsing unit is used to parse the collected unstructured text and extract it into structured physical indicators.
5. The method for spatiotemporal prediction of multivariate traffic flow in highway networks based on a large language model according to claim 1, characterized in that, The joint loss function includes cross-entropy loss, which constrains the logicality of the output text, and mean squared error loss, which constrains the accuracy of the output predicted numerical values.
Citation Information
Patent Citations
Multi-mode space-time traffic flow modeling method supporting large-scale road network real-time prediction
CN120337795A
City calculation basic model and equipment based on Mama time sequence
CN120804586A
Space-time sensing subway passenger flow prediction method based on large model and multi-source information fusion
CN121543042A
Energy short-term load prediction method and system based on SE-Block improved Transform
CN121765658A