Traffic flow prediction method, system and medium based on spatiotemporal large language model

By constructing a spatiotemporal encoder and action chain instructions, the hallucination problem of large language models in traffic flow prediction is solved, the prediction accuracy and efficiency are improved, and the computational cost is reduced.

CN120071606BActive Publication Date: 2025-09-23SOUTH CHINA UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510008362.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-03
Publication Date
2025-09-23
Estimated Expiration
2045-01-03

AI Technical Summary

Technical Problem

Large language models suffer from hallucination problems in traffic flow prediction, especially when data is sparse and of insufficient quality, resulting in decreased prediction accuracy and high computational cost.

Method used

By constructing a spatiotemporal encoder based on recurrent neural networks and graph neural networks to encode traffic flow data, combined with preset alignment modules and action chain instructions, the hallucinations of large language models can be alleviated and prediction accuracy can be improved.

Benefits of technology

Accurate spatiotemporal predictions are achieved under large language models, which improves the accuracy and efficiency of traffic flow predictions and reduces computational costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120071606B_ABST
    Figure CN120071606B_ABST
Patent Text Reader

Abstract

The present invention discloses a traffic flow prediction method, system and medium based on a spatiotemporal large language model, comprising: obtaining traffic flow data to be predicted; constructing a spatiotemporal encoder based on a recurrent neural network and a graph neural network, encoding the traffic flow data to be predicted through the spatiotemporal encoder to obtain a first spatiotemporal feature; aligning the first spatiotemporal feature through an alignment module to obtain a second spatiotemporal feature, so as to align the dimensions of the spatiotemporal encoder and the large language model; obtaining a traffic flow prediction result through the large language model according to the second spatiotemporal feature and the constructed action chain instructions. The present invention designs a spatiotemporal encoder to help the large language model fully understand and mine the complex spatiotemporal patterns of different scenarios, and then introduces action chain instructions and alignment modules to alleviate the hallucinations of the large language model. It can achieve accurate spatiotemporal prediction under a frozen large language model, improve the accuracy of traffic flow prediction based on the large language model, and can be widely used in the field of data processing technology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a traffic flow prediction method, system and medium based on a spatiotemporal large language model. Background Art

[0002] With the rapid development of the Internet of Vehicles (IoV), the penetration rate of autonomous driving is increasing, demonstrating tremendous potential for achieving high-level intelligent transportation. The realization of high-level intelligent transportation relies on accurate perception of the dynamic nature of large-scale environments. Fully understanding the dynamic characteristics of transportation systems that change over time and space, and predicting and analyzing their spatiotemporal patterns and trends, are crucial for urban intelligence. Specifically, accurate traffic flow forecasting can effectively improve vehicle efficiency, reduce congestion, and achieve high-quality intelligent transportation.

[0003] With the development of deep learning, from using convolutional neural networks for regional grid-based traffic flow prediction to graph neural network (GNN)-based traffic flow prediction that considers non-Euclidean distances in road networks, traffic flow prediction tasks have shown an increasing emphasis on capturing changes in network structure. In particular, the spatial graph structure of traffic road networks exhibits significant changes over time. The differences in the properties of the same traffic area at different times affect surrounding traffic areas and even the entire system, as demonstrated in numerous studies. At the same time, large language models (LLMs), with their powerful learning capabilities and generalization, have gradually become a research hotspot. Incorporating GNN-based models into LLMs significantly improves the accuracy of spatiotemporal predictions. However, integrating GNN-based models into LLMs and applying them to traffic flow prediction still presents challenges.

[0004] While large language models have achieved astonishing results across various industries, they inevitably face the problem of hallucinations. Issues such as data sparsity and data quality make it easy for general-purpose large language models to produce "serious nonsense" in various downstream tasks. Specifically, using large language models directly for spatiotemporal prediction inference can produce hallucinations. Partially fine-tuning large language models in the absence of high-quality data can also produce hallucinations, but full fine-tuning incurs prohibitive computational costs. Summary of the Invention

[0005] In order to solve the above technical problems, the purpose of the present invention is to provide a traffic flow prediction method, system and medium based on a spatiotemporal large language model with high accuracy.

[0006] To achieve the above objectives, one aspect of the present invention provides a traffic flow prediction method based on a spatiotemporal large language model, comprising the following steps:

[0007] Obtain traffic flow data to be predicted;

[0008] Constructing a spatiotemporal encoder based on a recurrent neural network and a graph neural network, and encoding the traffic flow data to be predicted by the spatiotemporal encoder to obtain a first spatiotemporal feature;

