A method, apparatus, equipment, medium, and product for predicting urban traffic speed based on a large language model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-30
- Publication Date
- 2026-08-14
AI Technical Summary
[0004]然而,上述方案存在以下缺陷:该方法将天气数值作为静态附加特征与速度序列拼接,天气对交通的影响被简化为输入层的一组数值,模型仅能学习到降雨量与速度之间的静态统计相关关系,难以对能见度下降、路面附着系数降低、通行能力折减、驾驶行为保守化以及天气消退后的恢复滞后等中间过程进行显式建模,也难以解释相同天气在不同道路条件下产生差异化响应的内在原因,导致预测结果缺乏可解释性和机理一致性
[0024]本发明实施例的技术方案,通过天气作用链解析模块将天气描述信息分解为环境物理层至事件阶段层的层级因果链,使天气对交通的影响由不可解释的静态数值相关转化为可解释的机理传递路径,显著提升了预测结果的可解释性和物理合理性。通过设置与天气作用机理绑定的多个候选轻量微调模块,并依据天气作用链信息、道路描述信息和城市画像信息动态确定激活权重,实现了跨城市场景下天气作用机理模块的灵活调用与组合,解决了多城市混合训练中的参数干扰问题,有效提升了源城市知识向目标城市迁移的泛化能力。通过识别天气事件所处阶段并采用分阶段校准参数对初步预测进行后处理修正,有效消除了不同天气阶段(尤其是恢复阶段)下预测结果的系统性偏差,避免了天气解除后速度瞬间跳回常态的不合理现象,确保了速度变化在时间维度上的渐进一致性。
Smart Images

