Automatic driving planning algorithm closed-loop automation test method and system based on large language model

The autonomous driving planning algorithm testing method, which automatically generates and semantically evaluates large language models, solves the problems of existing technologies that rely on manual design and have poor interpretability. It realizes automated, scalable, and interpretable test execution, improving test efficiency and accuracy.

CN123179936APending Publication Date: 2026-11-27AUTOCORE INTELLIGENT TECH (NANJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611663857.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-27
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing autonomous driving planning algorithm testing relies on manual design, which is inefficient. Coverage depends on personal experience. Test cases are bound to map formats, making it difficult to automate execution and interpret evaluation. The lack of map semantic structuring leads to poor test reusability and difficulty in explaining the causes of deviations.

Method used

Test scenarios are automatically generated using a large language model. Map data is parsed through a semantic list to generate structured test cases. The language model is used for automated execution and semantic evaluation. Combined with a visual language model, image-level comparison is performed to generate interpretable test reports.

Benefits of technology

It enables automated and large-scale test execution, reduces labor costs, supports multi-map reuse, provides test conclusions with rigorous data and intuitive images, and can discover the boundary behavior of planning algorithms in complex scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123179936A_ABST
    Figure CN123179936A_ABST
Patent Text Reader

Abstract

The application discloses an automatic driving planning algorithm closed-loop automation test method and system based on a large language model, which first analyzes scene map data to generate a semantic list, uses a first language model to generate structured test cases and reference trajectory data according to a natural language test intention; then converts the test cases into standard interface messages and issues them to a system under test, and collects actual trajectory data generated in response; then performs numerical geometric comparison and calculates quantitative deviation of the reference trajectory and the actual trajectory; finally, a second language model is used to analyze deviation characteristics to generate a semantic evaluation result, and a visual language model is used to perform image-level comparison to generate a visual evaluation result, and a comprehensive test report is generated by combining the two. The application realizes the whole-process closed-loop automation of scene automatic construction, test execution issuing and multi-modal interpretable evaluation, and significantly improves the coverage, efficiency and defect root cause positioning capability of the automatic driving planning algorithm test.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of autonomous driving testing technology, and in particular to a closed-loop automated testing method and system for autonomous driving planning algorithms based on a large language model. Background Technology

[0002] As a core component of the decision-making layer of autonomous driving systems, the output of autonomous driving planning algorithms directly determines the safety, comfort, and compliance of vehicle operation. With the evolution of autonomous driving technology from assisted driving to higher levels of automation, the road scenarios faced by planning algorithms are characterized by openness and high combinability. Typical scenarios such as navigating curves, merging / exiting, and obstacle avoidance, and their combinations, are virtually inexhaustible. Therefore, how to conduct thorough, repeatable, and traceable testing and verification of planning algorithms has become a critical issue that urgently needs to be addressed in the engineering process of autonomous driving algorithms.

[0003] In existing technologies, testing of autonomous driving planning algorithms mainly relies on simulation platforms: test engineers manually build test scenarios in the simulation environment, setting elements such as the vehicle's initial position, target position, and obstacles; or a parameterized scenario library is pre-established and maintained based on a scenario description language, and test cases are derived by modifying scenario parameters; there are also solutions based on the playback of actual test data. These solutions generally suffer from the following shortcomings: scenario writing depends on testers' manual reading and experience-based judgment of high-precision maps, and the coverage of test cases is limited by individual experience; test scenarios are deeply bound to specific simulation platforms and map formats, requiring scenario design and construction to be redone after changing the map or the system under test, resulting in poor reusability; test result evaluation is mostly based on manual observation or purely numerical indicators, making it difficult to explain the causes of deviations.

[0004] In recent years, large language models and visual language models have made significant progress in natural language understanding and multimodal image understanding. Some studies have applied them to the field of general software testing. However, existing technologies have not yet provided mature solutions for applying them to autonomous driving planning algorithm testing, realizing automatic generation of map semantic test scenarios, automated execution, and interpretable evaluation.

[0005] The following problems are commonly found in the testing of autonomous driving planning algorithms: First, test cases rely on manual design. Test engineers need to manually read high-precision maps and manually select scenarios such as start and end points, curves, and merging / exiting points. This is inefficient, coverage depends on personal experience, and manual re-analysis is required after map changes.

[0006] Secondly, constructing reference truth values ​​is difficult. Existing solutions lack a unified and reusable structured representation of map semantics, which means that map coordinates, topological and geometric features must be re-parsed for each test.

[0007] Third, the decoupling between test execution and the system under test is low. Test case distribution usually relies on manual selection on the simulation interface, which is difficult to scale, automate, and regress.

[0008] Fourth, the comparison methods are simplistic and uninterpretable. Existing consistency verification methods mostly use purely numerical geometric comparisons, such as Euclidean distance, Frechet distance, and root mean square error. These methods can only provide numerical deviations and cannot explain the causes of the deviations, whether they are acceptable strategic differences in planning, or output human-readable test conclusions. They are therefore insufficient to support automated test reports and root cause analysis.

[0009] Therefore, there is a need for a closed-loop automated testing method and system that can understand the testing intent of natural language, automatically generate test scenarios, automatically distribute and collect data, and semantically interpretably evaluate the planning results. Summary of the Invention

[0010] To address the shortcomings of existing technologies, the present invention aims to provide a closed-loop automated testing method and system for autonomous driving planning algorithms based on large language models.

[0011] To achieve the objectives of this invention, the technical solution adopted is as follows: A closed-loop automated testing method for autonomous driving planning algorithms based on large language models includes the following steps: S1, acquire scene map data and parse it into a semantic list containing node connectivity, geometric features and directional information; S2, receive the natural language test intent, and use the first language model to generate structured test cases that meet the test intent based on the semantic list; S3, Generate reference trajectory data based on the structured test cases and the semantic list; S4. Convert the structured test cases into standard interface messages acceptable to the system under test and send them to the system under test. S5, collects the actual trajectory data generated by the structured test cases in response to the system under test; S6, Perform a numerical geometric comparison between the reference trajectory data and the actual trajectory data to obtain the quantization deviation result; S7 utilizes a second language model to generate semantic evaluation results based on reference trajectory data, actual trajectory data, and quantization deviation results; S8 renders the reference trajectory data and the actual trajectory data as reference path images and actual path images respectively, and uses a visual language model to perform image-level comparison between the reference path images and the actual path images to generate visual evaluation results. S9. Summarize the semantic evaluation results and the visual evaluation results to generate a test report.

[0012] Furthermore, in step S1, the specific process of parsing the scene map data into a semantic list includes: Parse the original map file to extract node coordinates, paths, and relationships; calculate lane centerlines by aligning and cross-producting the path point sequences on the left and right boundaries; establish a lane-level directed connected graph based on the endpoint distance between any two lane centerlines; resample the lane centerlines and perform curvature detection to extract curve sections, turning directions, and turning radii; and summarize lane information, connected graphs, and curve features to generate a semantic list.

[0013] Furthermore, in step S2, the specific process of generating structured test cases using the first language model includes: The natural language test intent is parsed into a constraint set including start-point constraints, end-point constraints, and path feature constraints. A map semantic summary for the first language model to perceive is extracted from the semantic list as input context. Using the first language model, reasoning is performed based on the input context and constraint set. Candidate lanes are retrieved from the semantic list according to path feature constraints. The start-point and end-point lanes that satisfy the path feature constraints are determined by combining connectivity relationships. The start-point and end-point positions are represented by lane numbers and arc length ratio parameters on those lanes, and candidate structured results are output. The candidate structured results are validated for legality and connectivity reachability. If the validation fails, prompts guide the first language model to regenerate. The validated candidate structured results are serialized to generate structured test cases.

[0014] Furthermore, in step S3, the specific process of generating the reference trajectory data includes: Based on the directed connected graph in the semantic list, a shortest path algorithm is used to search for the lane sequence from the starting lane to the ending lane. The starting lane and the ending lane are truncated according to the arc length ratio parameter of the starting and ending lanes, and the truncated segments are spliced ​​with the center lines of the middle lanes. The spliced ​​path is resampled at equal intervals according to a preset step size, and the heading angle, curvature and cumulative arc length of each sampling point are calculated. Curve merging is then performed to generate reference trajectory data. The reference trajectory data includes a track point sequence, a curve list, total length, starting and ending point information and lane sequence.

[0015] Furthermore, in step S4, converting structured test cases into standard interface messages and sending them out specifically includes: The starting pose of the reference trajectory data is converted into the initial pose input message of the system under test, and the ending pose is converted into the target pose input message of the system under test. The data is then distributed to the system under test via a publish-subscribe method. After the distribution is completed, the enable interface of the system under test is called to enable the system under test to enter the autonomous driving execution state. It also includes: converting obstacle elements into obstacle simulation messages acceptable to the system under test and sending them out, wherein the physical validity parameters of the obstacle simulation messages are determined based on the physical dimensions of the vehicle under test obtained from the system under test.

[0016] Furthermore, in step S5, collecting actual trajectory data specifically includes: By continuously monitoring the real-time execution pose feedback of the system under test and accumulating it over time, real driving trajectory data is constructed; or when the system under test is not actually executing, the single-frame path data output by a certain planning stage of the system under test is read as the actual trajectory data; when the planning output of the system under test includes multiple planning stages or multiple candidate paths, the path segments corresponding to each planning stage or candidate path are extracted and compared with the corresponding road segments of the reference trajectory data.

[0017] Further, in step S6, the numerical geometric comparison includes: Calculate the absolute lateral deviation and signed lateral deviation of each sampling point of the actual trajectory data to the reference trajectory data; calculate the mean, root mean square and maximum value of the lateral deviation, and record the reference path arc length position corresponding to the maximum deviation point; calculate the trajectory completion degree of the actual trajectory on the reference path, as well as the lateral deviation and coverage of the curve sections.

[0018] Furthermore, in step S7, the specific process of generating semantic evaluation results includes: The feature descriptions of the reference trajectory data and the actual trajectory data are assembled into structured context text. A prompt template containing system instructions and user instructions is constructed. The system instructions define the model role and structured output format. The user instructions, combined with the structured context text, require the second language model to comprehensively analyze the geometric features of the reference trajectory and the quantified deviation results to determine whether the deviation is within an acceptable range and whether the cause of the deviation is due to differences in planning strategy selection or planning defects. The structured text output by the second language model is parsed to extract the judgment conclusion, deviation nature classification, and natural language interpretation, generating semantic evaluation results.

[0019] Furthermore, in step S8, the specific process of performing image-level comparison using a visual language model includes: The reference path and the actual path are combined into the same comparison image, and the actual path scatter points, curve sections highlighting bands, maximum deviation point markers, and vehicle width corridors colored according to deviation are superimposed on the comparison image. Prompt words containing multimodal user commands and the comparison image are constructed and input into the visual language model. The visual language model cross-validates whether the image observation features are consistent with the quantified deviation results and outputs the visual evaluation results.

[0020] A closed-loop automated testing system for autonomous driving planning algorithms based on large language models, comprising: The map semanticization module is used to acquire scene map data and parse the scene map data into a semantic list containing node connectivity, geometric features and orientation information; The test case generation module is configured with a first language model to receive natural language test intents and generate structured test cases that meet the test intents based on the semantic list using the first language model. The reference truth generation module is used to generate reference trajectory data based on the structured test cases and the semantic list; The obstacle injection module is used to receive obstacle elements from the test case generation module, complete obstacle-related data processing, and output them to the test delivery module. The test delivery module is used to convert the structured test cases into standard interface messages acceptable to the system under test, and to deliver the standard interface messages to the system under test. The results acquisition module is used to collect the actual trajectory data generated by the system under test in response to structured test cases. The semantic comparison and evaluation module is equipped with a second language model, which is used to perform numerical geometric comparison between reference trajectory data and actual trajectory data to obtain quantization deviation results, and generate semantic evaluation results based on reference trajectory data, actual trajectory data and quantization deviation results using the second language model. The visual comparison and evaluation module is equipped with a visual language model, which is used to render the reference trajectory data and the actual trajectory data into reference path images and actual path images respectively, and to use the visual language model to perform image-level comparison between the reference path images and the actual path images to generate visual evaluation results. The report generation module is used to summarize the semantic evaluation results and the visual evaluation results to generate a test report.

[0021] The beneficial effects of the present invention are as follows, compared with the prior art: Compared to the traditional method of manually designing test scenarios, this invention supports the automatic generation of executable test cases based on natural language test intentions, which greatly reduces the human cost of test scenario design, and testers do not need to have map parsing or programming skills.

[0022] In this invention, test case generation is decoupled from the specific map format. Changing the test map eliminates the need to rewrite the test logic; only the semantic manifest needs to be regenerated, achieving one-time structuring and multiple reuse. The automatic conversion and distribution of test cases to the standard interface of the system under test, with pluggable distribution protocols, enables automated, scalable, and regressive test execution. It supports integrating test cases into a general software testing framework and performing batch regression tests, facilitating continuous verification during algorithm iteration.

[0023] This invention introduces an independent semantic evaluation-side language model and a visual evaluation-side visual language model. Based on quantitative indicators, it compares and judges the reference true value and the actual result from two dimensions: data semantics and image vision. This makes up for the shortcomings of traditional pure numerical comparison, which only reports the deviation without explaining the reason. The test conclusion has both data rigor and image intuitiveness.

[0024] This invention supports inserting simulated obstacles into the reference path, extending the testing scope from path geometry verification to planning behavior verification in obstacle scenarios. It also reuses the same set of reference truth values, distribution, and evaluation closed loops, eliminating the need to design separate test links for obstacle scenarios. Furthermore, it can automatically distinguish between "expected safe parking" and "unexpected abnormal parking," reducing the cost of manual review.

[0025] Through actual testing and verification, the present invention can automatically and stably discover the boundary behavior of planning algorithms in complex scenarios (such as the superposition of lateral offset caused by obstacle avoidance and the turning requirements of curves), and this discovery can be independently reproduced in batch automated regression, proving that the present invention has the actual ability to discover defects / boundary behaviors, rather than just the ability to verify path consistency. Attached Figure Description

[0026] Figure 1 This is a flowchart of the closed-loop automated testing method for autonomous driving planning algorithms based on large language models as described in this invention; Figure 2 This is a schematic diagram of the closed-loop automated testing system for autonomous driving planning algorithms based on large language models, as described in this invention. Detailed Implementation

[0027] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of this application.

[0028] like Figure 1 As shown, the closed-loop automated testing method for autonomous driving planning algorithms based on large language models described in this invention includes the following steps: S1, acquire scene map data and parse it into a semantic list containing node connectivity, geometric features and directional information; Specifically, this embodiment uses a Lanelet2 format high-precision map (OSM XML format), and the map semantic parsing includes the following sub-steps: (1) Original map parsing: Parse the OSM XML file, extract the nodes and their local coordinates (local_x, local_y), extract the path as an ordered node reference sequence of lane boundaries, and extract the left boundary member reference, right boundary member reference, speed limit, and lane subtype attributes under the type=lanelet tag in the relation. (2) Calculate the lane centerline: For each lane, take its left boundary path point sequence L and right boundary path point sequence R, and select the alignment method with the smallest point-by-point Euclidean error from four inversion combinations (L,R), (L^',R), (L,R^'), and (L^',R^'). Then, according to the semantics of the left and right boundaries of Lanelet2 (the left boundary must be located on the left side of the driving direction), use the cross product cross=d(R)×o(LR) to determine the direction consistency. When cross<0, invert L and R at the same time. Finally, use the midpoint sequence of the corresponding index points as the lane centerline. (3) Constructing a directed connected graph: For any two lanes a and b, if the Euclidean distance between the end point of the center line of lane a and the starting point of the center line of lane b is less than the preset tolerance (0.6 meters in this embodiment), then a directed edge a→b is established to form a successor relationship; similarly, a predecessor relationship is constructed to form a lane-level directed connected graph G=(V,E). (4) Centerline resampling and curvature detection: The centerline of each lane is resampled at fixed arc length intervals (1.0 meter in this embodiment); For three adjacent sampling points P(i-1), P(i), P(i+1), the change in heading angle Δθ(i) = heading(P(i),P(i+1)) - heading(P(i-1),P(i)) is calculated. When |Δθ(i)|≥3°, it is marked as a point within the curve interval. The turning direction is determined by the positive or negative value of Δθ(i). A positive value indicates a left turn and a negative value indicates a right turn. The turning radius R(i) = L(i) / 2·|Δθ(i)| (radians), where L(i) is the sum of the arc lengths of the two segments |P(i)-P(i-1)|+|P(i+1)-P(i)|; Noise curves containing only a single point (without arc length extension) are discarded. (5) Generate a semantic list: The above information is summarized into a unified data structure. Each lane entry includes: lane number, chain number, starting coordinates (x(s), y(s), z(s)), ending coordinates (x(e), y(e), z(e)), starting heading angle, ending heading angle, length, list of successor lane numbers, list of preceding lane numbers, list of curves (each item includes turning direction, starting arc length, ending arc length, maximum heading change, minimum turning radius), speed limit, lane subtype, and resampled centerline coordinate sequence.

[0029] This semantic list is a one-time structured processing result that can be repeatedly called by the first language model and subsequent steps without requiring the original map file to be re-parsed for each test.

[0030] S2 receives the natural language test intent, uses the first language model, and generates structured test cases that meet the test intent based on the semantic list; Specifically, after reading the semantic list, the first language model determines the starting and ending lanes that meet the route feature constraints (number of curves, direction, radius range, etc.) based on the natural language test intent (e.g., "select a path containing right turns on the inner ring"). The starting and ending positions are represented by the lane number and the arc length ratio parameter on that lane. The output is a structured test case, which includes at least the starting and ending information.

[0031] Generating structured test cases using a first-language model includes the following sub-steps: (1) Test Intent Parsing and Constraint Extraction: The test intent in natural language is received and parsed into a set of machine-controllable constraints. The constraint set includes three categories: start-point constraints, end-point constraints, and path feature constraints. Start-point / end-point constraints define the starting and ending positions of the path, and can be specified as a specific lane, a location description (e.g., near a landmark), or left unspecified (wildcard). Path feature constraints define the geometric features the path must satisfy, including the number of curves, curve direction, turning radius range, path length range, whether it forms a loop (one-loop drive), speed limits, and lane subtypes (e.g., motor vehicle lanes). During parsing, the intent text is preprocessed for standardization, filtering out expressions irrelevant to the test scenario. Constraints not explicitly given in the intent are set to wildcard status and considered by the model during generation.

[0032] (2) Semantic List Context Construction: Extract the map semantic summary for the first language model to perceive from the semantic list generated in step S1 to construct the model input context. Each lane is represented by a feature record, with fields including lane number, chain number, starting coordinates and starting heading, ending coordinates and ending heading, length, maximum curve angle, curve list summary (turning direction, starting arc length, ending arc length, minimum turning radius), speed limit, lane subtype, list of successor lane numbers and list of preceding lane numbers; the chain structure is represented by a summary record of chain number, list of included lanes, total length and whether it is a loop. To avoid excessive inference overhead caused by injecting all high-density centerline coordinates into the model context, only the above structured features and necessary key coordinates are retained, and short lanes that do not meet the minimum test requirements are filtered and marked by criteria such as length and number of curves, so that the model can avoid selecting them.

[0033] (3) Candidate start and end point reasoning and generation: The first language model reasons based on the given semantic list context and the parsed test intent: it retrieves candidate lanes in the semantic list according to the route feature constraints. For example, when the intent requires "includes right turns", it prioritizes filtering from the set of lanes with right turns in the curve list; then it evaluates whether each candidate lane forms a feasible combination with the start constraint and the end constraint in combination with the connectivity relationship, and determines the start lane and end lane that meet the route feature constraints; the start and end point positions are represented in the form of "lane number + arc length ratio parameter", where the arc length ratio parameter t∈0,1 represents the relative position on the center line of the lane normalized by the cumulative arc length, and outputs the candidate structured results containing the start lane number and arc length ratio parameter, and the end lane number and arc length ratio parameter; when the intent requires a complete loop, it outputs the loop representation where the start and end points are the same lane and the same arc length ratio on it. The generation process employs a generation method with output format constraints, limiting the model to only referencing lane numbers, chain numbers, and feature values ​​that actually exist in the context, and requiring the output to conform to a predefined data structure format, thereby suppressing the model's fabrication of non-existent lanes or features from the generation source.

[0034] (4) Executability verification and automatic correction: The candidate structured results output by the first language model are verified. The verification items include: format validity: the fields are complete, the types are correct and can be parsed by standard JSON; value validity: the lane number exists in the semantic list and the arc length ratio parameter is in the range of 0 and 1; connectivity and reachability: the lane-level directed connectivity graph in the semantic list is used to determine whether there is a reachable path from the starting lane to the ending lane. The reachability pre-check is completed by calling the shortest path search on the graph without the need for complete path planning. When the verification fails, a correction prompt containing the error reason and reasonable correction suggestions is constructed (such as clamping the out-of-bounds arc length ratio parameter to the interval endpoint, removing unreachable lane combinations and giving new candidates), requiring the first language model to regenerate. If the number of retries exceeds the preset limit (3 times in this embodiment) and still fails, it is determined that the test intention is not executable under the current map and an error message containing the specific reason is returned to avoid sending invalid test cases to the downstream process.

[0035] (5) Structured Test Case Output: The validated candidate structured results are serialized according to a predefined data structure to generate structured test cases. The structured test cases include at least start-point information and end-point information: the start-point information includes the start lane number and the arc length ratio parameter on that lane, and the end-point information includes the end lane number and the arc length ratio parameter on that lane; when the test intent specifies path feature constraints, the test cases also record a summary of the path feature constraints (number of curves, turning direction, radius range, etc.) for consistency verification in the reference trajectory generation stage; the structured test cases are stored in JSON format and used as input for step S3.

[0036] In one implementation, structured test cases also include obstacle elements, which are defined by their longitudinal distance, lateral offset, and motion state (stationary or at a specified speed) relative to the reference pose. Specifically, the absolute pose of the obstacle is calculated by coordinate transformation using the position and heading of the reference pose, combined with the specified longitudinal distance and lateral offset: the longitudinal axis is the heading direction of the reference pose, and the lateral axis is the vertical direction. A positive value of the lateral offset indicates the right side of the reference heading, and a negative value indicates the left side. The reference pose comes from the starting point of the reference trajectory data or from the query result of the real-time pose of the system under test, to support the dynamic insertion of obstacles relative to the current vehicle position.

[0037] In one implementation, the first language model receives an intent list consisting of multiple sets of natural language test intents, executes the above sub-steps (1) to (5) one by one, generates multiple structured test cases in batches and outputs them as a test case list for subsequent batch distribution and regression testing.

[0038] S3 generates reference trajectory data based on structured test cases and semantic manifest; Specifically, based on the directed connected graph in the semantic inventory, the generation of reference trajectory data includes the following sub-steps: (1) Shortest path search: Dijkstra's algorithm is used to search for the shortest path from the starting lane l(s) to the ending lane l(e) on the lane-level directed connected graph G=(V,E), resulting in an ordered lane sequence {l(s),l(2), …,l(n-1),l(e)}; when the starting and ending lanes are the same lane and the map has a closed loop, the loop sequence is formed by traversing from the starting lane to the starting lane along the successor relationship. (2) Start and end point cutoff: For the starting lane, find the cutoff position s(target)=t(s)·L(lane) in the cumulative arc length sequence of its centerline according to the arc length ratio parameter t(s)∈[0,1], and retain the centerline segment from the cutoff point to the end of the lane; For the end lane, calculate the cutoff point in the same way according to the arc length ratio parameter t(e)∈[0,1], and retain the centerline segment from the start of the lane to the cutoff point; The coordinates of the cutoff point are obtained by linear interpolation within the segment; (3) Path splicing and deduplication: The starting point segment, the complete center line of each lane in the middle, and the ending point segment are spliced ​​in sequence. When the coordinate difference of the common endpoint of the adjacent segments is less than the preset deduplication tolerance (10^{-6} meters in this embodiment), redundant points are removed to obtain a continuous path polyline. (4) Equidistant resampling: The spliced ​​path polyline is resampled at a fixed step size (0.5 meters in this embodiment) to obtain an equidistant track point sequence {W(0),W(1),…,W(m)}; (5) Calculation of heading and curvature: For each track point W(i), the heading angle ψ(i) = atan2(W(i).yW(i-1).y,W(i).xW(i-1).x); the curvature κ(i) = |Δθ(i)| / L(i), where Δθ(i) is the difference between adjacent headings (normalized to [-180°, 180°]) and L(i) is the sum of the arc lengths of the two segments; the cumulative arc length s(i) = Σ(j=1)i|W(j)-W(j-1)|; (6) Curve detection and merging: Using the same heading change threshold (|Δθ|≥3°) as in step S1, curves are detected on the track point sequence. Adjacent curves in the same direction (when the distance is less than the preset merging distance of 3.0 meters) are merged into one curve interval. The turning direction, starting arc length s(start), ending arc length s(end) and maximum heading change of each curve segment are recorded.

[0039] The final reference trajectory data includes: a sequence of track points (each point includes x, y, z, heading angle, curvature, and cumulative arc length), a list of curves, total length, start and end point information, and lane sequence.

[0040] S4 converts structured test cases into standard interface messages acceptable to the system under test and sends them to the system under test. Specifically, the starting pose of the reference trajectory data is converted into the initial pose input message of the system under test, and the ending pose is converted into the target pose input message of the system under test. These are then distributed to the system under test via a publish-subscribe approach. After distribution, the enable interface of the system under test is called to enable the system under test to enter the autonomous driving execution state.

[0041] In one implementation, the standard interface message delivery protocol is configurable, including at least one of publish-subscribe messages, remote service calls, or application programming interface calls, to adapt to the communication middleware of different systems under test.

[0042] In one implementation, the method further includes the step of converting obstacle elements into obstacle simulation messages acceptable to the system under test and sending them out; specifically, in addition to pose information, the obstacle simulation message also includes bounding box size, motion state, and add / delete / modify action type fields; the physical validity parameters of the obstacle elements are determined based on the physical dimensions of the vehicle under test obtained from the system under test, and the physical dimensions of the vehicle under test include at least one of vehicle width, vehicle length, and wheelbase; the test sending module pre-sets default bounding box size templates for different obstacle categories (vehicles, pedestrians, non-motorized vehicles, etc.) to ensure the physical validity of test cases when converted into standard interface messages.

[0043] S5, collects the actual trajectory data generated by the structured test cases in response to the system under test; Specifically, the methods for collecting actual trajectory data include: continuously monitoring the real-time execution pose feedback of the system under test (such as the coordinate transformation query interface) and accumulating it over time to form the vehicle's actual driving trajectory as the standard working mode; or, when the system under test has not yet actually executed, reading the single-frame path data output by a certain planning stage of the system under test as an alternative data source.

[0044] In one implementation, the planning output of the system under test includes multiple planning stages or multiple candidate paths. The method further includes the steps of extracting the path segments corresponding to each planning stage or candidate path, comparing them with the corresponding road segments of the reference trajectory data, and summarizing the comparison results of each road segment to generate a comprehensive evaluation conclusion, so as to adapt to the situation where the output coverage of different planning stages in the hierarchical planning architecture is different.

[0045] In one implementation, while continuously monitoring the real-time pose feedback of the system under test, the system's operational status feedback is also continuously monitored. The acquisition process is determined to end based on one of the following conditions: the distance between the actual trajectory and the endpoint of the reference trajectory is less than a preset threshold, or the operational status feedback of the system under test indicates that the target has been reached, which is determined as arrival; the actual execution speed is lower than the preset threshold for more than a preset duration and is not determined as arrival, which is determined as unexpected stop; the cumulative time exceeds the preset safety upper limit time, which is determined as timeout; wherein the safety upper limit time is only used as a fallback criterion, and the acquisition will not end prematurely due to the cumulative time as long as the actual execution speed is not continuously lower than the preset threshold.

[0046] S6. Perform a numerical geometric comparison between the reference trajectory data and the actual trajectory data to obtain the quantization deviation result; Specifically, numerical geometric alignment includes the following sub-steps: (1) Point projection and lateral deviation calculation: For each sampling point P in the actual trajectory data, traverse each segment (P(0), P(1)) of the reference trajectory polyline, calculate the projection parameter t=clamp((PP(0))·(P(1)-P(0)) / |P(1)-P(0)|²,0,1), the projection point P(proj)=P(0)+t·(P(1)-P(0)), and the absolute lateral deviation d=|PP(proj)|; select the segment with the smallest d among all segments, and determine the direction of the signed lateral deviation by the cross product: cross = (P(1.x)-P(0.x))(P(y)-P(0.y))-(P(1.y)-P(0.y))(P(x)-P(0.x)), where a positive value indicates that the actual point is located to the left of the reference driving direction, and a negative value indicates that it is to the right; at the same time, the arc length s of the projection on the reference path is recorded; (2) Deviation statistics: Calculate the mean value d̄=1 / nΣ(i=1)n|d(i)|, the root mean square RMSE=√1 / nΣ(i=1nd(i)²) and the maximum value d(max)=max(i)|d(i)|, and record the index of the actual trajectory sampling point and the reference path arc length position s(max) corresponding to the maximum deviation; (3) Trajectory completion: completion C = max(i)(s(i)) / L(ref) × 100%, where max(i)(s(i)) is the maximum value of the projected arc length of each sampling point of the actual trajectory on the reference path, and L(ref) is the total length of the reference trajectory; at the same time, the ratio of the total length of the actual trajectory to the total length of the reference trajectory r = L(actual) / L(ref) is calculated. (4) Curve deviation statistics: For each curve interval [s(start), s(end)] marked in the reference trajectory, filter the actual trajectory sampling points whose projected arc length s(i) falls within the interval, calculate the mean and maximum value of their lateral deviation, and mark whether the curve interval is covered by the actual trajectory; if no actual sampling point projection falls into a curve interval, it is marked as not covered, which is used to determine whether the tested system skips or cuts the curve; (5) Obstacle scene analysis (when the structured test case contains obstacle elements): Calculate the Euclidean distance from the end point of the actual trajectory to the obstacle position, the end point speed, and determine whether it constitutes "safe stopping at the obstacle": It must simultaneously satisfy (a) the tested system has entered the driving state, (b) the final speed is lower than the stopping threshold (0.1m / s in this embodiment), and (c) the average deviation between the actual trajectory and the reference trajectory during the driving phase (sampling segment with speed higher than 0.05m / s) is lower than the consistency threshold (0.5m in this embodiment).

[0047] S7 utilizes a second language model to generate semantic evaluation results based on reference trajectory data, actual trajectory data, and quantization deviation results; Specifically, the semantic evaluation of a second language model includes the following sub-steps: (1) Context construction: The feature descriptions of the reference trajectory data (start and end coordinates, total length, curve position and turning direction, minimum turning radius of the curve) and the feature descriptions of the actual trajectory data (arrival status, completion degree, mean / root mean / maximum value of lateral deviation and its reference path arc length position, sub-curve deviation statistics, obstacle analysis results) are assembled into a structured context text; (2) Prompt template construction: The prompt template includes a system instruction part and a user instruction part; the system instruction defines the model role as "autonomous driving planning algorithm test judge", and specifies that the output format is a structured text containing the judgment conclusion (pass / fail), the deviation nature classification (planning strategy difference or planning defect) and natural language explanation; the user instruction contains structured context text and judgment task description, requiring the model to comprehensively refer to the geometric features of the trajectory and the actual trajectory quantification deviation results to judge whether the deviation is within the acceptable range, whether the cause of the deviation is due to the difference in planning strategy selection (such as lateral deviation caused by obstacle avoidance) or planning defect (such as trajectory distortion at curves, abnormal parking). (3) When the structured test case contains obstacle elements, the prompt template further requires the model to automatically classify the stopping behavior as "expected safe parking" (the actual trajectory travels along the reference trajectory to the vicinity of the obstacle and then stops, and the deviation before stopping is small) or "unexpected abnormal parking" (the stopping position does not directly correspond to the obstacle, or the actual trajectory has deviated from the reference trajectory before stopping) based on the relative distance between the stopping position of the actual trajectory and the obstacle position, and the degree of consistency between the actual trajectory and the reference trajectory before stopping, as the basis for the root cause hypothesis classification; (4) Model output parsing: Parse the structured text output by the model, extract the judgment conclusion, the classification of the nature of the bias and the natural language interpretation, and form a semantic judgment result.

[0048] In one implementation, when the structured test cases include obstacle elements, the semantic evaluation results are automatically classified as expected safe parking or unexpected abnormal parking based on the relative distance between the stopping position of the actual trajectory and the position of the obstacle element, and the degree of consistency between the actual trajectory and the reference trajectory before stopping: if the actual trajectory stops near the position of the obstacle element and the actual trajectory before stopping is consistent with the reference trajectory, it is determined as expected safe parking; if the stopping position of the actual trajectory does not directly correspond to the position of the obstacle element, or the actual trajectory has deviated from the reference trajectory before stopping, it is determined as unexpected abnormal parking, and the semantic evaluation results are used as the basis for root cause hypothesis classification.

[0049] S8 renders the reference trajectory data and the actual trajectory data as reference path images and actual path images respectively, and uses a visual language model to perform image-level comparison between the reference path images and the actual path images to generate visual evaluation results. Specifically, image-level comparison of visual language models includes the following sub-steps: (1) Path image rendering: The reference trajectory data and the actual trajectory data are rendered into path images in the same coordinate system and the same scale, and the same scene map background is superimposed; In one embodiment, the reference path and the actual path are further combined into the same comparison image, and the following visual elements are marked in the comparison image: reference path lines, actual path scatter points colored according to the absolute value of the lateral deviation, deviation lines connecting each actual sampling point to the projection foot of the reference path, highlight bands in the curve section, star markers and numerical annotations of the maximum deviation point, obstacle footprint rectangles (drawn according to the actual bounding box size and heading rotation) and vehicle width corridors (vehicle width corridors are drawn along the reference path and the actual path respectively, for intuitive judgment of whether the deviation is off the lane boundary). (2) Numerical analysis text construction: The quantitative deviation results obtained in step S6 (arrival status, mean / root mean / maximum value of lateral deviation and its reference path arc length position, completion degree, curve deviation statistics, obstacle analysis results) are formatted into structured text and used as the text input of the visual language model; (3) Multimodal prompt construction: The prompt template includes a system instruction part and a multimodal user instruction part; the system instruction defines the model role as "path test visual inspector", explains the meaning of each visual element in the superimposed image (refer to path color, deviation coloring rules, curve area marking, obstacle marking, etc.), and specifies the output format as visual judgment conclusion (normal / attention / cannot be judged) and specific observation (items 3-5 in this embodiment); the user instruction includes numerical analysis text and comparison image (using Base64 encoding as image input), and requires the model to read the image and numerical values ​​at the same time for cross-validation: check whether the deviation pattern observed in the image is consistent with the numerical statistics, whether there is a local severe deviation where the value is averaged out, whether there is a trajectory jump or abnormal inflection point, and whether it deviates from the preset lane boundary; (4) Model output: The visual language model outputs the visual evaluation results, including the visual judgment conclusion and specific observation description; when the numerical deviation result is judged to be passed but the visual language model observes a serious local deviation in the image, it clearly points out the inconsistency, which serves as the basis for marking manual review in the test report.

[0050] S9 summarizes the semantic evaluation results and visual evaluation results to generate a test report; Specifically, the quantitative deviation results of step S6, the semantic evaluation results of step S7, and the visual evaluation results of step S8 are summarized in a unified format to generate a structured test report containing test case information, reference and actual path images, quantitative indicators, semantic evaluation text, visual evaluation text, and final judgment conclusion.

[0051] In one implementation, the method further includes the steps of generating test cases in batches based on multiple sets of natural language testing intentions, connecting to parameterized test cases of a general software testing framework (such as pytest), executing regression tests in batches, and generating an aggregated test report in the standard format of the testing framework. The aggregated test report summarizes the judgment conclusions, key quantitative indicators, and overall pass rate of each of the multiple test cases.

[0052] like Figure 2 As shown, the present invention also provides a closed-loop automated testing system for autonomous driving planning algorithms based on large language models, comprising: The map semanticization module is used to acquire scene map data and parse the scene map data into a semantic list containing node connectivity, geometric features and orientation information; The test case generation module is configured with a first language model to receive natural language test intents and generate structured test cases that meet the test intents based on the semantic list using the first language model. The reference truth generation module is used to generate reference trajectory data based on the structured test cases and the semantic list; The test delivery module is used to convert the structured test cases into standard interface messages acceptable to the system under test, and to deliver the standard interface messages to the system under test. The results acquisition module is used to collect the actual trajectory data generated by the system under test in response to structured test cases. The semantic comparison and evaluation module is equipped with a second language model, which is used to perform numerical geometric comparison between reference trajectory data and actual trajectory data to obtain quantization deviation results, and generate semantic evaluation results based on reference trajectory data, actual trajectory data and quantization deviation results using the second language model. The visual comparison and evaluation module is equipped with a visual language model, which is used to render the reference trajectory data and the actual trajectory data into reference path images and actual path images respectively, and to use the visual language model to perform image-level comparison between the reference path images and the actual path images to generate visual evaluation results. The report generation module is used to summarize the semantic evaluation results and the visual evaluation results to generate a test report.

[0053] The system under test is an autonomous driving planning algorithm or simulation environment. The system under test receives standard interface messages output by the test distribution module, performs calculations and executions, and outputs actual execution feedback to the result acquisition module.

[0054] In one implementation, an obstacle injection module is also included, which generates obstacle simulation messages based on obstacle elements in the structured test cases and sends them to the system under test.

[0055] In one implementation, the report generation module is also used to connect structured test cases to parameterized test cases of a general software testing framework, execute them in batches, and generate aggregated test reports in the standard format of the testing framework.

[0056] The applicant of this invention has provided a detailed description of the embodiments of the invention in conjunction with the accompanying drawings. However, those skilled in the art should understand that the above embodiments are merely preferred embodiments of the invention. The detailed description is only intended to help readers better understand the spirit of the invention and is not intended to limit the scope of protection of the invention. On the contrary, any improvements or modifications made based on the inventive spirit of the invention should fall within the scope of protection of the invention.

Claims

1. A closed-loop automated testing method for autonomous driving planning algorithms based on large language models, characterized in that, Includes the following steps: S1, acquire scene map data and parse it into a semantic list containing node connectivity, geometric features and directional information; S2, receive the natural language test intent, and use the first language model to generate structured test cases that meet the test intent based on the semantic list; S3, Generate reference trajectory data based on the structured test cases and the semantic list; S4. Convert the structured test cases into standard interface messages acceptable to the system under test and send them to the system under test. S5, collects the actual trajectory data generated by the structured test cases in response to the system under test; S6, Perform a numerical geometric comparison between the reference trajectory data and the actual trajectory data to obtain the quantization deviation result; S7 utilizes a second language model to generate semantic evaluation results based on reference trajectory data, actual trajectory data, and quantization deviation results; S8 renders the reference trajectory data and the actual trajectory data as reference path images and actual path images respectively, and uses a visual language model to perform image-level comparison between the reference path images and the actual path images to generate visual evaluation results. S9. Summarize the semantic evaluation results and the visual evaluation results to generate a test report.

2. The closed-loop automated testing method for autonomous driving planning algorithms based on large language models according to claim 1, characterized in that, In step S1, the specific process of parsing the scene map data into a semantic list includes: Parse the original map file to extract node coordinates, paths, and relationships; calculate lane centerlines by aligning and cross-producting the path point sequences on the left and right boundaries; establish a lane-level directed connected graph based on the endpoint distance between any two lane centerlines; resample the lane centerlines and perform curvature detection to extract curve sections, turning directions, and turning radii; and summarize lane information, connected graphs, and curve features to generate a semantic list.

3. The closed-loop automated testing method for autonomous driving planning algorithms based on large language models according to claim 1, characterized in that, In step S2, the specific process of generating structured test cases using the first language model includes: The natural language test intent is parsed into a constraint set including start-point constraints, end-point constraints, and path feature constraints. A map semantic summary for the first language model to perceive is extracted from the semantic list as input context. Using the first language model, reasoning is performed based on the input context and constraint set. Candidate lanes are retrieved from the semantic list according to path feature constraints. The start-point and end-point lanes that satisfy the path feature constraints are determined by combining connectivity relationships. The start-point and end-point positions are represented by lane numbers and arc length ratio parameters on those lanes, and candidate structured results are output. The candidate structured results are validated for legality and connectivity reachability. If the validation fails, prompts guide the first language model to regenerate. The validated candidate structured results are serialized to generate structured test cases.

4. The closed-loop automated testing method for autonomous driving planning algorithms based on large language models according to claim 1, characterized in that, In step S3, the specific process of generating reference trajectory data includes: Based on the directed connected graph in the semantic list, a shortest path algorithm is used to search for the lane sequence from the starting lane to the ending lane. The starting lane and the ending lane are truncated according to the arc length ratio parameter of the starting and ending lanes, and the truncated segments are spliced ​​with the center lines of the middle lanes. The spliced ​​path is resampled at equal intervals according to a preset step size, and the heading angle, curvature and cumulative arc length of each sampling point are calculated. Curve merging is then performed to generate reference trajectory data. The reference trajectory data includes a track point sequence, a curve list, total length, starting and ending point information and lane sequence.

5. The closed-loop automated testing method for autonomous driving planning algorithms based on large language models according to claim 1, characterized in that, Step S4 involves converting structured test cases into standard interface messages and sending them out, specifically including: The starting pose of the reference trajectory data is converted into the initial pose input message of the system under test, and the ending pose is converted into the target pose input message of the system under test. The data is then distributed to the system under test via a publish-subscribe method. After the distribution is completed, the enable interface of the system under test is called to enable the system under test to enter the autonomous driving execution state. It also includes: converting obstacle elements into obstacle simulation messages acceptable to the system under test and sending them out, wherein the physical validity parameters of the obstacle simulation messages are determined based on the physical dimensions of the vehicle under test obtained from the system under test.

6. The closed-loop automated testing method for autonomous driving planning algorithms based on large language models according to claim 1, characterized in that, Step S5, collecting actual trajectory data specifically includes: By continuously monitoring the real-time execution pose feedback of the system under test and accumulating it over time, real driving trajectory data is constructed; or when the system under test is not actually executing, the single-frame path data output by a certain planning stage of the system under test is read as the actual trajectory data; when the planning output of the system under test includes multiple planning stages or multiple candidate paths, the path segments corresponding to each planning stage or candidate path are extracted and compared with the corresponding road segments of the reference trajectory data.

7. The closed-loop automated testing method for autonomous driving planning algorithms based on large language models according to claim 1, characterized in that, In step S6, the numerical geometric comparison includes: Calculate the absolute lateral deviation and signed lateral deviation of each sampling point of the actual trajectory data to the reference trajectory data; calculate the mean, root mean square and maximum value of the lateral deviation, and record the reference path arc length position corresponding to the maximum deviation point; calculate the trajectory completion degree of the actual trajectory on the reference path, as well as the lateral deviation and coverage of the curve sections.

8. The closed-loop automated testing method for autonomous driving planning algorithms based on large language models according to claim 1, characterized in that, In step S7, the specific process of generating semantic evaluation results includes: The feature descriptions of the reference trajectory data and the actual trajectory data are assembled into a structured context text. A prompt template containing system instructions and user instructions is constructed. The system instructions define the model role and structured output format. The user instructions, combined with the structured context text, require the second language model to comprehensively analyze the geometric features of the reference trajectory and the quantified deviation results to determine whether the deviation is within an acceptable range and whether the cause of the deviation is a difference in planning strategy selection or a planning defect. The structured text output by the second language model is parsed to extract the judgment conclusion, the deviation nature classification, and the natural language interpretation, generating a semantic evaluation result.

9. The closed-loop automated testing method for autonomous driving planning algorithms based on large language models according to claim 1, characterized in that, In step S8, the specific process of image-level comparison using a visual language model includes: The reference path and the actual path are combined into the same comparison image, and the actual path scatter points, curve sections highlighting bands, maximum deviation point markers, and vehicle width corridors colored according to deviation are superimposed on the comparison image. Prompt words containing multimodal user commands and the comparison image are constructed and input into the visual language model. The visual language model cross-validates whether the image observation features are consistent with the quantified deviation results and outputs the visual evaluation results.

10. A closed-loop automated testing system for autonomous driving planning algorithms based on a large language model, characterized in that, include: The map semanticization module is used to acquire scene map data and parse the scene map data into a semantic list containing node connectivity, geometric features and orientation information; The test case generation module is configured with a first language model to receive natural language test intents and generate structured test cases that meet the test intents based on the semantic list using the first language model. The reference truth generation module is used to generate reference trajectory data based on the structured test cases and the semantic list; The obstacle injection module is used to receive obstacle elements from the test case generation module, complete obstacle-related data processing, and output them to the test delivery module. The test delivery module is used to convert the structured test cases into standard interface messages acceptable to the system under test, and to deliver the standard interface messages to the system under test. The results acquisition module is used to collect the actual trajectory data generated by the system under test in response to structured test cases. The semantic comparison and evaluation module is equipped with a second language model, which is used to perform numerical geometric comparison between reference trajectory data and actual trajectory data to obtain quantization deviation results, and generate semantic evaluation results based on reference trajectory data, actual trajectory data and quantization deviation results using the second language model. The visual comparison and evaluation module is equipped with a visual language model, which is used to render the reference trajectory data and the actual trajectory data into reference path images and actual path images respectively, and to use the visual language model to perform image-level comparison between the reference path images and the actual path images to generate visual evaluation results. The report generation module is used to summarize the semantic evaluation results and the visual evaluation results to generate a test report.