[0009] Performing feature alignment on the first spatiotemporal features using a preset alignment module to obtain second spatiotemporal features, so as to align the spatiotemporal encoder and the large language model dimension;

[0010] An action chain instruction is constructed, and a traffic flow prediction result is obtained by using the large language model according to the second spatiotemporal feature and the action chain instruction.

[0011] In some embodiments, encoding the traffic flow data to be predicted by the spatiotemporal encoder to obtain the first spatiotemporal feature specifically includes:

[0012] Inputting the traffic flow data to be predicted into the spatiotemporal encoder;

[0013] Performing spatial encoding on the traffic flow data to be predicted by using the graph neural network to obtain spatial features;

[0014] Time encoding the traffic flow data to be predicted is performed by the recurrent neural network to obtain a time feature;

[0015] The spatial feature and the temporal feature are nonlinearly connected to obtain the first spatiotemporal feature.

[0016] In some embodiments, the time encoding of the traffic flow data to be predicted by the recurrent neural network to obtain time features specifically includes:

[0017] Extracting features of the traffic flow data to be predicted through a gated dilated convolutional layer in the recurrent neural network to obtain multi-scale time features;

[0018] The multi-scale time features are correlated and merged through a cross-scale correlation layer in the recurrent neural network to obtain the time features.

[0019] In some embodiments, performing feature alignment on the first spatiotemporal features by a preset alignment module to obtain the second spatiotemporal features specifically includes:

[0020] Inputting the first spatiotemporal feature into the alignment module, and then projecting the first spatiotemporal feature to obtain a spatiotemporal label;

[0021] Performing mapping analysis on the spatiotemporal markers to obtain a hidden representation;

[0022] The spatiotemporal tag and the hidden representation are mapped and concatenated to obtain the second spatiotemporal feature.

[0023] In some embodiments, the constructing action chain instruction specifically includes:

[0024] Build logical guidance templates and step-by-step decomposition guidance templates;

[0025] Acquiring regional information, time information, and weather data from the traffic flow data to be predicted, and determining a marking character;

[0026] The action chain instruction is constructed according to the logic guidance template, the step-by-step decomposition guidance template, the area information, the time information, the weather data and the marking character.

[0027] In some embodiments, the multi-scale time feature is obtained by the following formula:

[0028]

[0029] in, represents the multi-scale temporal features, represents the convolution kernel and and represents a one-dimensional convolution kernel and and Indicates bias and k represents the number of one-dimensional convolution kernels and k = [1, 2, 3, 4], l represents the number of layers, D f Indicates the number of the first channel, D tr Indicates the number of the second channel, represents the spatial feature, [·] represents the concatenation operation, ⊙ represents the Hadamard product, and σ3 and σ4 represent activation functions.

[0030] In some embodiments, the second spatiotemporal feature is obtained by mapping and concatenating the spatiotemporal tag and the hidden representation using the following formula:

[0031]

[0032] in, represents the second spatiotemporal feature, pr represents the space-time label, Γ hi represents the hidden representation and C represents the number of initial channels, N represents the number of spatial nodes, and D L represents the number of third channels, σ5 represents the activation function, W1, W2 and W3 represent the mapping operation and D brepresents the number of the fourth channel, β represents the output step size, and [·,·] represents the concatenation operation.

[0033] To achieve the above objectives, another aspect of the present application provides a traffic flow prediction system based on a spatiotemporal language model, comprising:

[0034] A data acquisition module, used to obtain traffic flow data to be predicted;

[0035] a spatiotemporal feature encoding module, configured to construct a spatiotemporal encoder based on a recurrent neural network and a graph neural network, and encode the traffic flow data to be predicted by the spatiotemporal encoder to obtain a first spatiotemporal feature;

[0036] A feature alignment module, configured to perform feature alignment on the first spatiotemporal features using a preset alignment module to obtain second spatiotemporal features, so as to align the spatiotemporal encoder and the large language model dimensions;

[0037] The instruction construction and result prediction module is used to obtain a traffic flow prediction result based on the second spatiotemporal feature and the action chain instruction through the large language model.

[0038] To achieve the above-mentioned purpose, another aspect of an embodiment of the present application proposes an electronic device, which includes a memory, a processor, a program stored on the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory. When the program is executed by the processor, the traffic flow prediction method based on the spatiotemporal large language model as described above is realized.

