Automatic traffic simulation method and system for generating SUMO recognizable XML based on large language model

By using a large language model and hierarchical iterative verification technology, the problems of low efficiency, high technical threshold and poor scenario adaptability in XML input file generation in SUMO traffic simulation are solved, realizing efficient and accurate SUMO-XML file generation and automated traffic simulation.

CN121835401APending Publication Date: 2026-04-10XIONGAN QIANFANG SHUCHENG ZHILIAN TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-30
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing technologies for SUMO traffic simulation suffer from low efficiency in generating XML input files, high technical barriers, and poor scenario adaptability, leading to simulation failures and increased labor costs.

Method used

SUMO-XML files are generated using a large language model. By constructing a specialized dataset, fine-tuning the basic large language model, and combining hierarchical iterative syntax and semantic verification, the automatic conversion of natural language instructions to SUMO-XML is achieved.

Benefits of technology

It significantly improves the efficiency of SUMO traffic simulation, lowers the technical threshold, and allows users to generate compliant XML files without programming skills, adapting to complex scenarios and ensuring simulation accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121835401A_ABST
    Figure CN121835401A_ABST
Patent Text Reader

Abstract

The invention relates to the cross technical field of artificial intelligence and traffic simulation, and relates to an automatic traffic simulation method for generating an SUMO recognizable XML based on a large language model, which comprises the following steps: constructing and preprocessing an instruction-fine tuning data set comprising a natural language instruction and an SUMO-XML file mapping relationship; performing fine tuning on the basic large language model by combining a fine tuning technology with a structured prompt and thinking chain strategy to obtain an SUMO-XML adaptive large language model; when a natural language instruction of a user is received, an initial XML text is generated through the adaptive model, and an XML file capable of being recognized by SUMO is generated after hierarchical iterative grammar and semantic verification and correction; and finally, the simulation driving program module reads the file and drives the SUMO to complete automatic simulation. The problems that in existing SUMO simulation, XML generation efficiency is low, the technical threshold is high and scene adaptability is poor are effectively solved, simulation efficiency is remarkably improved, the use threshold of a user is lowered, and the method can be widely applied to multiple scenes such as urban traffic management, traffic planning, emergency simulation and teaching and scientific research.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of interdisciplinary technology of artificial intelligence and traffic simulation, specifically to an automated traffic simulation method and system based on generating SUMO-recognizable XML from a large language model. Background Technology

[0002] Currently, traffic simulation is a core tool for urban traffic planning, management, and optimization. SUMO, as an open-source and efficient traffic simulation software, is widely used in scenarios such as traffic flow analysis, road capacity assessment, and traffic light timing optimization. SUMO's simulation process relies on a specific formatted XML file as input. This file must contain detailed information such as road network structure, vehicle routes, travel demand, and signal control schemes, and the format must strictly adhere to SUMO's defined tag logic and data format requirements.

[0003] Currently, SUMO XML file generation mainly relies on two methods, both of which have shortcomings: one is to manually write or organize data using spreadsheet tools and then convert it. This method is inefficient and prone to simulation failures due to format errors (such as missing tags or mismatched attributes), especially in complex road network scenarios, where manual labor costs increase significantly. The other method is to generate customized scripts using programming languages ​​such as Python and MATLAB. Although this method is more efficient than manual generation, it requires developers to have a high level of technical expertise, needing them to master both programming skills and the SUMO-XML format specification. Furthermore, the generated scripts have limited flexibility and are difficult to quickly adapt to the simulation needs of different cities and scenarios.

[0004] In recent years, large language models have demonstrated excellent capabilities in text generation. However, when general-purpose large language models are directly applied to SUMO-XML generation, the generated files often suffer from problems such as formatting issues and missing key parameters due to a lack of specific understanding of the SUMO-XML format specification and traffic domain knowledge, making them unusable for simulation. Therefore, current technology still lacks a solution that can efficiently and accurately convert natural language instructions into standardized XML files that can be directly used for SUMO simulation.

[0005] In summary, effectively addressing the issues of low efficiency in generating XML input files, high technical barriers, and poor scenario adaptability in SUMO traffic simulation is a current technical challenge faced by those skilled in the art. Summary of the Invention

