A Multi-Vehicle Cooperative Controllable Adversarial Testing Method Based on Diffusion Model
By adopting a multi-vehicle cooperative controllable adversarial testing method based on a diffusion model, the problem of generating controllable disturbance behavior in multi-vehicle interaction scenarios was solved, and simulation testing of diverse adversarial scenarios was realized, thereby improving the safety and robustness of autonomous driving systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-23
- Publication Date
- 2026-03-13
AI Technical Summary
Existing autonomous driving simulation and testing methods struggle to generate controllable and repeatable perturbation behaviors in multi-vehicle interaction scenarios, and lack diverse and targeted adversarial situations, affecting the realism of test scenarios and the coverage of evaluation.
A multi-vehicle cooperative controllable adversarial testing method based on diffusion model establishes a spatiotemporal modeling framework by integrating road maps, lane topology and trajectory priors. It introduces adversarial guidance functions and partial diffusion mechanisms to achieve explicit constraints and dynamic adjustments on key risk variables, generating adversarial behaviors of various types and intensities.
A diverse, controllable, and realistic safety-critical closed-loop simulation environment was constructed, which significantly improved the robustness and safety of autonomous driving systems in complex and dynamic traffic environments and provided an efficient means of safety verification.
Smart Images

Figure CN121389817B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent autonomous driving, and in particular to a multi-vehicle cooperative and controllable adversarial testing method based on a diffusion model. Background Technology
[0002] With the rapid development of intelligent connected and autonomous driving technologies, vehicles operating in dynamic traffic environments such as urban roads, highways, and complex intersections place higher demands on the safety and robustness of perception, planning, and control systems. Especially in long-tail safety-critical scenarios, autonomous driving systems must be able to maintain stable responses and make reasonable decisions under sudden risk interactions. However, the probability of such extreme events occurring in real-world roads is extremely low, and directly testing with real vehicles poses significant safety risks. Therefore, using simulation platforms to generate safety-critical scenarios and conducting closed-loop testing has become an important means of researching and validating autonomous driving algorithms.
[0003] Existing autonomous driving simulation and testing methods mainly fall into two categories: The first is heuristic simulation methods based on rules or dynamic models, which generate test scenarios by manually setting interaction logic. However, these methods have limited behavioral diversity and realism, making it difficult to reflect real traffic distribution characteristics. The second is data-driven imitation learning or reinforcement learning methods. While these can replicate human driving behavior to some extent, they often struggle to guarantee the controllability and stability of generated behaviors in safety-critical scenarios, making it difficult to construct diverse and targeted adversarial situations. Furthermore, most existing methods for generating safety-critical scenarios remain in a static, offline stage, lacking a closed-loop interaction mechanism. This means that the environmental vehicles cannot respond in real-time to changes in the tested vehicle's strategy, thus affecting the realism of the test scenarios and the coverage of the evaluation.
[0004] In recent years, diffusion models have been increasingly adopted in traffic behavior simulation due to their superior performance in controllable generation and multimodal modeling. However, existing diffusion model methods mostly focus on scene initialization or single-vehicle trajectory generation, lacking controllable adversarial generation mechanisms for multi-vehicle interactions. Especially in multi-agent adversarial testing, how to enable multiple background vehicles to generate controllable and repeatable disturbances to the tested vehicle while maintaining traffic rationality and consistency in interaction logic remains a critical problem that urgently needs to be solved. Summary of the Invention
[0005] To address the aforementioned issues, this invention proposes a controllable adversarial testing method for multi-vehicle cooperation based on a diffusion model. First, it integrates multi-source information such as road maps, lane topology, and trajectory priors to establish a spatiotemporal modeling framework for multi-vehicle interaction. Then, in the generation phase, an adversarial guidance function is introduced into the reverse denoising process based on the diffusion model, enabling explicit constraints and dynamic adjustments to key risk variables (such as collision type, time to collision, relative speed, and relative position). Simultaneously, combined with a partial diffusion mechanism, by controlling the diffusion ratio parameter and trajectory perturbation intensity, controllable generation of multiple types and intensities of adversarial behavior is achieved, balancing the physical plausibility and behavioral diversity of traffic scenarios. Within this framework, adversarial vehicles can actively challenge the planning strategies of the tested vehicles while maintaining the overall realism of traffic flow, thereby constructing a diverse, controllable, and realistic safety-critical closed-loop simulation environment.
[0006] Through the above design, this invention constructs a closed-loop simulation system of "generation-adversarial-evaluation": In the generation phase, controllable collaborative generation of multi-vehicle trajectories is achieved; in the adversarial phase, high-risk interactive behaviors are generated through a guidance mechanism; and in the evaluation phase, the quality of the generated adversarial scenarios is quantitatively analyzed based on realism and controllability indicators to ensure its effective support for the safety verification of the tested autonomous driving system. This invention's method can be widely applied to autonomous driving planning and decision-making algorithms, control strategy models, and simulation safety evaluation platforms. It can efficiently reproduce low-probability, high-risk, long-tail scenarios in a virtual environment, significantly improving the robustness, safety, and verifiability of autonomous driving systems in complex dynamic traffic environments.
[0007] Technical solution:
[0008] A multi-vehicle cooperative and controllable adversarial testing method based on a diffusion model includes the following steps:
[0009] Step S1: Diffusion Model Training Phase
[0010] The diffusion model is trained based on real driving data. By adding noise forward and denoising backward, the vehicle behavior distribution is learned, and fixed model parameters are obtained. ;
[0011] Step S2: Scene and Multi-Vehicle Spatiotemporal Modeling
[0012] By integrating road maps, lane topology, and vehicle status information, a spatiotemporal scene representation of multi-vehicle interaction is constructed, which serves as the input for diffusion generation;
[0013] Step S3 is based on an adversarial-guided diffusion generation mechanism:
[0014] During the inference phase, noise is reversed to generate multi-vehicle trajectories. Non-adversarial vehicles generate normal behavior according to reasonable constraints, while adversarial vehicles are superimposed with risk guidance to generate adversarial behavior.
[0015] Step S4: Partial Diffusion Control and Diversified Adversarial Generation
[0016] By utilizing joint trajectory priors, intermediate noise states are selected as the starting point during the diffusion process, and adversarial scenarios with different intensities and types are generated through partial diffusion and gradient guidance.
[0017] Step S5: Realism and controllability assessment of multi-agent adversarial scenarios:
[0018] A dual-index system based on Wasserstein distance and time-to-collision (TTC) is established to quantitatively evaluate the realism and adversarial controllability of generated scenarios.
[0019] It should be noted that this invention adopts a two-stage process of separating training and inference, wherein step S1 is the model training stage, in which the diffusion model parameters are learned through real traffic data. After the training phase is completed, the model parameters remain fixed and are no longer updated. After entering the inference phase, step S2 is executed first to uniformly model the road topology, vehicle state and historical trajectory in the test scenario, and construct a spatiotemporal scene representation of multi-vehicle interaction, which serves as the input for diffusion generation (step S3) and partial diffusion control (step S4).
[0020] Specifically, step S1 completes the offline training of the diffusion model, which is performed only once before the model is deployed. This is used to learn the statistical features of driving behavior in real traffic data, providing a basic behavioral distribution model for adversarial generation in the inference stage.
[0021] During the training phase, the diffusion model constructs a forward denoising and backward denoising process for the trajectory distribution based on a real-world driving dataset. Specifically, given a sequence of real trajectories... The forward noise addition process follows a preset noise schedule. Gaussian noise is gradually added within each step to form a Markov chain from a clean trajectory (clean data) to a completely noisy trajectory. Let be the total number of noise-adding steps, and its one-step transition probability be defined as:
[0022]
[0023] in, Indicates the first The noisy trajectory of the step, The noise intensity coefficient, As a unit array, The mean is Covariance is The multivariate Gaussian distribution, symbolized by " " means "defined as".
[0024] In the reverse denoising process, the model uses neural network parameters Predicted denoised mean To reconstruct the noise introduced by forward denoising, the statistical laws governing driving behavior in acceleration changes, directional response, and inter-vehicle avoidance interactions are learned. The conditional distribution of this law is expressed as:
[0025]
[0026] in, For model parameters The determined probability distribution For the predicted denoised trajectory. For neural networks in noise level and decision context information Denoising mean prediction under the following conditions For the first The covariance matrix of the step.
[0027] The model is trained by minimizing the noise prediction error.
[0028] After training, fixed model parameters are obtained. The resulting diffusion model behavior generation model is denoted as .
[0029] Specifically, step S2 aims to construct a traffic scenario and spatiotemporal interaction model for multi-vehicle cooperative adversarial simulation, providing a unified and structured input basis for subsequent diffusion generation and adversarial behavior control.
[0030] In autonomous driving safety testing, real-world traffic scenarios typically consist of multiple interacting vehicles, each subject to multiple constraints including road geometry, dynamic characteristics of neighboring vehicles, and traffic rules. To realistically reproduce the dynamic interactions of multiple entities in a simulation environment, this invention establishes a multi-vehicle spatiotemporal modeling framework in step S2, integrating road maps, lane topology, vehicle states, and historical trajectory information to form a high-dimensional dynamic scene representation oriented towards diffusion generation tasks.
[0031] Step S21: Traffic scenario definition and state space modeling;
[0032] Assuming there are a total of The vehicles included one test vehicle (the autonomous vehicle controlled by the automated driving system), and the rest... The vehicle is an environmental vehicle. The system is in time step The state is defined as:
[0033]
[0034] in, Indicates the first The vehicle's position, velocity, and heading angle in a two-dimensional map coordinate system. The vehicle's motion vector is defined as:
[0035]
[0036] in, Indicates the first The longitudinal acceleration and angular velocity of the vehicle.
[0037] Step S22: Construct decision context and environmental feature encoding;
[0038] Each vehicle's decision-making process depends on its local observations and the dynamic information of neighboring vehicles. Therefore, a decision context for each vehicle is defined. ,include:
[0039] (1) Local road topology information centered on vehicles (including lane centerlines, boundaries and passable areas);
[0040] (2) Fragments of historical trajectory ,in This refers to the length of the historical observation time window;
[0041] (3) Dynamic information such as the speed, relative position and relative heading angle of nearby vehicles.
[0042] After coordinate normalization and feature mapping, the decision context information is uniformly encoded into a spatiotemporal feature tensor. This refers to environmental feature encoding, which characterizes the dynamic interaction relationships between multiple vehicles and the evolutionary features of the environment over time, and serves as the input context for the diffusion model.
[0043] Step S23: Vehicle role definition and generation model description;
[0044] In the multi-vehicle simulation framework, all vehicles are divided into three categories:
[0045] (1) Ego Vehicle: Controlled by the autonomous driving algorithm under test, its policy function is denoted as... The input consists of the environmental state and perception results, and the output is a planned trajectory for the next few steps. This vehicle is not directly controlled by the diffusion generation model and is used as a test subject to evaluate the system's decision-making performance and safety robustness.
[0046] (2) Adversarial Vehicle: Several non-autonomous vehicles in the environment are selected as adversarial agents, and their future trajectories are generated by the behavior generation model in the diffusion model. Generated based on historical states and decision context. In the diffusion-based reverse denoising process, a mean prediction function is used. The trajectory is gradually denoised, and in Overlaying guidance during denoising update ,in Including adversarial guidance items With reasonableness constraints Through this mechanism, adversarial vehicles can generate targeted disturbances while maintaining traffic order, thus achieving controllable adversarial behavior. A further partial diffusion mechanism (step S4) is introduced to act on the adversarial vehicles that need to generate disturbances, thereby enhancing adversarial behavior and controlling collision type and attack intensity.
[0047] (3) Non-Adversarial Vehicle: Other vehicles in the environment besides adversarial vehicles are also generated through behavior generation models. Future trajectories are generated based on their historical states and environmental information. However, in the diffusion-based reverse denoising process, the mean prediction function... Only using rationality constraint functions Instead of adding adversarial guidance items, this ensures the stability of traffic flow and the physical realism of the scene.
[0048] In this invention, each vehicle in the traffic scenario is modeled as an intelligent agent, with a one-to-one correspondence between the two. The intelligent agent represents the decision-making and dynamic response entity of the vehicle in the simulation system. The vehicle under test, the adversarial vehicle, and the non-adversarial vehicle all belong to different roles of the intelligent agent.
[0049] Step S24: Construct a closed-loop interaction and simulation update mechanism;
[0050] Within each simulation cycle, the vehicle under test is determined based on the current context. Output future trajectory planning, other vehicles based on Generate a response action, where, A dedicated decision-making context for the vehicle being tested; For the decision context of a vehicle in any environment, These represent the behavioral parameters of an individual vehicle. and They are constructed using the same environmental feature encoding method, but due to different reference centers and sets of observable neighboring vehicles, they correspond to independent context instances of different vehicles.
[0051] The system uses a unicycle model to update the global state. The dynamic equation is:
[0052]
[0053] Updated status The inputs fed back to each vehicle form a closed-loop interactive update mechanism. This closed-loop process ensures that the trajectory of the adversary vehicle can adaptively adjust according to the strategy changes of the tested vehicle, thereby achieving dynamic and causally consistent multi-vehicle cooperative adversarial simulation.
[0054] Specifically, the simulation system executes the following closed-loop process at each time step:
[0055] (1) The tested vehicle is determined according to the current context. Output future trajectory planning;
[0056] (2) The combat and non-combat vehicles are based on respectively Output the action at the next moment ;
[0057] (3) Environment execution state update function ;
[0058] (4) Feed back the updated status to each vehicle perception module as input for the next step.
[0059] Through this closed-loop interaction mechanism, the adversarial vehicle can adaptively respond based on the real-time decision-making strategy of the test vehicle, thereby achieving dynamic collaboration and behavioral game among multiple vehicles. The entire simulation cycle continues until the test vehicle successfully passes through the intersection or a collision event occurs.
[0060] Step S3 is as follows:
[0061] Obtain model parameters during the training phase (step S1) Following this, this step belongs to the inference phase, which generates the future trajectories of multiple vehicles under given scenario conditions and introduces an adversarial guidance function to induce controllable high-risk behavior in adversarial vehicles. This step is the foundational generation module of the inference phase, providing the basis for adversarial updates for subsequent partial diffusion control.
[0062] During the inference phase, the model learns from Gaussian noise samples. Starting from this point, the reverse denoising process is executed step by step. The denoising update is represented as:
[0063]
[0064] in, For the model in the first The denoising mean of the steps, Let covariance matrix be the variance matrix. This is the step size coefficient used to adjust the gradient correction magnitude, which controls the injection ratio of the guiding gradient during the back diffusion process, thereby ensuring overall numerical stability.
[0065] bootstrap function From the opposing terms With reasonableness constraints composition:
[0066]
[0067] in, The adversarial weight is used to determine the strength of the adversarial behavior; Used to guide adversarial vehicles to generate targeted risky behavior, including multi-dimensional control factors based on distance, relative speed, and time to collision (TTC); To maintain the rationality and physical stability of the overall traffic flow, a constraint mechanism based on route constraints and Gaussian regularization of vehicle spacing is employed.
[0068] Through this differentiable guided function, the model can dynamically correct the denoising direction during the inference phase, achieving continuous control and interpretable adjustment of multi-vehicle adversarial behavior.
[0069] For non-adversarial vehicles, the denoising update is based solely on the decision context and reasonableness constraints. (Rules including lane keeping, vehicle spacing constraints, and dynamic consistency) are used to correct the mean prediction, enabling it to generate a normal response trajectory that conforms to real traffic statistics; for adversarial vehicles, a gradient-based adversarial guidance term is also included in the mean prediction at each step of the denoising process. This causes its trajectory to deviate in the direction of the predetermined risk while maintaining physical rationality.
[0070] Through the aforementioned guidance mechanism, the model can generate different levels of risk behaviors during the inference phase based on the adversarial strength parameter. This module forms the basis for the subsequent S4 partial diffusion control and can be used independently when partial diffusion is not enabled.
[0071] Step S4 is as follows:
[0072] Step S41: Constructing prior trajectories for multiple agents;
[0073] This step constructs trajectory priors through a multi-agent trajectory constraint mechanism. The prior trajectory of the adversarial vehicle will be used as the starting point of the perturbation in the subsequent partial diffusion (the prior trajectory of the non-adversarial vehicle will still use the conventional diffusion to generate the trajectory).
[0074] The system first extracts the centerlines of the lanes occupied by the tested vehicle and the opposing vehicle based on the road topology. Then, it calculates the reachable range along the centerline within a given time window by combining the vehicle's current position, speed, and acceleration. By comparing the spatiotemporal interaction between the reachable ranges of each vehicle, it determines whether there are potential conflict areas such as intersections, merging points, or centerline crossings.
[0075] After identifying a potential conflict, the system generates a corresponding predicted trajectory based on vehicle dynamics constraints: the longitudinal speed of the adversary vehicle is adjusted to allow it to enter the conflict zone at the target time, and its lateral position is offset according to the lane width; the tested vehicle generates a baseline trajectory along its planned direction. The combination of the adversary vehicle's predicted trajectories constitutes a multi-agent trajectory prior, enabling the diffusion model to maintain the overall interactive structure of the scene during subsequent generation, while providing a clear spatiotemporal framework for the controllable generation of adversarial behavior.
[0076] Step S42: Partial diffusion control mechanism;
[0077] This step proposes a partial diffusion mechanism for the controllable generation of adversarial behavior: based on the trajectory prior of adversarial vehicles. In the intermediate diffusion step Construct intermediate trajectories at a specified noise level This allows for the introduction of controllable disturbances to adversarial vehicles while maintaining the overall scene structure, enabling the model to generate different types of risk behaviors and collision patterns.
[0078] Before the reverse denoising process, based on a predefined partial diffusion ratio... Determine the intermediate diffusion step as For the trajectory prior of the adversarial vehicle Partial diffusion design does not require stepwise execution from 0 to... Instead of using the complete forward-noising link, it directly calculates its value in the 1st descent using a closed-form expression of the diffusion model. The noisy representation of the step, i.e.:
[0079]
[0080] in, Forward diffusion in the first The product of the coefficients of the steps, The sample contains Gaussian noise. The intermediate trajectory. As the starting point for reverse denoising, and combined with adversarial guidance and rationality constraints for iterative updates, the generated trajectory exhibits controllable local offsets while preserving the original structure.
[0081] By adjusting the ratio The size of the variable can be continuously adjusted between maintaining the original trajectory and free generation. This diffusion mechanism provides a flexible perturbation injection method for the controllable generation of adversarial scenarios, which constitutes an important basis for the multi-vehicle cooperative behavior control of this invention.
[0082] Step S43: Denoising guidance and local perturbation generation;
[0083] Under partial diffusion control, the anti-vehicle uses the intermediate noisy trajectory obtained in step S42. As the starting point for reverse denoising, from the first The guided back-diffusion process begins in step S3, while non-adversarial vehicles still generate noise from the initial noise of the complete diffusion process. The back-diffusion update employs the unified denoising method shown in step S3, and in each back-diffusion step, the mean prediction is gradient-corrected based on rationality constraints and adversarial guidance. Specifically, the model adjusts the update results at each step based on the gradient information of the current trajectory state, causing the trajectory to shift directionally relative to the prior trajectory while maintaining statistical rationality and dynamic consistency, thus forming a local perturbation driven by the guidance mechanism.
[0084] During the process, adversarial and non-adversarial vehicles share the same diffusion generation framework, but only adversarial vehicles emerge from the partially diffused intermediate state. The system begins reverse denoising and superimposed adversarial guidance; non-adversarial vehicles continue denoising from Gaussian noise using the conventional diffusion process, with only reasonableness constraints applied. Therefore, this generation framework can form joint trajectories in multi-vehicle scenarios that possess both overall coordination and differentiated adversarial behavioral characteristics. By combining the intermediate state of partial diffusion with the guidance denoising mechanism, the generated trajectory can exhibit controllable offsets in local regions, enabling flexible construction of various types of local risk scenarios.
[0085] Step S44: Diversified generation and adjustability;
[0086] The partial diffusion mechanism allows the model to continuously adjust the diffusion ratio parameter. Adversarial weights It achieves a smooth transition between different adversarial intensities, thereby flexibly controlling the risk intensity and collision type of the generated trajectory.
[0087] in, The degree to which the generated result depends on the prior trajectory is determined when When the size is smaller, the generated results are more stable and have stronger physical consistency; when When the size is larger, the model generates greater diversity, making it suitable for exploring potentially unknown high-risk scenarios. Adversarial weights By controlling the influence of adversarial terms during the guidance process, the strength of local risk shifts can be adjusted, enabling the model to smoothly transition between weak interference and strong adversarial forces.
[0088] By combining multi-agent joint trajectory priors with partial diffusion control, this invention achieves controllable adversarial generation of multi-vehicle collaboration under a unified generation framework, significantly improving the diversity of test scenarios and evaluation coverage.
[0089] Step S5 aims to comprehensively evaluate the generated multi-vehicle cooperative confrontation scenario from both realism and controllability perspectives, to verify that the invention, while maintaining the rationality of traffic behavior, possesses the ability to precisely control the intensity and type of confrontational behavior. Specifically, as follows:
[0090] Step S51: Authenticity Assessment System;
[0091] This step aims to establish a realism evaluation system for multi-vehicle collaborative scenarios based on real driving data, which is used to verify the realism of the adversarial trajectory generated by this invention at the physical behavior level and the consistency with traffic distribution.
[0092] By statistically comparing the distribution characteristics of generated trajectories and measured driving trajectories, a realism measurement model based on driving dynamics attributes is constructed. Longitudinal acceleration is selected. lateral acceleration With jerk (Acceleration represents the rate of change of acceleration) For each of the three physical characteristics, the Wasserstein distance of its standardized histogram is calculated to measure the degree of difference between the generated trajectory and the actual data distribution:
[0093]
[0094] in, and These represent the feature distributions of the generated trajectory and the true trajectory, respectively; for and Joint distribution set, This represents any joint distribution within the set, used to characterize the matching relationship between two distributions. The smaller the distance value, the closer the driving behavior generated by the model is to the real driving distribution in a statistical sense. This metric can effectively evaluate the physical rationality and statistical fidelity of the diffusion model in the multi-vehicle collaborative generation process, providing a quantitative basis for the realism of simulation test scenarios.
[0095] Step S52: Controllability assessment system;
[0096] In terms of controllability assessment, this invention focuses on examining the model's ability to regulate the intensity and spatiotemporal characteristics of adversarial behavior. By guiding and constraining the relative collision velocity difference and TTC between the test vehicle and the adversary vehicle during the diffusion generation stage, continuous and adjustable generation of different risk levels and behavior types can be achieved. The controllability evaluation function is defined as follows:
[0097]
[0098] in, Indicates the first evaluation within the time window Discrete time moments The total number of walks included in this time window. and These represent the collision time and distance under the assumption of constant velocity. and This refers to the bandwidth parameter corresponding to time and distance. This metric comprehensively reflects the temporal urgency and spatial proximity of risk events in the generated scenario. The larger the value, the stronger the challenge to the tested vehicle, thus enabling a quantitative measurement of the model's control accuracy in the intensity of adversarial behavior and the timing of risk triggering during the generation phase.
[0099] Through the aforementioned dual-layer evaluation system of realism and controllability, this invention can systematically verify the realism and risk adjustment capabilities of multi-vehicle cooperative combat scenarios, ensuring that the generated scenarios are usable and reliable, thereby providing credible test inputs for subsequent autonomous driving safety verification.
[0100] Beneficial effects
[0101] Compared with existing technologies, this invention significantly improves the realism, controllability, and closed-loop consistency of multi-vehicle cooperative combat scenarios, and has the following advantages:
[0102] (1) Controllable generation of multi-vehicle cooperative adversarial behavior: This invention introduces a differentiable guiding function into a unified diffusion framework, enabling adversarial vehicles to generate adjustable risk behaviors while maintaining traffic rationality. This mechanism supports continuous control of adversarial intensity and significantly improves the relevance of test scenarios.
[0103] (2) An adversarial generation mechanism that balances realism and controllability: By combining a partial diffusion strategy with trajectory priors, this invention introduces local disturbances without disrupting the original traffic structure, enabling the generated trajectories to possess both physical consistency and behavioral diversity. The diffusion ratio and noise intensity can be flexibly adjusted to meet different risk requirements.
[0104] (3) Unified quantitative evaluation system for realism and controllability: This invention uses Wasserstein distance and controllability indicators based on collision relative velocity difference and TTC to systematically evaluate the quality of generated scenarios. This system can ensure that adversarial scenarios are both realistic and have adjustable risk expression capabilities.
[0105] (4) Excellent engineering adaptability and application expansion capabilities: The adversarial generation framework of this invention can be directly integrated with existing autonomous driving simulation and safety verification platforms to achieve a closed-loop process from generation to evaluation. The framework has a unified structure and strong portability, and can be used for various types of adversarial testing, behavior prediction research and intelligent transportation system verification. Attached Figure Description
[0106] Figure 1 This is a flowchart of the method of the present invention;
[0107] Figure 2 This is a schematic diagram of the guiding function in an embodiment of the present invention;
[0108] Figure 3 This is a schematic diagram of a partial diffusion model according to an embodiment of the present invention;
[0109] Figure 4 This is a schematic diagram illustrating the prior construction of multi-agent trajectories in an embodiment of the present invention. Detailed Implementation
[0110] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0111] Example
[0112] A multi-vehicle cooperative controllable adversarial testing method based on a diffusion model, the overall process of which is as follows: Figure 1 As shown, it includes the following steps:
[0113] S1 diffusion model training phase:
[0114] During the training phase, publicly available real-world driving datasets (such as nuScenes) are selected as training samples. Each sample trajectory is represented as a joint state-action sequence. .
[0115] The model models the joint trajectory distribution based on the diffusion probability model, and incorporates scenario conditions at each step of the diffusion process. Using local maps and the historical status of neighboring vehicles as input, the statistical distribution of real driving behavior is learned through a dual process of forward noise addition and backward noise reduction.
[0116] The actual trajectory during forward diffusion. go through = 1000 noisy steps are progressively injected with Gaussian noise, forming a Markov chain that gradually evolves from a clean trajectory to a completely noisy trajectory; the corresponding back-diffusion process is handled by a neural network. The denoising mean is predicted at each step, and its form is:
[0117]
[0118] in, It is a constant.
[0119] The model is trained by minimizing the noise prediction error, and the loss function is:
[0120]
[0121] in, , Forward diffusion in the first The cumulative coefficients of each step. Through the above training process, the model can learn the statistical patterns of driving behavior in aspects such as longitudinal acceleration, lateral adjustment, and multi-vehicle avoidance. After training, fixed model parameters are obtained. These parameters will be used during the inference phase to generate smooth, continuous, and dynamically constrained future trajectories for multiple vehicles.
[0122] This step is only for offline training and does not involve adversarial guidance or some diffusion mechanisms.
[0123] S2 Scene and Multi-Vehicle Spatiotemporal Modeling:
[0124] Step S21: Traffic scenario definition and state space modeling;
[0125] In this embodiment, typical traffic scenarios (such as unsignalized intersections and highways) are selected as the test environment. The scenario includes... = 6 vehicles, including 1 test vehicle and 5 environment vehicles. All vehicles move in a two-dimensional local map coordinate system, and their state vectors are defined as:
[0126]
[0127]
[0128] in, Indicates the vehicle's location. For longitudinal velocity, This is the heading angle.
[0129] Action vectors Defined as a combination of longitudinal velocity and angular velocity, the system uses a single-track dynamics model for state updates:
[0130]
[0131] Among them, the dynamic equation It can be represented as:
[0132]
[0133] in, Indicates that the vehicle is in longitudinal acceleration at time t, Indicates that the vehicle is in The angular velocity at a given moment, and the angular velocity together determine the vehicle speed. With heading The changes are recorded and used to update the state at the next moment.
[0134] The simulation time step is set to 0.1s, and the single test cycle is about 15s, which can cover typical confrontation and avoidance processes.
[0135] Step S22: Decision context construction and environmental feature encoding;
[0136] At each time step Both the tested vehicle and the environmental vehicles make decisions based on their local observation information. Each vehicle's... Includes the following information:
[0137] (1) Local lane geometry information: including lane centerline, boundary line and passable area;
[0138] (2) Fragments of historical trajectory The length of the history window is among them. = 10;
[0139] (3) Status of adjacent vehicles: including relative speed, relative position and relative heading angle.
[0140] To reduce the input dimensionality, this embodiment sets a fixed radius. = 40m domain perception range, considering only 5 nearest neighbor vehicles.
[0141] The above information, after normalization and feature mapping, is input into the feature encoding module to form a spatiotemporal feature tensor of multi-vehicle interaction. This serves as input to the diffusion model, guiding the subsequent trajectory generation process.
[0142] Step S23: Vehicle role definition and generation model description;
[0143] In this embodiment, the six vehicles in the scene are divided into three categories:
[0144] (1) Test vehicle (1 vehicle): controlled by an autonomous driving control algorithm (e.g., reinforcement learning or planning-based controller), does not participate in the generation of the diffusion model, and is only used as the test target;
[0145] (2) Two opposing vehicles: located on the left side of the intersection and at the opposite entrance, respectively, generated by a behavior generation model. Control, and superimpose adversarial guidance functions during the generation phase. It is used to realize the dynamic disturbance behavior of the vehicle under test;
[0146] (3) Non-confrontational vehicles (3 vehicles): Only constrained by the rationality terms of the diffusion model Control measures are in place to maintain the authenticity and stability of the overall traffic flow.
[0147] Step S24: Closed-loop interaction and simulation update mechanism;
[0148] The simulation system executes the following closed-loop process at each time step:
[0149] (1) The tested vehicle is determined according to the current context. Output future trajectory planning;
[0150] (2) The combat and non-combat vehicles are based on respectively Output the action at the next moment ;in These are behavioral parameters for individual vehicles (agents), used to configure vehicle behavior characteristics other than the decision context; non-adversarial vehicle behavior parameters only include constraint settings for maintaining normal traffic behavior, such as guide weights; for adversarial vehicles, control factors for implementing disturbances may also be included.
[0151] (3) Environment execution state update function ;
[0152] (4) Feed back the updated status to each vehicle perception module as input for the next step.
[0153] Through this closed-loop interaction mechanism, the adversarial vehicle can adaptively respond based on the real-time decision-making strategy of the test vehicle, thereby achieving dynamic collaboration and behavioral game among multiple vehicles. The entire simulation cycle continues until the test vehicle successfully passes through the intersection or a collision event occurs.
[0154] S3's adversarial-guided diffusion generation mechanism:
[0155] In the reasoning stage, such as Figure 2 As shown, from Gaussian noise samples Starting from this point, the model progressively executes a conditional backward denoising process to generate future trajectories for multiple vehicles. For non-adversarial vehicles, the denoising update relies solely on the decision context. In addition, reasonable constraints are imposed to ensure lane keeping, vehicle spacing, and dynamic continuity, making the generated trajectory statistically close to the real driving distribution. For adversarial vehicles, an additional guidance term oriented towards the tested vehicle is applied on top of the above reasonable constraints, and the direction and risk level of the trajectory are adjusted through gradient correction in each denoising step. Specifically, the first... The denoising update step can be expressed as:
[0156]
[0157] in, This is the step size coefficient used to adjust the gradient correction magnitude.
[0158] bootstrap function From the opposing terms With reasonableness constraints composition:
[0159]
[0160] in, To counteract the weighting coefficient, The value can be flexibly set according to testing requirements to adjust the degree of influence of the anti-guiding mechanism in the denoising process. When = 0.1, the adversarial behavior is weak, mostly exhibiting slight relative velocity perturbations; when At a value of 1.0, the counter-attack effect is more pronounced, with counter-vehicles exhibiting stronger approach or speed changes as they approach the potential conflict zone; when... At version 2.0, the counter-guidance effect is further enhanced, which can generate a clear trend of high-risk approach or collision.
[0161] The definitions of each item in the guiding function are as follows.
[0162] (1) Distance potential energy term :
[0163] This method uses the time-accumulated form of distance potential energy to encourage the adversary vehicle to gradually approach the spatial position of the test vehicle within the prediction time window:
[0164]
[0165] in, Let be the Euclidean distance between the two vehicles at time t. and The test vehicle and the opposing vehicle are respectively at time... The planar position vector.
[0166] (2) Relative velocity term :
[0167] Used to control the relative velocity difference before a collision in order to adjust the risk level:
[0168]
[0169] in, The speed of the vehicle being measured. To counter the speed of the vehicle, For the desired relative velocity, the function This is an indicator function; it only applies when the distance between two vehicles is less than a threshold. Activated at 5m.
[0170] (3) Time to Collision Item :
[0171] Used to measure the time urgency and risk level of a potential collision. Let the relative position and velocity be respectively... and The closest approach time can be calculated based on the relative motion relationship. closest distance The expression is as follows:
[0172]
[0173] Therefore, the collision term is defined as follows:
[0174]
[0175] in, and These are the bandwidth parameters corresponding to time and distance.
[0176] (4) Route constraints :
[0177] This constraint is used to keep vehicles within the lane and prevent them from leaving the passable area:
[0178]
[0179] in, Let be the normal distance from the trajectory to the path. This is the maximum allowable deviation threshold (taken as 0.8m).
[0180] (5) Gaussian regularization term for vehicle spacing :
[0181] Used to maintain a reasonable distance between the vehicle and other vehicles in the environment to prevent non-physical collisions. Assume the vehicle... and At any moment The relative position is decomposed into tangential distance. Distance from normal direction ,but:
[0182]
[0183] in, The distance is the standard deviation. This is the tangential distance weight. This term applies soft constraints simultaneously in the longitudinal and lateral directions, thereby maintaining the spatial continuity of traffic flow.
[0184] S4 Partial Diffusion Control and Diverse Adversarial Generation:
[0185] Step S41: Constructing prior trajectories for multiple agents;
[0186] This step constructs a joint trajectory prior through a multi-agent trajectory constraint mechanism. This is to provide each vehicle with an initial state that has spatial consistency and potential interaction structure before partial diffusion begins.
[0187] In this embodiment, the centerline trajectory and intersection geometric constraints of all participating vehicles are first extracted using the scene map and lane topology information to obtain the driving direction and passable area of each vehicle. For example... Figure 4 Assume a scenario at an unsignalized intersection where the tested vehicle (Ego Vehicle) travels straight from south to north, adversary vehicle 1 (ADV1) travels from west to east, and adversary vehicle 2 (ADV2) travels from east to west. The travel paths of the three vehicles form a calculable conflict zone at the intersection. (The calculation method is existing technology), the system determines the coordinates of the conflict point based on geometric relationships. And based on the initial state of each vehicle. Calculate its estimated arrival time in the region. .
[0188] Based on this, the system utilizes the future trajectory of the vehicle being tested. As a reference, by determining the reachable intervals of each adversary vehicle in a given time domain and its reach relationship with the conflict area, a joint trajectory prior with spatiotemporal consistency among multiple vehicles is constructed.
[0189] Specifically, for any opposing vehicle, let its current speed be... The path parameters along the lane centerline at the current location are: The coordinates of the potential conflict point are The system first calculates the target speed required for the vehicle to reach the conflict zone:
[0190]
[0191] in For the lane centerline in the path parameters The spatial location, Let this be the desired arrival time. The corresponding initial acceleration is taken as:
[0192]
[0193] It is required to meet vehicle dynamics constraints. ,in This is the maximum permissible acceleration. The vehicle's longitudinal velocity and position are then recursively derived from this using the dynamic equations.
[0194] In terms of lateral movement, the system applies an offset along the normal direction of the lane centerline based on road geometry and safe traffic conditions. This constitutes the lateral position of the opposing vehicle:
[0195]
[0196] in For the lane centerline in parameters The horizontal coordinate at the location is taken in this embodiment. = 0.5, used to form a reasonable lateral relative distance.
[0197] The aforementioned longitudinal and lateral trajectories together constitute the predicted trajectory of the counter-vehicle. and the trajectory of the vehicle being tested Together, they form a multi-agent joint trajectory prior for partial diffusion.
[0198] Ultimately, this embodiment obtains the multi-agent joint trajectory prior:
[0199]
[0200] Each trajectory contains a sequence of states in the future time domain. The continuity is maintained through vehicle dynamics equations. This prior establishes a clear interaction structure and potential conflict modes among multiple vehicles, which will serve as an initial template in the partial diffusion mechanism of step S42 to generate intermediate diffusion states after local disturbances.
[0201] Step S42: Partial diffusion control mechanism;
[0202] This embodiment introduces a partial diffusion mechanism to enhance the controllability of adversarial behavior based on the diffusion model trained in step S1.
[0203] Unlike the complete diffusion process which generates a trajectory starting from a pure noise sample, this embodiment sets a partial diffusion ratio. Directly construct the corresponding intermediate diffusion step The noise-adding trajectory is used as the starting point for inverse denoising, such as Figure 3 As shown.
[0204] In this embodiment, the multi-agent joint trajectory prior obtained in step S41 is taken. ,Pick intermediate step The value is 500. Based on the closed-form expression of the diffusion model, its noisy form at step 500 can be calculated as follows:
[0205]
[0206] in The product of diffusion coefficients, This is a Gaussian noise sample. This noisy intermediate state... Subsequently, it serves as the initial state input model for the reverse diffusion process, used to introduce controllable perturbations while maintaining the original spatiotemporal structure.
[0207] Step S43: Denoising guidance and local perturbation generation;
[0208] After partial diffusion initialization is completed, this embodiment uses the intermediate noise-adding trajectory obtained in step S42. As the starting point of reverse diffusion, from the first The guided denoising process begins. The denoising update adopts the unified form from step S32, which introduces adversarial guided gradient correction based on the model's predicted mean:
[0209]
[0210] in, The step size coefficient is used to adjust the gradient correction magnitude. For the model in the first Denoising mean prediction step Here is the diffuse noise covariance matrix. is the gradient step size coefficient, used to control the proportion of the guiding term injected in each update step. In each iteration, the model evaluates the gradient of the guiding function based on the current trajectory state and adjusts the denoising direction accordingly, thereby guiding the trajectory to produce a local shift while maintaining dynamic continuity and statistical rationality.
[0211] This denoising guidance mechanism ensures that the model maintains the continuity and stability of the generated trajectory under partial diffusion conditions, allowing local perturbations to be flexibly superimposed at different stages.
[0212] Step S44: Diversified generation and adjustability;
[0213] Based on the aforementioned partial diffusion control and denoising guidance mechanism, this embodiment can generate various adjustable adversarial behaviors in multi-vehicle cooperative scenarios. This is achieved by simultaneously adjusting the partial diffusion ratio. Adversarial weights The model can achieve continuous control of risk intensity and disturbance magnitude within a unified diffusion generation framework.
[0214] During the generation process, parameters The proportion of prior trajectory retained during the diffusion process controls the degree to which the generated samples depend on the original trajectory structure. When the data size is small, the model's generated results rely more on data distribution reconstruction, resulting in stable trajectories and high physical consistency; when... As the value increases, the perturbation space expands and the diversity of trajectory distributions increases, thus enabling the exploration of more potential risk scenarios.
[0215] On the other hand, opposing weights The magnitude of the adversarial term's influence in the guiding function directly affects the magnitude of the gradient shift during the denoising stage. A larger... It will amplify localized risk behaviors, causing combat vehicles to exhibit more pronounced speed or positional deviations near the conflict zone; smaller This results in only slight disturbances, exhibiting weak antagonism or near-no-collision interaction.
[0216] In the iterative backdivergence, the model updates the guiding function based on the current trajectory state. The gradient direction enables a closed-loop interaction between the tested vehicle and the adversary vehicle.
[0217] Multi-agent diffusion models share parameterized representations during the generation process. Based on the aforementioned trajectory priors, the behavior of multiple vehicles is jointly optimized, enabling different types of vehicles to exhibit targeted adversarial characteristics while maintaining the rationality of traffic statistics.
[0218] Through this mechanism, this embodiment can realize a variety of adversarial scenarios under the same model framework, including tail-end collision interference, lateral approach and head-on challenge, which significantly improves the diversity, continuity and test coverage of the generated scenarios.
[0219] S5 Multi-Agent Adversarial Scenario Realism and Controllability Assessment:
[0220] In this embodiment, the generated multi-vehicle confrontation scenario is quantitatively evaluated from the aspects of realism and controllability to verify the statistical rationality and risk adjustability of the generated multi-vehicle confrontation scenario.
[0221] Step S51: Authenticity Assessment System;
[0222] The realism assessment in this embodiment aims to verify the consistency between the multi-vehicle trajectories generated by the diffusion model and real traffic data in terms of dynamic characteristics and behavioral distribution. The assessment is based on publicly available real-world driving datasets (nuScenes) and selects longitudinal acceleration. lateral acceleration With jerk Three key physical indicators. The specific process is as follows:
[0223] (1) Input data construction: Collect the above three types of dynamic features of vehicle trajectories in the generated scene and the real dataset, and establish standardized histograms respectively. and .
[0224] (2) Calculation of distribution differences: The Wasserstein distance is used to calculate the differences between the two distributions:
[0225]
[0226] in, For its joint distribution set, This represents any joint distribution in the set, used to characterize the matching relationship between two distributions.
[0227] (3) Output index analysis: Calculate the average value of the distribution distance of each feature. The magnitude of the distance is used to measure the realism of the model. The smaller the distance, the closer the generated trajectory is to real driving behavior in terms of acceleration and dynamic response.
[0228] In actual experiments, the average Wasserstein distance of this embodiment remained within the range of 0.326–0.327, indicating that the difference between the generated trajectory and the distribution of real driving data was small, and the vehicle acceleration changes smoothly and conformed to physical constraints. This verifies that the diffusion model of the present invention can maintain the statistical rationality and physical reality of traffic behavior under multi-agent conditions.
[0229] Step S52: Controllability assessment system;
[0230] The controllability assessment in this embodiment is used to quantify the model's ability to adjust the intensity and timing of generated adversarial behaviors, focusing on two key indicators: relative velocity difference and time to collision. The assessment method is as follows:
[0231] (1) Calculation of relative velocity difference
[0232] Calculate the relative speed difference between the tested vehicle and each opposing vehicle at each moment. The weighted average was then used to reflect the changing trend of the intensity of the confrontation over time.
[0233] (2) Calculation of collision index at time
[0234] Under the assumption of constant speed, calculate the potential collision time and minimum distance between the tested vehicle and the opposing vehicle. Define the controllability evaluation function as follows:
[0235]
[0236] in, = 1.0 , = 4.0 This represents the bandwidth parameter for time and distance. The larger the value of this indicator, the stronger the time urgency and risk characteristics of the scenario, and the more it reflects the model's ability to control the timing of risk triggers.
[0237] In addition to multi-vehicle adversarial scenarios, the realism and controllability evaluation system introduced in this invention can be widely applied to the construction and screening of adversarial scenario sets, supporting the safety verification, robustness testing and model improvement research of subsequent autonomous driving decision-making algorithms, and has good feasibility and promotion value.
[0238] verify
[0239] To verify the effectiveness of the multi-vehicle cooperative controllable adversarial testing method based on the diffusion model proposed in this invention, multi-scenario simulation verification can be performed on a typical traffic simulation platform. The verification process includes:
[0240] In typical traffic scenarios such as intersections, merging sections, and roundabouts, the tested vehicle and multiple adversary vehicles were deployed. By adjusting the diffusion parameters and guidance weights, the trajectory generation quality and behavioral controllability of the system under different risk levels were observed. The evaluation indicators mainly include trajectory realism (measured by Wasserstein distance), adversarial behavior controllability (evaluated by relative speed difference and time-to-collision index), and system robustness (obtained from collision rate and boundary crossing rate statistics in the simulation scenario).
[0241] The verification methods are mainly divided into the following two levels:
[0242] (1) Model generation consistency verification
[0243] By comparing the generated trajectory with the distribution of real driving data, the continuity and smoothness of the multi-vehicle behavior generated by the model under dynamic constraints are verified, ensuring that the system output trajectory has statistical authenticity.
[0244] (2) Verification of controllability against adversarial forces
[0245] By continuously adjusting the adversarial weights With partial diffusion ratio This study verifies the model's controllability over collision time, relative velocity, and interaction patterns under different parameter conditions, thereby determining the stability of the proposed method in risk mitigation and behavioral diversification generation.
[0246] The experimental results are shown in Table 1.
[0247] Table 1 Different adversarial weights The following test results
[0248]
[0249] Experimental results show that the method of the present invention works under different adversarial weights. The trajectory accuracy is consistently maintained, with the Wasserstein distance remaining within a very small range of 0.326–0.327, while the risk indicator varies. Significant and controllable changes were observed. When At this time, the collision rate is 25%, the average risk cost is 0.006, and the relative collision speed is only 2.672 m / s, resulting in a generated scene exhibiting slight interference; when At that time, the above indicators increased to 50%, 0.013, and 15.135 m / s respectively, showing a clear moderate intensity of confrontation; when At that time, the risk cost further increased to 0.077. The above data shows that, while maintaining dynamic consistency and traffic statistics rationality, the present invention can achieve continuous risk control from weak confrontation to strong confrontation by adjusting parameters, and stably generate multi-level and multi-type cooperative confrontation scenarios.
[0250] In summary, this invention provides a multi-vehicle cooperative controllable adversarial testing method based on a diffusion model, which can achieve a continuous mapping from real traffic distribution to controllable risk adversarial scenarios without human intervention. This method constructs an easily reproducible and scalable testing system, which can be effectively used for the safety verification and performance evaluation of autonomous driving systems.
Claims
1. A multi-vehicle cooperative controllable confrontation test method based on a diffusion model, characterized in that, Comprising the following steps: Step S1: Diffusion model training phase: The diffusion model is trained based on real driving data, vehicle behavior distribution is learned through forward noise adding and reverse noise removing, and fixed model parameters are obtained ; Step S2: Scene and multi-vehicle spatiotemporal modeling: Fusing road map, lane topology and vehicle state information, construct a spatiotemporal scene representation of multi-vehicle interaction as input for diffusion generation; Step S3: Diffusion generation mechanism based on adversarial guidance: Generate multi-vehicle trajectories from noise in the inference phase, non-adversarial vehicles generate normal behavior according to rationality constraints, and adversarial vehicles superimpose risk guidance to produce confrontation; Step S4: Partial diffusion control and diversified adversarial generation: Use joint trajectory prior to select intermediate noise state as starting point in diffusion process, generate adversarial scenes with different intensity and type through partial diffusion and gradient guidance; Step S5: Multi-agent adversarial scene reality and controllability evaluation: Establish a double-index system based on Wasserstein distance and time-to-collision to quantitatively evaluate the reality and adversarial controllability of the generated scene.
2. The multi-vehicle cooperative controllable confrontation test method based on the diffusion model according to claim 1, characterized in that, Step S1 completes the offline training of the diffusion model. In the training phase, the diffusion model constructs the forward noise adding and reverse noise removing processes of the trajectory distribution based on the measured driving data set: given a real trajectory sequence The forward noise adding process adds Gaussian noise according to a preset noise schedule In step S2, the diffusion model is trained in the training phase, and the forward noise adding and reverse noise removing processes of the trajectory distribution are constructed based on the measured driving data set: given a real trajectory sequence The one-step transition probability is defined as: wherein denotes the noisy trajectory of step is the noise intensity coefficient, is the identity matrix, denotes the multivariate Gaussian distribution with mean and covariance The symbol denotes "defined as". In the reverse denoising process, the model learns the statistical regularity of driving behavior in acceleration change, direction response and vehicle interaction through the neural network parameters Predicting the denoising mean To reconstruct the noise introduced by forward noise adding, so as to learn the statistical regularity of driving behavior in acceleration change, direction response and vehicle interaction, the conditional distribution is expressed as: wherein, is the probability distribution determined by the model parameters , is the predicted denoised trajectory, is the denoised mean prediction of the neural network at noise level and decision context information , is the covariance matrix of the first step. The model is trained by minimizing the noise prediction error; after training, fixed model parameters are obtained The diffusion model behavior generation model obtained in this way is denoted as .
3. The multi-vehicle cooperative controllable confrontation test method based on the diffusion model according to claim 1, characterized in that, Step S2: Construct traffic scene and spatiotemporal interaction model for multi-vehicle cooperative adversarial simulation, provide unified and structured input basis for subsequent diffusion generation and adversarial behavior control; Specifically as follows: Step S21: Traffic scene definition and state space modeling; Suppose there are vehicles in the scenario, including 1 ego vehicle, and the rest vehicles are environment vehicles; the state of the system at time step is defined as: in, Indicates the first The vehicle's position, speed, and heading angle in a two-dimensional map coordinate system; The action vector of the vehicle is defined as: in, Indicates the first The longitudinal acceleration and angular velocity of the vehicle; Step S22: Construct decision context and environment feature encoding; The decision process of each vehicle relies on its local observations and the dynamic information of neighboring vehicles; for this purpose, the decision context of each vehicle is defined , including: (1) Local road topology information centered on the vehicle; (2) historical trajectory segments wherein is a historical observation time window length; (3) Speed, relative position and relative heading angle dynamic information of adjacent vehicles; The decision context information is normalized by coordinates and processed by feature mapping, and is uniformly encoded as a space-time feature tensor That is, the environment feature code represents the dynamic interaction relationship between multiple vehicles and the evolution characteristics of the environment over time, and serves as the input context of the diffusion model. Step S23: Vehicle role definition and generation model description; In the multi-vehicle simulation framework, all vehicles are divided into three categories: (1) The vehicle under test: controlled by the automatic driving algorithm to be tested, whose strategy function is denoted as , with the environment state and perception results as inputs and the future planning trajectory as output; the vehicle is not directly controlled by the diffusion generation model and is used as a test object to evaluate the system decision performance and safety robustness; (2) Adversarial vehicles: select several vehicles as the main body of confrontation from all non-self vehicles in the environment, and their future trajectories are generated by the behavior generation model in the diffusion model According to the historical state and decision context; in the diffusion reverse denoising process, through the mean prediction function Step-by-step denoising of the trajectory; in the denoising update of Superimpose the guide , wherein Including an adversarial guide term And a rationality constraint term ; Introduce partial diffusion mechanism to act on the adversarial vehicles that need to generate perturbations to enhance the adversarial behavior and control the collision type and attack strength; (3) Non-adversarial vehicles: the rest of the environment vehicles other than adversarial vehicles also pass through the behavior generation model generate future trajectories based on their own historical states and environmental information; but in the diffusion reverse denoising process, the mean prediction function only uses a rational constraint function without adding adversarial guidance terms to ensure the stability of traffic flow and the physical reality of the scene; Each vehicle in the traffic scene is modeled as an agent, and the vehicle and the agent correspond one-to-one; Step S24: Construct closed-loop interaction and simulation update mechanism; In each simulation cycle, the vehicle under test is subject to the current context The output future trajectory plan, other vehicles are based on Generate response actions, where, For the exclusive decision context of the vehicle under test; For the decision context of any environmental vehicle, Indicates the behavior parameters of the vehicle individual; And The same environment feature coding method is used for construction, but because of the reference center and the set of observable neighboring vehicles are different, it corresponds to the independent context instance of different vehicles; The system adopts a single-track dynamics model to update the global state, For the dynamics equation, as follows: updated state inputs to each vehicle, forming a closed loop interactive update mechanism.
4. The multi-vehicle cooperative controllable confrontation test method based on the diffusion model according to claim 3, characterized in that, At each time step, the following closed-loop process is executed: (1) the vehicle under test outputs a future trajectory plan according to the current context ; (2) The anti and non-anti vehicles are respectively based on Output next time action ; (3) Environment execution state update function ; (4) The updated state is fed back to the vehicle perception module as the input for the next step; The whole simulation loop continues until the vehicle under test successfully passes through the intersection or a collision event occurs.
5. The multi-vehicle cooperative controllable confrontation test method based on the diffusion model according to claim 1, characterized in that, Step S3 is specifically: In the inference phase, the model starts from a Gaussian noise sample and performs a step-wise reverse denoising process; The denoising update is represented as: wherein, is the denoised mean of the model at the step, is the covariance matrix, is a step length coefficient for adjusting the gradient correction amplitude, for controlling the injection proportion of the guided gradient in the back diffusion process, so as to ensure the overall numerical stability; Guiding function By an adversarial term With a plausibility constraint term Consists of: wherein, for adversarial weights, to determine the strength of adversarial behavior; for guiding adversarial vehicles to generate targeted risky behavior, including multi-dimensional control factors based on distance, relative speed, and time to collision; for maintaining the reasonableness and physical stability of the overall traffic flow, including constraint mechanisms based on route constraints and inter-vehicle distance Gaussian regularization; For non-adversarial vehicles, only rely on decision context and rationality constraints in denoising update Correct the mean prediction; for adversarial vehicles, also include gradient-based adversarial guidance in the mean prediction at each step of denoising .
6. The multi-vehicle cooperative controllable confrontation test method based on the diffusion model according to claim 5, characterized in that, Guiding function By the adversarial term With the rationality constraint term Consists of: wherein, for the adversarial weight coefficients, an adversarial term including: a distance potential term , a relative velocity term and a time-to-collision term , a reasonability constraint term including: a route constraint term and a vehicle-spacing Gaussian regular term are defined as follows: (1) Distance potential energy term : This term adopts a time-accumulated form of distance potential energy to encourage the adversarial vehicle to gradually approach the spatial position of the vehicle under test within the prediction time window: in, Let be the Euclidean distance between the two vehicles at time t. and The test vehicle and the opposing vehicle are respectively at time... The planar position vector; (2) Relative velocity term : Used to control the relative speed difference before collision to adjust the risk level: where, is the measured vehicle speed, is the opposing vehicle speed, is the desired relative speed, function is an indicator function, only if the distance between the two vehicles is less than a threshold activated when = 5m; (3) Time-to-collision term : To measure the time urgency and risk degree of potential collision; set relative position and velocity as And According to the relative motion relationship, the closest time And the closest distance The expression is as follows: Accordingly, the time-to-collision term is defined as: wherein, with is a bandwidth parameter corresponding to time and distance; (4) Route constraint term : This constraint is used to keep the vehicle driving within the lane and prevent it from leaving the passable area: wherein, is the normal distance of the trajectory to the path, is the maximum allowed deviation threshold; (5) Vehicle spacing Gaussian regularization term : For maintaining reasonable distance between the vehicle and other environment vehicles, preventing non-physical collision; setting vehicle With The relative position at time Is decomposed into tangential distance And normal distance Then: where, is the distance standard deviation, is the tangential distance weight; this term applies soft constraints in both longitudinal and lateral directions, thus maintaining the spatial continuity of the traffic flow.
7. The multi-vehicle cooperative controllable confrontation test method based on the diffusion model according to claim 1, characterized in that, Step S4 is specifically: Step S41: Multi-agent trajectory prior construction; Building trajectory priors through multi-agent trajectory constraint mechanism : The system first extracts the center line of the lane where the measured vehicle and the opposing vehicle are located according to the road topology, and combines the current position, speed and acceleration of the vehicle to calculate the reachable interval of the vehicle along the center line within a given time window; by comparing the space-time interaction relationship of the reachable intervals of each vehicle, it is determined whether there is an intersection, a merging point or a potential conflict area of center line intersection; After identifying potential conflicts, the system generates corresponding prediction trajectories according to vehicle dynamics constraints: the longitudinal speed of the adversarial vehicle is adjusted to be able to enter the conflict area at the target time, and the lateral position is offset according to the lane width; The vehicle under test generates a baseline trajectory along its planning direction; The adversarial vehicle prediction trajectory combination constitutes a multi-agent trajectory prior, enabling the diffusion model to maintain the overall interaction structure of the scene in the subsequent generation process, while providing a clear spatiotemporal framework for controllable adversarial behavior generation; Step S42: Partial diffusion control mechanism; Based on trajectory priors of adversarial vehicles in the intermediate diffusion steps constructing the intermediate trajectories with specified noise levels ; before the backward denoising process, according to predefined partial diffusion ratios determining the intermediate diffusion steps as ; for trajectory priors of adversarial vehicles , directly calculating its noisy representation at the first step with the closed-form expression of the diffusion model, i.e.: wherein is the coefficient product of the forward diffusion in the first step, is a Gaussian noise sample; Intermediate trajectory As the starting point of reverse denoising, the generated trajectory is iteratively updated by combining adversarial guidance and rationality constraints, so that the generated trajectory presents controllable local offset on the basis of preserving the original structure. By adjusting the size of the ratio of the original trajectory between the free to generate a continuous adjustment; Step S43: Denoising guidance and local disturbance generation; Under partial diffusion control, the intermediate noisy trajectory obtained in step S42 is counteracted As a starting point for the reverse denoising, from the first Instead of the adversarial vehicle still generating from the initial noise of the full diffusion process, the guided reverse diffusion process is executed from step 1 onwards; the reverse update takes the form of uniform denoising as shown in step S3, and the mean prediction is gradient-corrected according to the plausibility constraints and adversarial guidance in each reverse step; The adversarial vehicle shares the same diffusion generation framework as the non-adversarial vehicles in the process, but only the adversarial vehicle is from the intermediate state of partial diffusion , starts reverse denoising and superimposes adversarial guidance; the non-adversarial vehicle still denoises from Gaussian noise according to the conventional diffusion process, only reasonable constraints are applied; Step S44: Diversified generation and adjustability; Continuous adjustment of diffusion scale parameter With the confrontation weight Smooth transition is realized between different confrontation intensities, so as to flexibly control the risk intensity and collision type of the generated trajectory. wherein, determining the degree of dependence of the generation result on the trajectory prior, the adversarial weight controlling the influence of the adversarial term in the guidance process, and thereby adjusting the strength of the local risk bias.
8. The multi-vehicle cooperative controllable confrontation test method based on the diffusion model according to claim 1, characterized in that, Step S5 is specifically: Step S51: authenticity evaluation system; The distribution characteristics of the generated trajectory and the measured driving trajectory are compared statistically to construct a reality measurement model based on driving dynamics attributes. The longitudinal acceleration , lateral acceleration and jerk are selected as physical characteristics, and the Wasserstein distance of the standardized histogram of each characteristic is calculated to measure the difference between the generated trajectory and the real data distribution: wherein, and respectively represent the feature distribution of the generated trajectory and the real trajectory, is and a set of joint distributions; represents any joint distribution in the set, used to depict the matching relationship between two distributions; Step S52: controllability evaluation system; By guiding and constraining the relative speed difference and TTC between the tested vehicle and the confrontation vehicle in the diffusion generation stage, continuous adjustable generation of different risk levels and behavior types is realized; wherein the controllability evaluation function is defined as: wherein, denotes the i-th discrete time instant within the evaluation time window, is the total number of discrete steps comprised in the time window, and are the collision time and distance, respectively, under constant speed assumption, and are the bandwidth parameters corresponding to time and distance, respectively.
Citation Information
Patent Citations
End-to-end automatic driving system closed-loop confrontation test method based on world model
CN120927321A
World model driving data generation method based on controllable diffusion mechanism
CN121095916A