[0039] To achieve the above-mentioned purpose, another aspect of an embodiment of the present application proposes a storage medium, which is a computer-readable storage medium for computer-readable storage. The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the traffic flow prediction method based on the spatiotemporal large language model as described above.

[0040] The beneficial effects of the present invention are as follows: the traffic flow prediction method and system based on the spatiotemporal large language model of the present invention first obtains the traffic flow data to be predicted, then constructs a spatiotemporal encoder based on a recurrent neural network and a graph neural network, encodes the traffic flow data to be predicted through the spatiotemporal encoder to obtain a first spatiotemporal feature, and then performs feature alignment on the first spatiotemporal feature through a preset alignment module to obtain a second spatiotemporal feature, and finally constructs an action chain instruction, and obtains a traffic flow prediction result through the large language model according to the second spatiotemporal feature and the action chain instruction. The present invention designs a spatiotemporal encoder to help the large language model fully understand and mine the complex spatiotemporal patterns of different scenarios, and then introduces action chain instructions and alignment modules to alleviate the hallucinations of the large language model, which can achieve accurate spatiotemporal prediction under a frozen large language model and improve the accuracy of traffic flow prediction based on the large language model. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following introduction is made to the drawings required for use in the embodiments of the present invention. It should be understood that the drawings introduced below are only for the convenience of clearly describing some embodiments of the technical solutions of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative work.

[0042] Figure 1 A flow chart of the steps of a traffic flow prediction method based on a spatiotemporal language model provided by an embodiment of the present invention;

[0043] Figure 2 A flow chart of a traffic flow prediction method based on a spatiotemporal large language model provided by an embodiment of the present invention;

[0044] Figure 3 A schematic diagram of the structure of a traffic flow prediction system based on a spatiotemporal language model provided by an embodiment of the present invention;

[0045] Figure 4 A schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. They are merely examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the appended claims.

[0047] It will be understood that the terms "first", "second", etc. used in this application may be used herein to describe various concepts, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0048] The terms "at least one", "plurality", "each", "any", etc. used in this application include "at least one", "two" or more, "plurality" or "each", "any" or "any one", "each" or "any one" as used herein.

[0049] With the rapid development of the Internet of Vehicles (IoV), the penetration rate of autonomous driving is increasing, demonstrating tremendous potential for achieving high-level intelligent transportation. The realization of high-level intelligent transportation relies on accurate perception of the dynamic nature of large-scale environments. Fully understanding the dynamic characteristics of transportation systems that change over time and space, and predicting and analyzing their spatiotemporal patterns and trends, are crucial for urban intelligence. Specifically, accurate traffic flow forecasting can effectively improve vehicle efficiency, reduce congestion, and achieve high-quality intelligent transportation.

[0050] With the development of deep learning, from using convolutional neural networks for regional grid-based traffic flow prediction to graph neural network (GNN)-based traffic flow prediction that considers non-Euclidean distances in road networks, traffic flow prediction tasks have shown an increasing emphasis on capturing changes in network structure. In particular, the spatial graph structure of traffic road networks exhibits significant changes over time. The differences in the properties of the same traffic area at different times affect surrounding traffic areas and even the entire system, as demonstrated in numerous studies. At the same time, large language models (LLMs), with their powerful learning capabilities and generalization, have gradually become a research hotspot. Incorporating GNN-based models into LLMs significantly improves the accuracy of spatiotemporal predictions. However, integrating GNN-based models into LLMs and applying them to traffic flow prediction still presents challenges.

[0051] While large language models have achieved astonishing results across various industries, they inevitably face the problem of hallucinations. Issues such as data sparsity and data quality make it easy for general-purpose large language models to produce "serious nonsense" in various downstream tasks. Specifically, using large language models directly for spatiotemporal prediction inference can produce hallucinations. Partially fine-tuning large language models in the absence of high-quality data can also produce hallucinations, but full fine-tuning incurs prohibitive computational costs.

[0052] To this end, an embodiment of the present invention proposes a traffic flow prediction method based on a spatiotemporal large language model. First, the traffic flow data to be predicted is obtained. Then, a spatiotemporal encoder is constructed based on a recurrent neural network and a graph neural network. The traffic flow data to be predicted is encoded by the spatiotemporal encoder to obtain a first spatiotemporal feature. Then, the first spatiotemporal feature is aligned by a preset alignment module to obtain a second spatiotemporal feature. Finally, an action chain instruction is constructed. The traffic flow prediction result is obtained by the large language model based on the second spatiotemporal feature and the action chain instruction. The present invention designs a spatiotemporal encoder to help the large language model fully understand and mine the complex spatiotemporal patterns of different scenarios. Then, the action chain instruction and alignment module are introduced to alleviate the hallucinations of the large language model. This can achieve accurate spatiotemporal prediction under a frozen large language model and improve the accuracy of traffic flow prediction based on the large language model.