[0006] This invention aims to solve the technical problems of low efficiency in generating XML input files, high technical threshold, and poor scene adaptability in existing SUMO traffic simulation technology.

[0007] To achieve the above objectives, this invention provides an automated traffic simulation method based on a large language model to generate SUMO-recognizable XML, comprising the following steps: S1.SUMO can recognize XML-specific datasets; Collect diverse SUMO-XML files and extract their core tag structure, attribute definitions, and data format specifications; construct an "instruction-XML" pairing dataset based on the correspondence between natural language instructions and XML files; perform structuring processing on the XML files in the constructed "instruction-XML" pairing dataset and clean the natural language instructions; S2. Fine-tuning of the basic large language model; Select an open-source basic large language model; adopt an efficient parameter fine-tuning method and use the "instruction-XML" pairing dataset to fine-tune the open-source basic large language model; perform model training iterations to obtain a SUMO-XML adapted large language model; S3.XML file generation and validation; Receive natural language simulation commands from the user; input the natural language simulation commands into the SUMO-XML adaptive large language model to generate initial XML text; perform hierarchical iterative syntax and semantic verification on the initial XML text; S4. Automated traffic simulation; The SUMO software is invoked to load the compliant XML file and perform automated traffic simulation.

[0008] Furthermore, in step S1, each piece of data in the “instruction-XML” pairing dataset contains a natural language instruction describing the traffic simulation requirements and a corresponding standard SUMO-XML file.

[0009] Furthermore, in step S2, during the fine-tuning process, LoRA parameter efficient fine-tuning technology is adopted, and combined with the application of structured prompts and thought chain strategies, in order to force the model to follow the hierarchical logic of SUMO-XML and enhance its logical consistency when generating complex scenarios, and to fine-tune the open-source basic large language model.

[0010] Furthermore, the LoRA parameter efficient fine-tuning technique involves injecting a low-rank matrix with a rank of 8 into the attention layer of the basic large language model and freezing the original model parameters.

[0011] Furthermore, in step S3, the initial XML text undergoes hierarchical iterative syntax and semantic validation. If errors are found during validation, the error information is fed back to the model for correction. This "generate-validate-correct" cycle continues until an XML file that fully conforms to the SUMO specification is output.

[0012] Furthermore, the semantic verification utilizes a pre-defined SUMO semantic rule base to check the integrity of core tags, the validity of attribute values, and the validity of references in the XML file.

[0013] Accordingly, the present invention also provides an automated traffic simulation system based on a large language model to generate SUMO-recognizable XML, comprising: The data processing and model training module is used to build and preprocess specialized datasets, and to fine-tune the basic large language model to obtain a SUMO-XML adapted large language model. The XML generation and validation module is used to receive user natural language commands, call the adaptation model to generate XML text, and iteratively correct it through syntax and semantic validation mechanisms until a valid SUMO-XML file is output. The SUMO simulation driver module is used to read valid XML files, automatically drive the SUMO software to complete the simulation, and collect and output simulation result data.

[0014] Furthermore, the data processing and model training module includes: The raw XML and instruction collection submodule is responsible for collecting raw SUMO-XML files and related natural language instructions, and outputting raw data pairs; The instruction-XML pairing dataset construction submodule is used to receive raw data and construct a structured instruction-XML corresponding dataset; The dataset preprocessing and cleaning submodule is used to preprocess and clean the constructed dataset to provide high-quality training data for model training. The SUMO-XML model fine-tuning training submodule is used to fine-tune the basic large language model using cleaned training data, generating a SUMO-XML adapted large language model that can understand SUMO semantics and output corresponding XML.

[0015] Furthermore, the XML generation and validation module includes: The user interface submodule is used to receive natural language commands input by the user and pass them to the downstream inference engine; The SUMO-XML model inference engine submodule is used to load and call the fine-tuned model generated by module one, and generate the initial SUMO-XML file according to user instructions; The XML syntax checking submodule is used to perform syntax compliance checks on the initialization XML output by the inference engine. The SUMO semantic rule library submodule is used to store the domain-specific semantic rules required for SUMO simulation; The XML validation and correction loop controller submodule is used to receive the initial XML, call the validator, and perform checks by combining syntax checking and semantic rule base. If errors are found, it combines and generates correction prompt words, and returns them to the model inference engine for iterative correction until a valid SUMO-XML file is generated.

