Automatic driving test scene generation method and device based on large language model and probabilistic scene generation language
By combining a large-scale language model with a probabilistic scene generation language, the problems of data scarcity and insufficient generation accuracy in autonomous driving simulation scene generation are solved, enabling efficient and easy-to-use scene generation and the generation of high-value scenes, thereby improving the effectiveness of autonomous driving testing.
Patent Information
- Application Number
- CN202511035179.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-25
- Publication Date
- 2025-11-14
AI Technical Summary
Existing autonomous driving simulation scenario generation technologies suffer from problems such as data scarcity, insufficient generation accuracy, poor generalization ability, and generation results that do not conform to real-world logic, making it impossible to comprehensively and efficiently test autonomous driving systems.
By combining a large-scale language model with a probabilistic scene generation language, the system deeply analyzes the natural language instructions input by users to generate modular code snippets that conform to the syntax of the scene generation language. It then uses a DSL compiler and sampler to generate scene instances that meet spatiotemporal and behavioral constraints, guiding the generation of high-value scenarios such as safety-critical scenarios.
It achieves a direct, efficient, and reliable conversion from natural language intent to complex dynamic simulation scenarios, improving the efficiency, ease of use, and richness of scenario generation, ensuring the realism and high value of scenarios, and significantly enhancing the effectiveness and relevance of autonomous driving system testing.
Smart Images