[0053] Reference Figure 1 , Figure 1 A flow chart of the steps of a traffic flow prediction method based on a spatiotemporal large language model provided in an embodiment of the present invention. The embodiment of the present invention provides a traffic flow prediction method based on a spatiotemporal large language model, which includes steps S101 to S104:

[0054] S101, obtaining traffic flow data to be predicted;

[0055] S102: constructing a spatiotemporal encoder based on a recurrent neural network and a graph neural network, encoding the traffic flow data to be predicted by the spatiotemporal encoder to obtain a first spatiotemporal feature;

[0056] As a further optional implementation, the step of encoding the traffic flow data to be predicted by a spatiotemporal encoder to obtain the first spatiotemporal feature can be specifically divided into the following steps S1021 to S1024:

[0057] S1021. Input the traffic flow data to be predicted into a spatiotemporal encoder;

[0058] S1022. Spatial encoding of the traffic flow data to be predicted is performed using a graph neural network to obtain spatial features.

[0059] In some optional embodiments, although large language models demonstrate remarkable proficiency in language processing, they still face challenges in understanding the inherent evolutionary patterns of spatiotemporal data. To overcome this limitation, embodiments of the present invention first utilize a graph neural network (GNN) to extract spatial features G, which can be formalized as follows:

[0060]

[0061] Where X represents the traffic flow, W k represents the learnable parameters, represents the adaptive adjacency matrix, and σ represents the activation function. The extracted spatial features include characteristic information such as the relationship between traffic flows at different intersections.

[0062] S1023. Time-encoding the traffic flow data to be predicted using a recurrent neural network to obtain a time feature.

[0063] Specifically, after extracting spatial feature representations, the spatiotemporal encoder uses temporal encoding to help the large language model capture and understand temporal features. This embodiment of the present invention uses a multi-scale, multi-core temporal convolutional network to further extract temporal features from traffic flow X. This effectively captures the complex temporal dependencies between different temporal resolutions, enhancing the large language model's ability to understand the complex temporal dynamics of spatiotemporal data.

[0064] As an optional implementation, step S1023 may be specifically divided into the following steps S10231 and S10232:

[0065] S10231. Extract features from the traffic flow data to be predicted using a gated dilated convolutional layer in a recurrent neural network to obtain multi-scale temporal features.

[0066] As an optional implementation, the multi-scale time feature is obtained by the following formula:

[0067]

[0068] in, Represents multi-scale temporal features, represents the convolution kernel and and represents a one-dimensional convolution kernel and and Indicates bias and k represents the number of one-dimensional convolution kernels and k = [1, 2, 3, 4], l represents the number of layers, D f Indicates the number of the first channel, D tr Indicates the number of the second channel, represents spatial features, [·] represents concatenation operation, ⊙ represents Hadamard product, σ3 and σ4 represent activation functions.

[0069] Specifically, the temporal encoding consists of two key components: the gated dilated convolutional layer and the cross-scale association layer. The gated dilated convolutional layer is formalized as follows:

[0070]