[0016] Furthermore, the SUMO simulation driving module includes: The simulation driver submodule is used to receive a valid SUMO-XML file from Module 2, and to drive and manage the simulation process. The SUMO simulation engine submodule, which is called by the driver program, is the core engine for performing simulations and runs the simulation based on the input XML file. The simulation data acquisition and output submodule is used to collect relevant simulation result data and output it in a formatted manner after the simulation is completed.

[0017] Compared with the prior art, the beneficial effects of the present invention are: By directly converting natural language instructions into XML files required for simulation using a large language model, the tedious manual writing or script development is completely eliminated, reducing the construction time of complex simulation scenarios from hours or even days to minutes, significantly improving efficiency.

[0018] Users do not need to master the SUMO-XML format specification or programming skills; they can perform traffic simulations using only natural language. This makes it easy for traffic planners, managers, and teaching and research personnel to get started, significantly lowering the barrier to entry.

[0019] Based on training with large-scale and diverse datasets, and combined with strategies such as thought chains, the model of this invention can understand and generate various complex and novel traffic scenarios, with high flexibility, good versatility, and enhanced scenario adaptability.

[0020] Through its unique layered iterative syntax and semantic verification and correction mechanism, the system ensures that the final generated XML file can be directly recognized and run by the SUMO software, effectively avoiding simulation failures caused by format errors, improving the reliability of the automated process, and guaranteeing the accuracy of the output. Attached Figure Description

[0021] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a schematic diagram of the automated traffic simulation method based on a large language model to generate SUMO-recognizable XML in this invention.

[0022] Figure 2This is a flowchart illustrating the SUMO-XML special data construction method in an embodiment of the present invention.

[0023] Figure 3 This is a flowchart illustrating the process of fine-tuning the basic large language model in an embodiment of the present invention.

[0024] Figure 4 This is a schematic diagram of the generation and verification process of SUMO-recognizable XML files in an embodiment of the present invention.

[0025] Figure 5 This is a schematic diagram of the automated traffic simulation process in an embodiment of the present invention.

[0026] Figure 6 This is a schematic diagram of the module structure of an automated traffic simulation system based on a large language model to generate SUMO-recognizable XML in an embodiment of the present invention. Detailed Implementation

[0027] 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 embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. Example

[0028] like Figure 1 As shown in this embodiment, an automated traffic simulation method based on a large language model to generate SUMO-recognizable XML includes the following steps: S1: SUMO can recognize XML-specific data construction. For example... Figure 2 As shown, this step consists of three sub-steps.

[0029] S11: Collect diverse SUMO-XML files, including official SUMO example XML files and mature simulation XML files for different scenarios, such as urban main road commuting, micro-circulation around scenic spots, and highway holiday traffic. Extract the core tag structure, attribute definitions, and data format specifications to form a SUMO-XML format knowledge base. The core tag structure includes... <net>Road network tags, <route>Path tags <vehicle>Vehicle tags, <tllogic>The traffic light control label has attributes including vehicle type, maximum speed (maxSpeed), and road network node coordinates (x / y).

[0030] S12: Based on the correspondence between natural language instructions and XML files, construct an "instruction-XML" paired dataset: each data entry contains a "natural language instruction" and a "corresponding standard SUMO-XML file" to ensure that the instructions cover common simulation requirements such as road network structure, vehicle parameters, simulation duration, and signal control. The dataset size is, for example, no less than 1,000 sets.

[0031] "Natural language instructions" such as "Generate XML of a main road network with 3 two-way lanes, a speed limit of 60 km / h, 2 intersections, and a traffic light cycle of 60 seconds".

[0032] S13: Perform structured processing on the XML file, converting it into a text format that the large language model can understand, and clean the natural language instructions to ensure the consistency and validity of the dataset.