Figure CN122575145A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent transportation technology, and in particular to a method, apparatus, equipment, medium and product for predicting urban traffic speed based on a large language model. Background Technology
[0002] Large language models, due to their powerful sequence modeling and contextual understanding capabilities, are increasingly being applied to the field of time series forecasting, with traffic speed prediction being a typical example. In cross-city application scenarios, a key challenge in this field is how to effectively transfer knowledge learned from the source city to the target city, which lacks training samples, while ensuring that the prediction results have reasonable physical responses under different weather conditions.
[0003] Currently, there are traffic prediction methods based on large language models that can align weather text, city attributes, or point-of-interest information with traffic sequences and fine-tune the output of future speeds through unified instructions. Although these methods can utilize samples from multiple cities, they typically treat city differences as ordinary text background. When there are differences between the source city and the target city in terms of road morphology or weather response mechanisms, the model directly transfers common weather-speed relationships from the source city to the target city.
[0004] However, the above approach has the following drawbacks: This method concatenates weather data as a static additional feature with the speed sequence, and the impact of weather on traffic is simplified to a set of values in the input layer. The model can only learn the static statistical correlation between rainfall and speed, and it is difficult to explicitly model intermediate processes such as reduced visibility, reduced road surface adhesion coefficient, reduced traffic capacity, conservative driving behavior, and recovery lag after the weather dissipates. It is also difficult to explain the underlying reasons for the different responses of the same weather under different road conditions, resulting in a lack of interpretability and mechanistic consistency in the prediction results. Summary of the Invention
[0005] This invention provides a method, device, equipment, medium, and product for predicting urban traffic speed based on a large language model. It enables interpretable modeling of weather impacts through weather action chain analysis, thereby improving the prediction accuracy and mechanism consistency of the target city.
[0006] According to a first aspect of the present invention, a method for predicting urban traffic speed based on a large language model is provided, comprising:
[0007] Obtain weather description information, road description information, and city profile information for the target city at the current forecast time;
[0008] The weather description information is input into the weather action chain parsing module, which parses the information to obtain weather action chain information that characterizes the path of weather's impact on traffic and the current stage of the weather event.
[0009] Based on the weather action chain information, the road description information, and the city profile information, at least one target lightweight fine-tuning module and its corresponding activation weight are determined from a plurality of preset candidate lightweight fine-tuning modules.
[0010] The target lightweight fine-tuning module is injected into the large language model according to the activation weight, and the historical traffic speed information is processed by the injected large language model to obtain the preliminary predicted traffic speed of the target city in the future time domain.
[0011] The preliminary predicted traffic speed is calibrated based on the calibration parameters corresponding to the current stage of the weather event to obtain the target predicted traffic speed for the target city in the future time domain.
[0012] According to a second aspect of the present invention, an urban traffic speed prediction device based on a large language model is provided, comprising:
[0013] The information acquisition module is used to acquire weather description information, road description information, and city profile information of the target city at the current forecast time.
[0014] The information parsing module is used to input the weather description information into the weather action chain parsing module to obtain weather action chain information that characterizes the action path of weather affecting traffic and the current stage of the weather event.
[0015] The weight determination module is used to determine at least one target lightweight fine-tuning module and its corresponding activation weight from a plurality of preset candidate lightweight fine-tuning modules based on the weather action chain information, the road description information and the city profile information.
[0016] The speed prediction module is used to inject the target lightweight fine-tuning module into the large language model according to the activation weight, and process the historical traffic speed information through the injected large language model to obtain the preliminary predicted traffic speed of the target city in the future time domain.
[0017] The speed calibration module is used to calibrate the preliminary predicted traffic speed according to the calibration parameters corresponding to the current stage of the weather event, so as to obtain the target predicted traffic speed of the target city in the future time domain.
[0018] According to a third aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0019] At least one processor; and
[0020] A memory communicatively connected to the at least one processor; wherein,
[0021] The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the urban traffic speed prediction method based on a large language model according to any embodiment of the present invention.
[0022] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the urban traffic speed prediction method based on a large language model as described in any embodiment of the present invention.
[0023] According to a fifth aspect of the present invention, embodiments of the present invention also provide a computer program product, the computer program product including a computer program, which, when executed by a processor, implements the urban traffic speed prediction method based on a large language model according to any embodiment of the present invention.
[0024] The technical solution of this invention decomposes weather description information into a hierarchical causal chain from the environmental physical layer to the event stage layer through a weather action chain analysis module. This transforms the impact of weather on traffic from an inexplicable static numerical correlation into an interpretable mechanism transmission path, significantly improving the interpretability and physical rationality of the prediction results. By setting multiple candidate lightweight fine-tuning modules bound to the weather action mechanism and dynamically determining activation weights based on weather action chain information, road description information, and city profile information, flexible invocation and combination of weather action mechanism modules in cross-city scenarios are achieved. This solves the parameter interference problem in multi-city mixed training and effectively improves the generalization ability of source city knowledge to target city transfer. By identifying the stage of the weather event and using phased calibration parameters to post-process and correct the preliminary prediction, systematic biases in prediction results under different weather stages (especially the recovery stage) are effectively eliminated. This avoids the unreasonable phenomenon of speed instantly jumping back to normal after the weather clears, ensuring the gradual consistency of speed changes over time.
[0025] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0026] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1This is a flowchart of an urban traffic speed prediction method based on a large language model according to Embodiment 1 of the present invention;
[0028] Figure 2 This is a flowchart of an urban traffic speed prediction method based on a large language model according to Embodiment 2 of the present invention;
[0029] Figure 3 This is an example diagram of calibration results in an urban traffic speed prediction method based on a large language model according to Embodiment 2 of the present invention;
[0030] Figure 4 This is an example architecture diagram of an urban traffic speed prediction method based on a large language model provided in Embodiment 2 of the present invention;
[0031] Figure 5 This is a comparison chart of the Xi'an results in a method for predicting urban traffic speed based on a large language model according to Embodiment 2 of the present invention.
[0032] Figure 6 This is a comparison chart of the Harbin results in a method for predicting urban traffic speed based on a large language model according to Embodiment 2 of the present invention.
[0033] Figure 7 This is a comparison chart of the Shanghai performance in a method for predicting urban traffic speed based on a large language model according to Embodiment 2 of the present invention;
[0034] Figure 8 This is a comparison chart of the effects of a method for predicting urban traffic speed based on a large language model in Chongqing, provided in Embodiment 2 of the present invention.
[0035] Figure 9 This is a schematic diagram of the structure of an urban traffic speed prediction device based on a large language model according to Embodiment 3 of the present invention;
[0036] Figure 10 This is a schematic diagram of the structure of an electronic device that implements an embodiment of the present invention. Detailed Implementation
[0037] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0038] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0039] Example 1
[0040] Figure 1 This invention provides a flowchart of a method for predicting urban traffic speed based on a large language model, as shown in Embodiment 1. This embodiment is applicable to cross-city severe weather traffic congestion warnings, road speed limit suggestions, emergency route guidance, winter road safety, bridge and elevated road risk monitoring, and traffic speed prediction using a meteorological and traffic fusion platform. It can also be extended to cross-city weather condition prediction of traffic flow, travel time, and public transportation passenger flow. This method can be executed by a large language model-based urban traffic speed prediction device, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:
[0041] S110. Obtain weather description information, road description information, and city profile information for the target city at the current prediction time.
[0042] In this embodiment, the target city refers to the city where the prediction is performed. The current prediction time refers to the target time point where traffic speed prediction needs to be performed; it can be the current real-time time or any future reference time specified by the user. Weather description information is a general term for meteorological conditions affecting traffic, including numerical weather data and text weather data. Numerical weather data includes, but is not limited to, quantitative indicators such as rainfall, snowfall, visibility, wind speed, and temperature. Text weather data includes, but is not limited to, unstructured information such as weather warning texts, real-time description texts, and weather forecast texts. Road description information is a general term for the physical attributes and geometric features of the road segment to be predicted, including inherent road attributes that affect weather response sensitivity, such as road grade, gradient, bridge or elevated road markings, number of lanes, curve curvature, and drainage capacity. City profile information is a general term for the macro-level traffic environment characteristics of the city, including factors characterizing the overall traffic operation endowment of the city, such as climate zones, topographic relief, road network density, expressway ratio, and road functional structure.
[0043] Specifically, the processor can collect all the raw input data required for cross-language model-based urban traffic speed prediction from external data sources. The weather description information covers both numerical and textual weather data. The road description information covers the inherent physical attributes of the road segment to be predicted, such as its grade, slope, and bridge markings. The urban profile information covers factors that characterize the overall traffic operation endowment of the city, such as climate zones, topographic relief, and road network density.
[0044] For example, traffic speed data from multiple source and target cities can be collected at a sampling interval of 5 minutes, with both the historical input length H and the prediction length P set to 12. Weather data is sourced from ground weather stations, road weather equipment, and warning texts. After standardizing the numerical units, the data is aligned with road speeds according to timestamps and spatial service ranges, and a city profile is constructed for each city, including climate zones, topographic relief, road network density, and road functional structure.
[0045] S120. Input the weather description information into the weather action chain analysis module to obtain weather action chain information that characterizes the action path of weather affecting traffic and the current stage of the weather event.
[0046] In this embodiment, the weather action chain parsing module is a functional unit used to transform unstructured weather description information into structured mechanistic representations. It can be a parser based on a large language model, a parsing network based on Transformer, a parser based on rule templates, or any combination of these methods. Its core function is to decompose the raw weather data into intermediate mechanistic variables with causal relationships according to the physical transmission path of weather's impact on traffic. Weather action chain information is a structured representation of the complete causal transmission path of weather's impact on traffic. It can include a set of mechanistic variables passed down step-by-step according to the environmental physical layer, traffic behavior layer, road sensitivity layer, and event stage layer, as well as the confidence information corresponding to each variable. Essentially, it is a data form that explicitly encodes the complete causal chain of weather values, changes in the physical environment, adjustments in driving behavior, and road conditions modulated to the event's timeline.
[0047] Specifically, the processor can use the parsing module to decompose weather description information into four levels—environmental physical layer, traffic behavior layer, road sensitivity layer, and event stage layer—according to the physical transmission logic of weather affecting traffic. These levels are then combined into a complete causal chain, forming an explicit path that represents the effects of weather on traffic, from changes in the physical environment to adjustments in driving behavior, to modulation of road conditions, and finally to the timeline of events.
[0048] For example, the parser can use a structured output template, requiring each field to output a normalized value, confidence level, and accompanying text. Numerical weather information is prioritized as the quantitative basis, while text is used to supplement weather type, impact range, and duration. Conflict flags are set for clearly conflicting text and numerical records, and the confidence level of the corresponding field is reduced.
[0049] S130. Based on weather action chain information, road description information, and city profile information, determine at least one target lightweight fine-tuning module and its corresponding activation weight from a plurality of pre-set candidate lightweight fine-tuning modules.
[0050] In this embodiment, the current stage of a weather event refers to its position in the time process from occurrence to dissipation, including the occurrence stage, enhancement stage, stabilization stage, and recovery stage. Candidate lightweight fine-tuning modules are parameterized units attached to each network layer of the large language model and incrementally adjust their outputs. They are parameter-efficient fine-tuning modules in the form of low-rank matrices. Each candidate lightweight fine-tuning module corresponds to a reusable weather mechanism, which is independent of the specific weather name but only bound to the type of mechanism. Activation weights are numerical indicators used to quantify the importance of each candidate lightweight fine-tuning module in the current prediction scenario.
[0051] Specifically, the processor can comprehensively consider three factors: weather impact mechanism, road inherent attributes, and overall urban characteristics. It can then select one or more modules most suitable for the current prediction scenario from a pre-built library of reusable mechanism modules, quantify the importance of each module being invoked, and obtain the activation weights of different modules. Each candidate module corresponds to a reusable weather action mechanism that is not related to the specific weather name but is only bound to the action mechanism type.
[0052] For example, the lightweight fine-tuning module library can have four modules, each with a low-rank dimension of 32. Modules do not necessarily correspond one-to-one with weather names, but rather with reusable mechanisms of action. For instance, both heavy rain and freezing rain can activate the low visibility and slippery road modules, while blizzards can additionally activate the traffic capacity reduction and recovery lag modules.
[0053] S140. Inject the target lightweight fine-tuning module into the large language model according to the activation weight, and process the historical traffic speed information through the injected large language model to obtain the preliminary predicted traffic speed of the target city in the future time domain.
[0054] In this embodiment, the large language model is a large-scale language model pre-trained using an autoregressive or autoencoder approach based on the Transformer architecture. Historical traffic speed information is a collection of speed observations for the road segment to be predicted at multiple time steps prior to the prediction time. The preliminary predicted traffic speed is a traffic speed prediction value directly output by the large language model, without stage calibration. Historical traffic speeds can be composed of segments that can be set up according to a set number of time steps (e.g., 3 time steps). These segments are mapped to traffic tokens through a linear layer or one-dimensional convolution. To preserve the absolute speed scale, a normalized road speed limit value, a time location code, and a missing mask are added to the tokens.
[0055] Specifically, the processor can load the selected lightweight fine-tuning modules with their corresponding activation weights into the corresponding network layers of the large language model. The target modules are attached to each layer of the large language model in the form of low-rank matrices or adapters. Their parameter increments are weighted according to the activation weights and superimposed on the frozen backbone parameters, so that the large language model can obtain the ability to adapt to the current weather scenario and urban conditions without changing its original knowledge structure. Then, the token sequence containing historical traffic speed information and weather action chain information is sent into the injected model for autoregressive inference to obtain preliminary prediction results that integrate weather mechanism and urban adaptation information.
[0056] S150. Based on the calibration parameters corresponding to the current stage of the weather event, the preliminary predicted traffic speed is calibrated to obtain the target predicted traffic speed of the target city in the future time domain.
[0057] In this embodiment, the calibration parameters are a set of correction coefficients used to correct systematic biases in the initial forecasts at different weather event stages. The target predicted traffic speed is the final traffic speed prediction value output after stage calibration.
[0058] Specifically, the processor can use calibration parameters that match the current stage of the weather event to perform stage-adaptive post-processing corrections on the preliminary prediction results. The current weather event stages include the occurrence stage, enhancement stage, stabilization stage, and recovery stage. Different calibration coefficients are configured for different stages, and an additional recovery lag coefficient with a value between zero and one is introduced in the recovery stage. The predicted speed at the current moment is weighted and smoothed with the calibrated speed at the previous moment, and finally the target predicted traffic speed after stage calibration correction is output.
[0059] The technical solution of this invention decomposes weather description information into a hierarchical causal chain from the environmental physical layer to the event stage layer through a weather action chain analysis module. This transforms the impact of weather on traffic from an inexplicable static numerical correlation into an interpretable mechanism transmission path, significantly improving the interpretability and physical rationality of the prediction results. By setting multiple candidate lightweight fine-tuning modules bound to the weather action mechanism and dynamically determining activation weights based on weather action chain information, road description information, and city profile information, flexible invocation and combination of weather action mechanism modules in cross-city scenarios are achieved. This solves the parameter interference problem in multi-city mixed training and effectively improves the generalization ability of source city knowledge to target city transfer. By identifying the stage of the weather event and using phased calibration parameters to post-process and correct the preliminary prediction, systematic biases in prediction results under different weather stages (especially the recovery stage) are effectively eliminated. This avoids the unreasonable phenomenon of speed instantly jumping back to normal after the weather clears, ensuring the gradual consistency of speed changes over time.
[0060] Example 2
[0061] Figure 2 This is a flowchart of an urban traffic speed prediction method based on a large language model, provided in Embodiment 2 of the present invention. This embodiment is a further refinement of the above embodiment. Figure 2 As shown, the method includes:
[0062] S201. Obtain weather description information, road description information, and city profile information for the target city at the current forecast time.
[0063] S202. Input the weather description data into the weather action chain analysis module. The weather action chain analysis module will analyze the impact path of weather on traffic layer by layer into environmental physical layer variables, traffic behavior layer variables, road sensitivity layer variables, and event stage layer variables.
[0064] Among them, the environmental physical layer variables include at least variables used to characterize the degree of visibility reduction, the degree of influence of road surface adhesion coefficient, and the degree of water or snow accumulation; the traffic behavior layer variables include at least variables used to characterize the degree of reduction in expected speed, the degree of increase in following distance, and the degree of decrease in lane change probability; the road sensitivity layer variables include at least variables used to characterize the weather sensitivity of slopes, curves, bridges, overpasses, and drainage capacity; and the event stage layer variables are used to identify the stage of the current weather event.
[0065] In this embodiment, environmental physical layer variables represent the objective state changes caused by weather directly affecting the road physical environment. Examples include quantitative indicators such as the degree of visibility reduction, the impact of road surface adhesion coefficient, the degree of water or snow accumulation, and the degree of change in lighting conditions, representing the primary impact of weather on the environmental physical state. Traffic behavior layer variables represent the changes in driver behavior patterns caused by changes in the environmental physical layer. Examples include quantitative indicators such as the degree of reduction in desired speed, the degree of increase in following distance, and the degree of decrease in lane change probability, representing the intermediate response of physical environment changes to the driving decision-making level. Road sensitivity layer variables represent the differentiated sensitivity of different road geometries and physical structures to the same weather effects. Examples include the amplification or attenuation of weather effects by factors such as slopes, curves, bridges, overpasses, and drainage capacity, representing the spatial modulation effect of weather effects under different road conditions. Event stage layer variables represent the current weather event's position in the time process from occurrence to dissipation, including stages such as occurrence, intensification, stabilization, and recovery, representing the evolution of weather effects over time.
[0066] Specifically, the processor can input weather description data into the weather action chain analysis module, which then analyzes the path of weather's impact on traffic layer by layer into environmental physical layer variables, traffic behavior layer variables, road sensitivity layer variables, and event stage layer variables. The analysis module decomposes unstructured weather description data into four levels of mechanistic variables according to the physical transmission logic of weather's impact on traffic. This separates and quantifies the originally mixed weather information according to the chain of "objective physical effects, driving behavior responses, road condition modulation to time process state," providing structured hierarchical variables for subsequent action chain combinations.
[0067] S203. Combine environmental physical layer variables, traffic behavior layer variables, road sensitivity layer variables, and event stage layer variables according to hierarchical causal relationships to generate weather action chain information.
[0068] In this embodiment, hierarchical causality refers to the logical relationship in which the impact of weather on traffic is transmitted step by step and constrained in the order of environmental physical layer, traffic behavior layer, road sensitivity layer to event stage layer.
[0069] Specifically, the processor can combine environmental physical layer variables, traffic behavior layer variables, road sensitivity layer variables, and event stage layer variables according to hierarchical causal relationships to generate weather action chain information. The four hierarchical variables obtained from the previous step are integrated and encoded according to their inherent physical transmission order, linking the originally scattered variables into a complete causal action chain with sequential constraints. This provides a structured data representation of the complete transmission path of weather from its impact on the physical environment to its influence on traffic operations, for use in subsequent module selection and model inference steps. The weather action chain analysis module also outputs the confidence level of each mechanistic variable; if the confidence level is insufficient, rule completion or regression to the default value is used.
[0070] For example, urban conditional weather action chain vector It can be represented as:
[0071]
[0072] In the formula, This represents the weather action chain analysis module under parameter φ. Weather text, 'r' represents weather data, 'r' represents road attributes, 'u' represents city profile, 'v' represents visibility attenuation, 'a' represents road surface adhesion impact, 'c' represents traffic capacity reduction, 'b' represents conservative driving behavior, 'l' represents recovery lag, and 'p' represents event stage.
[0073] S204. Combine weather action chain information, road description data, and urban profile description data to obtain combined feature information.
[0074] In this embodiment, the combined feature information is a unified feature representation formed by splicing or fusing three types of heterogeneous data: weather action chain information, road description information, and urban profile description information.
[0075] Specifically, the processor can splice or fuse three types of information from different modalities and semantic levels: weather mechanism representation, road inherent attributes, and urban macro environment, to form a combined feature vector with a unified dimension. This allows information on weather impact mechanisms, road condition sensitivity, and overall urban endowment to be comprehensively processed by the weight generation module in the same feature space.
[0076] For example, the processor can segment historical traffic speeds into numerical segments of fixed length and map them to traffic tokens consistent with the word embedding dimensions of a large language model through a numerical encoder. Weather action chain tokens, road attribute tokens, time tokens, and traffic tokens are combined into combined feature information in a preset order. The adaptation weight generation module initially uses a higher temperature to allow each lightweight fine-tuning module to fully explore the system, and then gradually lowers the temperature to form sparse selection. One module is activated per sample. For complex weather conditions or specific road conditions in the target city, the module weights can reflect multiple mechanisms of action simultaneously.
[0077] S205. Based on the combined feature information, determine the initial activation weights of each candidate parameter adjustment module through the adaptation weight generation module.
[0078] In this embodiment, the adaptation weight generation module is a functional unit that calculates the activation values of each candidate parameter adjustment module based on input features. It can be a regression network based on a multilayer perceptron, a mapping network based on an attention mechanism, or any combination of the above methods. Its core function is to map the combined feature information into the initial activation values of each candidate module. The initial activation weights are the unfiltered and unnormalized raw activation values directly output by the adaptation weight generation module to each candidate parameter adjustment module.
[0079] Specifically, the processor can input the combined feature information into the adaptation weight generation module, which then uses its internally learnable mapping parameters to convert the combined feature information into the initial activation values of each candidate parameter adjustment module. These initial activation values reflect the initial importance of each candidate module being invoked in the comprehensive context of the current weather action chain, road conditions, and urban profile.
[0080] S206. Select a preset number of candidate parameter adjustment modules with the highest initial activation weight from all candidate parameter adjustment modules as target parameter adjustment modules, and reset the activation weight of the unselected candidate parameter adjustment modules to zero.
[0081] In this embodiment, the preset quantity is the upper limit of the number of candidate parameter adjustment modules that can be activated in a single prediction scenario, which is preset according to application requirements. For example, the value can be between 1 and 3.
[0082] Specifically, the processor can select a preset number of candidate parameter adjustment modules with the highest initial activation weights from all candidate parameter adjustment modules as target parameter adjustment modules, and reset the activation weights of unselected candidate parameter adjustment modules to zero. Then, by selecting a number of modules with the highest initial activation weights from all candidate modules according to a preset upper limit, the processor can finally activate these modules as target modules, while resetting the activation weights of unselected modules to zero. This sparsity filtering ensures that only a small number of modules most relevant to the current weather mechanism are activated for a single prediction scenario, thus avoiding parameter interference that may occur when multiple mechanism modules are activated simultaneously.
[0083] S207. Normalize the initial activation weights of the target parameter adjustment module to obtain the activation weights corresponding to the target parameter adjustment module.
[0084] Specifically, the processor can normalize the initial activation weights of the target parameter adjustment module to obtain the corresponding activation weights of the target parameter adjustment module. The initial activation weights of the selected target modules are then renormalized so that the sum of the activation weights of the selected modules equals a preset constant. This ensures that when multiple target modules are activated simultaneously, their contribution has a uniform dimension, facilitating the subsequent injection of parameter increments from each module into the large language model according to their weights.
[0085] For example, the weight generation module calculates the weights of each lightweight fine-tuning module based on the weather action chain vector m, road attribute vector r, city profile vector u, and event stage p. :
[0086]
[0087] In the formula, and To adapt to the weight generation parameters, τ is the temperature coefficient, and TopK indicates that only the preset number of K lightweight fine-tuning modules with the highest weights are retained, while the remaining weights are reset to zero and renormalized. This ensures that only a small number of fine-tuning modules are activated for different city, weather, and road scenarios, reducing parameter interference in mixed training with multiple weather and city conditions.
[0088] S208. Inject the target lightweight fine-tuning module into the large language model according to the activation weight, and process the historical traffic speed information through the injected large language model to obtain the preliminary predicted traffic speed of the target city in the future time domain.
[0089] For example, the backbone parameters of the large language model are frozen, and the parameter increments of each lightweight fine-tuning module are weighted and injected into the corresponding network layers using determined adaptation weights. The effective weights of the l-th layer are represented as follows:
[0090]
[0091] In the formula, For the original weights that are frozen, and The low-rank matrix of the large model for the k-th lightweight fine-tuning module is given by: To adapt to the weights, s is a scaling factor. A smaller s only makes minor adjustments. During actual training, the scaling factor is adjusted based on whether it affects the overall model's judgment ability. If the impact is significant, the scaling factor is reduced. The model performs joint inference based on the combined tokens and outputs the traffic speed of the target city for the next P time steps through the regression head.
[0092] S209. Based on the current stage of the weather event, obtain the corresponding calibration coefficient from the pre-stored stage calibration parameters.
[0093] In this embodiment, the pre-stored stage calibration parameters are a set of calibration coefficients learned on the validation set for different weather event stages after the model training is completed. These parameters cover the linear calibration coefficients corresponding to each stage and the recovery lag coefficients corresponding to the recovery stage. These parameters can be stored in a fixed manner after training is completed for use in the inference stage.
[0094] Specifically, the processor can retrieve the corresponding calibration coefficient from the pre-stored stage calibration parameters based on the current stage of the weather event. Using the event stage information parsed from the weather action chain as an index, it searches the pre-stored calibration parameter table for the calibration coefficient that matches the current stage.
[0095] S210. Perform phased adaptive calibration on the preliminary predicted traffic speed based on the calibration coefficient to obtain the target predicted traffic speed.
[0096] Specifically, the processor can use the found calibration coefficients to post-process and correct the preliminary prediction results, ensuring that the predicted speed follows a decreasing trend during periods of worsening weather and a gradual recovery trend during periods of improved weather. The final output is the target predicted traffic speed after phase calibration and correction. Finally, non-negative and road speed limit constraints are applied to the speed, and the weights of each lightweight fine-tuning module are output as an explanation of weather impact and city adaptation.
[0097] For example, for the p-th stage of the current weather event, the calibration result is expressed as:
[0098]
[0099] In the formula, and The calibration parameters for the target city in stage p. To restore the lag coefficient, The calibration result from the previous moment. This represents the prediction result at the current moment. Finally, non-negativity and road speed limit constraints are applied to the speed, and the weights of each lightweight fine-tuning module are output as an explanation of weather impact and city adaptation.
[0100] For example, a specific example can be used to demonstrate the calibration effect. Figure 3 This is an example diagram of calibration results in an urban traffic speed prediction method based on a large language model provided in Embodiment 2 of the present invention, as shown in the figure. Figure 3 The figure illustrates the numerical comparison of the initial predicted velocity before and after correction by the stage calibration step in this invention, as well as the schematic value of the actual trend. The figure includes three curves: the uncalibrated prediction, the result after stage calibration, and the actual trend (illustrated) as reference benchmarks. The horizontal axis contains velocity comparison data for five stages. Different calibration coefficients are used for different weather event stages (occurrence, intensification, stabilization, and recovery). Through continuous comparison at multiple time steps, it can be seen that in the t0 to t2 stage (velocity decline period): the uncalibrated prediction and the calibrated result remain consistent at each time step, both showing a velocity decline trend, corresponding to the occurrence to intensification stage of the weather event, where the velocity continuously decreases as the weather worsens. In the t3 to t4 stage (velocity recovery period): at time t3, the predicted velocity recovers from 12 to 40, and at time t4, it further recovers to 68. The uncalibrated prediction and the calibrated result remain consistent at each time step, demonstrating the differentiated correction effect produced by calibration at different stages. This calibration is not a globally uniform adjustment, but rather a targeted correction based on stage characteristics.
[0101] The technical solution of this invention decomposes weather description information into a hierarchical causal chain of environmental physics, traffic behavior, road sensitivity, and event stage layers through a weather action chain analysis module. This transforms the impact of weather on traffic from an inexplicable static numerical correlation into an interpretable mechanism transmission path. This allows the model to distinguish the paths through which different weather factors affect speed, significantly improving the interpretability and physical plausibility of prediction results and overcoming the shortcomings of existing technologies that simplify weather impacts to static correlations. By setting multiple candidate lightweight fine-tuning modules bound to the weather action mechanism, and dynamically determining the activation weights of each module based on weather action chain information, road description information, and city profile information by an adaptation weight generation module, flexible invocation and combination of weather action mechanism modules across city scenarios are achieved. By identifying the stage of a weather event, the preliminary forecast is post-processed and corrected using phased calibration parameters. In the recovery stage, a recovery lag coefficient is introduced to weight and smooth the current predicted speed from the previous calibrated speed. This effectively eliminates the systematic bias of the forecast results under different weather stages, avoids the unreasonable phenomenon of speed instantly returning to normal after the weather is cleared, and ensures the gradual consistency of speed changes over time, further improving the reliability and practical application value of the forecast results.
[0102] As a first optional embodiment of this second embodiment, based on the above embodiment, the training steps further include:
[0103] The process involves acquiring source city training samples from multiple source cities and target city training samples from the target city, and constructing counterfactual training sample pairs. These counterfactual training sample pairs are generated by changing at least one weather description or city profile description data in the original training samples while keeping the road description data, time period, and historical traffic speed information unchanged. The training samples and counterfactual training sample pairs from the source and target cities are then input into the large language model to obtain the corresponding original prediction speed and counterfactual prediction speed. The joint loss is determined based on the counterfactual prediction speed, the original prediction speed, the preset weather change direction constraint, the preset module usage rate, and the preset module upper limit. The core parameters of the large language model are kept frozen, and the parameters of the target parameter adjustment module, the adaptation weight generation module, and the candidate parameter adjustment module are updated based on the joint loss.
[0104] In this embodiment, the source city training samples are historical data samples with real traffic speed labels from the source city during the training phase. The target city training samples are historical data samples with or without labels from the target city during the training phase. When the target city provides no labeled samples, it is a zero-sample mode; when it provides a few labeled samples, it is a few-sample mode. Counterfactual training sample pairs are sets of control samples constructed by changing at least one weather description or city profile description data, while keeping the road description data, time period, and historical traffic speed information unchanged, based on the same original training samples. The only difference between these and the original samples is the weather conditions or urban environment, thus providing the model with comparable data where all other conditions are the same and only the weather or urban environment changes.
[0105] In this embodiment, the preset weather change direction constraint is a speed response direction rule pre-set according to the weather change direction (intensification or deterioration). When the weather worsens, the predicted speed is constrained to decrease; when the weather eases, the predicted speed is constrained to increase. This ensures that the change direction of the model output is consistent with the physical mechanism of weather action. The preset module utilization rate is a target activation frequency distribution set for each candidate parameter adjustment module. This guides the utilization rate of each module to tend towards equilibrium during training, preventing a few modules from monopolizing all training samples for a long period. The preset module upper limit is the maximum number of parameter adjustment modules allowed to be activated in a single training sample. This constrains the sparsity of module activation, promoting the decoupling of different weather action mechanisms. The joint loss is a comprehensive optimization objective obtained by weighted summation of multiple loss functions, including but not limited to regression loss, counterfactual consistency loss, cross-city consistency loss, module load balancing loss, and module sparsity loss. The backbone parameters are the original network weights in the large language model, excluding the lightweight fine-tuning modules.
[0106] Specifically, the processor can acquire source city training samples from multiple source cities and target city training samples from the target city. While maintaining road description data, time periods, and historical traffic speed information, it modifies at least one weather description or city profile description data in the original training samples to generate corresponding counterfactual training sample pairs. The processor can then feed the original and counterfactual samples from the source and target cities into the current large language model for forward inference, obtaining their respective prediction outputs. The difference between the original prediction speed and the counterfactual prediction speed reflects the degree of influence of weather or urban factors on the model output; this difference will serve as the basis for calculating the subsequent counterfactual consistency loss. The processor can calculate the joint loss by integrating multiple optimization objectives. While freezing the backbone parameters of the large language model to maintain their original knowledge, it updates the trainable parameters of the adaptation weight generation module, candidate parameter adjustment module, and target parameter adjustment module only based on the backpropagation gradient of the joint loss. This allows the model to acquire customized adjustment capabilities for weather action chains and cross-city adaptation without compromising the original capabilities of the large language model.
[0107] In zero-shot mode, the target city does not provide any labeled traffic speed samples during the training phase. The joint loss does not include the target city regression loss, but only the following loss terms: counterfactual consistency loss, cross-city consistency loss, module load balancing loss, module sparsity loss, and source city regression loss. In few-shot mode, the target city provides a small number of labeled traffic speed samples during the training phase. Loss composition: The joint loss includes the target city regression loss, and retains all of the following loss terms: target city regression loss, counterfactual consistency loss, cross-city consistency loss, module load balancing loss, module sparsity loss, and source city regression loss.
[0108] For example, counterfactual samples can be generated in four ways: the first is single-factor intensity perturbation, such as adjusting rainfall from 5 mm / h to 30 mm / h while keeping other conditions constant; the second is visibility or road condition replacement, such as adjusting visibility from 5 km to 500 m; the third is event phase transformation, such as changing from a stable period to a recovery period and setting a reasonable duration; the fourth is cross-city profile replacement, such as replacing the road profile of a plain city with that of a mountain city to simulate the response changes when source city knowledge migrates to the target city. Counterfactual samples are not used directly as true label samples, but are used to constrain prediction discrepancies. Samples with excessively large perturbation amplitudes or that violate the combination rules of meteorological variables are deleted. A large language model is used to check descriptive consistency, and a rule base is used to check numerical ranges.
[0109] Furthermore, based on the above embodiments, the steps for determining the joint loss according to the counterfactual prediction speed, the original prediction speed, the preset weather change direction constraint, the preset module utilization rate, and the preset module upper limit can be refined as follows:
[0110] A regression loss is constructed based on the difference between the predicted speed and the actual speed label for each sample; a counterfactual consistency loss is constructed based on the difference between the counterfactual predicted speed and the original predicted speed within the same city, as well as the preset weather change direction constraint; a cross-city consistency loss is constructed based on the difference between the predicted speeds of source city samples and target city samples that are comparable in terms of weather action chain information; a module load balancing loss is constructed based on the difference between the activation rate of each candidate parameter adjustment module in the training batch and the preset target utilization rate; a module sparsity loss is constructed based on the difference between the number of target parameter adjustment modules activated by a single training sample and the preset upper limit; and a joint loss is obtained by weighting and summing the regression loss, counterfactual consistency loss, cross-city consistency loss, module load balancing loss, and module sparsity loss.
[0111] In this embodiment, the true speed label is the actual observed traffic speed value recorded in the training samples. Regression loss is an optimization objective used to constrain the predicted speed to approximate the true speed. Counterfactual predicted speed is the predicted output obtained by inputting counterfactual training samples into the large language model; the difference between it and the original predicted speed reflects the degree of influence of weather or urban factors on the model output. Counterfactual consistency loss is an optimization objective constructed based on the difference between the counterfactual predicted speed and the original predicted speed, as well as the constraint of the direction of weather change; it is used to constrain the direction of speed change output by the model to conform to preset physical rules when weather factors change. Cross-city consistency loss is an optimization objective constructed based on the difference between the predicted speeds of the source city and the target city, which are comparable in terms of weather action chain information. Activation utilization rate refers to the frequency statistics of each candidate parameter adjustment module being activated as the target module in the training batch; it reflects the degree of participation of each module in the training process. The preset target utilization rate is the expected activation frequency distribution set for each candidate parameter adjustment module. Module load balancing loss is an optimization objective built upon the difference between the actual activation rate of each candidate module in a training batch and the preset target activation rate. It aims to prevent a few modules from monopolizing all training samples for an extended period, thus hindering the training of other modules. The preset upper limit is the maximum number of parameter-adjustable modules allowed to be activated in a single training sample. Module sparsity loss is an optimization objective built upon the difference between the actual number of modules activated in a single training sample and the preset upper limit.
[0112] Specifically, the processor can calculate the numerical deviation between the model's predicted speed and the actual speed, using this deviation as the basic regression optimization objective. The processor can use the comparability of original samples and counterfactual samples within the same city to constrain the direction of speed change output by the model to conform to preset physical rules when weather factors change, constructing a counterfactual consistency loss. Specifically, this means that speed should tend to decrease when the weather worsens and tend to increase when the weather improves. By selecting cross-city sample pairs with similar weather impact mechanisms, a cross-city consistency loss is constructed, constraining the predicted speeds of the source city and target city to tend to be consistent under the same weather action chain conditions. This effectively transfers the weather-speed response relationship learned by the source city from abundant data to the target city, which lacks training samples. The processor can statistically analyze the activation frequency of each candidate module in each training batch and constrain the usage rate of each module to tend to a balanced distribution based on a preset target usage rate, constructing a module load balancing loss to prevent a few popular modules from monopolizing all training samples while other modules are rarely activated. The processor can count the number of modules actually activated for each training sample and constrain this number to not exceed a preset upper limit, constructing a module sparsity loss. This ensures that each sample activates only the few modules most relevant to the current weather mechanism, avoiding parameter interference caused by the simultaneous activation of multiple modules and promoting decoupling between different weather mechanisms. The five loss functions with different optimization objectives are multiplied by their corresponding weight coefficients and then summed to form a unified joint loss.
[0113] For example, weather consistency constraints are imposed on the original forecast ŷ and the counterfactual forecast ŷ′. Based on the difference in weather disturbance intensity Δw and the preset weather change direction constraint κ, the counterfactual consistency loss is expressed as:
[0114]
[0115] In the formula, ReLU is a linear rectification function. When the weather worsens and the preset direction is a decrease in speed, κ takes a negative value; when the weather improves, speed recovery is allowed, but the recovery rate is limited by recovery lag constraints. For factors that may be road type dependent, such as strong winds, κ is jointly determined by road attributes and event stage. For example, when rainfall intensifies and there are no road closures, the speed of expressways should not increase overall; during the snowfall recovery period, speed is allowed to gradually recover, but the recovery rate is limited by snow removal status and road grade; strong winds use different directional weights for closed tunnels and open bridges.
[0116] The combined loss is:
[0117]
[0118] In the formula, The regression loss is the value of the actual traffic speed. For counterfactual weather consistency loss, This represents the cross-city consistency loss between the source city and the target city under comparable weather action chains. This is used to prevent a few lightweight fine-tuning modules from monopolizing all samples for an extended period, thus avoiding module load balancing losses. Module sparsity loss is used to limit the number of modules activated per sample. , , and This is the loss weight.
[0119] For example, during training, only the traffic numerical encoder, the adaptation weight generation module, the lightweight fine-tuning module, and the regression head are updated. The optimizer uses AdamW, with the learning rate of the lightweight fine-tuning module higher than that of the adaptation weight generation module, and the backbone parameters are kept frozen. To avoid the collapse of a few modules, the module utilization rate for each batch is calculated and a load balancing loss is added. The weather event phase is determined jointly based on the warning time, the rate of change of weather variables, and the action chain analysis results. Calibration parameters are learned on validation sets for the occurrence, enhancement, stabilization, and recovery phases, respectively. The recovery lag coefficient is preferably set between 0 and 1, so that the calibration speed simultaneously references the current output and the calibration result of the previous moment. After model training is complete, common weather action chains, city profiles, and lightweight fine-tuning module combinations are cached to reduce the analysis overhead during online inference. For newly emerging target cities or weather descriptions, only the weather action chains and adaptation weights are recalculated; when the target city provides a small number of labeled samples, only the phase calibration parameters and a few lightweight modules can be fine-tuned, without retraining all backbone parameters.
[0120] The technical solution of this invention constructs cross-city counterfactual weather command pairs during the training phase. While maintaining comparability of road function, time period, and historical traffic context, weather factors or city profile factors are controlled and altered. A counterfactual consistency loss is applied to constrain the model's output velocity change direction to conform to preset physical rules when weather factors change. This mechanism enables the model to learn a weather-velocity response relationship consistent with physical mechanisms even when training samples are sparse or extreme weather samples are insufficient, overcoming the deficiency of existing technologies that only constrain numerical errors, leading to a lack of physical consistency in prediction results. By setting multiple candidate lightweight fine-tuning modules bound to weather action mechanisms, and dynamically determining the activation weights of each module based on weather action chain information, road description information, and city profile information by the adaptation weight generation module, flexible invocation and combination of weather action mechanism modules in cross-city scenarios are achieved. The source city and target city share the same set of candidate modules, but the adaptation weight generation module automatically assigns different activation weights based on differences in city profiles. This solves the parameter interference problem in multi-city mixed training and the parameter duplication problem caused by training models independently for each city, effectively improving the prediction accuracy of the target city under conditions of few or zero samples. After training, only common weather action chains, city profiles, and lightweight fine-tuning modules need to be cached. During inference, for newly appearing target cities or weather descriptions, only the weather action chains and adaptation weights need to be recalculated, without retraining all backbone parameters. When the target city provides a small number of labeled samples, adaptation can be completed by fine-tuning the stage calibration parameters and a few lightweight modules. This mechanism significantly reduces the deployment and maintenance costs of cross-language-based urban traffic speed prediction models, demonstrating good scalability and practical application prospects.
[0121] For example, a specific example can be used to demonstrate the overall architecture. Figure 4 This is an example architecture diagram of an urban traffic speed prediction method based on a large language model provided in Embodiment 2 of the present invention, as shown below. Figure 4As shown, the multi-source input region gathers four types of raw data: weather text or warning information, road attributes, city profiles, and historical traffic speeds. This data first enters the weather action chain parsing module. This module, with a large language model parser at its core, decomposes the raw weather description information into six mechanistic variables according to the physical transmission path of weather's impact on traffic: visibility impact, road surface adhesion impact, capacity reduction, driving behavior impact, recovery lag, and event stage. These variables are combined and output as a weather action chain vector m, transforming the indivisible whole of weather impact into a structured mechanistic representation with causal relationships. The weather action chain vector m, along with road attributes r, city profile u, and event stage p, are input to the city-conditional adaptation weighting module. This module calculates the activation weights of each candidate lightweight fine-tuning module based on the four types of information and uses a Top-K strategy to retain only the modules with the highest weights, resetting the weights of the remaining modules to zero, thus achieving adaptive module selection based on weather mechanisms and city conditions. After weight allocation, the system enters the lightweight fine-tuning module invocation phase. The diagram illustrates four exemplary candidate modules, corresponding to four reusable weather mechanisms: low visibility, slippery road surfaces, reduced traffic capacity, and recovery lag. The system activates only a small number of modules most relevant to the current prediction scenario and injects them into the large language model. After injection, the system proceeds to the speed prediction and stage calibration module. The large language model infers and outputs a preliminary predicted speed based on historical traffic speed information and weather action chain information. Subsequently, it performs stage-by-stage speed calibration based on the weather event stage identification results, finally outputting the target predicted speed for multiple future time steps. The attached diagram, with a dashed box, indicates the cross-city counterfactual weather consistency training stage. This stage operates on the above process during training, constructing counterfactual weather sample pairs from multi-source city samples and applying consistency constraints. Combined with the prediction loss, it optimizes the parameters of trainable modules, but the core parameters of the large language model remain frozen during this process. After this training stage endows the model with the ability to respond to weather changes with physical consistency, the inference stage only needs to execute the solid line path above the process to complete the prediction.
[0122] For example, the effect can be demonstrated through a set of specific examples. Figures 5-8This image shows a performance comparison of the urban traffic speed prediction method based on a large language model provided in Embodiment 2 of the present invention. The dataset used for validation is a real traffic speed dataset from six cities: Chengdu, Harbin, Shanghai, Wuhan, Xi'an, and Chongqing. Each city includes road segment speed data, road network information, and corresponding weather information, covering normal and abnormal weather conditions such as sunny, rainy, and blizzard. Experimental setup: The historical input length was set to 12 time steps, and the prediction length was set to 12 time steps. Five cities were used as source cities for training, and zero-sample testing was conducted on the remaining target city (where no target city was found). A small-sample adaptation experiment involving a small number of target city samples was also included. The preferred evaluation metrics are Root Mean Square Error (RMSE), Mean Absolute Error (MAE), and Mean Absolute Percentage Error (MAPE). Experimental comparison models: The experimental comparison models include existing traffic prediction methods such as STGCN, GWN, ASTGCN, MTGNN, DCRNN, PGCN, DastNet, MetaST, TransGTR, and SFMGTL, used to comprehensively verify the effectiveness of the method of the present invention. Figure 5-8 As shown, the prediction results demonstrate that the method of this invention achieves superior prediction performance compared to existing baseline methods in cities where no target samples were found, such as Xi'an, Harbin, Shanghai, and Chongqing. Compared to representative state-of-the-art methods, the method of this invention significantly reduces RMSE, MAE, and MAPE in multiple cities, indicating that it maintains strong generalization ability even when sufficient training samples are lacking in the target cities.
[0123] Example 3
[0124] Figure 9 This is a schematic diagram of a city traffic speed prediction device based on a large language model, provided in Embodiment 3 of the present invention. Figure 9 As shown, the device includes:
[0125] The information acquisition module 31 is used to acquire weather description information, road description information and city profile information of the target city at the current forecast time;
[0126] Information parsing module 32 is used to input the weather description information into the weather action chain parsing module to obtain weather action chain information that characterizes the action path of weather affecting traffic and the current stage of the weather event;
[0127] The weight determination module 33 is used to determine at least one target lightweight fine-tuning module and its corresponding activation weight from a plurality of preset candidate lightweight fine-tuning modules based on the weather action chain information, the road description information and the city profile information.
[0128] The speed prediction module 34 is used to inject the target lightweight fine-tuning module into the large language model according to the activation weight, and process the historical traffic speed information through the injected large language model to obtain the preliminary predicted traffic speed of the target city in the future time domain.
[0129] The speed calibration module 35 is used to calibrate the preliminary predicted traffic speed according to the calibration parameters corresponding to the current stage of the weather event, so as to obtain the target predicted traffic speed of the target city in the future time domain.
[0130] The technical solution of this invention decomposes weather description information into a hierarchical causal chain from the environmental physical layer to the event stage layer through a weather action chain analysis module. This transforms the impact of weather on traffic from an inexplicable static numerical correlation into an interpretable mechanism transmission path, significantly improving the interpretability and physical rationality of the prediction results. By setting multiple candidate lightweight fine-tuning modules bound to the weather action mechanism and dynamically determining activation weights based on weather action chain information, road description information, and city profile information, flexible invocation and combination of weather action mechanism modules in cross-city scenarios are achieved. This solves the parameter interference problem in multi-city mixed training and effectively improves the generalization ability of source city knowledge to target city transfer. By identifying the stage of the weather event and using phased calibration parameters to post-process and correct the preliminary prediction, systematic biases in prediction results under different weather stages (especially the recovery stage) are effectively eliminated. This avoids the unreasonable phenomenon of speed instantly jumping back to normal after the weather clears, ensuring the gradual consistency of speed changes over time.
[0131] Furthermore, the information parsing module 32 is specifically used for:
[0132] The weather description data is input into the weather action chain analysis module, which then analyzes the path of weather affecting traffic layer by layer into environmental physical layer variables, traffic behavior layer variables, road sensitivity layer variables, and event stage layer variables.
[0133] The environmental physical layer variables, the traffic behavior layer variables, the road sensitivity layer variables, and the event stage layer variables are combined according to hierarchical causal relationships to generate weather action chain information;
[0134] The environmental physical layer variables include at least variables characterizing the degree of visibility attenuation, the degree of influence of road surface adhesion coefficient, and the degree of water or snow accumulation; the traffic behavior layer variables include at least variables characterizing the degree of reduction in expected speed, the degree of increase in following distance, and the degree of decrease in lane change probability; the road sensitivity layer variables include at least variables characterizing the weather sensitivity of slopes, curves, bridges, overpasses, and drainage capacity; and the event stage layer variables are used to identify the current stage of the weather event.
[0135] Furthermore, the weight determination module 33 is specifically used for:
[0136] The weather action chain information, the road description data, and the city profile description data are combined to obtain combined feature information;
[0137] Based on the combined feature information, the initial activation weights of each candidate parameter adjustment module are determined by the adaptation weight generation module.
[0138] Select a preset number of candidate parameter adjustment modules with the highest initial activation weight from all candidate parameter adjustment modules as the target parameter adjustment modules, and reset the activation weight of the unselected candidate parameter adjustment modules to zero;
[0139] The initial activation weights of the target parameter adjustment module are normalized to obtain the activation weights corresponding to the target parameter adjustment module.
[0140] Furthermore, the speed calibration module 35 is specifically used for:
[0141] Based on the current stage of the weather event, the corresponding calibration coefficient is obtained from the pre-stored stage calibration parameters;
[0142] The preliminary predicted traffic speed is subjected to phased adaptive calibration based on the calibration coefficient to obtain the target predicted traffic speed.
[0143] Optionally, the device may further include a training module.
[0144] The training module includes:
[0145] The first determining unit is used to acquire source city training samples from multiple source cities and target city training samples from target cities, and to construct counterfactual training sample pairs respectively. The counterfactual training sample pairs are generated by changing at least one weather description data or city profile description data in the original training samples while keeping the road description data, time period and historical traffic speed information unchanged.
[0146] The second determining unit is used to input the training samples and counterfactual training sample pairs of the source city and the target city into the large language model respectively to obtain the corresponding original prediction speed and counterfactual prediction speed.
[0147] The third determining unit is used to determine the joint loss based on the counterfactual prediction speed, the original prediction speed, the preset weather change direction constraint, the preset module utilization rate, and the preset module upper limit.
[0148] The fourth determining unit is used to keep the backbone parameters of the large language model frozen, and update the parameters of the target parameter adjustment module, the adaptation weight generation module, and the candidate parameter adjustment module according to the joint loss.
[0149] Specifically, the third determining unit is used for:
[0150] A regression loss is constructed based on the difference between the predicted speed and the actual speed label for each sample.
[0151] Based on the difference between the counterfactual prediction speed and the original prediction speed in the same city, and the pre-set weather change direction constraint, a counterfactual consistency loss is constructed.
[0152] Based on the difference in prediction speed between source city samples and target city samples that are comparable in terms of weather action chain information, a cross-city consistency loss is constructed.
[0153] Based on the difference between the activation rate of each candidate module in the training batch and the preset target rate, the module load balancing loss is constructed.
[0154] The module sparse loss is constructed by adjusting the difference between the number of modules activated by a single training sample and a preset upper limit.
[0155] The joint loss is obtained by weighted summation of the regression loss, the counterfactual consistency loss, the cross-city consistency loss, the module load balancing loss, and the module sparsity loss.
[0156] The urban traffic speed prediction device based on a large language model provided in the embodiments of the present invention can execute the urban traffic speed prediction method based on a large language model provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method.
[0157] Example 4
[0158] Figure 10 A schematic diagram of an electronic device 40 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0159] like Figure 10As shown, the electronic device 40 includes at least one processor 41 and a memory, such as a read-only memory (ROM) 42 or a random access memory (RAM) 43, communicatively connected to the at least one processor 41. The memory stores computer programs executable by the at least one processor. The processor 41 can perform various appropriate actions and processes based on the computer program stored in the ROM 42 or loaded from storage unit 48 into the RAM 43. The RAM 43 may also store various programs and data required for the operation of the electronic device 40. The processor 41, ROM 42, and RAM 43 are interconnected via a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.
[0160] Multiple components in electronic device 40 are connected to I / O interface 45, including: input unit 46, such as keyboard, mouse, etc.; output unit 47, such as various types of monitors, speakers, etc.; storage unit 48, such as disk, optical disk, etc.; and communication unit 49, such as network card, modem, wireless transceiver, etc. Communication unit 49 allows electronic device 40 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0161] Processor 41 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 41 performs the various methods and processes described above, such as urban traffic speed prediction methods based on large language models.
[0162] In some embodiments, the urban traffic speed prediction method based on a large language model can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 48. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 40 via ROM 42 and / or communication unit 49. When the computer program is loaded into RAM 43 and executed by processor 41, one or more steps of the urban traffic speed prediction method based on a large language model described above can be performed. Alternatively, in other embodiments, processor 41 can be configured to perform the urban traffic speed prediction method based on a large language model by any other suitable means (e.g., by means of firmware).
[0163] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0164] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0165] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0166] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0167] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0168] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0169] In one embodiment, the present invention further includes a computer program product, which includes a computer program that, when executed by a processor, implements the urban traffic speed prediction method based on a large language model according to any embodiment of the present invention.
[0170] In implementing the computer program product, computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0171] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0172] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for predicting urban traffic speed based on a large language model, characterized in that, include: Obtain weather description information, road description information, and city profile information for the target city at the current forecast time; The weather description information is input into the weather action chain parsing module, which parses the information to obtain weather action chain information that characterizes the path of weather's impact on traffic and the current stage of the weather event. Based on the weather action chain information, the road description information, and the city profile information, at least one target lightweight fine-tuning module and its corresponding activation weight are determined from a plurality of preset candidate lightweight fine-tuning modules. The target lightweight fine-tuning module is injected into the large language model according to the activation weight, and the historical traffic speed information is processed by the injected large language model to obtain the preliminary predicted traffic speed of the target city in the future time domain. The preliminary predicted traffic speed is calibrated based on the calibration parameters corresponding to the current stage of the weather event to obtain the target predicted traffic speed for the target city in the future time domain.
2. The method according to claim 1, characterized in that, The step of inputting the weather description information into the weather action chain analysis module to obtain weather action chain information that characterizes the action path of weather affecting traffic and the current stage of the weather event includes: The weather description data is input into the weather action chain analysis module, which then analyzes the path of weather affecting traffic layer by layer into environmental physical layer variables, traffic behavior layer variables, road sensitivity layer variables, and event stage layer variables. The environmental physical layer variables, the traffic behavior layer variables, the road sensitivity layer variables, and the event stage layer variables are combined according to hierarchical causal relationships to generate weather action chain information; The environmental physical layer variables include at least variables characterizing the degree of visibility attenuation, the degree of influence of road surface adhesion coefficient, and the degree of water or snow accumulation; the traffic behavior layer variables include at least variables characterizing the degree of reduction in expected speed, the degree of increase in following distance, and the degree of decrease in lane change probability; the road sensitivity layer variables include at least variables characterizing the weather sensitivity of slopes, curves, bridges, overpasses, and drainage capacity; and the event stage layer variables are used to identify the current stage of the weather event.
3. The method according to claim 1, characterized in that, Based on the weather action chain information, the road description information, and the city profile information, the process of determining at least one target lightweight fine-tuning module and its corresponding activation weight from a set of pre-set candidate lightweight fine-tuning modules includes: The weather action chain information, the road description data, and the city profile description data are combined to obtain combined feature information; Based on the combined feature information, the initial activation weights of each candidate parameter adjustment module are determined by the adaptation weight generation module. Select a preset number of candidate parameter adjustment modules with the highest initial activation weight from all candidate parameter adjustment modules as the target parameter adjustment modules, and reset the activation weight of the unselected candidate parameter adjustment modules to zero; The initial activation weights of the target parameter adjustment module are normalized to obtain the activation weights corresponding to the target parameter adjustment module.
4. The method according to claim 1, characterized in that, The step of calibrating the preliminary predicted traffic speed according to the calibration parameters corresponding to the current stage of the weather event to obtain the target predicted traffic speed for the target city in the future time domain includes: Based on the current stage of the weather event, the corresponding calibration coefficient is obtained from the pre-stored stage calibration parameters; The preliminary predicted traffic speed is subjected to phased adaptive calibration based on the calibration coefficient to obtain the target predicted traffic speed.
5. The method according to claim 1, characterized in that, The training steps also include: Source city training samples from multiple source cities and target city training samples from target cities are obtained, and counterfactual training sample pairs are constructed respectively. The counterfactual training sample pairs are generated by changing at least one weather description data or city profile description data in the original training samples while keeping the road description data, time period and historical traffic speed information unchanged. The training samples and counterfactual training sample pairs of the source city and the target city are respectively input into the large language model to obtain the corresponding original prediction speed and counterfactual prediction speed. The joint loss is determined based on the counterfactual prediction speed, the original prediction speed, the preset weather change direction constraint, the preset module utilization rate, and the preset module upper limit. Keep the core parameters of the large language model frozen, and update the parameters of the target parameter adjustment module, the adaptation weight generation module, and the candidate parameter adjustment module according to the joint loss.
6. The method according to claim 5, characterized in that, The determination of joint loss based on the counterfactual prediction speed, the original prediction speed, the preset weather change direction constraint, the preset module utilization rate, and the preset module upper limit includes: A regression loss is constructed based on the difference between the predicted speed and the actual speed label for each sample. Based on the difference between the counterfactual prediction speed and the original prediction speed in the same city, and the pre-set weather change direction constraint, a counterfactual consistency loss is constructed. Based on the difference in prediction speed between source city samples and target city samples that are comparable in terms of weather action chain information, a cross-city consistency loss is constructed. Based on the difference between the activation rate of each candidate module in the training batch and the preset target rate, the module load balancing loss is constructed. The module sparse loss is constructed by adjusting the difference between the number of modules activated by a single training sample and a preset upper limit. The joint loss is obtained by weighted summation of the regression loss, the counterfactual consistency loss, the cross-city consistency loss, the module load balancing loss, and the module sparsity loss.
7. A device for predicting urban traffic speed based on a large language model, characterized in that, include: The information acquisition module is used to acquire weather description information, road description information, and city profile information of the target city at the current forecast time. The information parsing module is used to input the weather description information into the weather action chain parsing module to obtain weather action chain information that characterizes the action path of weather affecting traffic and the current stage of the weather event. The weight determination module is used to determine at least one target lightweight fine-tuning module and its corresponding activation weight from a plurality of preset candidate lightweight fine-tuning modules based on the weather action chain information, the road description information and the city profile information. The speed prediction module is used to inject the target lightweight fine-tuning module into the large language model according to the activation weight, and process the historical traffic speed information through the injected large language model to obtain the preliminary predicted traffic speed of the target city in the future time domain. The speed calibration module is used to calibrate the preliminary predicted traffic speed according to the calibration parameters corresponding to the current stage of the weather event, so as to obtain the target predicted traffic speed of the target city in the future time domain.
8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the urban traffic speed prediction method based on a large language model as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the urban traffic speed prediction method based on a large language model as described in any one of claims 1-6.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the urban traffic speed prediction method based on a large language model according to any one of claims 1-6.