[0071] Apply four one-dimensional convolution kernels and as well as and Extract temporal features at multiple scales. In the feature extraction process, [·] transforms the output of four one-dimensional convolution kernels from Splice to Where N represents the number of spatial nodes, the activation function and Hadamard product ⊙ are used to control the information retention rate. The residual connections between different layers and the convolution kernel It is used to effectively capture the temporal dependencies of various scales, thereby enriching the temporal representation of the spatial feature G while avoiding the gradient disappearance (G tr The multi-scale temporal features obtained can reflect the temporal evolution of perception at different scales.

[0072] S10232. Correlation merging of multi-scale time features is performed through a cross-scale correlation layer in a recurrent neural network to obtain a time feature.

[0073] Specifically, by introducing a cross-scale correlation layer, multi-scale temporal features are merged The correlation between different scales in , thereby retaining the feature information of each scale, can be formalized as follows:

[0074]

[0075] in, represents the convolution kernel and b s Indicates bias and D s and D tr Each indicates a different number of channels.

[0076] S1024: Perform nonlinear connection on the spatial feature and the temporal feature to obtain a first spatiotemporal feature.

[0077] Specifically, after the time encoding of layer l, the expressions of the above gated dilated convolution layer and the cross-scale association layer are combined through nonlinear connections to obtain the final first spatiotemporal feature

[0078] It should be noted that the embodiments of the present invention, through the above-mentioned spatial and temporal modeling, can use adaptive explicit graph structures and spatial information enhancement according to different traffic flow prediction tasks or traffic flow prediction scenarios, and then fully analyze the time dependencies at different time scales, thereby providing strong support for large language models to learn different spatiotemporal evolution patterns.

[0079] S103: aligning the first spatiotemporal features using a preset alignment module to obtain second spatiotemporal features, so as to align the spatiotemporal encoder and the large language model dimensions;

[0080] It should be noted that effective alignment of spatiotemporal information and text can play a key role in large language models understanding spatiotemporal evolution patterns. The embodiment of the present invention fuses different evolution patterns through an alignment module, integrates the contextual features of text and spatiotemporal data, and uses lightweight tag alignment to extract more expressive and interpretable multi-level semantic features.

[0081] As an optional implementation, the step of performing feature alignment on the first spatiotemporal features by a preset alignment module to obtain the second spatiotemporal features can be specifically divided into the following steps S1031 to S1033:

[0082] S1031: Input the first spatiotemporal feature into an alignment module, and then project the first spatiotemporal feature to obtain a spatiotemporal label;

[0083] Specifically, the embodiment of the present invention adopts an indirect prediction strategy, that is, by generating prediction marks that are helpful for the prediction process, and then analyzing the hidden representation of the marks through mapping, so as to change the result distribution to generate more accurate prediction values, thereby avoiding the erroneous perception caused by directly predicting the future spatiotemporal values. First, the first spatiotemporal feature S is calculated by the following formula: r To project:

[0084] Ξ pr =S r W p +b p

[0085] Among them, pr represents a space-time marker and W p Represents a mapping operation and b p Indicates bias and

[0086] S1032, performing mapping analysis on the spatiotemporal markers to obtain a hidden representation;

[0087] S1033. Map and concatenate the spatiotemporal label and the hidden representation to obtain a second spatiotemporal feature.

[0088] As an optional implementation, the spatiotemporal label and the hidden representation are mapped and concatenated by the following formula to obtain a second spatiotemporal feature:

[0089]

[0090] in, represents the second spatiotemporal feature, Ξ pr represents the space-time label, Γ hi represents a hidden representation and C represents the number of initial channels, N represents the number of spatial nodes, and D L represents the number of third channels, σ5 represents the activation function, W1, W2 and W3 represent the mapping operation and D b represents the number of the fourth channel, β represents the output step size, and [·,·] represents the concatenation operation.

[0091] Specifically, there are two challenges in fine-tuning the large language model using instructions in the embodiment of the present invention. First, its spatiotemporal predictions usually rely on numerical data, and its structure and patterns focus on semantic and syntactic relations, which is different from the natural language that large language models are good at processing; second, large language models usually use multi-classification losses to predict vocabulary, thereby generating a probability distribution of potential results, rather than the continuous value distribution required for the prediction task. Therefore, the embodiment of the present invention adopts an indirect prediction strategy, through which the rich spatiotemporal context features hidden in the spatiotemporal tags are used to capture dynamic spatiotemporal dependencies, thereby helping the large language model to achieve more accurate spatiotemporal predictions.

[0092] S104: Construct an action chain instruction, and obtain a traffic flow prediction result based on the second spatiotemporal feature and the action chain instruction through a large language model.

[0093] It's important to note that because both temporal and spatial information contain rich and valuable semantic details, they help large language models understand spatiotemporal patterns within specific contexts. For example, traffic patterns within a transportation system can vary significantly across time and region. Textual descriptions of temporal and spatial information can help large language models better analyze these differences. However, issues such as data sparsity can hinder the representation of this information, leading to illusions and misleading the large language model's understanding of spatiotemporal evolution. Therefore, accurately representing spatial and temporal information through text significantly impacts the performance of large language models.

[0094] As an optional implementation, the step of constructing an action chain instruction can be specifically divided into the following steps S1041 to S1043:

[0095] S1041. Constructing a logic guidance template and gradually decomposing the guidance template;

[0096] Specifically, the embodiment of the present invention designs a new instruction text called CoA. First, it helps the large language model to gradually decompose the prediction problem by constructing a logical guidance template "Let us predict step by step", and then provides the large language model with a detailed step-by-step decomposition guidance template ("Separately.Then,") to calibrate the model's thinking process. Finally, the prediction steps are decomposed to build a complete prediction action chain for the large language model. By constructing a logical guidance template and a step-by-step decomposition guidance template, the embodiment of the present invention can improve the interpretability of the large language model while alleviating the illusion of the large language model.

[0097] S1042, obtaining area information, time information, and weather data from the traffic flow data to be predicted, and determining a marking character;

[0098] S1043. Construct an action chain instruction based on the logic guidance template, the step-by-step decomposition of the guidance template, the area information, the time information, the weather data, and the marking characters.

[0099] Specifically, the multi-scale time information mark (such as the spatiotemporal mark Ξ pr ) and regional information are integrated into the instruction text of the large language model. Time information includes the specific time and day of the week corresponding to different time steps, and regional information includes cities, specific administrative regions, and point of interest (POI) data near different nodes, with weather data added for support. By integrating this diverse information to construct action chain instructions, the embodiments of the present invention help the CoA encapsulate these understandings in a complex spatiotemporal context, enhancing the ability of the large language model to identify and assimilate spatiotemporal evolution paradigms across different regions and timeframes.

[0100] Furthermore, the embodiment of the present invention uses<Ca_start> 、<Ca_HIS> ,...,<Ca_HIS> as well as<Ca_end> Special tags such as , etc., are used to help large language models accurately identify different parts and reduce ambiguity in input and output, thus improving the model's understanding ability.<Ca_start> and<Ca_end> Represent the start and end identifiers of the time and space tags,<Ca_HIS> A placeholder representing a spatiotemporal tag. Based on the above alignment, the large language model can effectively distinguish different spatiotemporal evolution patterns, thereby improving its spatiotemporal prediction capability in traffic flow prediction scenarios.

[0101] In summary, the processing flow of the traffic flow prediction method based on the spatiotemporal language model in the embodiment of the present invention is as follows: Figure 2As shown, the system first receives the traffic flow data to be predicted. It then uses a spatiotemporal encoder, comprised of a recurrent neural network and a graph neural network, to encode temporal and spatial information, enriching the representation of spatiotemporal features and learning the relative order relationships between time series and spatial nodes. After encoding the input traffic flow data to be predicted, action chaining instructions are used to force the large language model to decompose the traffic flow prediction process. Secondly, an alignment module is added between the spatiotemporal encoder and the large language model to extract more expressive and interpretable multi-layer semantic features, ensuring consistency between the spatiotemporal encoder, action chaining instructions, and the large language model. Finally, the large language model generates traffic flow predictions.

[0102] The above describes the traffic flow prediction method based on the spatiotemporal large language model according to the embodiment of the present invention. It can be seen that compared with the traffic flow prediction method in the prior art, the embodiment of the present invention has the following advantages:

[0103] First, the spatiotemporal encoder encodes the temporal and spatial information in the traffic flow data to be predicted, enriching the expression of spatiotemporal features while improving the prediction performance of large language models while taking into account generalization.

[0104] Second, an alignment module is added to the spatiotemporal encoder and large language model, and an indirect prediction strategy is adopted. By generating spatiotemporal markers that contribute to the prediction process, the spatiotemporal markers are then mapped and analyzed to their hidden representations, thereby changing the resulting distribution to generate more accurate predictions and avoiding the misperceptions caused by directly predicting future spatiotemporal values. This method utilizes the rich spatiotemporal contextual features hidden in the spatiotemporal markers to capture dynamic spatiotemporal dependencies, thereby improving the spatiotemporal prediction accuracy of traffic flows using the large language model.

[0105] 3. Adding logic guidance templates and step-by-step decomposition guidance templates to action chain instructions, integrating regional information, time information, and weather data, and using marker characters to distinguish contextual information, enables the large language model to reason and predict according to the action chain, and output the paradigm chain according to the decomposed actions based on the specified traffic flow prediction scenario and the provided information.

[0106] Reference Figure 3 The embodiment of the present invention further provides a traffic flow prediction system based on a spatiotemporal language model, comprising:

[0107] A data acquisition module, used to obtain traffic flow data to be predicted;

[0108] A spatiotemporal feature encoding module is used to construct a spatiotemporal encoder based on a recurrent neural network and a graph neural network, and encode the traffic flow data to be predicted through the spatiotemporal encoder to obtain the first spatiotemporal feature;

[0109] A feature alignment module is used to align the first spatiotemporal features using a preset alignment module to obtain a second spatiotemporal feature, so as to align the spatiotemporal encoder and the large language model dimensions;

[0110] The instruction construction and result prediction module is used to obtain traffic flow prediction results based on the second spatiotemporal features and action chain instructions through a large language model.

[0111] The contents of the above-mentioned traffic flow prediction method embodiment based on the spatiotemporal large language model are all applicable to the traffic flow prediction system embodiment based on the spatiotemporal large language model. The functions specifically implemented by the traffic flow prediction system embodiment based on the spatiotemporal large language model are the same as those of the above-mentioned traffic flow prediction method embodiment based on the spatiotemporal large language model, and the beneficial effects achieved are also the same as those achieved by the above-mentioned traffic flow prediction method embodiment based on the spatiotemporal large language model.

[0112] An embodiment of the present invention further provides an electronic device comprising: a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for enabling communication between the processor and the memory. When the program is executed by the processor, the aforementioned traffic flow prediction method based on a spatiotemporal large language model is implemented. The electronic device can be any intelligent terminal, including a tablet computer and an in-vehicle computer.

[0113] like Figure 4 FIG2 is a schematic diagram of the hardware structure of the electronic device provided by the embodiment of the present invention, referring to FIG2 Figure 4 , an embodiment of the present invention provides an electronic device, including:

[0114] The processor 1001 may be implemented as a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is configured to execute relevant programs to implement the technical solutions provided by the embodiments of the present invention.

[0115] The memory 1002 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1002 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1002 and is called by the processor 1001 to execute the traffic flow prediction method based on the spatiotemporal large language model of the embodiment of the present invention.

[0116] Input / output interface 1003, used to implement information input and output;

[0117] Communication interface 1004, used to implement communication interaction between this device and other devices, which can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WiFi, Bluetooth, etc.);