[0033] Large language models can understand text formats, such as annotations to clarify the meaning of tags. Example: <net><!-- Road network definition, including nodes and edges --> <node id="1" x="0" y="0" / > <!-- Node 1, coordinates (0,0) -->< / net> .

[0034] Cleaning natural language instructions includes removing ambiguous expressions and standardizing terminology, such as standardizing "bus" to "public transport vehicle".

[0035] S2: Fine-tuning of the basic large language model. For example... Figure 3 As shown, this step consists of three sub-steps.

[0036] S21: Choose an open-source base language model, such as Llama3-7B or ChatGLM4, and deploy it on a single-machine or distributed computer system. Evaluate the base model's initial understanding of the SUMO-XML format. For example, input a simple command "generate SUMO-XML containing 1 node" and determine whether the output contains the correct... <node>Label.

[0037] S22: The PEFT (Parameter-Efficient Fine-Tuning) method is used to fine-tune the base model: an adapter layer (using a bottleneck-structured feedforward network) is added to the base model, the original parameters of the base model are frozen, and only the adapter layer parameters are trained. Instruction fine-tuning is performed using the "instruction-XML pairing dataset" as the core, without the need for additional traffic domain pre-training. To address the issue of "the model potentially ignoring XML tag nesting logic and parameter correspondence errors," such as omissions... <vehicle>The `depart` attribute of the tag, obfuscation <net>and <route>The hierarchical relationship is defined. During instruction fine-tuning, prompting engineering techniques are applied, including Structured Prompting and CoT (CoT), which, when combined, improve the accuracy of XML generation.

[0038] Furthermore, the specific implementation of S22 includes three sub-steps: S221: Parameter Efficient Fine-Tuning (PEFT) uses LoRA (Low-Rank Adaptation) as a specific implementation of PEFT (a variant of the adapter layer). Low-rank matrices are injected into the attention layer and feedforward network of the base model. In this embodiment, the rank r of LoRA is set to 8, α is set to 16, the original parameters are frozen, and only the newly added LoRA parameters are trained, resulting in less than 1% of the original model's parameters. While maintaining the general capabilities of the base model, it efficiently adapts to the SUMO-XML generation task, avoiding the computational resource consumption of full parameter fine-tuning.

