Optimization generation method of key scenarios for intelligent vehicles based on large model knowledge guidance
By combining large language models and intelligent car testing methods with optimized search, knowledge expression and parameter optimization modules are built, and the problem of insufficient generation efficiency and coverage of key scenarios of smart cars in traditional methods is solved, and efficient and accurate key scenario generation and self-learning ability is achieved.
Patent Information
- Application Number
- CN202510622702.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2045-05-15
AI Technical Summary
It is difficult for the existing technology to efficiently generate key test scenarios for smart cars. Traditional methods lack in-depth understanding of test scenarios and cannot provide sufficient heuristic gradient information in complex multi-dimensional scenarios, resulting in insufficient search efficiency and coverage of key scenarios.
Combining the large language model (LLM) and optimization search, a knowledge expression module and parameter optimization module are built, and through global exploration, local optimization and spatial pruning strategies, the Carla simulation platform is used to build and simulate and execute scenes, and the knowledge model is dynamically updated to guide optimized search.
It realizes efficient generation and coverage of key scenarios of smart cars, improves search efficiency and accuracy, and dynamically builds a diverse knowledge base to adapt to changes in the test environment by self-learning.
Smart Images

Figure CN120144481B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of autonomous vehicle testing, and more specifically, is a method for optimizing and generating key scenarios for intelligent vehicles based on large model knowledge guidance. Background Art
[0002] Smart car technology is at the forefront of innovation in the transportation sector. To ensure that smart cars can cope with complex driving environments and avoid accidents, a scientific and comprehensive testing and evaluation system is essential. Scenario-based testing methods abstract various driving conditions that a vehicle may encounter into parameterized and semantically described "test scenario fragments." These methods effectively simulate the real world and provide more comprehensive testing of the system under test. Efficiently and comprehensively generating key test scenarios is a key component of smart car performance verification.
[0003] Existing research has primarily focused on importance sampling and optimization search. Importance sampling methods focus testing resources on key scenario areas through probability density function reconstruction. However, these methods focus on statistical confidence verification and are unable to directly guide algorithm optimization iterations. In contrast, optimization search methods directly locate system weaknesses through parameter space exploration. The generated key test scenarios can be directly used for intelligent vehicle algorithm optimization and improvement, offering greater application value. However, current algorithms generally employ existing intelligent optimization algorithms or basic improved algorithms to directly optimize and search the scenario generation process, relying solely on parameter combinations and lacking a deep understanding of the test scenarios. The increasing level of intelligent driving has significantly increased the scale and complexity of scenarios, making nonlinearity and uncertainty the norm in the testing process. Traditional methods lack sufficient heuristic gradient information, resulting in challenges in efficiency, coverage, and accuracy in key scenario search. Introducing prior knowledge into the optimization search process has the potential to improve the performance of optimization algorithms. However, traditional knowledge construction methods rely on extensive manual experience, have a single, rigid knowledge structure, and are limited in guidance methods, making them difficult to apply to the complex and multidimensional intelligent vehicle scenario generation process.
[0004] Therefore, there is an urgent need for an optimized search method that comprehensively considers knowledge construction and knowledge application to achieve targeted and continuous generation of key scenarios for smart cars. Summary of the Invention
[0005] To solve the above problems, the present invention provides a method for optimizing and generating key scenarios of smart cars based on large language model (LLM) knowledge guidance. By combining the knowledge model, large language model and optimized search, key scenarios of smart cars can be quickly generated.
[0006] The technical solution of the present invention is described as follows in conjunction with the accompanying drawings:
[0007] The present invention provides a method for optimizing and generating key scenarios of intelligent vehicles based on large model knowledge guidance, comprising the following steps:
[0008] S1. Construct a knowledge expression module, designing knowledge results, large language model application methods, and dynamic update processes based on scenario theory knowledge and scenario exploration knowledge;
[0009] S2. Build a parameter optimization module and design a multi-stage optimization strategy that includes global exploration, local optimization, and spatial pruning, and integrate it with the knowledge model;
[0010] S3. Build a simulation test module based on the Carla simulation platform, using LLM-Agent to build the scenario building, system under test, simulation execution, and data export components;
[0011] S4. Select a pre-trained large language model, design selection indicators and perform model selection;
[0012] S5. Construct an evaluation and memory module to evaluate the test results and store all test and knowledge data in the process.
[0013] Furthermore, the specific method of S1 is as follows:
[0014] S11. Establish scenario theory knowledge, including importance, monotonicity and coupling;
[0015] S111, establish importance;
[0016] For a given autonomous driving system, the importance of specific scene elements is obtained by comparing them with each other, thereby building an element importance model;
[0017] S112, establish monotonicity;
[0018] Monotonicity is used to describe the monotonic relationship between parameters and results within a specific parameter range. LLM is derived based on kinematic equations and physical laws and is used to guide the search process for test boundaries.
[0019] S113, establish coupling;
[0020] The interdependence between elements is analyzed through coupling theory in system engineering, which is completed by LLM;
[0021] S12. Establish scene exploration knowledge, including spatial region features, optimal solution features, and convergence features;
[0022] S121. Analyze spatial regional characteristics;
[0023] Divide the search space into unexplored and explored parts;
[0024] S122. Analyze the characteristics of the optimal solution;
[0025] Record the optimal solution information of key scene elements found in the optimization process; save the global optimal solution by real-time tracking and analyzing the performance of each element area, and when a new global optimal solution is found When the global optimal solution Add to the collection and set the maximum capacity , when the maximum capacity is exceeded, remove the earliest element that enters;
[0026] At the same time, through the design of prompt words, the LLM is required to self-infer the recommended value under the current dimension, thereby constructing and dynamically updating the set of high-quality solutions, and using the LLM's ability to understand knowledge to guide the subsequent local optimization process; statistical analysis is performed on the corresponding dimensions in the set of high-quality solutions to obtain the mean and standard deviation:
[0027] ;
[0028] ;
[0029] The calculation results are used to assist the LLM value recommendation process;
[0030] S123, evaluating the effectiveness of the optimization search process;
[0031] S13, design knowledge construction and dynamic update process;
[0032] Guide LLM to generate contextual prompts through preset prompt word templates, thereby dynamically updating the knowledge representation model to guide subsequent decisions and actions;
[0033] S131, initial stage of design and testing;
[0034] S132, design optimization process;
[0035] S133. Perform dynamic update.
[0036] Furthermore, the specific method of S111 is as follows:
[0037] S1111, LLM analyzes the functional requirements of the system to be tested, generates semantic descriptions of element comparisons between two elements through natural language reasoning, and converts them into a judgment matrix;
[0038] S1112. The Agent performs a judgment based on the hierarchical analysis test. If the consistency ratio (CR) test passes, the result is valid and saved to the knowledge base for subsequent optimization search. Otherwise, the previous value is used. The CR is calculated as follows:
[0039] ;
[0040] Where, is a random consistency indicator, when If the value is less than 0.1, the matrix is considered to have satisfactory consistency. By combining AHP with LLM, the importance model of scene elements is automatically generated and updated to quantify the influence of each element. At the same time, LLM dynamically adjusts the value of the judgment matrix elements according to the parameter sensitivity data in the subsequent optimization process, forming a closed-loop correction system.
[0041] The specific method of S112 is as follows:
[0042] S1121, LLM preliminarily determines the monotonicity level of scene elements based on physical kinematics theory;
[0043] S1122. Construct a local sensitivity analysis method, SA, and calculate partial derivatives based on discrete difference approximation:
[0044] ;
[0045] The test data and sensitivity analysis results are again provided to the LLM, which generates a revised monotonicity mapping table based on the test data;
[0046] The specific method of S113 is as follows:
[0047] S1131. Leveraging LLM’s ability to understand test scenarios, establish coupling relationships between elements based on historical data, and label the coupling strengths, expressing them in a coupling matrix M, where each element Representation elements and The coupling strength between
[0048] S1132. At each stage of the testing process, the Spearman correlation coefficient between the various factors is calculated using correlation analysis (CA). , quantify the nonlinear correlation between factors and provide it to LLM to assist LLM in adjusting the coupling relationship. The calculation formula is as follows:
[0049] ;
[0050] Where, is the difference between the two sets of sorted data, is the sample size; according to The value of adjusts the corresponding position in the coupling matrix to reflect the latest nonlinear correlation;
[0051] The specific method of S121 is as follows:
[0052] S1211, LLM identifies blank areas during the search process and combines it with the subsequent scene space partitioning strategy to optimize the global exploration efficiency; In the dimensional test space, each point Use vector Indicates that , for each dimension , the distance from any point to the nearest forward recursive known point is defined as follows:
[0053] ;
[0054] Where, To determine the point set in the excavated area, Projection on dimension, setting threshold If the calculated distance is less than , it is considered to have been discovered; dynamic adjustment, LLM automatically identifies and updates regional features based on historical data and theoretical models, thereby realizing the dynamic update of regional features during the accelerated testing process;
[0055] The specific method of S123 is as follows:
[0056] S1231, LLM analyzes whether the local optimization phase can continue to explore test scenarios or whether it needs to switch to the global exploration phase based on the number of key scenarios in each optimization search process and the convergence criterion of the particle population;
[0057] S1232, Convergence analysis includes the convergence rate of the optimization algorithm ,stability and repeated features Conduct quantitative evaluation and adjust the optimization strategy based on the evaluation results to ensure the comprehensiveness of the search process. To assist LLM analysis, the calculation formulas for each indicator are constructed as follows:
[0058] ;
[0059] ;
[0060] ;
[0061] Where, For the The number of key scenes found in the iteration; is the number of key scenes in the initial particle space; For the The average value of all particle positions; is the Euclidean distance between particles;
[0062] The specific method of S131 is as follows:
[0063] In the initial stage of testing, a preliminary scenario theory model is constructed based on the theory related to the test scenario and the information of the system to be tested. The scenario description is converted into prompt words, and combined with the context information, it assists the initialization of LLM to build a theoretical knowledge model.
[0064] The specific method of S132 is as follows:
[0065] During the optimization process, historical instructions, population variable states, scenario library data, and simulation test results of the optimization search process are collected, and contextual information is formed based on preset prompt word templates covering key concepts of optimization search, objective functions, and scenario theory. Based on the current contextual information, LLM calls the corresponding agent calculation tool to generate knowledge about the importance, monotonicity, and coupling of scenario elements, and dynamically updates the scenario theory knowledge accordingly. For the exploration process knowledge, regional characteristics, optimal solution characteristics, and convergence characteristics are recorded, and the LLM optimal solution is inferred and saved as a specific numerical matrix.
[0066] The specific method of S133 is as follows:
[0067] After each round of optimization, the LLM continuously receives new data and, through the collaborative work of the SA, CA, and AHP agents, implements knowledge verification and generates sensitivity and correlation data, assisting the LLM in learning and adapting to changes in the test environment and adjusting the knowledge representation model. The updated knowledge representation will guide the decision-making behavior of the intelligent agents in the subsequent parameter optimization module, and the decision results will be fed back to the system again, forming a closed loop of continuous improvement.
[0068] Furthermore, the specific method of S2 is as follows:
[0069] S21, modeling the global exploration part;
[0070] S22, modeling the local optimization part;
[0071] S23, modeling the spatial pruning part;
[0072] S24. Design optimization execution process.
[0073] Furthermore, the specific method of S21 is as follows:
[0074] S211. For each scenario dimension, determine whether the importance and value range of each dimension have changed; if it is a newly generated or changed dimension, repartition it according to the specific value, discrete step length, and importance of the scenario parameter; if there is no change, no repartitioning is required;
[0075] S212: Randomly select data points in each single-dimensional partition and combine them to generate a sampling space;
[0076] S213, selecting the required samples in the sampling space by using a random sampling method;
[0077] The specific method of S22 is as follows:
[0078] S221, regional aggregation;
[0079] First, the regions divided by the global exploration module are aggregated using regional features and optimal solution features. Statistical analysis is performed on the parameters of each scenario within each divided region. Starting from the starting point of the value, the region with more than 20% of the number of key scenarios in the overall space is marked as the core region. A separation zone is defined around the center of the core region. The length of the core region after aggregation does not exceed 3 times the length of the minimum region of the scenario parameter. For non-core regions, the length is not more than 5 times the minimum region, and the length is greater than the core region.
[0080] S222, particle equation optimization;
[0081] Construct an importance weight that is equal to the importance knowledge result; LLM gives the optimal solution for recommended exploration through prompt words, guides particle movement, and designs the following particle motion equation:
[0082] ;
[0083] ;
[0084] Where, is the time step Time Particle In the Speed in parameter dimensions; is the inertia weight; For the The importance weight of each parameter dimension; is the acceleration constant of the region; is the acceleration constant of other regions. The region where the particle is located and other regions are the regions where the particle is located after regional aggregation. The integration of multiple regions helps the particle converge quickly and grasp the global vision. is the global acceleration constant; is the LLM acceleration constant; , , , A random number between [0,1], used to increase the randomness of the search; For the current particle In the Position in the parameter dimension; The current particle The optimal position of each parameter dimension in the region; To remove the particle The sum of the optimal solutions of all regions other than the region where the parameter dimension is located; For particle The number of aggregation regions in each parameter dimension; The particle number given by LLM analysis is The optimal solution for parameter dimensions; for The particle position at the time step; Calculated Particle velocity at the time step;
[0085] The specific method of S23 is as follows:
[0086] S231, constrained monotonicity;
[0087] For parameters known to be monotonic, establish constraints to exclude regions that are unlikely to contain better solutions based on monotonicity.
[0088] S232, Analyze coupling;
[0089] Based on the coupling between parameters, a correlation model between parameters is constructed and used to identify invalid parameter combinations. During the search process, when a certain set of parameter values is encountered, based on the coupling analysis results, the parameter space region that cannot produce a better solution under the given parameter values is cut off.
[0090] S233, design pruning buffer zones;
[0091] The most critical element has the largest initial buffer zone, which is the width of the element in the global exploration part. The buffer zones of other elements are proportionally converted according to their importance. Each time the spatial pruning part is executed, the buffer zone width is adjusted to 3 / 4 of the previous round;
[0092] The specific method of S24 is as follows:
[0093] The synergistic effect of the three modules of global exploration, local optimization, and spatial pruning completes the cyclic optimization process. The global exploration part is called at the beginning of the test and when the optimization falls into a local optimum to replenish the diverse individuals in the particle swarm. The local optimization part determines whether the number of cycles has ended after each round of optimization. After each round of optimization, it determines whether the number of cycles has ended. If not, the parameter space is pruned according to the spatial pruning part to exclude non-critical areas. The convergence knowledge is further integrated. If convergence is achieved, the global exploration part is turned into a new round of exploration results. Otherwise, the local optimization part is continued. The statement logic is converted into task prompt words to assist LLM in agent scheduling and optimization.
[0094] Furthermore, the specific method of S3 is as follows:
[0095] S31. Construct a simulation test platform based on CARLA simulation; the simulation test platform includes four core components: scenario construction, system under test, simulation execution, and data export;
[0096] S32. The scenario building component selects elements from the element library to build a test scenario based on the input use case, and uses the CARLA internal API to customize static scene elements, dynamic traffic participants and environmental features; the element library defines various elements for environment initialization, and the constructed elements include: lane width, lane id, longitudinal speed, lateral speed, lateral offset from the lane, lateral distance and longitudinal distance between the main vehicle and the traffic vehicle, longitudinal speed and lateral speed of the traffic vehicle, light intensity, road adhesion coefficient, and weather conditions; the system component under test provides an external autonomous driving algorithm interface to realize sensor setting, vehicle control signal input, chassis and scene feedback information output, and supports multiple perception sensors according to the sensor characteristics in Carla; the simulation execution component initializes the scene by loading the specific values of the above-mentioned scene elements and executes the simulation program. During the process, the kinematic indicators of each traffic participant are saved in real time, including vehicle position, speed, acceleration, and heading angle to the result library; the data export component exports and merges all motion data collected during the simulation in a standardized JSON format.
[0097] Furthermore, the specific method of S4 is as follows:
[0098] Select the Qwen model.
[0099] Furthermore, the specific method of S5 is as follows:
[0100] S51. Define scenario criticality indicators based on the two core dimensions of collision time and safety distance, which are related to hazard, and assign different criticality levels, as shown in the following formula:
[0101] ;
[0102] Where, To guide the optimization search scenario fitness value, in order to avoid the possible negative value of collision time and relative distance affecting the gradient search process, the reciprocal is taken; collision time less than 0.6s and safety distance less than 3m indicate extreme scenarios, so Take 1.67s-1, Take 0.33m-1; and The calculation formula is as follows:
[0103] ;
[0104] ;
[0105] The scene criticality is designed into three levels and assigned different weights. When two indicators are met at the same time, it indicates that the scene relative position is extreme and the collision time is extremely small, indicating that it is a key scene of concern in the test process. The criticality level is high and the weight is assigned to 10. When only one indicator is met, the criticality level is medium. When both indicators are not met, the criticality level is low and the weight is assigned to 0.1.
[0106] S52, data memory stores historical LLM interaction status, various aspects of knowledge in the knowledge model, parameter space and test result information related to the test scenario, as well as particle position and motion information of the historical five optimization steps; the test scenario and test result information are stored in the vector database Chroma; for other information, an SQL database is built based on SQLite to realize the writing, querying and updating of historical dialogues, knowledge base and particle swarm optimization status.
[0107] The beneficial effects of the present invention are:
[0108] 1) This invention can quickly generate key scenarios for smart cars by combining knowledge models, large language models, and optimized search algorithms;
[0109] 2) The LLM-based automated knowledge model construction and active updating method designed in this invention can realize the dynamic construction of a self-learning multi-knowledge base, and guide the accurate optimization search process with a transparent knowledge representation and reasoning mechanism, which is more efficient and accurate than manually generated knowledge.
[0110] 3) The multi-stage optimization strategy designed by the present invention, which includes global exploration, local optimization, and spatial pruning, can effectively apply knowledge models and improve the efficiency of discovery in key scenarios.
[0111] 4) The automated testing tool designed by the present invention based on the Carla simulation platform can fully utilize the advantages of LLM in tool calling to achieve automated deconstruction, reconstruction, simulation, and testing of test scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0112] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.
[0113] Figure 1 This is a flow chart of a method for optimizing and generating key scenarios of intelligent vehicles based on large model knowledge guidance according to the present invention;
[0114] Figure 2 This is a schematic diagram of the structure of a method for optimizing and generating key scenarios of intelligent vehicles based on large model knowledge guidance according to the present invention;
[0115] Figure 3 A schematic diagram of the knowledge construction and updating process;
[0116] Figure 4 Schematic diagram of the improved Latin hypercube sampling method;
[0117] Figure 5 Schematic diagram of the local optimization process;
[0118] Figure 6 Schematic diagram of the spatial pruning method;
[0119] Figure 7 Design rule diagram for optimizing prompt words;
[0120] Figure 8 This is a schematic diagram of the simulation test platform architecture;
[0121] Figure 9 Schematic diagram of the test scenario;
[0122] Figure 10 Determine a schematic diagram for discrete step lengths of the scene;
[0123] Figure 11 This is a schematic diagram showing the simulation test scenario;
[0124] Figure 12 Generate data diagrams for key test scenarios for each group;
[0125] Figure 13 This is a schematic diagram of coverage data for each group;
[0126] Figure 14 Schematic diagram of test time data for each group. DETAILED DESCRIPTION
[0127] The present invention will be further described in detail below with reference to the accompanying drawings and examples. It will be understood that the specific embodiments described herein are intended only to illustrate the present invention and are not intended to limit the present invention. It should also be noted that, for ease of description, the accompanying drawings only illustrate portions relevant to the present invention, not all structures.
[0128] Example 1:
[0129] See Figure 1 and Figure 2 This embodiment provides a method for optimizing and generating key scenarios of intelligent vehicles based on large model knowledge guidance, including the following steps:
[0130] S1. Build a knowledge expression module. Design knowledge results, large language model application methods, and dynamic update processes based on scenario theory knowledge and scenario exploration knowledge. The details are as follows:
[0131] S11. Establish scenario theory knowledge, including importance, monotonicity and coupling, specifically:
[0132] S111, establish importance;
[0133] Different scenario factors have different degrees of influence on test results. For a given autonomous driving system, the importance of specific scenario factors is obtained by comparing them with each other, thereby constructing a factor importance model. The specific steps are:
[0134] S1111. The Large Language Model (LLM) analyzes the functional requirements of the system to be tested, generates semantic descriptions of element comparisons between two elements through natural language reasoning, and converts them into a judgment matrix; is a set of scene elements to be compared, For the number of elements, construct a judgment matrix ; By solving the largest eigenvalue of the matrix and the corresponding eigenvector , the relative weight of each factor can be obtained ;
[0135] S1112. The Agent performs a judgment based on the Analytical Hierarchy Process (AHP). If the consistency ratio (CR) test passes, the result is valid and saved to the knowledge base for subsequent optimization search. Otherwise, the previous value is used. The CR is calculated as follows:
[0136] ;
[0137] Where, is a random consistency indicator, when If it is less than 0.1, the matrix can be considered to have satisfactory consistency. By combining the analytic hierarchy process (AHP) with LLM, the importance model of scene elements can be automatically generated and updated to quantify the impact of each element. At the same time, LLM dynamically adjusts the value of the judgment matrix elements according to the parameter sensitivity data in the subsequent optimization process (performed by the large prediction model itself), forming a closed-loop correction system. The adjustment process is to feed back the sensitivity data to LLM, and LLM decides by itself whether the elements in the judgment matrix need to be adjusted.
[0138] S112, establish monotonicity;
[0139] Monotonicity describes the monotonic relationship between parameters and results within a specific parameter range. LLM is derived based on kinematic equations and physical laws and is used to guide the search for test boundaries. Because changes in certain scenario parameters can cause the overall risk to change monotonically (for example, an increase in vehicle speed may increase braking distance, thereby increasing risk), the specific steps are:
[0140] S1121, LLM, based on the theory of physical kinematics, preliminarily determines the monotonicity level (0, 1, 2) of the scene elements. The judgment process is to analyze the monotonic impact of the element on the safety of the test results and score it according to the degree of impact;
[0141] Among them, the initial judgment of the monotonicity level of the scene elements can be made according to the preset rules;
[0142] When there is no clear monotonic relationship between the impact of scene element changes on the test results, that is, as the elements increase, the test results will not move in one direction, and the level is 0;
[0143] When the impact of scene element changes on test results is monotonic within a small range, the range width is no less than 1 / 5 of the entire element value, and the level is 1;
[0144] When the effect of scene element changes on the test results has a significant monotonic relationship, that is, as the elements increase, the test results will move in the same direction, the level is 2;
[0145] S1122. Construct a local sensitivity analysis method, SA, and calculate partial derivatives based on discrete difference approximation:
[0146] ;
[0147] The test data and sensitivity analysis results are provided to the LLM again, and the LLM integrates the knowledge and test data to generate a revised monotonicity mapping table;
[0148] S113, establish coupling;
[0149] The interdependence between elements is systematically analyzed through the coupling theory in system engineering, which is led by LLM. The specific steps are:
[0150] S1131. Leveraging LLM’s ability to understand test scenarios, establish coupling relationships between elements based on historical data, and label the coupling strengths, expressing them in a coupling matrix M, where each element Representation elements and The coupling strength between
[0151] Among them, when it is defined as weak coupling, that is, multiple factors changing together along a fixed direction have no single direction effect on the test results, it is marked as 0;
[0152] When strong coupling is defined, that is, multiple factors changing together in a fixed direction have a single-directional impact on the test results, it is marked as 1;
[0153] Weak coupling and strong coupling are determined based on pre-set thresholds;
[0154] S1132. At each stage of the testing process, the Spearman correlation coefficient between the various factors is calculated using correlation analysis (CA). , quantify the nonlinear correlation between factors and provide it to LLM to assist LLM in adjusting the coupling relationship. The calculation formula is as follows:
[0155] ;
[0156] Where, is the difference between the two sets of sorted data, is the sample size; according to The value of adjusts the corresponding position in the coupling matrix to reflect the latest nonlinear correlation;
[0157] S12. Establish scene exploration knowledge, including spatial region features, optimal solution features, and convergence features;
[0158] S121. Analyze spatial regional characteristics;
[0159] The search space is divided into unexplored parts and explored parts; the specific steps are:
[0160] LLM identifies blank areas during the search process and combines it with the subsequent scene space partitioning strategy to optimize the global exploration efficiency. In the dimensional test space, each point Use vector Indicates that , for each dimension , the distance from any point to the nearest forward recursive known point is defined as follows:
[0161] ;
[0162] Where, To determine the point set in the excavated area, Projection on dimension, setting threshold If the calculated distance is less than , it is considered to have been discovered; dynamic adjustment, LLM automatically identifies and updates regional features based on historical data and theoretical models, thereby realizing the dynamic update of regional features during the accelerated testing process and can adapt to different exploration stages;
[0163] S122, optimal solution feature analysis;
[0164] Record the optimal solution information of key scene elements found in the optimization process; save the global optimal solution by real-time tracking and analyzing the performance of each element area, and when a new global optimal solution is found , add it to the collection:
[0165] ;
[0166] To prevent the collection from growing too large, set a maximum capacity , when the capacity is exceeded, remove the earliest element:
[0167] ;
[0168] At the same time, through the design of prompt words, the LLM is required to self-infer the recommended value under the current dimension, thereby constructing and dynamically updating the set of high-quality solutions, and using the LLM's ability to understand knowledge to guide the subsequent local optimization process; statistical analysis is performed on the corresponding dimensions in the set of high-quality solutions to obtain the mean and standard deviation:
[0169] ;
[0170] ;
[0171] The calculation results are used to assist the LLM value recommendation process;
[0172] S123, convergence characteristics;
[0173] Evaluate the effectiveness of the optimization search process; the specific steps are as follows:
[0174] S1231, LLM analyzes whether the local optimization phase can continue to explore test scenarios or whether it needs to switch to the global exploration phase based on the number of key scenarios in each optimization search process and the convergence criterion of the particle population;
[0175] S1232, Convergence analysis includes the convergence rate of the optimization algorithm ,stability and repeated features Conduct quantitative evaluation to ensure the comprehensiveness of the search process. To assist LLM analysis, the calculation formulas for each indicator are constructed as follows:
[0176] ;
[0177] ;
[0178] ;
[0179] Where, For the The number of key scenes found in the iteration; is the number of key scenes in the initial particle space; For the The average value of all particle positions; is the Euclidean distance between particles; by comprehensively utilizing the automatic analysis capabilities of LLM, exploring the construction and updating of knowledge will help improve the interpretability and search efficiency of optimization;
[0180] S13, design knowledge construction and dynamic update process;
[0181] Traditional knowledge expression methods usually rely heavily on human subjective analysis and are limited by the limitations of expert understanding. This invention comprehensively considers information such as historical instructions, population variable status, scenario library data, and simulation test results during the optimization search process, and guides LLM to generate contextual prompts through preset prompt word templates, thereby dynamically updating the knowledge expression model and guiding subsequent decisions and actions. The specific process is as follows Figure 3 shown.
[0182] S131. In the initial testing phase, a preliminary scenario theory model is constructed based on the theory related to the test scenario and the information of the system to be tested. The scenario description is converted into prompt words, and combined with the context information, it assists the initialization of the LLM to build the theoretical knowledge model.
[0183] S132. During the optimization process, historical instructions, population variable states, scenario library data, and simulation test results of the optimization search process are collected, and context information is formed based on preset key concepts, objective functions, and prompt word templates related to scenario theory covering the optimization search. Based on the current context information, LLM calls the corresponding Agent calculation tool to generate knowledge about the importance, monotonicity, and coupling of scenario elements, and dynamically updates the scenario theory knowledge accordingly. For the exploration process knowledge, regional characteristics, optimal solution characteristics, and convergence characteristics are recorded, and the LLM optimal solution is inferred and saved as a specific numerical matrix;
[0184] S133, Dynamic Update: After each round of optimization, the LLM continuously receives new data. Through the collaborative work of SA, CA, and AHP agents, it implements knowledge verification and generates sensitivity and correlation data. This helps the LLM learn and adapt to changes in the test environment and adjust the knowledge representation model. The updated knowledge representation guides the decision-making behavior of the agents in the subsequent parameter optimization module. The decision results are then fed back to the system, forming a closed loop of continuous improvement.
[0185] S2. Build a parameter optimization module and design a multi-stage optimization strategy that includes global exploration, local optimization, and spatial pruning, and integrate it with the knowledge model;
[0186] S21, global exploration partial modeling;
[0187] Latin Hypercube Sampling (LHS) can provide uniform and discrete scene data by controlling the sampling process of each batch in layers. Different scene elements have different effects on the test results, and the sampling frequency needs to be adjusted accordingly. Therefore, the knowledge results in the knowledge base can be used to guide the sampling. During the optimization process, the subsequent pruning module will prune the scene space. The improved LHS algorithm process is as follows: Figure 4 As shown;
[0188] S211: For each scenario dimension, determine whether its importance and value range have changed. If it is a newly generated or changed dimension, repartition it based on the specific value, discrete step size, and importance of the scenario parameter. If it has not changed, no repartitioning is required.
[0189] S212: Randomly select data points in each single-dimensional partition and combine them to generate a sampling space;
[0190] S213, selecting the required samples in the sampling space by using a random sampling method;
[0191] S22, modeling the local optimization part;
[0192] This invention improves the traditional particle swarm optimization (PSO) by combining the knowledge model. Figure 5 The specific measures are as follows:
[0193] 221) Regional aggregation;
[0194] First, the regions defined by the global exploration module are aggregated using regional and optimal solution features. Statistical analysis is performed on each scenario parameter within each region. Starting from the starting point, regions where the number of key scenarios exceeds 20% of the total number of key scenarios in the space are marked as core regions. A separation zone is defined around the center of the core region. The aggregated length of the core region is no more than three times the length of the minimum region for that scenario parameter. Non-core regions are aggregated to a length no more than five times the minimum region, extending beyond the core region. This ensures that the complexity of the search space is reduced while ensuring search effectiveness.
[0195] 222) Particle equation optimization;
[0196] Different scenario parameters contribute differently to the test results. Importance knowledge is integrated into the particle movement process, and an importance weight equal to the importance knowledge result is constructed, so that particles pay more attention to important parameter dimensions during the optimization process; if a dimension is more important, then when updating the particle velocity, the movement of this dimension will be more affected, causing particles to adjust their positions faster on important dimensions and move closer to a better solution. LLM can directly recommend the optimal solution for exploration through prompt words, thereby guiding particle movement. In order to better apply the features of different regions in the optimization process, cross-regional information sharing and global information target search can be achieved. The following particle motion equation is designed:
[0197] ;
[0198] ;
[0199] Where, is the time step Time Particle In the Speed in parameter dimensions; is the inertia weight; For the The importance weight of each parameter dimension; is the acceleration constant of the region; is the acceleration constant of other regions. The region and other regions here are the regions where the particle is located after regional aggregation. Combining multiple regions helps the particle converge quickly and grasp the global vision; is the global acceleration constant; is the LLM acceleration constant; , , , A random number between [0,1], used to increase the randomness of the search; For the current particle In the Position in the parameter dimension; The current particle The optimal position of each parameter dimension in the region; To remove the particle The sum of the optimal solutions of all regions other than the region where the parameter dimension is located; For particle The number of aggregation regions in each parameter dimension; The particle number given by LLM analysis is The optimal solution for parameter dimensions; for The particle position at the time step; Calculated Particle velocity at the time step;
[0200] S23, modeling the spatial pruning part;
[0201] Since scene elements have characteristics such as multi-dimensionality, different step lengths, and a wide range of values, the intelligent vehicle test parameter space generated by the combination of multi-dimensional scene elements is huge and difficult to exhaust. There are a large number of non-critical areas in the parameter space, and the global random exploration characteristics of the optimization algorithm may have a probability of exploring these non-critical areas. Since the intelligent vehicle simulation test process consumes a lot of time and computing resources, the exploration process of non-critical areas will inevitably affect the test efficiency. In order to improve efficiency, the present invention proposes a spatial pruning strategy, which combines the monotonicity, coupling and regional characteristics in the knowledge model to prune and optimize the parameter space. Specifically, it includes the following three strategies:
[0202] S231, monotonicity constraint;
[0203] For parameters known to be monotonic, establish constraints to exclude regions that are unlikely to contain optimal solutions based on monotonicity. For example, if increasing a parameter value causes the objective function value to decrease, avoid searching in the direction of increasing that parameter during the search. Instead, prune the dimension of that parameter while keeping other parameters constant.
[0204] S232, coupling analysis;
[0205] Based on the coupling between parameters, a correlation model between parameters is constructed and used to identify invalid parameter combinations. During the search process, when a set of parameter values is encountered, based on the coupling analysis results, those areas of the parameter space that cannot produce a better solution under the given parameter values are cut off;
[0206] S233, see Figure 6 , design pruning buffer zones;
[0207] As the optimization search process continues, a large number of key scenarios are discovered. The boundary between key and non-key areas will become the focus of optimization search. To avoid excessive pruning of key areas in the initial optimization phase, pruning buffers are designed based on the importance of scene elements and the search process. The most critical elements have the largest initial buffer, which is the width of the area of the element in the global exploration phase. The buffers of other elements are proportionally scaled based on their importance. At the beginning of each spatial pruning phase, the buffer width is adjusted to 3 / 4 of the previous round, achieving fine-grained pruning. Figure 6 The figure shows a parameter space with four dimensions. The orange combined use cases (orange connecting lines) indicate areas that have been tested and have results, while the blue ones indicate untested areas. Parameter D is monotonic; pruning it left under the influence of the first set of results does not produce a critical scenario (yellow connecting line). Parameters C and D are coupled; under the influence of the second set of results, pruning C to the right and D to the left does not produce a critical scenario. The yellow overlay in the figure represents the buffer zone designed by this invention.
[0208] S24, design optimization execution process;
[0209] The synergy of the three modules of global exploration, local optimization and spatial pruning completes the cyclic optimization process. The present invention designs optimization rules based on the module characteristics. Figure 7 As shown in the figure. The global exploration component is called at the beginning of the test and when the optimization falls into a local optimum. It replenishes the diverse individuals in the particle swarm, allowing for hierarchical exploration of the dispersed space and breaking the local optimum phenomenon. The local optimization component determines whether the number of rounds has ended after each round of optimization. It uses the gradient characteristics of the parameters to perform spatial optimization. After each round of optimization, it determines whether the number of rounds has ended. If not, the parameter space is pruned according to the spatial pruning component to eliminate non-critical areas and improve search efficiency. Further convergence knowledge is integrated. If convergence is achieved, the global exploration component generates a new round of exploration results. Otherwise, the local optimization component continues. The above statement logic is converted into task prompts to assist the LLM in agent scheduling and optimization.
[0210] S3. Build the simulation test module. Based on the Carla simulation platform, use LLM-Agent to build the scenario building, system under test, simulation execution, and data export components. The details are as follows:
[0211] S31. The simulation test platform is the basic support for simulation testing. The intelligent vehicle function verification based on the large language model requires a highly controllable, repeatable and highly realistic virtual environment. CARLA has real-time 3D scene rendering capabilities, physical engine support and traffic element simulation functions, and is programmed in the same Python language as the mainstream large language model. Therefore, the present invention builds a simulation test platform based on CARLA simulation, such as Figure 8As shown in the figure, it specifically includes four core components: scenario construction, system to be tested, simulation execution, and data export.
[0212] S32: The scenario construction component selects elements from the feature library based on the input use case to construct a test scenario. Utilizing CARLA's internal API, it customizes static scene elements such as road structure, traffic signs, and buildings; dynamic traffic participants such as vehicles, pedestrians, and bicycles; and environmental characteristics such as lighting, weather conditions, and road surface conditions. The feature library defines various elements that can be used for environment initialization. The elements constructed in this invention include: lane width, lane ID, longitudinal speed, lateral speed, lateral offset from the lane, lateral and longitudinal distances between the host vehicle and the traffic vehicle, longitudinal and lateral speeds of the traffic vehicle, light intensity, road adhesion coefficient, and weather conditions (including sunny, rainy, and foggy weather conditions, with defined intensities for each meteorological indicator). The system under test component provides an external autonomous driving algorithm interface to implement sensor configuration, vehicle control signal input, and chassis and scene feedback output. Based on the sensor characteristics in CARLA, it supports a variety of perception sensors such as cameras and lidar. The simulation execution component initializes the scene by loading the specific values of the aforementioned scene elements and executing the simulation program. During this process, the kinematic indicators of each traffic participant, including vehicle position, speed, acceleration, and heading angle, are stored in the result library in real time. The data export component exports and merges all motion data collected during the simulation in a standardized JSON format.
[0213] S4. Select a pre-trained large language model, design selection indicators and perform model selection, as follows:
[0214] S41. To ensure the effectiveness of the LLM-guided accelerated testing method, it is crucial to select a suitable LLM. The present invention designs the following selection criteria:
[0215] a. Knowledge comprehension and expression capabilities: The core of this invention is knowledge comprehension and application. Therefore, LLM needs to have a deep understanding of complex scenarios and multidimensional data, and be able to generate accurate and rich knowledge expressions;
[0216] b. Reasoning and optimization capabilities: LLM should be able to quickly process large-scale data and support real-time reasoning and optimization to improve efficiency;
[0217] c. Interaction and tool scheduling capabilities: Large language models must be able to effectively interact with optimization agents, supporting flexible scheduling and task allocation to ensure efficient and controllable optimization processes.
[0218] d. Scalability: Due to the complexity of the combined simulation testing and optimization search process, large language models should be easy to deploy, have good scalability, and be able to be dynamically updated as testing requirements change;
[0219] S42. According to the above standards, deepseek, chatgpt, and Qwen can all meet the requirements. Among them, the present invention selects Qwen as the core technical support because Qwen has been trained with large-scale data and can provide rich knowledge support; it can achieve fast knowledge reasoning, can be seamlessly connected with Agent tools, and supports flexible task scheduling and optimized process management; more importantly, Qwen has a complete API system, which is convenient and fast to call and supports dynamic updates and adjustments, and has obvious advantages compared to other LLMs.
[0220] S5. Construct an evaluation and memory module to evaluate the test results and store all test and knowledge data in the process, as follows:
[0221] S51. Evaluating the criticality of test scenarios and designing accurate evaluation indicators are core tasks of intelligent vehicle acceleration testing. Since the present invention focuses on the hazards during testing, during vehicle operation, collision time determines the maximum reaction time when a hazard occurs, and safety distance determines the distance between the host vehicle and the interacting object. Therefore, the present invention defines the scenario criticality indicators based on the two core dimensions of collision time and safety distance, which are related to hazard, and assigns different criticality levels, as shown in the following formula:
[0222] ;
[0223] Where, To guide the optimization search scenario fitness value, in order to avoid the possible negative value of collision time and relative distance affecting the gradient search process, the reciprocal of collision time and relative distance is taken. According to existing research, collision time less than 0.6s and safety distance less than 3m indicate extreme scenarios, so Take 1.67s-1, Take 0.33m-1. and The calculation formula is as follows:
[0224] ;
[0225] ;
[0226] All optimization algorithms require gradient information to assist in finding the optimal solution, and there should be no confusion between scenes with different critical features. Therefore, this invention divides scene criticality into three levels and assigns different weights. When two indicators are met simultaneously, it indicates that the scene's relative position is extreme and the collision time is extremely small, indicating that it is a critical scene of concern in the test process. The criticality level is high and is assigned a weight of 10. When only one indicator is met, the criticality level is medium. When neither indicator is met, the criticality level is low and is assigned a weight of 0.1.
[0227] S52. An efficient and maintainable memory pool is a key component of test quality assurance, which can systematically organize all test-related information. In order to ensure the smooth operation of the system and avoid memory pressure, the data memory of the present invention mainly stores historical LLM interaction status, various knowledge in the knowledge model, parameter space and test result information related to the test scenario, and particle position and motion information of the historical 5 optimization steps. In order to efficiently store information, the test scenario and test result information are stored in the vector database Chroma, which is convenient for subsequent storage and query of a large number of scenarios. For other information, an SQL database is built based on SQLite to achieve fast writing, querying and updating of historical dialogues, knowledge base and particle swarm optimization status.
[0228] Example 2:
[0229] This embodiment designs a test scenario and tests and analyzes the system under test, as follows:
[0230] S6. Design the test scenario and test and analyze the system under test. The specific methods are as follows:
[0231] S61, test scenario design;
[0232] S611. Test scenarios cannot exist outside the functional design and operational domain. The system under test in this invention is a vehicle equipped with ACC and AEB systems based on millimeter-wave radar ranging. The algorithm's core decision-making logic is based on the time-to-collision (TTC) and safety distance model. Inclement weather significantly impacts the perception sensors and chassis control of smart cars. Furthermore, the ACC system's ability to respond to multi-target and cut-in scenarios is crucial. Therefore, this invention sets a functional scenario: a rainy day, a preceding vehicle traveling at a constant speed ahead of the main vehicle, and at some point, a vehicle in the adjacent lane cuts into the main vehicle's lane. This scenario allows for a comprehensive evaluation of the ACC system's multi-target following capabilities and the AEB system's emergency avoidance capabilities in rainy conditions.
[0233] S612, such as Figure 9 As shown, the rainfall intensity of the scene is The main vehicle is moving along the center line of the left road, with an initial speed of , the vehicle ahead is in the same lane at a speed The initial distance between the two vehicles is ; Cutting vehicles along the center line of the right lane Constant speed driving Cut into the main lane after the distance, the longitudinal length of the cutting track is , the horizontal length is , keep driving straight after cutting in, the initial distance between the cutting vehicle and the main vehicle is , the road adhesion coefficient is ;Thus, the semantic test scenario is represented as an abstract scenario consisting of 10 scene elements, covering four types of elements: weather, distance, movement, and road surface;
[0234] S613. Since the scene space is a concept of a continuous domain, the test cases generated by sampling it are theoretically infinite and cannot be fully tested. In addition, due to the influence of the hardware accuracy of different sensors and controllers, the test results obtained by over-subdivided test cases tend to be uniform; weather, distance and movement conditions will affect the function of the system to be tested to varying degrees, and the scales of the horizontal distance and the longitudinal distance in the direction of movement are different. Therefore, the present invention discretizes the scene space according to the influence of scene elements on the radar, tires, etc. in the system to be tested; the simulation frequency and simulation accuracy during the simulation process; and the efficiency and accuracy of the test requirements, such as Figure 10 shown.
[0235] S62, Experimental Design and Execution;
[0236] To validate the effectiveness of the proposed method, a series of experimental groups were designed. Experimental Group A is a complete implementation of the proposed method, including scenario theory knowledge, scenario exploration knowledge, the LLM active knowledge construction process, and dynamic optimization methods, hoping to fully demonstrate the capabilities and potential advantages of the new method. Control Group B uses a traditional particle swarm optimization algorithm without additional knowledge guidance or dynamic optimization to illustrate the difference between the proposed algorithm and the most basic traditional methods. Furthermore, ablation groups C through E were designed to gradually remove key components of the proposed method to evaluate the impact of each component on the overall performance. Specifically, ablation group C does not integrate scenario theory knowledge and removes the dynamic partitioning and pruning strategies that require scenario theory knowledge. This approach uses a simplified LLM-Agent to complete scenario search, aiming to evaluate the importance of scenario theory knowledge in the overall system. The reason for removing scenario theory knowledge is that the subsequent optimization agent requires scenario exploration knowledge. Ablation group D does not integrate the LLM's active knowledge construction process, but instead uses manual and rule-based knowledge construction. This approach aims to evaluate the impact of actively constructed and dynamically updated knowledge models on search results. Ablation group E uses rule-based search rather than the LLM-Agent, executing each optimization process with a fixed convergence threshold. If no new key scenes are discovered after two consecutive rounds, the optimization process automatically switches to the global exploration phase. This approach aims to analyze the value of LLM dynamic optimization for search results. For each group, a single parameter optimization round is considered a search round, and 100 rounds are performed cumulatively. During this period, search process information and the final key scene information are recorded.
[0237] S63, result analysis and evaluation;
[0238] S631, simulation test scenario demonstration;
[0239] During the test, the scene images generated by the Carla simulation platform are as follows: Figure 10 As shown, the rainfall intensity and vehicle positions in the scenario have changed significantly. It can be seen that through the simulation test module constructed by the present invention, LLM can correctly execute the simulation test tool and generate test scenarios with different rainfall intensities, different vehicle kinematic information, and different road adhesion coefficients, further reducing the workload of scenario design and test execution.
[0240] S632, key scene generation effect analysis;
[0241] In order to verify the scene generation effect of each algorithm, the key scene data generated by each iteration of 5 groups from A to E are plotted as follows: Figure 11 shown.
[0242] The horizontal axis in the figure represents the number of overall parameter optimization cycles (theoretically, one cycle is tested 100 times), and the vertical axis represents the number of key scenarios found. Figure 12 The middle trend indicates that the optimization algorithm based on LLM knowledge dynamic guidance (Group A) demonstrated the strongest optimization capabilities throughout the entire testing phase, discovering the greatest number of key scenarios within the iterations and exhibiting a higher average slope than the other groups. The traditional particle swarm optimization algorithm (Group B) was able to discover test scenarios in the initial stages, but due to the algorithm's local convergence characteristics, it was unable to consistently discover key scenarios. Among the other ablation groups, those removing LLM dynamic construction knowledge (Group D), scenario theory knowledge (Group C), and LLM-agent dynamic search (Group E) showed decreasing key scenario discovery capabilities, indicating that these components contribute positively to overall performance. The control group performed significantly worse than all experimental and ablation groups, demonstrating the comprehensive effectiveness of the proposed multi-agent optimization framework.
[0243] S633, Coverage Evaluation and Analysis;
[0244] Thorough exploration of the entire parameter space and key test areas is the core of intelligent vehicle scenario generation. Given the highly multidimensional and large-scale nature of the test scenario space studied in this paper, comprehensive testing is not possible within a limited test cycle. To explore the coverage of each algorithm in the key scenario generation process, this paper designs the following two indicators:
[0245] Overall spatial area coverage: Evaluate all non-repetitive scenarios tested during the search process for each group, and calculate the average percentage of the values of the scene element dimensions under a single group to the overall value range, reflecting the degree of exploration of the overall test space by the accelerated test algorithm.
[0246] For each group , overall spatial area coverage It can be expressed as:
[0247] ;
[0248] in, is the number of dimensions; Dimension Next The value range of scene elements in the group; It is the overall value range of the feature dimension.
[0249] Key scenario area coverage: Evaluate all key test scenarios discovered during the search process of each group, count the value ranges of each dimensional element of all key test scenarios, and calculate the average value of each dimensional element of the key test scenarios found in a single group as a percentage of the overall key scenario dimensional value range.
[0250] For each group , coverage of key scene areas It can be expressed as:
[0251] ;
[0252] in, is the number of dimensions; Dimension Next The value range of the key test scenario elements found by the group; The value range of this factor dimension in all key test scenarios.
[0253] The coverage calculation results of each group are as follows Figure 13 shown.
[0254] As can be seen from the figure, the present invention (Group A) has the highest overall spatial coverage (an improvement of 35.23% compared to the traditional algorithm) and key area coverage (an improvement of 22.96% compared to the traditional algorithm), demonstrating that the integrated application of knowledge, LLM, and agent can effectively escape local optimality and conduct global exploration. The traditional algorithm (Group B) has a limited exploration scope and a small number of key scenarios, which limits its ability to cover scene space and key areas. Groups C, D, and E all show improved coverage compared to the traditional algorithm, but Group D has the most significant improvement, demonstrating the important role of the combined use of scenario theory knowledge and optimization architecture in scenario coverage. Dynamic knowledge updating also plays a role, but the impact is minimal.
[0255] S634, time cost analysis;
[0256] Test time is a key efficiency indicator in the process of intelligent vehicle testing and evaluation. Accelerated testing should discover a large number of key test scenarios in a short period of time. Compared with the basic traversal test, the accelerated test method based on optimized search discussed in this invention generates key test scenarios through targeted optimization, which has a natural efficiency advantage. In order to comprehensively compare the time cost of each group, the overall time consumption of each group is counted during the test (unit: hour), and the scenario generation efficiency index is defined as: the number of key test scenarios discovered per unit time. The statistical and calculation results of each group are as follows: Figure 14 shown.
[0257] From the analysis of the data, it can be seen that in terms of overall time, due to the influence of the repetition phenomenon, the number of algorithm tests will be reduced to a certain extent, resulting in the longest overall time for the present invention and the shortest time for the traditional algorithm. However, this does not mean that the present invention has the lowest efficiency, because the testing process should ensure that a large number of key test scenarios are quickly generated in a short period of time. In terms of generation efficiency indicators, due to the highest number of key scenarios generated, the present invention has the highest generation efficiency, while the traditional algorithm (Group B) has the lowest generation efficiency. In other groups, the generation efficiency of Group D, Group C, and Group E decreases in turn, but they are all better than the traditional algorithm. This shows that both scenario theoretical knowledge and optimization architecture are conducive to improving scenario generation efficiency.
[0258] In summary, the present invention constructs a new search architecture based on LLM of "multi-dimensional knowledge generation-dynamic process guidance-automatic simulation execution", designs an automatic construction and active update method of knowledge model based on LLM, realizes the dynamic construction of self-learning multi-knowledge base, and guides the accurate optimization search process with transparent knowledge representation and reasoning mechanism; utilizes the dynamic information flow and collaborative optimization effect of "LLM-knowledge model-optimization Agent" to construct a multi-stage optimization strategy of global exploration, local optimization and spatial pruning to improve the efficiency of discovery of key scenarios; based on the advantages of LLM in tool calling, an automated testing tool based on the Carla simulation platform is established. Through the LLM-Agent construction of four core components: scenario construction, system to be tested, simulation execution, and data export, the automated deconstruction, reconstruction, simulation and testing of the test scenario are realized. Ultimately, the generation efficiency and coverage of key test scenarios are improved, while effectively balancing the time cost.
[0259] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.
Claims
1. A method for optimizing and generating key scenarios of intelligent vehicles based on large model knowledge, characterized in that: The following steps are involved: S1. Construct a knowledge expression module, designing knowledge results, large language model application methods, and dynamic update processes based on scenario theory knowledge and scenario exploration knowledge; S2. Build a parameter optimization module and design a multi-stage optimization strategy that includes global exploration, local optimization, and spatial pruning, and integrate it with the knowledge model; S3. Build a simulation test module based on the Carla simulation platform, and use LLM-Agent to build the scenario building, system under test, simulation execution, and data export components; S4. Select a pre-trained large language model, design selection indicators and perform model selection; S5. Build an evaluation and memory module to evaluate the test results and store all test and knowledge data in the process; The specific method of S1 is as follows: S11. Establish scenario theory knowledge, including importance, monotonicity and coupling; S111, establish importance; For a given autonomous driving system, the importance of specific scene elements is obtained by mutual comparison, thereby constructing an element importance model, specifically: S1111, LLM analyzes the functional requirements of the system to be tested, generates semantic descriptions of element comparisons between two elements through natural language reasoning, and converts them into a judgment matrix; S1112. The Agent performs a judgment based on the hierarchical analysis test. If the consistency ratio (CR) test passes, the result is valid and saved to the knowledge base for subsequent optimization search. Otherwise, the previous value is used. The CR is calculated as follows: Where RI is the random consistency index. When CR is less than 0.1, the matrix is considered to have satisfactory consistency. By combining AHP with LLM, the importance model of scene elements is automatically generated and updated to quantify the influence of each element. At the same time, LLM dynamically adjusts the value of the judgment matrix elements according to the parameter sensitivity data in the subsequent optimization process, forming a closed-loop correction system. S112, establish monotonicity; The LLM is derived based on the kinematic equations and physical laws and is used to guide the search process of the test boundary. Specifically: S1121, LLM preliminarily determines the monotonicity level of scene elements based on physical kinematics theory; S1122. Construct a local sensitivity analysis method, SA, and calculate partial derivatives based on discrete difference approximation: The test data and sensitivity analysis results are again provided to the LLM, which generates a revised monotonicity mapping table based on the test data; S113, establish coupling; The interdependence between elements is analyzed through the coupling theory in system engineering, which is completed by LLM. Specifically: S1131. Leveraging LLM’s ability to understand test scenarios, establish coupling relationships between elements based on historical data, and label the coupling strengths, expressing them in a coupling matrix M, where each element m ij represents the coupling strength between elements i and j; S1132. At each stage of the testing process, the Spearman correlation coefficient r between the various factors was calculated using correlation analysis (CA). s , quantify the nonlinear correlation between factors and provide it to LLM to assist LLM in adjusting the coupling relationship. The calculation formula is as follows: Where, d i is the difference between the two sets of sorted data, x is the number of samples; according to r s The value of adjusts the corresponding position in the coupling matrix to reflect the latest nonlinear correlation; S12. Establish scene exploration knowledge, including spatial region features, optimal solution features, and convergence features; S121. Analyze the characteristics of the spatial region; divide the search space into an unexplored part and an explored part, specifically: S1211, LLM identifies the blank areas in the search process and combines it with the subsequent scene space partitioning strategy to optimize the global exploration efficiency; in the d-dimensional test space, each point P i Use vector (x i1 ,x i2 ,...,x id ), where i = 1, 2, ..., N, and for each dimension j∈{1, 2, ..., d}, the distance from any point to the nearest forward recursive known point is defined as follows: Where K j To determine the projection of the point set in the excavated area on the jth dimension, set the threshold R j If the calculated distance is less than R j , it is considered to have been discovered; dynamic adjustment, LLM automatically identifies and updates regional features based on historical data and theoretical models, thereby realizing the dynamic update of regional features during the accelerated testing process; S122. Analyze the characteristics of the optimal solution; Record the optimal solution information of key scene elements found in the optimization process; save the global optimal solution by real-time tracking and analyzing the performance of each element area, and when a new global optimal solution is found, i When the global optimal solution gb i Add to the collection and set the maximum capacity S max , when the maximum capacity is exceeded, remove the earliest element that enters; At the same time, through the design of prompt words, LLM infers the recommended value under the current dimension, thereby constructing and dynamically updating the set of high-quality solutions, and using LLM's ability to understand knowledge to guide the subsequent local optimization process; statistical analysis is performed on the corresponding dimensions in the set of high-quality solutions to obtain the mean and standard deviation: The calculation results are used to assist the LLM value recommendation process; S123. Evaluate the effect of the optimization search process, specifically: The specific method of S123 is as follows: S1231, LLM analyzes whether the local optimization phase can continue to explore test scenarios or whether it needs to switch to the global exploration phase based on the number of key scenarios in each optimization search process and the convergence criterion of the particle population; S1232, Convergence analysis includes the convergence rate V of the optimization algorithm t , stability σ t and repeated features D t Conduct quantitative evaluation and adjust the optimization strategy based on the evaluation results to ensure the comprehensiveness of the search process. To assist LLM analysis, the calculation formulas for each indicator are constructed as follows: Where, F t+1 is the number of key scenes found in the tth iteration; F0 is the number of key scenes in the initial particle space; is the average position of all particles in the tth generation; d is the Euclidean distance between particles; S13, design knowledge construction and dynamic update process; Guide LLM to generate contextual prompts through preset prompt word templates, thereby dynamically updating the knowledge representation model to guide subsequent decisions and actions; S131. Initial stage of design and testing, specifically: In the initial stage of testing, a preliminary scenario theory model is constructed based on the theory related to the test scenario and the information of the system to be tested. The scenario description is converted into prompt words, and combined with the context information, it assists the initialization of LLM to build a theoretical knowledge model. S132, design optimization process, specifically: During the optimization process, historical instructions, population variable states, scenario library data, and simulation test results of the optimization search process are collected, and contextual information is formed based on preset prompt word templates covering key concepts of optimization search, objective functions, and scenario theory. Based on the current contextual information, LLM calls the corresponding agent calculation tool to generate knowledge about the importance, monotonicity, and coupling of scenario elements, and dynamically updates the scenario theory knowledge accordingly. For the exploration process knowledge, regional characteristics, optimal solution characteristics, and convergence characteristics are recorded, and the LLM optimal solution is inferred and saved as a specific numerical matrix. S133, perform dynamic update, specifically: After each round of optimization, the LLM continuously receives new data. Through the collaborative work of SA, CA, and AHP agents, it implements knowledge verification and generates sensitivity and correlation data. This helps the LLM learn and adapt to changes in the test environment and adjust the knowledge representation model. The updated knowledge representation guides the decision-making behavior of the intelligent agents in the subsequent parameter optimization module, and the decision results are fed back to the system, forming a closed loop of continuous improvement. The specific method of S2 is as follows: S21. Model the global exploration part, specifically: S211. For each scenario dimension, determine whether the importance and value range of each dimension have changed; if it is a newly generated or changed dimension, repartition it according to the specific value, discrete step length, and importance of the scenario parameter; if there is no change, no repartitioning is required; S212: Randomly select data points in each single-dimensional partition and combine them to generate a sampling space; S213, selecting the required samples in the sampling space by using a random sampling method; The specific method of S22 is as follows: S221, regional aggregation; First, the regions divided by the global exploration module are aggregated using regional features and optimal solution features. Statistical analysis is performed on the parameters of each scenario within each divided region. Starting from the starting point of the value, the region with more than 20% of the number of key scenarios in the overall space is marked as the core region. A separation zone is defined around the center of the core region. The length of the core region after aggregation does not exceed 3 times the length of the minimum region of the scenario parameter. For non-core regions, the length is not more than 5 times the minimum region, and the length is greater than the core region. S222, particle equation optimization; Construct an importance weight that is equal to the importance knowledge result; LLM gives the optimal solution for recommended exploration through prompt words, guiding particle movement to design the following particle motion equation: Where, is the velocity of particle i in the dth parameter dimension at time step t; ω is the inertia weight; I d is the importance weight of the dth parameter dimension; c1 is the acceleration constant of the region; c2 is the acceleration constant of other regions. The region and other regions are the regions where the particles are located after regional aggregation. Combining multiple regions helps particles converge quickly and grasp the global vision; c3 is the global acceleration constant; c4 is the LLM acceleration constant; r1, r2, r3, r4 are random numbers between [0, 1], used to increase the randomness of the search; is the position of the current particle i in the dth parameter dimension; is the optimal position of the dth parameter dimension of the current particle in the region; is the sum of the optimal solutions of all regions except the region where the particle's dth parameter dimension is located; n d is the number of aggregation regions in the dth parameter dimension of the particle; The optimal solution of the dth parameter dimension of the particle given by LLM analysis; is the particle position at time step t+1; is the calculated particle velocity at time step t+1; The specific method of S23 is as follows: S231, constrained monotonicity; For parameters known to be monotonic, establish constraints to exclude regions that are unlikely to contain better solutions based on monotonicity. S232, Analyze coupling; Based on the coupling between parameters, a correlation model between parameters is constructed and used to identify invalid parameter combinations. During the search process, when a certain set of parameter values is encountered, based on the coupling analysis results, the parameter space region that cannot produce a better solution under the given parameter values is cut off. S233, design pruning buffer zones; The most critical element has the largest initial buffer zone, which is the width of the element in the global exploration part. The buffer zones of other elements are proportionally converted according to their importance. Each time the spatial pruning part is executed, the buffer zone width is adjusted to 3 / 4 of the previous round; The specific method of S24 is as follows: The synergistic effect of the three modules of global exploration, local optimization, and spatial pruning completes the cyclic optimization process. The global exploration part is called at the beginning of the test and when the optimization falls into a local optimum to replenish the diverse individuals in the particle swarm. The local optimization part determines whether the cycle has ended after each round of optimization. After each round of optimization, it determines whether the cycle has ended. If not, the parameter space is pruned according to the spatial pruning part to exclude non-critical areas. Convergence knowledge is further integrated. If convergence is achieved, the global exploration part is transferred to generate a new round of exploration results. Otherwise, the local optimization part is continued. The statement logic is converted into task prompt words to assist LLM in agent scheduling and optimization. S22, modeling the local optimization part; S23, modeling the spatial pruning part; S24. Design optimization execution process.
2. The method for optimizing and generating key scenarios of intelligent vehicles based on large model knowledge guidance according to claim 1 is characterized in that: The specific method of S3 is as follows: S31. Construct a simulation test platform based on CARLA simulation; the simulation test platform includes four components: scenario construction, system under test, simulation execution, and data export; S32, the scenario building component selects elements from the feature library to build the test scenario based on the input use case, and uses the CARLA internal API to customize static scene elements, dynamic traffic participants and environmental features; The element library defines various elements used for environment initialization, including lane width, lane ID, longitudinal speed, lateral speed, lateral offset from the lane, lateral distance and longitudinal distance between the main vehicle and the traffic vehicle, longitudinal speed and lateral speed of the traffic vehicle, light intensity, road adhesion coefficient, and weather conditions. The system component under test provides an external autonomous driving algorithm interface to implement sensor settings, vehicle control signal input, chassis and scene feedback information output, and supports multiple perception sensors based on the sensor characteristics in Carla. The simulation execution component initializes the scene by loading the specific values of the scene elements and executing the simulation program. During the process, the kinematic indicators of each traffic participant, including vehicle position, speed, acceleration, and heading angle, are saved in real time in the result library. The data export component exports and merges all motion data collected during the simulation in a standardized JSON format.
3. The method for optimizing and generating key scenarios of intelligent vehicles based on large model knowledge guidance according to claim 1 is characterized in that: The specific method of S4 is as follows: Select the Qwen model.
4. The method for optimizing and generating key scenarios of intelligent vehicles based on large model knowledge guidance according to claim 1 is characterized in that: The specific method of S5 is as follows: S51. Define scenario criticality indicators based on the two core dimensions of collision time and safety distance, which are related to hazard, and assign different criticality levels, as shown in the following formula: Where S is the scenario fitness value guiding the optimization search. In order to avoid the possible negative value of the collision time and relative distance affecting the gradient search process, the reciprocal is taken. The collision time is less than 0.6s and the safety distance is less than 3m, which indicates an extreme scenario. Therefore, S T Take 1.67s-1, S S Take 0.33m-1; TTC -1 and The calculation formula is as follows: The scene criticality is designed into three levels and assigned different weights. When two indicators are met at the same time, it indicates that the scene relative position is extreme and the collision time is extremely small, indicating that it is a key scene of concern in the test process. The criticality level is high and the weight is assigned to 10. When only one indicator is met, the criticality level is medium. When both indicators are not met, the criticality level is low and the weight is assigned to 0.
1. S52, data memory stores historical LLM interaction status, various aspects of knowledge in the knowledge model, parameter space and test result information related to the test scenario, as well as particle position and motion information of the historical five optimization steps; the test scenario and test result information are stored in the vector database Chroma; for other information, an SQL database is built based on SQLite to realize the writing, querying and updating of historical dialogues, knowledge base and particle swarm optimization status.
Citation Information
Patent Citations
Intelligent automobile virtual simulation test method based on large language model
CN118586281A
Method for evaluating performance of self-driving vehicle oriented to full parameter space of logical scenario
US20230304896A1