[0118] Bus 1005 , which transmits information between various components of the device (e.g., processor 1001 , memory 1002 , input / output interface 1003 , and communication interface 1004 );

[0119] The processor 1001 , the memory 1002 , the input / output interface 1003 and the communication interface 1004 are connected to each other in communication within the device via a bus 1005 .

[0120] An embodiment of the present invention also provides a storage medium, which is a computer-readable storage medium used for computer-readable storage. The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the above-mentioned traffic flow prediction method based on the spatiotemporal large language model.

[0121] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0122] The embodiment of the present invention also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs Figure 1 The method shown.

[0123] In some optional embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the above-mentioned boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided in an exemplary manner for the purpose of providing a more comprehensive understanding of the technology. The disclosed method is not limited to the operation and logic flow presented herein. Optional embodiments are contemplated in which the order of the various operations is changed and the sub-operations described as a part of a larger operation are performed independently.

[0124] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise stated, one or more of the above-mentioned functions and / or features can be integrated into a single physical device and / or software module, or one or more functions and / or features can be implemented in separate physical devices or software modules. It is also understood that a detailed discussion of the actual implementation of each module is not necessary for understanding the present invention. More specifically, given the properties, functions, and internal relationships of the various functional modules in the devices disclosed herein, the actual implementation of the module will be understood within the routine skills of an engineer. Therefore, a person skilled in the art can implement the present invention set forth in the claims using ordinary skills without undue experimentation. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.