Figure CN120950419A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of simulation testing and artificial intelligence technology, and in particular to a method and apparatus for generating autonomous driving test scenarios based on a large language model and a probabilistic scene generation language. Background Technology
[0002] With the rapid development of autonomous driving technology, comprehensive and efficient testing of it has become crucial. Generating high-quality simulation scenarios, especially safety-critical scenarios that can effectively expose system defects, is a core challenge of simulation testing. Current scenario generation technologies are mainly based on rule-based and data-driven adversarial generation methods, which generally suffer from limitations such as data scarcity, insufficient generation accuracy, and poor generalization ability.
[0003] Data-driven methods rely on real-world driving data to generate accident scenarios using techniques such as density estimation models. While they have some practical value, they face challenges in terms of scenario coverage and data scarcity. Adversarial generation methods optimize scenario generation through adversarial learning, producing diverse scenarios, but the generated results may not conform to real-world logic and are heavily reliant on autonomous driving systems. Knowledge-rule-based generation methods generate scenarios using expert-defined rules; while offering strong interpretability, their flexibility and coverage are relatively limited.
[0004] In response to this situation, many autonomous driving providers have made some attempts. Although existing autonomous driving simulation scenario generation technologies have made some progress, they still have many limitations and cannot fully meet the needs of comprehensive and efficient testing of autonomous driving systems.
[0005] Therefore, this invention proposes a method for generalizing the generation of autonomous driving test scenarios based on a large language model (LLM) and a probabilistic scene generation language. This method integrates the powerful natural language understanding capabilities of LLM with the accuracy and structured advantages of the probabilistic scene generation language, thereby reliably and efficiently generating rich, diverse and logically complex dynamic simulation scenarios. Summary of the Invention
[0006] The purpose of this invention is to overcome the shortcomings of the aforementioned background technology and provide a method and apparatus for generating autonomous driving test scenarios based on a large-scale language model and a probabilistic scene generation language. This method utilizes a large-scale language model to deeply parse user-input natural language commands and structurally generate modular code fragments that conform to the syntax of the scene generation language. Through a DSL (Domain-Specific Language) compiler and sampler, one or more specific scene instances satisfying all spatiotemporal and behavioral constraints are generated. This process can also be optimized with target guidance to generate high-value scenarios such as those critical to safety. Finally, the scenarios are loaded into a simulator for execution, achieving a direct, efficient, and reliable conversion from natural language intent to complex dynamic simulation scenarios.
[0007] This invention provides a method for generating autonomous driving test scenarios based on a large language model and a probabilistic scene generation language, comprising the following steps: S1, using a large language model to parse the natural language commands input by the user. The large language model is responsible for identifying the causal relationships between key information in the commands, clarifying the core components and interaction logic of the scenario, and serving as input for subsequent steps; S2, performing a structured decomposition of the scenario description, formally mapping the natural language semantics to program logic, systematically decomposing the scenario into structured components corresponding to the grammatical elements of the scene generation language, including separating static elements such as road geometry and the initial state of entities, as well as clarifying the dynamic behavior patterns of each entity, the triggering conditions between behaviors, the response mechanism, and the overall control flow of the scenario, completing the transformation from semantics to logical structure; S3, generating code snippets of the probabilistic scene generation language, combining the large language model with a... The system combines an enhanced knowledge base containing the basic syntax of a probabilistic scene generation language, a standard function library, and typical scene design patterns. Guided and constrained by this enhanced knowledge base, the large language model generates highly modular code snippets that conform to the precise syntax of the probabilistic scene generation language for each decomposed structured component. For complex dynamic interaction logic, the large language model can generate high-level control flow structures. S4: Assemble and compile the script of the probabilistic scene generation language. Based on the inherent global syntax rules and preset modular assembly logic of the probabilistic scene generation language, the system systematically integrates the multiple independent code snippets generated. This integration process, in a programmatic manner, splices and sorts the code describing the environment, objects, behaviors, and control flow modules according to the correct dependencies and syntactic structures, and finally assembles them into a logically complete and syntactically correct final scene script.
[0008] In the above technical solution, the specific process of step S1 is as follows: S11, scene element identification: using a large language model to perform deep semantic analysis on instruction L, identify and extract key elements in the scene, including: traffic participants, static environment, object attributes, or fuzzy descriptions of attributes; S12, interaction logic extraction: identifying and establishing a framework of dynamic interaction relationships between elements, especially the causal relationship between the triggering conditions of events and response behaviors; S13, probabilistic description identification: identifying uncertain or fuzzy descriptions in the instruction, and preparing to map the uncertain or fuzzy descriptions to a domain-specific language for probability distribution.
[0009] In the above technical solution, the specific process of step S2 is as follows: S21, Separating static and dynamic elements, dividing scene elements into two categories: Static elements: elements that define the initial snapshot of the scene, including the geometric and physical attributes of the initial position, posture, and size of all traffic participants; Dynamic elements: elements that define how the scene evolves over time, including the behavioral logic of each participant, the triggering and interruption conditions between behaviors, and the termination conditions of the entire scene; S22, Establishing a behavioral temporal framework: Based on the interaction logic extracted in step S21, establishing a preliminary behavioral state machine or temporal framework.
[0010] In the above technical solution, the specific process of step S3 is as follows: S31, Formal definition: Using a large language model, the structured scene blueprint is transformed into code fragments that conform to a probabilistic scene generation language; S32, Static and dynamic code generation: The large language model generates code for defining the environment, the initial state of objects, and the dynamic behavior control flow based on the decomposed components.
[0011] In the above technical solution, step S31, the process of converting code fragments that conform to the probabilistic scenario generation language, is formally described as a transformation function constrained by a knowledge base. : (1) Among them, This represents the final generated code snippets that conform to the syntax of a probabilistic scenario generation language. It is the behavioral timing framework output by step S22. It is an enhanced knowledge base that includes the complete syntax of a probabilistic scene generation language, a standard function library, and typical scene design patterns; in step S32, during the process of generating code to define the environment, object initial states, and dynamic behavior control flow, complex dynamic interactions can be formally expressed as a conditional policy. And generate the corresponding probabilistic scenario generation language code structure: (2) Among them, This represents the scene state history up to time t. Represents the scene state history at time t. Under the conditional policy, when the highest priority interrupt condition is met, the system will execute the corresponding interrupt behavior policy. If none of the interruption conditions are met, the default behavior will be executed. .
[0012] In the above technical solution, the specific process of step S4 is as follows: S41, script assembly: First, the programmatic compiler generates the global syntax rules of the language based on the probabilistic scenario, and then assembles the generated multiple... Concatenate them into a logically complete and grammatically correct final script S42. Definition of Probabilistic Scene Space: Based on script S, a formal definition of a probabilistic scene space is provided to generate diverse and flexible scenes; this probabilistic scene space consists of a set of variable parameters. Composition, its joint probability distribution This constitutes the sampling space of the entire scene; S43, Scene rationality constraint set construction: To ensure the realism and validity of the scene, the compiler will integrate three types of constraints to form a total constraint set, and any valid scene instance must satisfy this constraint set.
[0013] In the above technical solution, the algorithm for the sampling space of the entire scene in step S42 is as follows: (3) This formula establishes a dependency model for scene parameters through the probability chain rule, and allows the distribution of subsequent parameters to depend on the values of previous parameters, thus accurately constructing scenes with complex logical connections; in step S43, the algorithm for the constraint set is as follows: (4) Among them, This is the total set of constraints, and any valid scenario instance must satisfy this set; Generate native language constraints for probabilistic scenarios using scripts. Directly defined spatiotemporal and logical relationships within the scene; It is governed by general traffic rules; It is based on the physical laws of vehicle dynamics model and the vehicle kinematic constraints; finally, the original program script Transformed into a precise, constrained probability scenario space ( This prepares for the next step of instantiation and solution.
[0014] The above technical solution also includes step S5, scenario instantiation and execution. A compiler and sampler for a domain-specific language are generated through probabilistic scenario generation. The script in the domain-specific language is executed to transform the abstract probabilistic scenario description into one or more concrete, executable simulation instances. The compiler parses and solidifies all deterministic and probabilistic constraints in the script to form a constrained scenario space. Based on the constrained scenario space, the sampler generates one or more concrete scenario instances that satisfy all spatiotemporal relationships and behavioral logic. Each instance has definite parameters. At the same time, this generation process can also be guided by optimization objectives to support the targeted generation of high-value scenarios for safety-critical or edge cases. The instantiated scenario spaces are loaded into the specified simulation engine for complete dynamic simulation and visualization rendering.
[0015] In the above technical solution, the specific process of step S5 is as follows: S51, Scene instantiation algorithm: aiming to extract from the probability space In the process of finding a set that satisfies the constraints Parameter solution An effective scenario example The generation of is represented by a probabilistic model that integrates the probability density function over the parameter space satisfying all constraints: (5) Among them, It is an indicator function. It is the solution of the scene parameters. Specific scene examples, when the scene The value is 1 if all constraints are satisfied, and 0 otherwise, for the probability space. Sample and utilize indicator functions As a filter, only valid scene instances that satisfy all constraints are accepted, and invalid parameter regions are pre-selected through static analysis and pruning techniques; S52, Objective-oriented optimization generation algorithm: When it is necessary to efficiently discover specific types of scenes, the process of discovering specific types of scenes is transformed into a stochastic optimization problem with multiple objectives, the goal of which is to find a comprehensive evaluation function F. The optimal parameter set with the highest expected value The specific formula is as follows: in, It is a weight for security. It is a weight of complexity. It is the weight of novelty. It is a function for evaluating the safety of a scenario. It is a function for evaluating the complexity of a scenario. It is a function that evaluates the novelty of a scenario, with parameters satisfying the reality constraint R. In the process, we search for the comprehensive evaluation function F. The optimal solution that reaches the maximum value It also guides the generation of a set of high-value scenarios that satisfy all real-world constraints.
[0016] The present invention also provides an autonomous driving test scenario generation device based on a large language model and a probabilistic scene generation language, which has a computer program that can execute an autonomous driving test scenario generation method based on a large language model and a probabilistic scene generation language.
[0017] The present invention provides a method and apparatus for generating autonomous driving test scenarios based on a large-scale language model and a probabilistic scene generation language, which has the following beneficial effects: (1) Improve scene generation efficiency and ease of use: This invention allows users to directly describe the scene they want to test using natural language through the natural language understanding capabilities of a large language model, without having to write complex code, which greatly reduces the threshold for use and improves efficiency.
[0018] (2) Achieve generalized generation of test scenarios and enhance richness and logical complexity: This invention integrates the powerful semantic understanding capability of LLM with the precise expression capability of probabilistic scenario generation language, and achieves generalized generation from abstract description to a large number of specific instances.
[0019] (3) Ensuring the authenticity and high value of the scenarios: This invention ensures the authenticity of the scenarios by introducing traffic rules and vehicle physical limitations. At the same time, it can guide the generation of high-value scenarios such as safety critical and edge cases, thereby significantly improving the effectiveness and relevance of autonomous driving system testing. Attached Figure Description
[0020] Figure 1 This is a flowchart illustrating the autonomous driving test scenario generation method based on a large-scale language model and a probabilistic scene generation language according to the present invention. Figure 2 The example of step 4 in embodiment 3 of the present invention, which is a method for generating autonomous driving test scenarios based on a large language model and a probabilistic scene generation language, is loaded into the running graphs of different simulators. Figure 3 This is a schematic diagram of the architecture of the autonomous driving test scenario generation device based on a large-scale language model and a probabilistic scene generation language according to the present invention. Detailed Implementation
[0021] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments, but these embodiments should not be construed as limiting the present invention.
[0022] This invention addresses the shortcomings of existing technologies in generating test scenarios for autonomous vehicles by proposing a generalized generation technique for autonomous driving test scenarios based on a large-scale language model and a probabilistic scene generation language. This technique utilizes a large-scale language model to deeply parse user-input natural language commands and structurally generate modular code snippets that conform to the syntax of the scene generation language. Through a DSL compiler and sampler, one or more specific scene instances satisfying all spatiotemporal and behavioral constraints are generated. This process can also optimize target guidance to generate high-value scenarios such as those critical to safety. Finally, the scenarios are loaded into the simulator for execution, achieving a direct, efficient, and reliable conversion from natural language intent to complex dynamic simulation scenarios. See the appendix for detailed process. Figure 1 As shown.
[0023] Example 1 The technical solution adopted by this invention to solve its technical problem is: an autonomous driving test scenario generation method based on a large-scale language model and a probabilistic scene generation language, comprising the following steps: Step 1: Parse the user's natural language input commands using a large language model. The large language model is responsible for identifying key information in the commands, such as traffic participants, environment, event sequences, and causal relationships between them, clarifying the core components of the scene and the interaction logic, which serves as input for subsequent steps.
[0024] Step 2, Structured Decomposition of Scene Description. Utilizing a large-scale language model and based on the predefined grammatical framework of the probabilistic scene generation language and scene ontology knowledge, the structured intent acquired in the previous stage is deeply processed. This process formally maps natural language semantics to program logic, systematically decomposing the scene into structured components corresponding to the grammatical elements of the scene generation language. This includes separating static elements such as road geometry and initial entity states, as well as clarifying the dynamic behavior patterns of each entity, the triggering conditions between behaviors, response mechanisms, and the overall scene control flow, completing the transformation from semantics to logical structure.
[0025] Step 3: Generation of code snippets for the probabilistic scenario generation language. A large language model is used, combined with an enhanced knowledge base containing the basic syntax of the probabilistic scenario generation language, a standard function library, and typical scenario design patterns. Guided and constrained by the enhanced knowledge base, the large language model generates highly modular code snippets that conform to the precise syntax of the probabilistic scenario generation language for each structured component decomposed in the previous step. Especially for complex dynamic interaction logic, the large language model can generate high-level control flow structures such as conditional interrupts and sequential tasks, ensuring the accuracy and readability of the code.
[0026] Step 4: Assembly and compilation of the probabilistic scenario generation language script. Based on the inherent global syntax rules and pre-defined modular assembly logic of the probabilistic scenario generation language, the multiple independent code fragments generated in the previous stage are systematically integrated. This process, in a programmatic manner, concatenates and sorts the code describing modules such as environment, objects, behaviors, and control flow according to the correct dependencies and syntactic structures. Finally, a logically complete and syntactically correct final scenario script is assembled.
[0027] Step 5: Scenario Instantiation and Execution. A compiler and sampler using the probabilistic scenario generation DSL language execute the script in this DSL language, transforming the abstract probabilistic scenario description into one or more concrete, executable simulation instances. The compiler parses and solidifies all deterministic and probabilistic constraints in the script, forming a constrained scenario space. The sampler then generates one or more concrete scenario instances that satisfy all spatiotemporal relationships and behavioral logic, each instance having definite parameters. This process can also be guided by optimization objectives to support targeted generation of high-value scenarios such as safety-critical or edge cases. Finally, these instantiated scenarios are loaded into the designated simulation engine for complete dynamic simulation and visualization rendering.
[0028] Example 2 This embodiment is basically the same as Embodiment 1, except that it discloses some technical details of each step in detail: 1) In step 1 above, a large-scale language model is used to transform the user's input natural language instruction L into a structured set of scene elements, specifically: (1) Scene element recognition. LLM is used to perform deep semantic analysis on instruction L to identify and extract key elements in the scene, mainly including: traffic participants (Actors): such as the main vehicle (ego), background vehicles, pedestrians, etc.; static environment (Environment): such as road type (highway, urban road), map file, weather conditions; object attributes (Attributes): such as the initial speed, color, model of the vehicle, or a vague description of the attribute (such as "slow car").
[0029] (2) Interaction logic extraction. Identify and establish a framework for dynamic interaction relationships between elements, especially the causal relationship between the event trigger and the response action. For example, in the instruction "When the main vehicle approaches the slow vehicle, change lanes to the left to overtake", extract the logical pair of trigger condition "the distance between the main vehicle and the slow vehicle is less than the threshold" and response action "execute the left lane change".
[0030] (3) Identification of probabilistic descriptions. Identify uncertain or ambiguous descriptions in the instructions, such as "far ahead" or "at a relatively fast speed", to prepare for mapping them to the probability distribution in the DSL.
[0031] 2) The specific content of step 2 above is as follows: (1) Separation of static and dynamic elements. Scene elements are clearly divided into two categories: Static Elements: Elements that define the initial snapshot of the scene, including the initial position, posture, size and other geometric and physical properties of all traffic participants. Dynamic Elements: Elements that define how the scene evolves over time, including the behavioral logic of each participant, the triggering and interruption conditions between behaviors, and the termination conditions of the entire scene.
[0032] (2) Establish a behavioral sequence framework: Based on the interaction logic extracted in step 1, establish a preliminary behavioral state machine or sequence framework. In this embodiment, for example, for the overtaking scenario, the framework can be initially described as: Status 1 (default): The main vehicle travels along the lane (Follow LaneBehavior).
[0033] Switching condition: The distance to the slow vehicle is less than the safety threshold.
[0034] State 2 (Interruption): Execute overtake behavior.
[0035] 3) The specific content of step 3 above is as follows: (1) Formal definition: Using LLM to transform structured scene blueprints into code snippets that conform to a probabilistic scene generation language, this process can be formally described as a transformation function constrained by a knowledge base. : (1) in, This represents the final generated code snippets that conform to the syntax of a probabilistic scenario generation language. It is the structured blueprint output from step two. It is an enhanced knowledge base that includes the complete syntax of a probabilistic scene generation language, a standard function library, and typical scene design patterns.
[0036] (2) Static and Dynamic Code Generation: Based on the decomposed components, LLM generates code to define the environment, initial state of objects, and dynamic behavior control flow. For complex dynamic interactions, it can be formally expressed as a Conditional Policy. And generate the corresponding probabilistic scenario generation language code structure: (2) in This represents the scene state history up to time t. Represents the scene state history at time t. The system employs a conditional policy. When the highest priority interrupt condition is met, the system will execute the corresponding interrupt behavior policy. If none of the interruption conditions are met, the default behavior will be executed. .
[0037] 4) In step 4 above, the assembly, compilation, and formalization of the scene space of the probabilistic scene generation language script are performed. Specifically: (1) Script assembly: First, the programmatic compiler generates the global syntax rules of the language based on the probabilistic scenario, and then assembles the multiple scripts generated in the previous step. Concatenate them into a logically complete and grammatically correct final script .
[0038] (2) Definition of Probabilistic Scene Space: The diversity and flexibility of scene generation stem from the formal definition of a probabilistic scene space by the script S. This probabilistic scene space consists of a set of variable parameters. Composition, its joint probability distribution This constitutes the sampling space for the entire scene.
[0039] (3) This formula establishes a general dependency model for scene parameters through the probabilistic chain rule. It allows the distribution of subsequent parameters (such as the speed of the background vehicle) to depend on the values of previous parameters (such as the speed of the main vehicle), thereby accurately constructing scenes with complex logical connections.
[0040] (3) Construction of scene rationality constraint set: In order to ensure the realism and validity of the scene, the compiler will integrate the three types of constraints to form a total constraint set. Any valid scene instance must satisfy this set.
[0041] (4) in, This is the total set of constraints; any valid scenario instance must satisfy this set. Generate native language constraints for probabilistic scenarios using scripts. Directly defined spatiotemporal and logical relationships within the scene; It is governed by general traffic rules; It is a vehicle kinematic constraint, based on the physical laws of the vehicle dynamics model, to ensure the realism of dynamic behavior.
[0042] Finally, the original program script It was successfully transformed into a precise, constrained probabilistic scene space. This prepares the ground for the next step of instantiation and solving.
[0043] 5) Step 5 above instantiates the scene and performs target-oriented optimization generation, specifically as follows: (1) Scene instantiation algorithm: This process aims to extract scenes from the probability space. In the process of finding a set that satisfies the constraints Parameter solution An example of a valid scenario. The generation of can be represented by a probabilistic model that integrates the probability density function over the parameter space satisfying all constraints: (5) in It is an indicator function. It is the solution of the scene parameters. Specific scene examples, when the scene The value is 1 if all constraints are satisfied, and 0 otherwise. The system will select from the probability space. Sampling is performed in the sample and the indicator function is used. As a filter, it only accepts valid scene instances that satisfy all constraints. By pre-emptively eliminating a large number of invalid parameter regions through static analysis and pruning techniques, sampling efficiency is greatly improved.
[0044] (2) Goal-oriented optimization generation algorithm. When it is necessary to efficiently discover specific types of scenarios (such as safety-critical), the process will be transformed into a stochastic optimization problem with multiple objectives, the goal of which is to find a comprehensive evaluation function F. The optimal parameter set with the highest expected value The specific formula is as follows: in, It is a weight for security. It is a weight of complexity. It is the weight of novelty. It is a function for evaluating the safety of a scenario. It is a function for evaluating the complexity of a scenario. It is a function that evaluates the novelty of a scenario, with parameters satisfying the reality constraint R. In the process, we search for the comprehensive evaluation function F. The optimal solution that reaches the maximum value This algorithm can guide the generation of a complete set of high-value scenarios that satisfy all real-world constraints.
[0045] Example 3 The technical solution of the present invention will now be further clarified with reference to actual cases: 1. User command input: The user inputs a natural language command into the system, such as: "Create a highway scenario where the main vehicle is driving normally on the road. There is an illegally parked car in front of it. When the main vehicle approaches, the illegally parked car suddenly starts moving and changes lanes to the left, merging into the main lane." 2. LLM Analysis and Decomposition: After receiving this instruction, the system's built-in LLM decomposes it into the following structured components: Geometry: Highway Ego Vehicle: Type: Vehicle (Car) Behavior: Driving along the main lane (Follow Lane Behavior) with a collision avoidance strategy configured (DriveAvoidingCollisions) Adversarial Vehicle: Type: Vehicle (Car) Initial position: On the visible right corner of the road, offset 0.5 meters from the roadside. Initial orientation: Facing a random, unfavorable angle of 10 to 20 degrees to the road direction. Core dynamic logic: Trigger condition: The distance between the main vehicle and the illegally parked vehicle is less than 15 meters.
[0046] Response Action: The action of illegally parked vehicles merging into the main lane.
[0047] Global constraints and termination conditions: Hard constraint: The initial distance between the main vehicle and the illegally parked vehicle must be greater than 20 meters (require (distance to parkedCar)>20).
[0048] Termination logic: After the interaction occurs, monitor the speed of the main vehicle. When the speed drops to near a stop, wait for a certain period of time before terminating the simulation. Set a 15-second timeout protection to prevent the simulation from running indefinitely.
[0049] 3. Generate probabilistic scene-based language code snippets: Based on the above decomposition results and combined with its built-in probabilistic scenario generation language knowledge base, LLM generates precise and modular code snippets for each component. In particular, for the core dynamic logic, LLM identifies it as a typical "condition wait-behavior execution" pattern and generates a behavior named PullIntoRoad.
[0050] (1) Segment A (Environment and Object Creation): # Define map and simulation parameters / / Set scene parameters The parameter map_file = "pathTo / map01.xodr" Parameter carla_map_name = "map01" Parameter time_step = 0.1 / / Simulation step size / / Import domain model Import "driving.model" / / Import the driving behavior model library / / Create the master vehicle (Ego) Create an entity ego_vehicle as the vehicle type. Assign the following behavior to ego_vehicle: DriveAvoidingCollisions (avoidance threshold = 5 meters) (2) Segment B (Definition of the opposing vehicle and its dynamic behavior): / / Define the dynamic behavior of the adversarial vehicle "PullIntoRoad" behavior PullIntoRoad(): / / Loop and wait until the trigger condition is met. The loop continues when (the distance from itself to ego_vehicle > 15 meters): Waiting for the next simulation step End the loop / / Once the conditions are met, execute the merging into the lane action. Execute FollowLaneBehavior(target lane = the lane where ego_vehicle is located) End of behavior / / Create an adversary vehicle (parked_car) Define right_curb as the roadside of the lane group where ego_vehicle is located. Define spot as a point on the visible right_curb. / / Define a random bad parking angle Define bad_angle as a random value between 10 and 20 degrees. Create an entity named parked_car as the vehicle type and configure it as follows: Location: 0.5 meters to the left of the spot. Orientation: Offset relative to the road direction (bad_angle) Assign behavior to parked_car: PullIntoRoad() (3) Fragment C (Global Constraints and Scene Monitoring): / / Define the hard constraints of the initial scene Requirement: (Initial distance from ego_vehicle to parked_car > 20 meters) / / Define a monitor to control the end of the simulation. Monitor StopAfterInteraction(): / / The main vehicle speed decreases after the interaction occurs. When (ego_vehicle speed > 2 m / s): Waiting for the next simulation step End the loop / / After the main vehicle has almost come to a stop, wait a short while longer. Wait for 50 simulation steps / / (50 * 0.1 seconds = 5 seconds) / / End simulation termination End monitor / / Apply a monitor and set a timeout Requires activation of the monitor StopAfterInteraction() The simulation should terminate after 15 seconds (as a timeout protection measure). 4. Assembly, compilation, and execution: The system automatically assembles the above code snippets into a complete, syntactically correct script. This script is then executed by a compiler and sampler, processing all probability distributions and hard constraints to generate a concrete scenario instance that satisfies all spatiotemporal and behavioral logic. Finally, this instance is loaded into different simulators, allowing users to observe the complete dynamic process of an illegally parked vehicle suddenly starting and cutting into the lane when a main vehicle approaches, such as... Figure 2 As shown.
[0051] Example 4 See Figure 3The present invention relates to an autonomous driving test scenario generation device based on a large-scale language model and a probabilistic scene generation language, comprising the following components: Natural Language Command Parsing Module: This module uses a large language model to parse the natural language commands input by the user. The large language model is responsible for identifying the causal relationships between key information in the commands, clarifying the core components of the scenario and the interaction logic, and using them as input for subsequent steps. The structured decomposition module performs a structured decomposition of the scene description, formally mapping the natural language semantics into program logic. It systematically decomposes the scene into structured components corresponding to the grammatical elements of the scene generation language, including separating static elements such as road geometry and the initial state of entities, as well as clarifying the dynamic behavior patterns of each entity, the triggering conditions between behaviors, the response mechanism, and the overall scene control flow, thus completing the transformation from semantics to logical structure. Code snippet generation module: Generates code snippets in probabilistic scenario generation language. It combines a large language model with an enhanced knowledge base containing the basic syntax of probabilistic scenario generation language, standard function library and typical scenario design patterns. Based on the guidance and constraints of the enhanced knowledge base, the large language model generates highly modular code snippets that conform to the precise syntax of probabilistic scenario generation language for each decomposed structured component. For complex dynamic interaction logic, the large language model can generate high-level control flow structures. Assemble and compile modules: Assemble and compile scripts of the probabilistic scenario generation language. Based on the inherent global syntax rules and preset modular assembly logic of the probabilistic scenario generation language, systematically integrate multiple independent code fragments generated. This integration process, in a programmatic manner, splices and sorts the code describing the environment, objects, behaviors and control flow modules according to the correct dependencies and syntax structure, and finally assembles them into a logically complete and syntactically correct final scenario script. Scene Instantiation and Execution Module: This module instantiates and executes scenes. It uses a compiler and sampler to generate a domain-specific language for probabilistic scene generation. The compiler executes the scripts in this domain-specific language, transforming the abstract probabilistic scene description into one or more concrete, executable simulation instances. The compiler parses and solidifies all deterministic and probabilistic constraints in the script, forming a constrained scene space. Based on this constrained scene space, the sampler generates one or more concrete scene instances that satisfy all spatiotemporal relationships and behavioral logics. Each instance has definite parameters. This generation process can also be guided by optimization objectives to support the targeted generation of high-value scenarios for safety-critical or edge cases. The instantiated scene spaces are then loaded into the specified simulation engine for complete dynamic simulation and visualization rendering.
[0052] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
[0053] The contents not described in detail in this specification are existing technologies known to those skilled in the art.
Claims
1. A method for generating autonomous driving test scenarios based on a large-scale language model and a probabilistic scene generation language, characterized in that: Includes the following steps: S1. Use a large language model to parse the natural language commands input by the user. The large language model is responsible for identifying the causal relationship between key information in the command, clarifying the core components of the scene and the interaction logic, and using them as input for subsequent steps. S2. Perform a structured decomposition of the scene description, formally map the natural language semantics into program logic, systematically decompose the scene into structured components corresponding to the grammatical elements of the scene generation language, including separating static elements such as road geometry and the initial state of entities, as well as clarifying the dynamic behavior patterns of each entity, the triggering conditions between behaviors, the response mechanism, and the overall scene control flow, thus completing the transformation from semantics to logical structure. S3. Generate code snippets for probabilistic scenario generation language. Combine a large language model with an enhanced knowledge base containing the basic syntax of probabilistic scenario generation language, standard function library and typical scenario design patterns. Based on the guidance and constraints of the enhanced knowledge base, the large language model generates highly modular code snippets that conform to the precise syntax of probabilistic scenario generation language for each decomposed structured component. For complex dynamic interaction logic, the large language model can generate high-level control flow structures. S4. Assemble and compile the script of the probabilistic scenario generation language. Based on the inherent global syntax rules and preset modular assembly logic of the probabilistic scenario generation language, systematically integrate the multiple independent code fragments generated. This integration process is carried out in a programmatic way, splicing and sorting the code describing the environment, objects, behaviors and control flow modules according to the correct dependency relationship and syntax structure, and finally assembling them into a logically complete and syntactically correct final scenario script.
2. The method for generating autonomous driving test scenarios based on a large-scale language model and a probabilistic scene generation language according to claim 1, characterized in that: The specific process of step S1 is as follows: S11. Scene element recognition: Utilize a large language model to perform deep semantic analysis on instruction L, identify and extract key elements in the scene, including: traffic participants, static environment, object attributes, or fuzzy descriptions of attributes. S12. Extracting interaction logic: Identifying and establishing a framework for dynamic interaction relationships between elements, especially the causal relationship between the triggering conditions of events and the response behavior. S13. Probabilistic description recognition: Recognizes uncertain or ambiguous descriptions in instructions and prepares to map the uncertain or ambiguous descriptions to a domain-specific language for probability distribution.
3. The method for generating autonomous driving test scenarios based on a large-scale language model and a probabilistic scene generation language according to claim 2, characterized in that: The specific process of step S2 is as follows: S21. Separate static and dynamic elements, dividing scene elements into two categories: Static elements: elements that define the initial snapshot of the scene, including the initial position, posture, and geometric and physical properties of all traffic participants; Dynamic elements: elements that define how the scene evolves over time, including the behavioral logic of each participant, the triggering and interruption conditions between behaviors, and the termination conditions of the entire scene. S22. Establish a behavioral sequence framework: Based on the interaction logic extracted in step S21, establish a preliminary behavioral state machine or sequence framework.
4. The method for generating autonomous driving test scenarios based on a large-scale language model and a probabilistic scene generation language according to claim 3, characterized in that: The specific process of step S3 is as follows: S31. Formal definition: Using a large language model to transform a structured scene blueprint into code snippets that conform to a probabilistic scene generation language; S32. Static and Dynamic Code Generation: The large language model generates code based on the decomposed components to define the environment, object initial states, and dynamic behavior control flow.
5. The method for generating autonomous driving test scenarios based on a large-scale language model and a probabilistic scene generation language according to claim 4, characterized in that: In step S31, the process of converting code snippets that conform to the probabilistic scenario generation language is formally described as a transformation function constrained by a knowledge base. : (1) in, This represents the final generated code snippets that conform to the syntax of a probabilistic scenario generation language. It is the behavioral timing framework output by step S22. It is an enhanced knowledge base that includes the complete syntax of a probabilistic scene generation language, a standard function library, and typical scene design patterns; In step S32, during the process of generating code to define the environment, object initial state, and dynamic behavior control flow, complex dynamic interactions can be formally expressed as a conditional strategy. And generate the corresponding probabilistic scenario generation language code structure: (2) in, This represents the scene state history up to time t. Represents the scene state history at time t. Under the conditional policy, when the highest priority interrupt condition is met, the system will execute the corresponding interrupt behavior policy. If none of the interruption conditions are met, the default behavior will be executed. .
6. The method for generating autonomous driving test scenarios based on a large-scale language model and a probabilistic scene generation language according to claim 5, characterized in that: The specific process of step S4 is as follows: S41, Script Assembly: First, the programmatic compiler generates global syntax rules for the language based on probabilistic scenarios, and then assembles the generated scripts. Concatenate them into a logically complete and grammatically correct final script ; S42. Definition of Probabilistic Scene Space: Based on script S, a formal definition of a probabilistic scene space is provided to generate diverse and flexible scenes; this probabilistic scene space consists of a set of variable parameters. Composition, its joint probability distribution This constitutes the sampling space for the entire scene; S43. Construction of the scenario rationality constraint set: To ensure the realism and validity of the scenario, the compiler will integrate three types of constraints to form a total constraint set. Any valid scenario instance must satisfy this constraint set.
7. The method for generating autonomous driving test scenarios based on a large-scale language model and a probabilistic scene generation language according to claim 6, characterized in that: In step S42, the algorithm for the sampling space of the entire scene is as follows: (3) This formula establishes a dependency model for scene parameters through the probability chain rule, and allows the distribution of subsequent parameters to depend on the values of previous parameters, thus accurately constructing scenes with complex logical connections. In step S43, the algorithm for the constraint set is as follows: (4) in, This is the total set of constraints, and any valid scenario instance must satisfy this set; Generate native language constraints for probabilistic scenarios using scripts. Directly defined spatiotemporal and logical relationships within the scene; It is governed by general traffic rules; It is a vehicle kinematic constraint based on the physical laws of the vehicle dynamics model; Finally, the original program script Transformed into a precise, constrained probability scenario space ( This prepares for the next step of instantiation and solution.
8. The method for generating autonomous driving test scenarios based on a large-scale language model and a probabilistic scene generation language according to claim 7, characterized in that: It also includes step S5, scenario instantiation and execution. A compiler and sampler for a domain-specific language are generated through probabilistic scenario generation. The script in the domain-specific language is executed to transform the abstract probabilistic scenario description into one or more concrete, executable simulation instances. The compiler parses and solidifies all deterministic and probabilistic constraints in the script to form a constrained scenario space. The sampler then generates one or more concrete scenario instances that satisfy all spatiotemporal relationships and behavioral logic based on the constrained scenario space. Each instance has definite parameters. At the same time, this generation process can also be guided by optimization objectives to support the targeted generation of high-value scenarios for safety-critical or edge cases. The instantiated scenario spaces are loaded into the specified simulation engine for complete dynamic simulation and visualization rendering.
9. The method for generating autonomous driving test scenarios based on a large-scale language model and a probabilistic scene generation language according to claim 8, characterized in that: The specific process of step S5 is as follows: S51, Scene Instantiation Algorithm: Aiming to extract from probability space In the process of finding a set that satisfies the constraints Parameter solution An effective scenario example The generation of is represented by a probabilistic model that integrates the probability density function over the parameter space satisfying all constraints: (5) in, It is an indicator function. It is the solution of the scene parameters. Specific scene examples, when the scene The value is 1 if all constraints are satisfied, and 0 otherwise, for the probability space. Sample and utilize indicator functions As a filter, it only accepts valid scenario instances that meet all constraints, and pre-emptively removes invalid parameter regions through static analysis and pruning techniques. S52. Objective-Oriented Optimization Generation Algorithm: When it is necessary to efficiently discover specific types of scenes, the process of discovering specific types of scenes is transformed into a stochastic optimization problem with multiple objectives. The objective is to find a comprehensive evaluation function F. The optimal parameter set with the highest expected value The specific formula is as follows: in, It is a weight for security. It is a weight of complexity. It is the weight of novelty. It is a function for evaluating the safety of a scenario. It is a function for evaluating the complexity of a scenario. It is a function that evaluates the novelty of a scenario, with parameters satisfying the reality constraint R. In the process, we search for the comprehensive evaluation function F. The optimal solution that reaches the maximum value It also guides the generation of a set of high-value scenarios that satisfy all real-world constraints.
10. An autonomous driving test scenario generation device based on a large-scale language model and a probabilistic scene generation language, comprising a computer program, characterized in that: The computer program is capable of executing the autonomous driving test scenario generation method based on a large language model and a probabilistic scene generation language as described in any one of claims 1 to 9.
Citation Information
Cited By
Spacecraft intelligent software virtual simulation test scene intelligent generation method
CN122111869A
A method for intelligently generating virtual simulation test scenarios for spacecraft intelligent software
CN122111869B