Knowledge-guided vehicle following model construction method based on large language model
By adopting a combination of large language models and deep neural networks in the vehicle follow-up model, the acceleration prediction model with inline traffic knowledge is solved, and the problem of degradation of prediction accuracy of traditional models in complex driving scenarios and limited effectiveness of data-driven models in unknown situations is achieved, and a more efficient and adaptive vehicle follow-up model is achieved.
Patent Information
- Application Number
- CN202510139434.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-08
- Publication Date
- 2025-05-16
AI Technical Summary
Traditional physical rules-based vehicle follow-up models have reduced prediction accuracy when dealing with complex and variable driving scenarios, and data-driven methods are limited in effectiveness in unknown or rare driving situations.
A knowledge guidance method based on large language models is adopted to build a vehicle follow-up model by combining simulated follow-up scenarios, embedded traffic knowledge acceleration prediction model and deep neural network model. This method integrates the information of the acceleration prediction model into a deep neural network through knowledge distillation to form a simplified model structure.
While retaining strong generalization capabilities, it reduces computing resource consumption and improves the adaptability and prediction performance of vehicle follow-up models in different traffic states.
Smart Images

Figure CN120012592A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of vehicle traffic technology, and in particular to a method, device, electronic device and storage medium for constructing a vehicle following model guided by knowledge based on a large language model. Background Art
[0002] As a core component of traffic flow dynamics, vehicle trajectory simulation and autonomous driving technology research and development, the Car-Following Model (CFM) plays a vital role in modern traffic engineering. The traditional physical rule-based CFM uses a series of rigorous mathematical formulas to quantify the interaction mechanism between vehicles in longitudinal motion, so it has high transparency and interpretability in theory. However, with the increasing complexity of traffic systems, such models gradually reveal their inherent limitations when dealing with changing driving scenarios, especially when dealing with the diversity of driver behaviors and driving situations that have never been encountered. The prediction accuracy of traditional models has dropped significantly.
[0003] In response to the above problems, a data-driven CFM paradigm came into being. With the help of statistical analysis of real traffic data and machine learning algorithms, it has demonstrated better prediction performance than traditional physical models. However, although these data-driven methods can provide reliable prediction results in known environments, their generalization ability is still limited by the breadth and diversity of the data sets used in the training process, which severely restricts their effectiveness in the face of unknown or rare driving situations. For example, a CFM trained based on congested road data is likely to perform below expectations when applied to free-flowing roads, which shows that the model's generalization ability under different traffic conditions has significant limitations. Summary of the invention
[0004] The present application provides a method, device, electronic device and storage medium for constructing a vehicle following model guided by knowledge based on a large language model, which can enable the vehicle following model to have a more simplified model structure while retaining strong generalization capabilities and reducing computing resource consumption.
[0005] According to one aspect of the present application, a method for constructing a vehicle following model guided by knowledge based on a large language model is provided, the method comprising:
[0006] Simulating a following scenario of a target vehicle according to sample data; wherein the sample data includes the speed of the target vehicle, the distance between the target vehicle and a preceding vehicle, and the relative speed between the target vehicle and the preceding vehicle;
[0007] Determining a first acceleration corresponding to the target vehicle in the following scenario by a predetermined acceleration prediction model; wherein the acceleration prediction model is a large language model embedded with traffic knowledge, and the traffic knowledge includes at least one of historical traffic patterns, driving behavior rules, and dynamic interaction information in various traffic scenarios;
[0008] A deep neural network model is trained according to the sample data and the first acceleration to obtain a vehicle following model.
[0009] According to another aspect of the present application, a vehicle following model construction device based on knowledge guidance of a large language model is provided, the device comprising:
[0010] A car-following scenario simulation module, used to simulate a car-following scenario of a target vehicle according to sample data; the sample data includes the speed of the target vehicle, the distance between the target vehicle and the preceding vehicle, and the relative speed between the target vehicle and the preceding vehicle;
[0011] A first acceleration prediction module, used to determine a first acceleration corresponding to the target vehicle in the following scenario by using a predetermined acceleration prediction model; wherein the acceleration prediction model is a large language model embedded with traffic knowledge, and the traffic knowledge includes at least one of historical traffic patterns, driving behavior rules, and dynamic interaction information under various traffic scenarios;
[0012] The car-following model building module is used to train a deep neural network model according to the sample data and the first acceleration to obtain a vehicle-following model.
[0013] According to another aspect of the present application, an electronic device is provided, the electronic device comprising:
[0014] at least one processor; and
[0015] a memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the vehicle following model construction method based on knowledge guidance of a large language model as described in any embodiment of the present invention.
[0017] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the method for constructing a vehicle following model based on knowledge guidance of a large language model as described in any embodiment of the present invention when executed.
[0018] The technical solution of the embodiment of the present application simulates a following scenario of a target vehicle based on sample data; wherein the sample data includes the speed of the target vehicle, the distance between the target vehicle and the preceding vehicle, and the relative speed between the target vehicle and the preceding vehicle; the first acceleration corresponding to the target vehicle in the following scenario is determined by a predetermined acceleration prediction model; wherein the acceleration prediction model is a large language model embedded with traffic knowledge, and the traffic knowledge includes at least one of historical traffic patterns, driving behavior rules, and dynamic interaction information under various traffic scenarios; the deep neural network model is trained based on the sample data and the first acceleration to obtain a vehicle following model. The technical solution of the embodiment of the present application obtains a vehicle following model by performing knowledge distillation on an acceleration prediction model based on a large language model and embedded with traffic knowledge, so that the vehicle following model can have a more simplified model structure while retaining a strong generalization ability, thereby reducing computing resource consumption.
[0019] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 is a flow chart of a method for constructing a vehicle following model guided by knowledge based on a large language model according to the first embodiment of the present application;
[0022] Figure 2 is a flow chart of a method for constructing a vehicle following model based on knowledge guidance of a large language model according to the second embodiment of the present application;
[0023] Figure 3 It is a structural schematic diagram of a vehicle following model building device based on knowledge guidance of a large language model according to the third embodiment of the present application;
[0024] Figure 4 It is a structural schematic diagram of an electronic device that implements the vehicle following model construction method guided by knowledge based on a large language model according to an embodiment of the present application. DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0027] Embodiment 1
[0028] Figure 1 A flowchart of a method for constructing a vehicle following model based on knowledge guidance of a large language model is provided for the first embodiment of the present application. This embodiment is applicable to the situation where a target vehicle in a following scene needs to be controlled by a vehicle following model. The method can be executed by a vehicle following model construction device based on knowledge guidance of a large language model. The device can be implemented in the form of hardware and / or software, and the device can be configured in an electronic device. Figure 1 As shown, the method includes:
[0029] S110, simulating a target vehicle following scenario according to sample data; wherein the sample data includes the speed of the target vehicle, the distance between the target vehicle and a preceding vehicle, and the relative speed between the target vehicle and the preceding vehicle.
[0030] Among them, the following scenario usually refers to a driving scenario where there is another vehicle driving in close proximity in front of the vehicle, and the vehicle in front has a continuous impact on the driver's operation, and the vehicle has no intention of changing lanes. In this scenario, the driver of the vehicle needs to pay close attention to the driving status of the vehicle in front and adjust his driving behavior according to the driving status of the vehicle in front.
[0031] In the embodiment of the present application, the following scenario of the target vehicle can be simulated according to the sample data. Specifically, the target vehicle and the preceding vehicle can be regarded as two vehicles traveling one behind the other in the same lane. The speed of the target vehicle, the distance between the target vehicle and the preceding vehicle, and the relative speed between the target vehicle and the preceding vehicle can be determined through the sample data. Furthermore, the speed of the preceding vehicle can be determined according to the speed of the target vehicle and the relative speed between the target vehicle and the preceding vehicle, so as to perform a simple simulation of the following scenario of the target vehicle.
[0032] Optionally, before simulating the following scenario of the target vehicle according to the sample data, it also includes: constructing a three-dimensional space according to a preset speed range, a preset spacing range and a preset relative speed range; performing random sampling from the three-dimensional space, and using the speed, spacing and relative speed corresponding to the points obtained by random sampling as sample data.
[0033] In an embodiment of the present application, a three-dimensional space can be first constructed according to a preset speed range, a preset spacing range, and a preset relative speed range. Among them, the preset speed range, the preset spacing range, and the preset relative speed range can be determined according to actual needs or experience, and the embodiment of the present application does not limit this. For example, the preset speed range can be [0,40] m / s, the preset spacing range can be [0.1,100] m, and the preset relative speed range can be [-5,5] m / s. After that, random sampling can be performed from the three-dimensional space, and the speed, spacing, and relative speed corresponding to the points obtained by random sampling can be used as sample data. Specifically, the speed corresponding to the randomly sampled points can be used as the speed of the target vehicle, the spacing corresponding to the randomly sampled points can be used as the spacing between the target vehicle and the preceding vehicle, and the relative speed corresponding to the randomly sampled points can be used as the relative speed between the target vehicle and the preceding vehicle. It should be noted that when random sampling is performed from the three-dimensional space, a sufficient number of samples should be ensured to ensure that the following scene simulated by the sample data can cover all possible following behaviors of the target vehicle.
[0034] S120. Determine a first acceleration corresponding to a target vehicle in a car-following scenario through a predetermined acceleration prediction model; wherein the acceleration prediction model is a large language model with embedded traffic knowledge, and the traffic knowledge includes at least one of historical traffic patterns, driving behavior rules, and dynamic interaction information in various traffic scenarios.
[0035] Among them, the large language model is a complex neural network trained based on a large-scale data set, which can capture and simulate the complexity and diversity of language. By pre-training on a large-scale text corpus, the large language model can learn the common patterns and structures of language, thus having powerful natural language processing capabilities.
[0036] Among them, historical traffic patterns refer to specific traffic modes and traffic structures formed in different historical periods; driving behavior patterns refer to the behavior patterns and characteristics exhibited by drivers during driving; and dynamic interactive information in various traffic scenarios includes traffic light information, road conditions information, and weather information.
[0037] In an embodiment of the present application, the first acceleration corresponding to the target vehicle in the following scenario can be determined by a predetermined acceleration prediction model. Specifically, the following scenario can be first converted into a natural language form that can be processed by a large language model, and then the first acceleration corresponding to the target vehicle in the following scenario can be determined by the traffic knowledge embedded in the predetermined acceleration prediction model. It can be understood that the acceleration prediction model in the present application uses embedded traffic knowledge, including historical traffic patterns, driving behavior rules, and dynamic interaction information under various traffic scenarios, to determine the first acceleration, and does not rely on a specific actual traffic data set. Therefore, the acceleration prediction model can still have good generalization ability and adaptability to new scenarios in the absence of a large amount of specific scenario training data. At the same time, this method also helps to alleviate the overfitting problem caused by insufficient representativeness of the data set, thereby achieving more robust prediction performance under different traffic conditions.
[0038] S130: Training a deep neural network model according to the sample data and the first acceleration to obtain a vehicle following model.
[0039] Among them, the deep neural network DNN is a machine learning model based on artificial neural network, with multiple layers of nonlinear transformation units, which is used to learn the complex representation of data. In the embodiment of the present application, the input of the deep neural network is three characteristic variables: speed, spacing, and relative speed. The structure of the deep neural network is 4 layers with 16 neurons in each layer, and the output of the deep neural network is the acceleration prediction value.
[0040] In the embodiment of the present application, although the acceleration prediction model in step S120 can be used to predict the acceleration of the target vehicle in the following scenario, the direct application of the acceleration prediction model based on the large language model has the problem of excessive resource consumption. Specifically, if the acceleration prediction model is deployed on a local device, a large amount of computing resources will be consumed to perform inference operations. If the commercial large language model API is called remotely, high service fees will be incurred. In addition, since the acceleration prediction model adopts an autoregressive generation method, each output depends on the previous result. This serialized generation process consumes a lot of time, usually reaching a delay of seconds, which makes the acceleration prediction model difficult to use directly in application scenarios with high real-time requirements. In order to solve the above problems, a deep neural network model with the same structure as the acceleration prediction model is selected in the embodiment of the present application, and the acceleration prediction model is subjected to knowledge distillation, and key information is extracted from it and integrated into a lightweight deep neural network model. Specifically, the deep neural network model can be trained according to the sample data and the first acceleration to obtain a vehicle following model, so that the vehicle following model retains the strong generalization ability of the acceleration prediction model while having a simpler model structure and reducing computing resource consumption, thereby being more suitable for deployment and application in actual environments.
[0041] Optionally, before training the deep neural network model according to the sample data and the first acceleration, it also includes: normalizing the sample data. Specifically, the three variables of speed, spacing and relative speed in the sample data can be normalized in turn, that is, converted into a standard normal distribution form. In this way, all variables are at the same scale, and model training is easier to converge to the optimal.
[0042] The technical solution of the embodiment of the present application simulates the following scenario of the target vehicle based on sample data; wherein the sample data includes the speed of the target vehicle, the distance between the target vehicle and the preceding vehicle, and the relative speed between the target vehicle and the preceding vehicle; the first acceleration corresponding to the target vehicle in the following scenario is determined by a predetermined acceleration prediction model; wherein the acceleration prediction model is a large language model embedded with traffic knowledge, and the traffic knowledge includes at least one of historical traffic patterns, driving behavior rules, and dynamic interaction information under various traffic scenarios; the deep neural network model is trained based on the sample data and the first acceleration to obtain the vehicle following model. The technical solution of the embodiment of the present application obtains the vehicle following model by performing knowledge distillation on the acceleration prediction model based on the large language model and embedded with traffic knowledge, so that the vehicle following model can have a more simplified model structure while retaining a strong generalization ability, thereby reducing computing resource consumption.
[0043] Embodiment 2
[0044] Figure 2 This is a flow chart of a method for constructing a vehicle following model based on knowledge guidance of a large language model provided in the second embodiment of the present application. The present embodiment is optimized based on the above embodiment. For solutions not described in detail in the embodiment of the present application, please refer to the above embodiment. Figure 2 As shown, the method includes:
[0045] S210: Simulate a target vehicle following scenario according to the sample data.
[0046] S220: Convert the car-following scenario into prompt words in natural language, and input the prompt words into a predetermined acceleration prediction model.
[0047] Among them, the prompt words include system prompt words and user prompt words. The system prompt words are used to guide the acceleration prediction model to output the prediction content, and the user prompt words are used to describe the following behavior of the target vehicle in the following scenario.
[0048] In an embodiment of the present application, when predicting the acceleration of a target vehicle in a car-following scenario by using an acceleration prediction model, it is necessary to first convert the car-following scenario into a form that can be processed by the acceleration prediction model, that is, prompt words in natural language form, and then input the prompt words into a predetermined acceleration prediction model so that the acceleration prediction model can output the prediction content based on the prompt words.
[0049] Optionally, the car-following scenario is converted into prompt words in natural language, including: describing the role positioning of the acceleration prediction model in the car-following scenario in natural language to obtain system prompt words; wherein the role positioning includes the background, goals, rules, instructions and output form of the acceleration prediction model; and describing the sample data corresponding to the car-following scenario in natural language to obtain user prompt words.
[0050] In an embodiment of the present application, the role of the acceleration prediction model in the following scenario, including background, goals, rules, instructions, and output forms, can be described in natural language to obtain system prompts to guide the acceleration prediction model to output the predicted content. For example, the description of the background can be "You are a driving assistant that aims to simulate the following behavior of a human driver. You will obtain real-time data of the following scenario, including the speed of the target vehicle, the distance between the target vehicle and the vehicle in front, and the relative speed between the target vehicle and the vehicle in front"; the description of the goal can be "Your goal is to predict the acceleration of the target vehicle in the next time step to fit the standard human driving pattern as closely as possible"; the description of the rules can be "You need to follow the following rules: When the expected collision time or distance is very small, you need to brake immediately to avoid a collision; the absolute values of acceleration and deceleration do not exceed 5m / s 2"; the description of the instruction may be "Please carefully analyze the current traffic scene and make acceleration predictions according to the above driving instructions"; the description of the output form may be "Your acceleration prediction output needs to conform to the json format." At the same time, the sample data corresponding to the following scene may be described in the form of natural language to obtain user prompts. For example, the user prompt may be "The following is the current following scene: the speed of the target vehicle is 22.59m / s, the distance between the target vehicle and the preceding vehicle is 7.35m, and the relative speed between the target vehicle and the preceding vehicle is -0.57m / s."
[0051] S230: Obtain prediction content output by the acceleration prediction model, and determine a first acceleration from the prediction content using a regular expression.
[0052] Among them, regular expression is a tool used for text search, replacement, parsing and verification. It can define a search pattern through a series of characters and symbols to match specific content in a string.
[0053] In an embodiment of the present application, after the prompt word is input into a predetermined acceleration prediction model, the acceleration prediction model can generate and output prediction content in json format according to the prompt word, and the acceleration prediction value, i.e., the first acceleration, can be extracted from the json format prediction content through a regular expression for subsequent deep neural network model training.
[0054] S240: Train a deep neural network model according to the sample data and the first acceleration to obtain a vehicle following model.
[0055] Optionally, a deep neural network model is trained according to the sample data and the first acceleration to obtain a vehicle following model, including: inputting the sample data into the deep neural network model to obtain a second acceleration output by the deep neural network model; determining a loss function according to the first acceleration, the second acceleration and a monotonicity constraint parameter; back-propagating through the loss function, iteratively updating the deep neural network model until the loss function converges to obtain a vehicle following model.
[0056] Among them, the monotonicity constraint parameter is used to impose monotonicity constraints during the training process of the deep neural network model. It can be understood that when other factors remain unchanged, the relationship between the speed of the target vehicle, the distance between the target vehicle and the preceding vehicle, and the relative speed between the target vehicle and the preceding vehicle, and the acceleration of the target vehicle is monotonic. For example, when the distance between the target vehicle and the preceding vehicle increases, the acceleration of the target vehicle will also increase accordingly. Therefore, by imposing monotonicity constraints during the training process of the deep neural network model, outliers can be identified and excluded, avoiding the inaccuracy of the prediction results due to the illusion phenomenon in the acceleration prediction model, which in turn affects the training of the deep neural network model.
[0057] In an embodiment of the present application, the deep neural network model can be trained according to the sample data and the first acceleration to obtain a vehicle following model. Specifically, the sample data can be first input into the deep neural network model to obtain the acceleration prediction value output by the deep neural network model, that is, the second acceleration. Then, the loss function is determined according to the first acceleration, the second acceleration and the monotonicity constraint parameter. By adding the monotonicity constraint parameter to the loss function, the monotonicity constraint can be imposed during the training process of the deep neural network model. Afterwards, the deep neural network model is iteratively updated through the loss function through back propagation until the loss function converges to obtain the vehicle following model.
[0058] Optionally, determining a loss function based on the first acceleration, the second acceleration and a monotonicity constraint parameter includes: determining an error value between the first acceleration and the second acceleration by a preset method; wherein the preset method includes at least one of a mean square error, a root mean square error and a mean absolute error; and performing a weighted summation of the error value and the monotonicity constraint parameter to obtain the loss function.
[0059] The monotonicity constraint parameter can be understood as the penalty imposed when the relationship between the target vehicle’s speed, the distance between the target vehicle and the preceding vehicle, and the relative speed between the target vehicle and the preceding vehicle and the acceleration of the target vehicle is not monotonic.
[0060] In the embodiment of the present application, the loss function can be determined according to the first acceleration, the second acceleration and the monotonicity constraint parameter. Specifically, first, the error value between the first acceleration and the second acceleration is determined by a preset method; wherein the preset method can be a mean square error, a root mean square error, and a mean absolute error, etc. Here, the mean square error is used as an example for explanation, and the calculation formula of the error value is:
[0061]
[0062] Secondly, the error value and the monotonicity constraint parameter are weighted and summed to obtain the loss function. Optionally, the calculation formula of the monotonicity constraint parameter is as follows:
[0063]
[0064] Optionally, the loss function is calculated as follows:
[0065] L=L MSE +θ mono C mono ;
[0066] Among them, L is the loss function, L MSE is the error value, C mono is the monotonicity constraint parameter, N is the number of sample data, is the first acceleration of the target vehicle corresponding to the i-th sample data, is the second acceleration of the target vehicle corresponding to the i-th sample data, v i is the speed of the target vehicle in the i-th sample data, s i is the distance between the target vehicle and the preceding vehicle in the i-th sample data, Δv i is the relative speed between the target vehicle and the preceding vehicle in the i-th sample data, θ mono is the weight coefficient of the monotonicity constraint parameter.
[0067] In the embodiment of the present application, in order to verify the performance of the vehicle following model KIDL constructed in the present application, vehicle following models including traditional vehicle following models (IDM, DNN and PIDL), vehicle following model KIDL-mono without monotonicity constraints during training, and vehicle following model KIDL were tested. Specifically, the traditional vehicle following model uses NGSIM-I80, NGSIM-US101 and HighD data sets as training sets in turn, and after the training is completed, it is tested on the NGSIM-I80, NGSIM-US101 and HighD data sets respectively to determine the total number of collisions on the three data sets, and the weighted sum of the trajectory errors on the three data sets when driving according to the acceleration predicted by the vehicle following model after training. The training data (LLM samples) of KIDL-mono and KIDL are generated by the acceleration prediction model. After training, they are tested on the NGSIM-I80, NGSIM-US101 and HighD datasets respectively to determine the total number of collisions on the three datasets and the weighted sum of the trajectory errors on the three datasets when driving according to the acceleration predicted by the vehicle following model after training. The results are shown in Table 1.
[0068] Table 1 Vehicle following model test results
[0069]
[0070]
[0071] As can be seen from Table 1, the overall performance of the KIDL-related models is significantly better than the traditional vehicle following model. It not only achieves the lowest level in terms of trajectory error, but also achieves a zero collision rate. Specifically, the complete KIDL model performs best, and its performance exceeds the traditional vehicle following model by at least 4.87%. By comparing the KIDL and KIDL-mono models, it is found that the monotonicity constraint can bring a 1.62% performance improvement. Therefore, the experimental results prove the strong generalization ability of the KIDL model, which can show excellent adaptability in different traffic scenarios and has the initial ability to be deployed in real traffic scenarios.
[0072] S250: Obtain a target speed of the target vehicle, a target distance between the target vehicle and a preceding vehicle, and a target relative speed between the target vehicle and the preceding vehicle in a real car-following scenario.
[0073] In an embodiment of the present application, when the target vehicle is in a real following scenario, the target speed of the target vehicle, the target distance between the target vehicle and the preceding vehicle, and the target relative speed between the target vehicle and the preceding vehicle can be obtained as inputs to a vehicle following model to predict the acceleration of the target vehicle through the vehicle following model.
[0074] S260: Determine a target acceleration of the target vehicle according to the target speed, the target distance, the target relative speed, and the vehicle following model, and control the target vehicle according to the target acceleration.
[0075] In an embodiment of the present application, the target speed, target distance, and target relative speed can be input into the vehicle following model to obtain the output result of the vehicle following model, determine the target acceleration of the target vehicle based on the output result, and perform real-time control of the target vehicle based on the target acceleration, such as adjusting the acceleration of the target vehicle to the value of the target acceleration, so as to ensure the safety of the target vehicle's following behavior.
[0076] The technical solution of the embodiment of the present application simulates the following scene of the target vehicle according to the sample data; converts the following scene into a prompt word in the form of natural language, and inputs the prompt word into a predetermined acceleration prediction model; obtains the prediction content output by the acceleration prediction model, and determines the first acceleration from the prediction content through a regular expression; trains the deep neural network model according to the sample data and the first acceleration to obtain the vehicle following model; obtains the target speed of the target vehicle, the target distance between the target vehicle and the preceding vehicle, and the target relative speed between the target vehicle and the preceding vehicle in the real following scene; determines the target acceleration of the target vehicle according to the target speed, the target distance, the target relative speed and the vehicle following model, and controls the target vehicle according to the target acceleration. The technical solution of the embodiment of the present application obtains the vehicle following model by performing knowledge distillation on the acceleration prediction model based on the large language model and embedded with traffic knowledge, so that the vehicle following model can have a more simplified model structure while retaining a strong generalization ability, and reduce the consumption of computing resources, so as to facilitate the real-time control of the target vehicle according to the target acceleration output by the vehicle following model in the real following scene, and ensure the safety of the following behavior of the target vehicle.
[0077] Embodiment 3
[0078] Figure 3 This is a schematic diagram of the structure of a vehicle following model building device based on knowledge guidance of a large language model provided in the third embodiment of the present application. Figure 3 As shown, the device comprises:
[0079] A following scenario simulation module 310 is used to simulate a following scenario of a target vehicle according to sample data; the sample data includes the speed of the target vehicle, the distance between the target vehicle and the preceding vehicle, and the relative speed between the target vehicle and the preceding vehicle;
[0080] A first acceleration prediction module 320 is used to determine a first acceleration corresponding to the target vehicle in the following scenario by using a predetermined acceleration prediction model; wherein the acceleration prediction model is a large language model embedded with traffic knowledge, and the traffic knowledge includes at least one of historical traffic patterns, driving behavior rules, and dynamic interaction information under various traffic scenarios;
[0081] The car-following model building module 330 is used to train a deep neural network model according to the sample data and the first acceleration to obtain a vehicle-following model.
[0082] Optionally, the device further comprises:
[0083] A three-dimensional space construction module, used to construct a three-dimensional space according to a preset speed range, a preset spacing range, and a preset relative speed range;
[0084] The sample data determination module is used to perform random sampling from the three-dimensional space and use the speed, spacing and relative speed corresponding to the points obtained by random sampling as sample data.
[0085] Optionally, the first acceleration prediction module 320 includes:
[0086] A car-following scene conversion unit, used for converting the car-following scene into prompt words in natural language form, and inputting the prompt words into a predetermined acceleration prediction model;
[0087] The first acceleration prediction unit is used to obtain the prediction content output by the acceleration prediction model and determine the first acceleration from the prediction content through a regular expression.
[0088] Optionally, the prompt words include system prompt words and user prompt words; the following scene conversion unit is specifically used to:
[0089] Describing the role of the acceleration prediction model in the car-following scenario in the form of natural language to obtain a system prompt; wherein the role includes the background, goal, rules, instructions and output form of the acceleration prediction model;
[0090] The sample data corresponding to the car-following scenario is described in the form of natural language to obtain a user prompt word.
[0091] Optionally, the car-following model building module 330 includes:
[0092] A second acceleration prediction unit, used for inputting the sample data into the deep neural network model to obtain a second acceleration output by the deep neural network model;
[0093] A loss function determining unit, configured to determine a loss function according to the first acceleration, the second acceleration, and a monotonicity constraint parameter;
[0094] The car-following model construction unit is used to perform back propagation through the loss function, iteratively update the deep neural network model until the loss function converges, and obtain the vehicle-following model.
[0095] Optionally, the loss function determining unit includes:
[0096] an error value determination subunit, configured to determine an error value between the first acceleration and the second acceleration in a preset manner; wherein the preset manner includes at least one of a mean square error, a root mean square error, and a mean absolute error;
[0097] The loss function determination subunit is used to perform weighted summation on the error value and the monotonicity constraint parameter to obtain the loss function.
[0098] Optionally, the device further comprises:
[0099] A target data acquisition module is used to acquire a target speed of the target vehicle, a target distance between the target vehicle and a preceding vehicle, and a target relative speed between the target vehicle and the preceding vehicle in a real car-following scenario;
[0100] The target vehicle control module is used to determine the target acceleration of the target vehicle according to the target speed, the target distance, the target relative speed and the vehicle following model, and control the target vehicle according to the target acceleration.
[0101] The vehicle following model construction device based on knowledge guidance of a large language model provided in the embodiment of the present application can execute the vehicle following model construction method based on knowledge guidance of a large language model provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0102] Embodiment 4
[0103] Figure 4 A schematic diagram of an electronic device 10 that can be used to implement an embodiment of the present application 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 processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0104] like Figure 4As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0105] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0106] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the vehicle following model construction method guided by knowledge of a large language model.
[0107] In some embodiments, the knowledge-guided vehicle following model construction method based on a large language model may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the knowledge-guided vehicle following model construction method based on a large language model described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the knowledge-guided vehicle following model construction method based on a large language model in any other appropriate manner (e.g., by means of firmware).
[0108] Various implementations 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 chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0109] The computer programs for implementing the methods of the present application 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, so that when the computer programs are executed by the processor, the functions / operations specified in the flow charts and / or block diagrams are implemented. The computer programs may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0110] In the context of the present application, a computer readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device or equipment. A computer readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer readable storage medium may be a machine readable signal medium. A more specific example of a machine readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0111] To provide interaction with a user, the systems and techniques described herein may 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 a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0112] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0113] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0114] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document is not limited here.
[0115] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of this application.
Claims
1. A method for constructing a vehicle following model based on knowledge guidance of a large language model, characterized in that: The method comprises: Simulating a following scenario of a target vehicle according to sample data; wherein the sample data includes the speed of the target vehicle, the distance between the target vehicle and a preceding vehicle, and the relative speed between the target vehicle and the preceding vehicle; Determining a first acceleration corresponding to the target vehicle in the following scenario by a predetermined acceleration prediction model; wherein the acceleration prediction model is a large language model embedded with traffic knowledge, and the traffic knowledge includes at least one of historical traffic patterns, driving behavior rules, and dynamic interaction information in various traffic scenarios; A deep neural network model is trained according to the sample data and the first acceleration to obtain a vehicle following model.
2. The method according to claim 1, characterized in that Before simulating the target vehicle's following scenario based on the sample data, it also includes: Constructing a three-dimensional space according to a preset speed range, a preset spacing range, and a preset relative speed range; Random sampling is performed from the three-dimensional space, and the speed, spacing and relative speed corresponding to the points obtained by random sampling are used as sample data.
3. The method according to claim 1, characterized in that Determining a first acceleration corresponding to the target vehicle in the car-following scenario by using a predetermined acceleration prediction model includes: Converting the following scene into prompt words in natural language, and inputting the prompt words into a predetermined acceleration prediction model; The prediction content output by the acceleration prediction model is obtained, and the first acceleration is determined from the prediction content by using a regular expression.
4. The method according to claim 3, characterized in that The prompt words include system prompt words and user prompt words; The following car scene is converted into prompt words in natural language, including: Describing the role of the acceleration prediction model in the car-following scenario in the form of natural language to obtain a system prompt; wherein the role includes the background, goal, rules, instructions and output form of the acceleration prediction model; The sample data corresponding to the car-following scenario is described in the form of natural language to obtain a user prompt word.
5. The method according to claim 1, characterized in that The deep neural network model is trained according to the sample data and the first acceleration to obtain a vehicle following model, including: Inputting the sample data into the deep neural network model to obtain a second acceleration output by the deep neural network model; Determining a loss function according to the first acceleration, the second acceleration, and a monotonicity constraint parameter; The deep neural network model is iteratively updated by back-propagating the loss function until the loss function converges to obtain a vehicle following model.
6. The method according to claim 5, characterized in that Determining a loss function according to the first acceleration, the second acceleration, and a monotonicity constraint parameter includes: Determine an error value between the first acceleration and the second acceleration in a preset manner; wherein the preset manner includes at least one of a mean square error, a root mean square error, and a mean absolute error; The error value and the monotonicity constraint parameter are weightedly summed to obtain the loss function.
7. The method according to claim 1, characterized in that After determining second sample data according to the sample data and the first acceleration, and training a deep neural network model according to the second sample data to obtain a vehicle following model, the method further includes: Obtaining a target speed of the target vehicle, a target distance between the target vehicle and a preceding vehicle, and a target relative speed between the target vehicle and the preceding vehicle in a real car-following scenario; A target acceleration of the target vehicle is determined according to the target speed, the target distance, the target relative speed, and the vehicle following model, and the target vehicle is controlled according to the target acceleration.
8. A vehicle following model construction device guided by knowledge based on a large language model, characterized in that: The device comprises: A car-following scenario simulation module, used to simulate a car-following scenario of a target vehicle according to sample data; wherein the sample data includes the speed of the target vehicle, the distance between the target vehicle and a preceding vehicle, and the relative speed between the target vehicle and the preceding vehicle; A first acceleration prediction module, used to determine a first acceleration corresponding to the target vehicle in the following scenario by using a predetermined acceleration prediction model; wherein the acceleration prediction model is a large language model embedded with traffic knowledge, and the traffic knowledge includes at least one of historical traffic patterns, driving behavior rules, and dynamic interaction information under various traffic scenarios; The car-following model building module is used to train a deep neural network model according to the sample data and the first acceleration to obtain a vehicle-following model.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the knowledge-guided vehicle following model construction method based on a large language model as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the knowledge-guided vehicle following model construction method based on a large language model according to any one of claims 1 to 7 when executed.