[0125] If the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the above methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program code.

[0126] The logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device). For purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by, or in conjunction with, an instruction execution system, apparatus, or device.

[0127] It should be understood that various parts of the present invention can be implemented using hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0128] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to the embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the claims and their equivalents.

[0129] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.

Claims

1. A traffic flow prediction method based on a spatiotemporal language model, characterized in that: The following steps are involved: Obtain traffic flow data to be predicted; Constructing a spatiotemporal encoder based on a recurrent neural network and a graph neural network, and encoding the traffic flow data to be predicted by the spatiotemporal encoder to obtain a first spatiotemporal feature; Performing feature alignment on the first spatiotemporal features using a preset alignment module to obtain second spatiotemporal features, so as to align the spatiotemporal encoder and the large language model dimension; constructing an action chain instruction, and obtaining a traffic flow prediction result based on the second spatiotemporal feature and the action chain instruction through the large language model; The step of aligning the first spatiotemporal features by a preset alignment module to obtain the second spatiotemporal features specifically includes: Inputting the first spatiotemporal feature into the alignment module, and then projecting the first spatiotemporal feature to obtain a spatiotemporal label; Performing mapping analysis on the spatiotemporal markers to obtain a hidden representation; Mapping and concatenating the spatiotemporal tag and the hidden representation to obtain the second spatiotemporal feature; The second spatiotemporal feature is obtained by mapping and concatenating the spatiotemporal tag and the hidden representation using the following formula: in, represents the second spatiotemporal feature, pr represents the space-time label, Γ hi represents the hidden representation and C represents the number of initial channels, N represents the number of spatial nodes, and D L represents the number of third channels, σ5 represents the activation function, W1, W2 and W3 represent the mapping operation and D b represents the number of the fourth channel, β represents the output step size, and [·,·] represents the concatenation operation.