[0039] S222: Structured prompt design: Add a fixed prefix template to each natural language instruction, forcing the model to generate content according to the SUMO-XML hierarchy, for example: Please generate a SUMO-XML file that strictly adheres to the following structure: 1. Road network definition ( <net>Include <node>and <edge>) 2. Vehicle type ( <vtype>(Define attributes such as type and maxSpeed) 3. Path planning ( <route>(Define the edges property) Command content: {User's original command} S223: Enhanced Thinking Chain: Manually annotate the "reasoning step - XML ​​fragment" correspondence in the training data, for example: Command: "Generate a 3-lane two-way main road with a speed limit of 60 km / h."

[0040] CoT Steps: Step 1: Define Road Network Nodes ( <node id="0" x="0" y="0" / > ) Step 2: Define edge attributes ( <edge id="edge0" from="0" to="1" numLanes="3" speed="16.67" / > ) Step 3: Generate bidirectional edges (add reverse edges) <edge id="edge1" from="1" to="0" ... / > ) Fine-tuning requires the model to output inference steps first, and then generate XML to improve logical consistency in complex scenarios.

[0041] S23: Divide the preprocessed "instruction-XML" pairing dataset into a training set and a validation set, with the training set accounting for 80% and the validation set accounting for 20%. With "natural language instructions as input and standard SUMO-XML text as output" as the training objective, set the training parameters, such as a learning rate of 5e-5, a batch size of 8, and 10 iterations. Optimize the adapter layer parameters using the training set and monitor the format accuracy of the XML output by the model through the validation set, such as tag integrity and attribute matching. When the format accuracy of the validation set is stably above 95%, the training can be considered complete, and a SUMO-XML adapted large language model is obtained.

[0042] S3: XML file generation and validation. For example... Figure 4 As shown, this step consists of three sub-steps.

[0043] S31: Receive natural language simulation instructions input by the user. The instructions must contain at least one core simulation element, such as road network range, vehicle type and quantity, simulation duration, signal control rules, etc. S32: Input the natural language simulation command into the SUMO-XML adaptive large language model, and the model outputs the corresponding XML text; S33: Perform hierarchical iterative format validation and correction on the XML text output by the model. The XML text output by the model is validated using preset XML syntax and semantic checking modules. If errors are found, error messages are fed back to the model. The model corrects the XML text based on the error messages until the format validation passes, resulting in a SUMO-recognizable XML file.

[0044] Furthermore, step S33 specifically includes four sub-steps: S331: Syntax Validation. The initial XML text output by the model is parsed using an XML parser (such as lxml). If parsing fails, specific syntax error information is collected, such as line numbers and error types. A lightweight XML parser, such as lxml.etree or the Python standard library xml.etree.ElementTree, is used to attempt to parse initial_xml. If parsing succeeds, the XML is well-formatted (tag closures, attribute quotes, etc.), and the process proceeds to the next step. If parsing fails, the exception information returned by the parser (error_msg) is captured, such as: "Opening and ending tag mismatch: 'vehicle' line 5 and 'vehicel'" or "Attribute 'maxSpeed' not defined".

[0045] S332: Semantic validation. If the syntax validation passes, the XML is validated using the SUMO semantic rule base. This checks the integrity of core tags, the validity of attribute values, the validity of references, etc., and collects all semantic error information.

[0046] Validation is performed based on a predefined SUMO Schema rule base. This rule base is a set of lightweight functions or rule sets used to check the integrity of core tags (e.g., whether the road network simulation simultaneously includes...). <net>and <route> / <vehicle>Tag), attribute validity (e.g., whether maxSpeed ​​is a non-negative floating-point number, whether the depart time is greater than or equal to 0, etc.), reference validity (the vehicle's route in...). <route>The labels define how traffic lights are logically bound to real intersection IDs, etc. Collect all semantic error information.

[0047] S333: Model Correction. If syntax or semantic errors exist, combine the original user command, the current XML text containing the error, and the structured error diagnosis report into a correction suggestion. Input this suggestion into the SUMO-XML-adaptive large language model and request it to output the corrected complete XML text. Example of correction suggestion: The SUMO-XML code you generated below contains some errors. Please carefully analyze the error report below and make only the necessary and minimal modifications to the erroneous parts to output the complete and corrected XML code.

[0048] (1) Original user instructions: {User's raw natural language command} (2) The currently generated (incorrect) XML code: [CODE_START] {initial_xml} [CODE_END] (3) Error diagnosis report: Syntax error: Line 15, the tag is misspelled; it should be:< / route> < / vehicle> .

[0049] Semantic error: Attribute error: The "depart" attribute value for vehicle ID="v0" is missing. This attribute is required.

[0050] Semantic errors, such as: Reference error: Vehicle ID="v1" references Route ID="route_unknown", but... <route>The ID was not found in the definition.

[0051] (4) Revision requirements: Please strictly follow the above error report and directly output the corrected complete XML code.

[0052] S334: Iterative correction. The XML text output after model correction is sent back to steps S331 and S332 for verification. This "generate -> verify -> feedback correction" loop will continue until: (1) The verification is completely successful, and the final valid SUMO-XML file is obtained.

[0053] (2) If errors still exist after three consecutive corrections, it may be due to complex instructions or rare errors that the model cannot understand. In this case, the loop will terminate. When the loop terminates due to exceeding the limit of corrections, the system will output the last error diagnosis report to the user and prompt the user to simplify or re-enter the natural language instructions.

[0054] S4: Automated traffic simulation. For example... Figure 5 As shown, this step consists of three sub-steps.

[0055] S41: Develop a simulation driver module that supports interface communication with SUMO software, based on SUMO's TraCI protocol or command-line call method; S42: The program module reads the XML file obtained in step S33, automatically parses the file type, such as the road network file .net.xml and the travel demand file .trips.xml, and loads the road network file first, then the travel demand file, according to the order required by SUMO simulation, and inputs the XML file into SUMO. S43: After receiving the XML file, SUMO automatically starts the simulation process and calculates simulation data in real time, such as the average vehicle speed of each road segment, the delay time at intersections, and the length of vehicle queues. The simulation results are then output in Excel or JSON format to complete the automated traffic simulation.

[0056] like Figure 6 As shown in this embodiment, an automated traffic simulation system based on a large language model to generate SUMO-recognizable XML includes a data processing and model training module, an XML generation and verification module, and a SUMO simulation driving module.

[0057] The data processing and model training module is used to construct a preprocessed dataset and fine-tune the basic large language model to obtain a SUMO-XML adapted large language model.

[0058] Specifically, the data processing and model training module includes a raw XML and instruction collection submodule, an instruction-XML paired dataset construction submodule, a dataset preprocessing and cleaning submodule, and a SUMO-XML model fine-tuning training submodule.

[0059] The module for collecting raw XML and instructions is responsible for collecting raw SUMO-XML files and related natural language instructions, and outputting raw data pairs. The module for constructing instruction-XML pairing datasets receives raw data and constructs structured instruction-XML corresponding datasets. The module for preprocessing and cleaning the datasets preprocesses and cleans the constructed datasets to provide high-quality training data for model training. The module for fine-tuning and training the SUMO-XML model uses the cleaned training data to fine-tune the basic large language model, generating a dedicated model that can understand SUMO semantics and output corresponding XML, i.e., the SUMO-XML adapted large language model.

[0060] In this embodiment, the XML generation and validation module is used to receive user instructions to generate and validate XML text to obtain a SUMO-recognizable XML file.

[0061] Specifically, the XML generation and validation module includes a user interface submodule, a SUMO-XML model inference engine submodule, an XML validation and correction loop controller submodule, an XML syntax check submodule, and a SUMO semantic rule base submodule.

[0062] The user interface submodule receives natural language commands input by the user and passes them to the downstream inference engine; the SUMO-XML model inference engine submodule loads and calls the fine-tuned model generated by Module 1, and generates the initial SUMO-XML file according to the user commands; the XML syntax checking submodule checks the syntax compliance of the initial XML output by the inference engine; the SUMO semantic rule library submodule stores the domain-specific semantic rules required for SUMO simulation; the XML validation and correction loop controller submodule receives the initial XML, calls the validator, and performs checks by combining syntax checking and the semantic rule library. If errors are found, it generates correction prompts and returns them to the model inference engine for iterative correction until a valid SUMO-XML file is generated.

[0063] In this embodiment, the SUMO-XML model fine-tuning training submodule is used to read XML files to drive SUMO to complete simulation and collect output data.

[0064] Specifically, the simulation driver submodule receives a valid SUMO-XML file from module two, drives and manages the simulation process; the SUMO simulation engine submodule, called by the driver, is the core engine for executing the simulation, running the simulation based on the input XML file; and the simulation data acquisition and output submodule acquires relevant simulation result data and outputs it in a formatted manner after the simulation is completed.

[0065] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.

[0066] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.< / route> < / route> < / net> < / route> < / vtype> < / edge> < / node> < / net> < / route> < / net> < / vehicle> < / node> < / tllogic> < / vehicle> < / route> < / net>

Claims

1. An automated traffic simulation method based on generating SUMO-recognizable XML from a large language model, characterized in that, Includes the following steps: S1.SUMO can recognize XML-specific datasets; Collect diverse SUMO-XML files and extract their core tag structure, attribute definitions, and data format specifications; construct an "instruction-XML" pairing dataset based on the correspondence between natural language instructions and XML files; perform structuring processing on the XML files in the constructed "instruction-XML" pairing dataset and clean the natural language instructions; S2. Fine-tuning of the basic large language model; Select an open-source basic large language model; adopt an efficient parameter fine-tuning method and use the "instruction-XML" pairing dataset to fine-tune the open-source basic large language model; perform model training iterations to obtain a SUMO-XML adapted large language model; S3.XML file generation and validation; Receive natural language simulation commands input by the user; input the natural language simulation commands into the SUMO-XML adapted large language model to generate initial XML text; Perform hierarchical iterative format validation and correction on the initial XML text; S4. Automated traffic simulation; The SUMO software is invoked to load the compliant XML file and perform automated traffic simulation.

2. The automated traffic simulation method based on generating SUMO-recognizable XML using a large language model according to claim 1, characterized in that, In step S1, each piece of data in the "instruction-XML" pairing dataset contains a natural language instruction describing traffic simulation requirements and a corresponding standard SUMO-XML file.

3. The automated traffic simulation method based on a large language model to generate SUMO-recognizable XML according to claim 1, characterized in that, Step S2: During the fine-tuning process, LoRA parameter efficient fine-tuning technology is adopted, combined with structured prompts and thought chain strategies to force the model to follow the hierarchical logic of SUMO-XML and enhance its logical consistency when generating complex scenarios, thereby fine-tuning the open-source basic large language model.

4. The automated traffic simulation method based on generating SUMO-recognizable XML from a large language model according to claim 3, characterized in that, The LoRA parameter efficient fine-tuning technique involves injecting a low-rank matrix with a rank of 8 into the attention layer of the basic large language model and freezing the original model parameters.

5. The automated traffic simulation method based on a large language model to generate SUMO-recognizable XML according to claim 1, characterized in that, In step S3, format verification includes syntax verification and semantic verification; If an error is found during the verification, the error message is fed back to the model. The model then corrects the XML text based on the error message until the format verification passes, resulting in an XML file that SUMO can recognize.

6. The automated traffic simulation method based on generating SUMO-recognizable XML from a large language model according to claim 5, characterized in that, The semantic validation uses a pre-defined SUMO semantic rule base to check the integrity of core tags, the validity of attribute values, and the validity of references in the XML file.

7. An automated traffic simulation system based on generating SUMO-recognizable XML from a large language model, characterized in that, include: The data processing and model training module is used to build and preprocess specialized datasets, and to fine-tune the basic large language model to obtain a SUMO-XML adapted large language model. The XML generation and validation module is used to receive user natural language commands, call the adaptation model to generate XML text, and iteratively correct it through syntax and semantic validation mechanisms until a valid SUMO-XML file is output. The SUMO simulation driver module is used to read valid XML files, automatically drive the SUMO software to complete the simulation, and collect and output simulation result data.

8. The automated traffic simulation system based on a large language model to generate SUMO-recognizable XML according to claim 7, characterized in that, The data processing and model training module includes: The raw XML and instruction collection submodule is responsible for collecting raw SUMO-XML files and related natural language instructions, and outputting raw data pairs; The instruction-XML pairing dataset construction submodule is used to receive raw data and construct a structured instruction-XML corresponding dataset; The dataset preprocessing and cleaning submodule is used to preprocess and clean the constructed dataset to provide high-quality training data for model training. The SUMO-XML model fine-tuning training submodule is used to fine-tune the basic large language model using cleaned training data, generating a SUMO-XML adapted large language model that can understand SUMO semantics and output corresponding XML.

9. The automated traffic simulation system based on a large language model to generate SUMO-recognizable XML according to claim 7, characterized in that, The XML generation and validation module includes: The user interface submodule is used to receive natural language commands input by the user and pass them to the downstream inference engine; The SUMO-XML model inference engine submodule is used to load and call the fine-tuned model generated by module one, and generate the initial SUMO-XML file according to user instructions; The XML syntax checking submodule is used to perform syntax compliance checks on the initialization XML output by the inference engine. The SUMO semantic rule library submodule is used to store the domain-specific semantic rules required for SUMO simulation; The XML validation and correction loop controller submodule is used to receive the initial XML, call the validator, and perform checks by combining syntax checking and semantic rule base. If errors are found, it combines and generates correction prompt words, and returns them to the model inference engine for iterative correction until a valid SUMO-XML file is generated.

10. The automated traffic simulation system based on a large language model to generate SUMO-recognizable XML according to claim 7, characterized in that, The SUMO simulation driver module includes: The simulation driver submodule is used to receive a valid SUMO-XML file from Module 2, and to drive and manage the simulation process. The SUMO simulation engine submodule, which is called by the driver program, is the core engine for performing simulations and runs the simulation based on the input XML file. The simulation data acquisition and output submodule is used to collect relevant simulation result data and output it in a formatted manner after the simulation is completed.