2. The traffic flow prediction method based on a spatiotemporal language model according to claim 1, characterized in that: The encoding of the traffic flow data to be predicted by the spatiotemporal encoder to obtain a first spatiotemporal feature specifically includes: Inputting the traffic flow data to be predicted into the spatiotemporal encoder; Performing spatial encoding on the traffic flow data to be predicted by using the graph neural network to obtain spatial features; Time encoding the traffic flow data to be predicted is performed by the recurrent neural network to obtain a time feature; The spatial feature and the temporal feature are nonlinearly connected to obtain the first spatiotemporal feature.

3. The traffic flow prediction method based on a spatiotemporal language model according to claim 2, characterized in that: The time encoding of the traffic flow data to be predicted by the recurrent neural network to obtain time features specifically includes: Extracting features of the traffic flow data to be predicted through a gated dilated convolutional layer in the recurrent neural network to obtain multi-scale time features; The multi-scale time features are correlated and merged through a cross-scale correlation layer in the recurrent neural network to obtain the time features.

4. The traffic flow prediction method based on a spatiotemporal language model according to claim 1, characterized in that: The instruction to construct an action chain specifically includes: Build logical guidance templates and step-by-step decomposition guidance templates; Acquiring regional information, time information, and weather data from the traffic flow data to be predicted, and determining a marking character; The action chain instruction is constructed according to the logic guidance template, the step-by-step decomposition guidance template, the area information, the time information, the weather data and the marking character.

5. The traffic flow prediction method based on a spatiotemporal language model according to claim 3 is characterized in that: The multi-scale time feature is obtained by the following formula: in, represents the multi-scale temporal features, represents the convolution kernel and and represents a one-dimensional convolution kernel and and Indicates bias and k represents the number of one-dimensional convolution kernels and k = [1, 2, 3, 4], l represents the number of layers, D f Indicates the number of the first channel, D tr Indicates the number of the second channel, represents the spatial feature, [·] represents the concatenation operation, ⊙ represents the Hadamard product, and σ3 and σ4 represent activation functions.

6. A traffic flow prediction system based on a spatiotemporal language model, characterized in that: include: A data acquisition module, used to obtain traffic flow data to be predicted; a spatiotemporal feature encoding module, configured to construct a spatiotemporal encoder based on a recurrent neural network and a graph neural network, and encode the traffic flow data to be predicted by the spatiotemporal encoder to obtain a first spatiotemporal feature; A feature alignment module, configured to perform feature alignment on the first spatiotemporal features using a preset alignment module to obtain second spatiotemporal features, so as to align the spatiotemporal encoder and the large language model dimensions; An instruction construction and result prediction module, configured to construct an action chain instruction and obtain a traffic flow prediction result based on the second spatiotemporal feature and the action chain instruction using the large language model; The step of aligning the first spatiotemporal features by a preset alignment module to obtain the second spatiotemporal features specifically includes: Inputting the first spatiotemporal feature into the alignment module, and then projecting the first spatiotemporal feature to obtain a spatiotemporal label; Performing mapping analysis on the spatiotemporal markers to obtain a hidden representation; Mapping and concatenating the spatiotemporal tag and the hidden representation to obtain the second spatiotemporal feature; The second spatiotemporal feature is obtained by mapping and concatenating the spatiotemporal tag and the hidden representation using the following formula: in, represents the second spatiotemporal feature, pr represents the space-time label, Γ hi represents the hidden representation and C represents the number of initial channels, N represents the number of spatial nodes, and D L represents the number of third channels, σ5 represents the activation function, W1, W2 and W3 represent the mapping operation and D b represents the number of the fourth channel, β represents the output step size, and [·,·] represents the concatenation operation.

7. An electronic device, characterized in that: The electronic device includes a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory. When the program is executed by the processor, the steps of the traffic flow prediction method based on a spatiotemporal large language model as described in any one of claims 1 to 5 are realized.

8. A storage medium, which is a computer-readable storage medium and is used for computer-readable storage, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the traffic flow prediction method based on a spatiotemporal large language model as described in any one of claims 1 to 5.