Data generation method and device, electronic equipment and storage medium
By constructing structured instruction examples and implementing quality checks, the problem of difficult data parsing generated by large language models was solved, enabling efficient generation of structured vehicle control instruction datasets, improving data utilization, and meeting the needs of large vehicle control instruction models.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHONGQING JINKANG NEW ENERGY VEHICLE CO LTD
- Filing Date
- 2026-03-30
- Publication Date
- 2026-07-03
Smart Images

Figure CN121935261B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of data processing technology, specifically relating to a data generation method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the rapid development of intelligent driving technology, the large-scale vehicle control command model has become the core path to achieve high-level intelligent driving. The training of the large-scale vehicle control command model requires a large amount of structured and high-precision command data in order to accurately understand the user's intentions and execute corresponding vehicle control operations such as air conditioning adjustment, navigation setting, and window control.
[0003] Currently, batch data generation can usually be achieved using Large Language Models (LLMs). However, since the data generated by traditional LLMs is mainly natural language and lacks unified structured constraints, even for the same vehicle control command such as turning on the air conditioner, the LLM may output multiple expressions or parameter combinations, which can easily lead to problems such as messy data formats and semantic ambiguity. The output data is difficult for downstream training channels or vehicle control systems to directly parse and utilize. A lot of manpower is required for data cleaning, alignment and formatting, and review. This relies on manual operation and is easily affected by subjective factors, resulting in low utilization of the generated data and failing to meet the requirements of large vehicle control command models for high-quality command data. Summary of the Invention
[0004] The purpose of this application is to provide a data generation method, apparatus, electronic device, and storage medium that can solve the problem that the natural language data output by current large language models is difficult to be directly parsed and utilized by downstream training channels or vehicle control systems, relies on manual operation, and results in low utilization of the generated data, which cannot meet the needs of large vehicle control command models for high-quality command data.
[0005] To solve the above-mentioned technical problems, this application is implemented as follows:
[0006] In a first aspect, embodiments of this application provide a data generation method, the method comprising:
[0007] Obtain a structured instruction example; wherein the structured instruction example is constructed based on a preset number of vehicle control instructions, and the structured instruction example includes function names and parameters;
[0008] Based on the structured instruction example, a first prompt word is determined, and initial positive example data is generated in batches according to the first prompt word;
[0009] A second prompt word is determined based on a preset negative example data type, and initial negative example data corresponding to the negative example data type is generated according to the second prompt word;
[0010] The initial positive examples and the initial negative examples are subjected to quality checks respectively to obtain valid positive examples and valid negative examples that pass the quality checks.
[0011] Based on the valid positive example data and the valid negative example data, a structured instruction dataset is obtained.
[0012] Optionally, obtaining the structured instruction example includes:
[0013] Obtain a preset number of vehicle control commands from the vehicle;
[0014] Each vehicle control command is parsed to obtain its function name and parameters.
[0015] The vehicle control commands are formatted into a structured command example using a unified template that matches function names and parameters one-to-one.
[0016] Optionally, the step of determining the first prompt word based on the structured instruction example and generating initial positive example data in batches according to the first prompt word includes:
[0017] Based on the structured instruction example, a first prompt word for generating initial positive example data is constructed; the first prompt word includes the structured instruction example and a task description for generating initial positive example data.
[0018] The first prompt word is input into a preset large language model to obtain the first positive example data output by the preset large language model in batches according to the first prompt word. The first positive example data includes function name, parameters and first query content that matches the function name and parameters.
[0019] The first query content in the first positive example data is rewritten to obtain the second positive example data;
[0020] The first positive example data and the second positive example data are determined as the initial positive example data.
[0021] Optionally, the first prompt word is input into a preset large language model to obtain the first positive example data output in batches by the preset large language model based on the first prompt word, including:
[0022] The first prompt word is input into the preset large language model, and the first query content is generated based on the structured instruction example to obtain textual positive example data;
[0023] Based on the mapping relationship between textual positive example data and structured instruction examples, the first query content, function name, and parameters are encapsulated into structured positive example data, resulting in the first positive example data output in batches by the preset large language model.
[0024] Optionally, the step of rewriting the first query content in the first positive example data to obtain the second positive example data includes:
[0025] The first query content in the first positive example data is rewritten to generate candidate query content; wherein, the rewriting includes at least one of synonym replacement, sentence transformation and content rewriting based on a preset large language model;
[0026] Verify the semantic consistency between the candidate query content and the function name and parameters in the corresponding first positive example data;
[0027] The candidate query content that passes the semantic consistency check is combined with the corresponding function name and parameters to obtain the second positive example data.
[0028] Optionally, the step of determining the second prompt word based on a preset negative example data type, and generating initial negative example data corresponding to the negative example data type according to the second prompt word, includes:
[0029] Based on the preset negative example data type, a second prompt word is constructed for generating initial negative example data; the second prompt word includes a task description for generating at least one type of initial negative example data;
[0030] The second prompt word is input into a preset large language model to obtain initial negative example data output in batches by the preset large language model based on the second prompt word; the initial negative example data includes at least one type of negative example data and a second query content corresponding to the negative example data type.
[0031] Optionally, the step of performing quality checks on the initial positive data and the initial negative data respectively to obtain valid positive data and valid negative data that pass the quality checks includes:
[0032] Based on a preset standard format, the format of the initial positive example data and the initial negative example data are checked respectively.
[0033] The initial positive example data is subjected to content checking using a preset large language model;
[0034] Initial negative data that passes the format check is determined as valid negative data, and initial positive data that passes both the format check and the content check is determined as valid positive data.
[0035] Optionally, the step of obtaining a structured instruction dataset based on the valid positive example data and the valid negative example data includes:
[0036] Based on a preset ratio of positive to negative examples, the effective positive examples and the effective negative examples are combined to obtain a structured instruction dataset.
[0037] A version number is assigned to the structured instruction dataset, and the structured instruction dataset carrying the version number is stored.
[0038] Secondly, embodiments of this application provide a data generation apparatus, the apparatus comprising:
[0039] The example acquisition module is used to acquire structured instruction examples; wherein, the structured instruction examples are constructed based on a preset number of vehicle control instructions, and the structured instruction examples include function names and parameters;
[0040] The first generation module is used to determine the first prompt word based on the structured instruction example, and generate initial positive example data in batches according to the first prompt word;
[0041] The second generation module is used to determine the second prompt word according to the preset negative example data type, and generate initial negative example data corresponding to the negative example data type according to the second prompt word;
[0042] The data detection module is used to perform quality detection on the initial positive data and the initial negative data respectively, and obtain valid positive data and valid negative data that pass the quality detection.
[0043] A dataset construction module is used to obtain a structured instruction dataset based on the valid positive example data and the valid negative example data.
[0044] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the data generation method as described in the first aspect.
[0045] Fourthly, embodiments of this application provide a readable storage medium storing a program or instructions that, when executed by a processor, implement the steps of the data generation method as described in the first aspect.
[0046] The data generation method provided in this application involves obtaining structured instruction examples, wherein the structured instruction examples are constructed based on a preset number of vehicle control instructions, and the structured instruction examples include function names and parameters. A first prompt word is determined based on the structured instruction examples. Initial positive example data is generated in batches according to the first prompt word. A second prompt word is determined based on a preset negative example data type. Initial negative example data corresponding to the negative example data type is generated according to the second prompt word. Quality checks are performed on the initial positive example data and the initial negative example data respectively to obtain valid positive example data and valid negative example data that pass the quality check. Based on the valid positive example data and the valid negative example data, a structured instruction dataset is obtained. This application embodiment utilizes a small number of structured instruction examples formatted from vehicle control instructions to generate positive example data in batches according to predetermined instruction data formats and requirements. It also constructs negative example data by category and automatically performs quality checks on both positive and negative example data to obtain a standardized and diverse dataset of structured vehicle control instructions. The automated process of batch generation, quality inspection, and construction of high-quality structured datasets enables large-scale, low-cost instruction data generation. The structured vehicle control instruction data can be directly parsed and utilized by downstream model training channels or vehicle control systems without relying on manual operation and intervention, greatly improving data utilization and further meeting the needs of large-scale vehicle control instruction models for high-quality instruction data.
[0047] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, specific embodiments of this application are given below. Attached Figure Description
[0048] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0049] Figure 1 This is a flowchart illustrating the steps of a data generation method provided in an embodiment of this application;
[0050] Figure 2 yes Figure 1 A flowchart of step 101 in a data generation method provided in this application embodiment;
[0051] Figure 3 yes Figure 1 A flowchart of step 102 in a data generation method provided in this application embodiment;
[0052] Figure 4 yes Figure 1 A flowchart of step 103 in a data generation method provided in this application embodiment;
[0053] Figure 5 yes Figure 1 A flowchart of step 104 in a data generation method provided in this application embodiment;
[0054] Figure 6 This is a flowchart illustrating a data generation method provided in an embodiment of this application;
[0055] Figure 7 This is a schematic diagram of the structure of a data generation device provided in an embodiment of this application;
[0056] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0057] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0058] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0059] The data generation method, apparatus, electronic device, and storage medium provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.
[0060] Reference Figure 1 The flowchart illustrates the steps of a data generation method provided in an embodiment of this application. The method may include:
[0061] Step 101: Obtain a structured instruction example; wherein, the structured instruction example is constructed based on a preset number of vehicle control instructions, and the structured instruction example includes function names and parameters.
[0062] In this embodiment, to meet the data requirements of the large-scale controllable command model for the vehicle, a data processor, data processing system, or data processing platform is used to generate and expand the set of command data required for the large-scale controllable command model for the vehicle. In this embodiment, the data processor, data processing system, or data processing platform can be deployed on the vehicle, or it can be in the cloud, on a server, etc. This embodiment takes the vehicle as the executing entity as an example for explanation.
[0063] In this embodiment, to obtain a standardized and diverse high-quality vehicle control command dataset, the vehicle first acquires structured command examples. These structured command examples are constructed based on a preset number of vehicle control commands. Each structured command example includes a function name and parameters. Specifically, each structured command example includes a function name (function_name) and a parameter (param), formed according to a unified template of function_name(param). The function name (function_name) refers to the core operation or control function to be executed as reflected in the vehicle control command, and the parameter (param) refers to the specific value, object name, or state of the core operation or control function to be executed as reflected in the vehicle control command. For example, if the vehicle control command is to turn on the air conditioning to the cooling mode at 25°C, then the corresponding function name (function_name) is "turn on the air conditioning," and the parameter (param) is "25°C for the cooling mode." The structured instruction examples are used to guide the generation of positive example data, ensuring that the generated data is structured and standardized. Based on the characteristics of vehicle control instructions, a preset number of vehicle control instructions are structured and split into two parts: function_name and param, to obtain structured instruction examples. The preset number can be set or adjusted according to actual needs. This embodiment does not limit the specific number of structured instruction examples.
[0064] In this embodiment, the structured instruction examples are constructed based on a preset number of vehicle control instructions. The quality and representativeness of the structured instruction examples directly affect the quality of the subsequently generated data. Their function names and parameters jointly define the target semantic space for subsequent data generation. Vehicle control instructions can be formatted into structured instruction examples according to a pre-defined unified template that corresponds one-to-one with function names and parameters. For example, the unified template can be in the form of function_name(param). Representative vehicle control instructions are selected manually or from vehicle control systems such as the CAN bus database, vehicle function list, or standardized instruction libraries from automakers. These vehicle control instructions are then parsed in a structured manner and uniformly represented in the format of function_name(param). A specific example: the original vehicle control instruction "Open the driver's side window to 50%" is formatted into the structured instruction example open_window(position=driver, level=50).
[0065] Step 102: Determine the first prompt word based on the structured instruction example, and generate initial positive example data in batches according to the first prompt word.
[0066] In this embodiment of the application, in order to meet the requirement of training and learning the large-scale vehicle controllable command model based on a large amount of high-quality structured command data, it is necessary to generate a standardized and diverse vehicle control command dataset. The vehicle control command dataset includes positive example data and negative example data. The construction of positive example data and negative example data directly determines the output quality and safety boundary of the model. Positive example data refers to correct and appropriately granular control commands or data under given requirements, vehicle status and environment. Negative example data refers to control commands or data that do not meet expectations, are erroneous, risky or unsafe.
[0067] In this embodiment, the first prompt word is determined based on the structured instruction example, and the model is used to generate initial positive example data in batches using the first prompt word. This embodiment can use the few-shot batch generation method for initial positive example data. Here, few-shot (small sample learning) refers to a method that allows the model to understand the task and complete the work through a very small number of examples. The first prompt word includes the structured instruction example and the task description used to generate initial positive example data, which is used to guide the model to generate data according to the predetermined instruction data format and requirements.
[0068] In this embodiment, a pre-set Large Language Model (LLM) can be used to generate positive example data in batches. The pre-set Large Language Model is a deep learning model trained on massive amounts of text data with a parameter scale of over 100 million. Based on its vast language knowledge and understanding of structured instruction examples, it can execute the instructions in the first prompt word and output the required instruction data in batches. This embodiment does not limit the processing procedure of the pre-set Large Language Model.
[0069] In specific implementation, structured instruction examples are used as few-sample examples. A clear task description is attached to each structured instruction example, and a clear, explicit, and demand-rich first prompt word is constructed to guide the large language model to generate positive example data according to the predetermined instruction data format and requirements. The first prompt word includes the structured instruction example and the task description used to generate the initial positive example data. For example, the constructed first prompt word could be, "You are a professional in-vehicle instruction data generation expert. Based on the template of the given structured instruction example above, generate 50 natural language queries for training the large vehicle control model and their corresponding structured instruction data." The words are input into a preset large language model. Based on its understanding of structured instruction examples, the preset large language model outputs the first positive example data in batches. The first positive example data includes the function name, parameters, and the first query content that matches the function name and parameters. The first query content query is a natural language expression of the user's intent. Each query content corresponds to function_name and param in the positive example data. The format of the first positive example data can be "function_name": "Adjust the car air conditioning temperature", "param": 25, "query": "Adjust the car temperature to 25 degrees".
[0070] Step 103: Determine the second prompt word based on the preset negative example data type, and generate initial negative example data corresponding to the negative example data type according to the second prompt word.
[0071] In this embodiment of the application, in order to construct negative sample data for training to distinguish boundaries and resist interference, initial negative sample data is constructed in stages according to the preset negative sample data type to improve the robustness of the model. In the specific implementation, the second prompt word is determined according to the preset negative example data type, and the initial negative example data is generated using the second prompt word. The core criterion is the difficulty of boundary differentiation, and the negative example data types are divided into simple negative examples, medium negative examples, and difficult negative examples. Each negative example data type corresponds to a different prompt word. According to the preset negative example data type, the second prompt word used to generate the negative example data is determined. The second prompt word is input into the preset large language model, and the large language model outputs multiple types of initial negative example data in batches according to the second prompt word. The initial negative example data includes at least one type of negative example data and the second query content corresponding to the negative example data type. The initial negative example data includes simple negative example data, medium negative example data, and difficult negative example data. The negative example data types are stratified according to the degree of error, such as minor error, medium error, and serious error. The initial negative example data is generated level by level, which can cover errors of different difficulties and types. The trained model can more accurately identify and distinguish various types of errors, and improve the robustness and accuracy of the model.
[0072] In this embodiment, simple negative examples include vehicle control commands completely unrelated to the current vehicle control category, as well as commands from non-vehicle control domains such as travel and entertainment categories. Medium negative examples refer to commands that are completely unexecutable for the current category; for example, using unsupported function commands as negative examples, or incorrectly classifying vehicle control commands from other categories into the current category. Difficult negative examples focus on boundary cases and easily confused expressions, such as changing the parameters of commands in the current vehicle control category to values outside a reasonable range, or using expressions highly related to the current category but actually unexecutable. Corresponding prompt words are constructed for each type of negative example data. For example, for difficult negative examples, the second prompt word could be: "Based on opening the car window, please generate some user questions with unreasonable parameter values or ambiguous expressions, and output 50 natural language query contents and their corresponding structured command data for training the large-scale vehicle control model," thereby generating various types of negative example data in batches.
[0073] Step 104: Perform quality checks on the initial positive and negative data respectively to obtain valid positive and negative data that pass the quality checks.
[0074] In this embodiment of the application, the construction of positive and negative example data directly determines the output quality and safety boundary of the model. The initial positive and negative example data are subjected to quality checks to ensure that the data meets the expected format and content standards. The quality checks include format checks and content checks. Data that passes the quality checks will be considered valid data.
[0075] In this embodiment, based on a preset standard format, format checks are performed on the initial positive example data and the initial negative example data respectively. The standard format of the initial positive example data typically includes a unified expression of the function name, parameters, and query content. The purpose of the format check is to ensure that the expression of the initial positive example data conforms to the format of the structured instruction paradigm, improving data consistency and readability. The standards for the format check of the initial positive example data include: whether the function_name is accurate, whether the param matches the function_name, and whether the param value is within the expected range. The format check of the initial negative example data ensures that the query content of the negative example data corresponds to the negative example data type. Furthermore, a large language model is used to perform content checks on the initial positive example data. The purpose of the content check is to ensure that the query content of the positive example data is semantically consistent with the function name and parameters, avoiding semantic deviation or ambiguity. Therefore, the initial negative example data that passes the format check is determined to be valid negative example data, and the initial positive example data that passes both the format check and the content check is determined to be valid positive example data.
[0076] Step 105: Based on the valid positive example data and the valid negative example data, obtain the structured instruction dataset.
[0077] In this embodiment, valid positive and negative examples that have passed quality inspection are combined and merged to form a final structured instruction dataset. This structured instruction dataset will be used for training and inference of the vehicle control model. Specifically, according to a preset ratio of positive to negative examples, valid positive and negative examples are combined to generate a structured instruction dataset. A version number is assigned to the generated structured instruction dataset, and the dataset carrying the version number is stored. The version number is used to identify different versions of the dataset. The ratio of positive to negative examples is typically determined based on model training requirements and data balance requirements to ensure dataset diversity. The preset ratio of positive to negative examples can be flexibly configured.
[0078] The data generation method provided in this application involves obtaining structured instruction examples, wherein the structured instruction examples are constructed based on a preset number of vehicle control instructions, and the structured instruction examples include function names and parameters. A first prompt word is determined based on the structured instruction examples. Initial positive example data is generated in batches according to the first prompt word. A second prompt word is determined based on a preset negative example data type. Initial negative example data corresponding to the negative example data type is generated according to the second prompt word. Quality checks are performed on the initial positive example data and the initial negative example data respectively to obtain valid positive example data and valid negative example data that pass the quality check. Based on the valid positive example data and the valid negative example data, a structured instruction dataset is obtained. This application embodiment utilizes a small number of structured instruction examples formatted from vehicle control instructions to generate positive example data in batches according to predetermined instruction data formats and requirements. It also constructs negative example data by category and automatically performs quality checks on both positive and negative example data to obtain a standardized and diverse dataset of structured vehicle control instructions. The automated process of batch generation, quality inspection, and construction of high-quality structured datasets enables large-scale, low-cost instruction data generation. The structured vehicle control instruction data can be directly parsed and utilized by downstream model training channels or vehicle control systems without relying on manual operation and intervention, greatly improving data utilization and further meeting the needs of large-scale vehicle control instruction models for high-quality instruction data.
[0079] Reference Figure 2 , showed Figure 1 A flowchart of step 101 in a data generation method is provided. This method is basically the same as the data generation method provided in the embodiments of this application, except that step 101 may include:
[0080] Sub-step 1011: Obtain a preset number of vehicle control commands from the vehicle side;
[0081] Sub-step 1012: Parse each vehicle control command to obtain the function name and parameters of the vehicle control command;
[0082] Sub-step 1013: Format the vehicle control commands into structured command examples according to the unified template that corresponds one-to-one between function names and parameters.
[0083] In this embodiment, a preset number of vehicle control commands are obtained from the vehicle. Each command is parsed to obtain its function name and parameters. Then, following a unified template where function names and parameters correspond one-to-one, the vehicle control commands are formatted into a structured command example. These vehicle control commands can be commonly used function commands in the vehicle control system, defined by the vehicle manufacturer or user requirements. Commands can be manually input or extracted from the vehicle control system, such as the CAN bus database, vehicle function list, or the automaker's standardized command library. In this embodiment, a small number of vehicle control commands are used to construct the structured command example. Therefore, a preset number of vehicle control commands are obtained from the vehicle. This preset number is determined based on the construction requirements, such as the core functional scenarios to be covered, ensuring the representativeness of the example. The specific number can be adjusted according to actual needs and is not specifically limited here.
[0084] In practice, a predetermined number of raw, non-standardized vehicle control commands are transformed into structured command examples with a unified format and clear semantics, providing a precise guiding template for the subsequent generation of large-scale data. Therefore, each acquired vehicle control command is parsed to extract the function name (function_name) and parameters (param). The function name is the core functional description of the vehicle control command, and the parameters are the input values or conditions required to implement the function. Each raw vehicle control command is parsed to identify its core function and the limiting conditions or operation objects of the core function, obtaining the function name and parameters of each vehicle control command. Following a pre-defined unified template that corresponds one-to-one between function name and parameter, the vehicle control command is formatted into a structured command example. For example, the unified template can be in the form of function_name(param). The parsed function name and parameters of the vehicle control command are formatted according to the unified template to form a structured command example.
[0085] This application's embodiments format vehicle control commands into a unified structured command template, ensuring the standardization and consistency of command data. This provides a clear template for the subsequent generation and construction of positive example data, improving data quality and processing efficiency, and reducing labor costs.
[0086] Reference Figure 3 , showed Figure 1 A flowchart of step 102 in a data generation method is provided. This method is basically the same as the data generation method provided in the embodiments of this application, except that step 102 may include:
[0087] Sub-step 1021: Based on the structured instruction example, construct a first prompt word for generating initial positive example data; the first prompt word includes the structured instruction example and a task description for generating initial positive example data;
[0088] Sub-step 1022: Input the first prompt word into the preset large language model to obtain the first positive example data output by the preset large language model in batches according to the first prompt word. The first positive example data includes the function name, parameters, and the first query content that matches the function name and parameters.
[0089] Sub-step 1023: Rewrite the first query content in the first positive example data to obtain the second positive example data;
[0090] Sub-step 1024: Determine the first positive example data and the second positive example data as the initial positive example data.
[0091] In this embodiment, to achieve standardization and data diversity in the vehicle control command dataset, a small number of structured command examples are used to guide the model to generate positive example data in batches. The scale of the positive example data is expanded through diversified rewriting. Specifically, based on the structured command examples, a first prompt word is constructed to generate initial positive example data. The first prompt word includes the structured command examples and a task description for generating the initial positive example data. The first prompt word is input into a preset large language model to obtain the first positive example data output in batches by the preset large language model based on the first prompt word. Simultaneously, the first query content in the first positive example data can be rewritten to obtain second positive example data. The first and second positive example data are determined as the initial positive example data. That is, the initial positive example data includes the positive example data output by the preset large language model and the rewritten positive example data.
[0092] In this embodiment, a clear, explicit, and demand-rich first prompt word can be constructed based on a structured instruction example to guide the preset large language model to generate positive example data according to the predetermined instruction data format and requirements. The first prompt word for generating initial positive example data includes a structured instruction example and a task description for generating the initial positive example data. The structured instruction example reflects the expected data format of the model output, and the task description for the initial positive example data guides the model to generate data according to the predetermined instruction data format and requirements. The preset large language model used in this embodiment is a deep learning model trained on massive amounts of text data with a parameter scale exceeding hundreds of millions. Based on its vast language knowledge and understanding of the structured instruction example, the preset large language model outputs the required positive example data in batches according to the first prompt word. This embodiment does not limit the processing procedure of the preset large language model.
[0093] In the specific implementation, based on the structured instruction examples, a first prompt word is constructed to generate initial positive example data. This allows the use of a small number of structured instruction examples to guide the preset large language model to generate expected positive example data. For example, the constructed first prompt word could be "You are a professional in-vehicle instruction data generation expert. Based on the template of the given structured instruction examples above, generate 50 natural language queries for training the vehicle control large model and their corresponding structured instruction data." Therefore, the first prompt word is input into the preset large language model to obtain the first positive example data output in batches based on the first prompt word. The first positive example data includes the function name, parameters, and the first query content matching the function name and parameters. The format of the first positive example data could be "function_name": "Adjust the in-vehicle air conditioning temperature", "param": 25, "query": "Adjust the in-vehicle temperature to 25 degrees".
[0094] In this embodiment, by constructing a first prompt word, it is ensured that the positive example data generated by the preset large language model is consistent with the format of the structured instruction example. The first prompt word is input into the preset large language model to generate the first positive example data in batches. This realizes the goal of guiding the preset large language model to generate positive example data with a small number of samples, which improves the data diversity and generalization ability, and ensures the efficient generation of positive example data. At the same time, the guidance of the first prompt word ensures the accuracy and diversity of the generated positive example data.
[0095] To expand the positive example data, this embodiment, while keeping the function names and parameters of the first positive example data unchanged, rewrites the first query content in the first positive example data to obtain the second positive example data. The diverse rewriting methods include at least one of synonym replacement, sentence structure transformation, and content rewriting based on a preset large language model, which will not be elaborated upon here. The first and second positive example data are determined as the initial positive example data. By merging the first and second positive example data, diverse initial positive example data is formed, expanding the scale of the positive example data, improving data generalization ability, and ensuring the richness of the structured instruction dataset.
[0096] This application's embodiments utilize a small number of structured instruction examples to guide a preset large language model to generate positive example data in batches, thereby improving data generation efficiency. Furthermore, by rewriting and expanding positive example data in various ways, it achieves efficient generation of positive example data, improving data quality and processing efficiency.
[0097] In some embodiments of this application, sub-step 1022, inputting the first prompt word into a preset large language model to obtain the first positive example data output in batches by the preset large language model based on the first prompt word, includes:
[0098] Sub-step 01: Input the first prompt word into the preset large language model, generate the first query content based on the structured instruction example, and obtain textual positive example data;
[0099] Sub-step 02: Based on the mapping relationship between textual positive example data and structured instruction examples, the first query content, function name, and parameters are encapsulated into structured positive example data to obtain the first positive example data output in batches by the preset large language model.
[0100] In this embodiment, Function Call is used to enable a pre-defined large language model to build high-quality structured positive example data in batches. Specifically, the first prompt word is input into the pre-defined large language model, and the first query content is generated based on the structured instruction example, resulting in textual positive example data. Since the output of the pre-defined large language model is natural language description data, in order to ensure the construction of high-quality structured positive example data, in this embodiment, Function Call refers to the pre-defined large language model calling a predefined function tool to perform specific operations. Given a structured instruction example, it generates what the user might ask, that is, it generates the first query content, resulting in textual positive example data. Then, according to the mapping relationship between the textual positive example data and the structured instruction example, the first query content, function name, and parameters are encapsulated into structured positive example data, thereby obtaining the first positive example data output in batches by the pre-defined large language model.
[0101] This application embodiment encapsulates textual positive example data into structured positive example data, enabling the batch generation of structured positive example data according to predetermined instruction data formats and requirements, ensuring data consistency and accuracy, and meeting the needs of the vehicle control instruction large model for high-quality instruction data.
[0102] In some embodiments of this application, sub-step 1023, rewriting the first query content in the first positive example data to obtain the second positive example data, includes:
[0103] Sub-step 01: Rewrite the first query content in the first positive example data to generate candidate query content; wherein, the rewriting includes at least one of synonym replacement, sentence transformation and content rewriting based on a preset large language model;
[0104] Sub-step 02: Verify the semantic consistency between the candidate query content and the function name and parameters in the corresponding first positive example data;
[0105] Sub-step 03: Combine the candidate query content that has passed the semantic consistency check with the corresponding function name and parameters to obtain the second positive example data.
[0106] In this embodiment of the application, in order to expand the scale of positive example data and improve the generalization ability of the data, the first query content in the first positive example data is rewritten in a diversified manner to generate the second positive example data. Specifically, the first query content in the first positive example data is rewritten to generate candidate query content. The rewritten query content does not all meet the requirements. Therefore, it is necessary to verify the semantic consistency between the candidate query content and the corresponding function name and parameter in the first positive example data. The candidate query content that passes the semantic consistency verification is combined with the corresponding function name and parameter to obtain the second positive example data, ensuring that the rewritten query content and the function name and parameter maintain semantic consistency, while improving the diversity and generalization ability of the positive example data.
[0107] In this embodiment, the first query content in the first positive example data is rewritten to generate candidate query content. The rewriting method includes at least one of synonym replacement, sentence structure transformation, and content rewriting based on a preset large language model. The purpose of rewriting is to expand the expression of the first query content and improve the diversity of the positive example data without changing the function name and parameters. Specifically, synonym replacement refers to replacing some words in a sentence with words of the same or similar meaning while maintaining the basic structure and core meaning of the original sentence. For example, if the original first query content is "set the air conditioning temperature to 25 degrees," then the query content after synonym replacement could be "set the air conditioning temperature to 25 degrees," "set the car's air conditioning temperature to 25 degrees," "set the air conditioning temperature to 25 degrees Celsius," etc. Sentence transformation refers to maintaining complete semantic consistency while changing the grammatical structure, word order, or expression of a sentence. For example, it can involve changing active, passive, or interrogative sentence structures. The original query might be "Navigate to a certain community," but the transformed query could be "Can you navigate to a certain community?" or "How do I get to a certain community?". Content rewriting based on a pre-defined large language model generates new query content without changing the function name or parameters.
[0108] In this embodiment, to ensure that the rewritten query content is semantically consistent with the function name and parameters, and to avoid semantic deviation or ambiguity, this embodiment performs semantic consistency verification on the candidate query content and the corresponding function name and parameters in the first positive example data. Through semantic consistency verification, the semantic consistency between the rewritten query content and the function name and parameters is ensured, improving the quality of the rewritten positive example data. The candidate query content that passes the semantic consistency verification is combined with the corresponding function name and parameters to form the second positive example data. The second positive example data is high-quality positive example data that has been rewritten and verified.
[0109] This application embodiment achieves the expansion and generation quality assurance of positive example data by rewriting positive example data in a variety of ways and ensuring the semantic consistency of the rewritten positive example data, thereby improving the diversity and generalization ability of the dataset, and realizing the automatic construction of high-quality data.
[0110] Reference Figure 4 , showed Figure 1 A flowchart of step 103 in a data generation method is provided. This method is basically the same as the data generation method provided in the embodiments of this application, except that step 103 may include:
[0111] Sub-step 1031: Based on the preset negative example data type, construct a second prompt word for generating initial negative example data; the second prompt word includes a task description for generating at least one type of initial negative example data;
[0112] Sub-step 1032: Input the second prompt word into the preset large language model to obtain the initial negative example data output in batches by the preset large language model based on the second prompt word; the initial negative example data includes at least one type of negative example data and the second query content corresponding to the negative example data type.
[0113] In this embodiment, the construction of positive and negative example data directly determines the output quality and safety boundary of the model. Negative example data refers to control instructions or data that are unexpected, erroneous, risky, or unsafe. Negative example data is used to train the model to identify unexecutable or erroneous instructions. In specific implementation, based on a preset negative example data type, a second prompt word is constructed to generate initial negative example data. The second prompt word is input into a preset large language model to obtain multiple types of initial negative example data output in batches by the large language model based on the second prompt word. The initial negative example data includes at least one type of negative example data and a second query content corresponding to the negative example data type.
[0114] In this embodiment, based on a preset negative example data type, hierarchical initial negative example data is generated. The negative example data is used to train the model to identify unexecutable or erroneous instructions. Therefore, according to the preset negative example data type, a second prompt word for generating initial negative example data is first constructed. The second prompt word includes a task description for generating at least one type of initial negative example data. The difficulty level of the boundary distinction can be used as the core criterion to classify the negative example data type. The negative example data type includes simple negative examples, medium negative examples, and difficult negative examples. For example, simple negative example data includes vehicle control instructions that are completely unrelated to the current vehicle control category, as well as instructions from non-vehicle control fields such as travel and entertainment categories. Medium negative example data refers to instructions that are completely unexecutable for the current category. For example, using function instructions that are not supported under the current category as negative examples, or incorrectly classifying vehicle control instructions from other categories into the current category. Difficult negative example data refers to focusing on boundary cases and easily confused expressions, such as changing the instruction parameters of the current vehicle control category to values that are outside the reasonable range, or using expressions that are highly related to the current category but are actually unexecutable.
[0115] In this embodiment, the second prompt word needs to be constructed based on the characteristics of the negative example data type to guide the preset large language model to generate hierarchical initial negative example data that meets expectations. For example, the second prompt word needs to be constructed based on the negative example data type so that the preset large language model can query or generate negative example data that satisfies the second prompt word and corresponds to the negative example data type. Specifically, the second prompt word is input into the preset large language model to obtain multiple types of initial negative example data output in batches by the large language model based on the second prompt word. The initial negative example data includes at least one type of negative example data and the second query content corresponding to the negative example data type. The initial negative example data includes simple negative example data, medium negative example data, and difficult negative example data, forming a diverse initial negative example dataset, ensuring the richness of the dataset, and providing high-quality negative samples for subsequent model training.
[0116] This application embodiment constructs and generates negative example data. The hierarchical system of negative example data covers all scenarios from those unrelated to vehicle control commands to those with blurred boundaries, improving the robustness and usability of the dataset, achieving efficient generation of negative example data, improving data quality and processing efficiency, and reducing labor costs.
[0117] Reference Figure 5 , showed Figure 1 A flowchart of step 104 in a data generation method is provided. This method is basically the same as the data generation method provided in the embodiments of this application, except that step 104 may include:
[0118] Sub-step 1041: Based on the preset standard format, perform format checks on the initial positive example data and the initial negative example data respectively;
[0119] Sub-step 1042: Use a pre-defined large language model to perform content checks on the initial positive example data;
[0120] Sub-step 1043 determines the initial negative data that passes the format check as valid negative data, and determines the initial positive data that passes both the format check and the content check as valid positive data.
[0121] In this embodiment of the application, the initial positive example data and the initial negative example data are subjected to quality checks to ensure that the data conforms to the preset standard format and content requirements. Specifically, based on the preset standard format, the initial positive example data and the initial negative example data are checked for format respectively, and the initial positive example data are checked for content using a preset large language model. Thus, the initial negative example data that passes the format check is determined as valid negative example data, and the initial positive example data that passes both the format check and the content check is determined as valid positive example data.
[0122] The standard format of initial positive example data typically includes a unified expression of function name, parameters, and query content. The purpose of format checking for initial positive example data is to ensure that its expression conforms to the structured instruction paradigm, improving data consistency and readability. The format checking criteria for initial positive example data include: whether function_name is accurate, whether param matches function_name, and whether param values are within the expected range. The format checking of initial negative example data ensures that the query content of the negative example data corresponds to the negative example data type. Furthermore, a large language model is used to perform content checking on the initial positive example data. The purpose of content checking is to ensure that the query content of the positive example data is semantically consistent with the function name and parameters, avoiding semantic deviation or ambiguity. Therefore, initial negative example data that passes the format check is determined to be valid negative example data, and initial positive example data that passes both the format and content checks is determined to be valid positive example data.
[0123] It should be noted that the format check does not require a model; it is directly based on the standard implementation for format checks of the initial positive and negative example data. Specifically, during the generation and filtering of negative example data, it can automatically identify format problems such as incorrect data type classification, ambiguous boundaries, or unclear expression in the negative example data. By correcting the classification labels of the negative example data, adjusting the difficulty of the negative example data, or removing unqualified negative example data, the validity of the negative example data is ensured. The content check is implemented through an intelligent agent of a pre-defined large language model constructed from rules. By evaluating the rationality, relevance, and ability to solve practical problems of the initial positive example data, it focuses on whether the first query content (query) in the initial positive example data exceeds the expected range and the consistency between the first query content (query) and function_name(param). Through content check, it ensures that the query content of the positive example data is semantically consistent with the function name and parameters.
[0124] In this embodiment, initial negative data that passes the format check is determined as valid negative data, and initial positive data that passes both the format and content checks is determined as valid positive data. By automatically detecting the format or content of the generated data, data with format discrepancies, semantic deviations, or potential ambiguities is automatically removed or corrected, ensuring that all positive and negative data meet their respective expected standards. The combination of format and content checks balances efficiency and quality, achieving automatic and comprehensive quality checks on initial positive and negative data, and filtering out valid positive and negative data.
[0125] This application's embodiments avoid formatting errors and semantic deviations through format and content checks, ensuring the high quality and consistency of the dataset, achieving efficient data quality checks and guarantees, and providing a high-quality data foundation for subsequent model training.
[0126] In some embodiments of this application, step 105, based on valid positive example data and valid negative example data, obtains a structured instruction dataset, which may specifically include the following steps:
[0127] Based on a preset ratio of positive to negative examples, valid positive and negative examples are combined to obtain a structured instruction dataset.
[0128] Assign a version number to the structured instruction dataset and store the structured instruction dataset carrying the version number.
[0129] In this embodiment, a structured instruction dataset is generated based on the obtained valid positive and negative example data, and version management is performed on the structured instruction dataset. Specifically, the valid positive and negative example data are combined according to a preset positive-negative example data ratio to generate the structured instruction dataset. The setting of the positive-negative example data ratio is typically determined based on model training requirements and data balance requirements to ensure dataset diversity. The preset positive-negative example data ratio can be flexibly configured and supports arbitrary combinations; no specific limitations are imposed here.
[0130] In this embodiment, based on a preset ratio of positive to negative examples, valid positive and negative examples are combined to obtain a structured instruction dataset. A version number is assigned to the generated structured instruction dataset, and the dataset carrying the version number is stored. The version number is used to identify different versions of the dataset, facilitating subsequent traceability and management. Storage methods can include databases, file systems, or other storage media. By assigning version numbers and storing the dataset, version management of the data is achieved, facilitating subsequent traceability and maintenance, and improving the management efficiency of the dataset.
[0131] In some embodiments of this application, the combined structured instruction dataset can also be manually inspected. Specifically, a full inspection is performed on key category data, and a sampling inspection is performed on non-key category data to ensure the overall quality and security of the structured instruction dataset. Specifically, for positive and negative example data, key category data is manually verified item by item, and non-key category data is sampled and reviewed proportionally. Key category data can be vehicle control instruction data that is frequently used by users in vehicle control and affects driving safety, while non-key category data is vehicle control instruction data that is less frequently used by users in vehicle control and has a smaller impact on driving safety. These will not be elaborated on here.
[0132] This application embodiment ensures the diversity and balance of the dataset by setting a preset ratio of positive and negative examples, realizes the construction and version management of structured instruction datasets, significantly improves the efficiency of dataset construction and management, reduces manual costs, and provides reliable data support for subsequent model training.
[0133] To facilitate understanding of the data generation method provided in the embodiments of this application by those skilled in the art, please refer to Figure 6This diagram illustrates a flowchart of a data generation method provided in an embodiment of this application. For example: based on a preset number of vehicle control commands, positive example data and negative example data are constructed respectively. The construction of positive and negative example data directly determines the output quality and safety boundary of the model. Specifically, based on structured command examples, a first prompt word is constructed to generate initial positive example data, thereby using a small number of structured command examples to guide a preset large language model to generate initial positive example data that meets expectations. Initial negative example data is constructed in a graded manner according to the difficulty level of boundary distinction. The initial negative example data includes simple negative example data, medium negative example data, and difficult negative example data. Difficult negative example data; quality checks are performed on the initial positive and negative example data separately. Based on a preset standard format, the initial positive and negative example data undergo format checks, and the initial positive example data undergoes content checks. The initial negative example data that passes the format check is determined as valid negative example data, and the initial positive example data that passes both the format and content checks is determined as valid positive example data. This ensures that all positive and negative example data meet the expected standards. The combined and merged instruction data is manually checked, and finally a structured instruction dataset is generated, a version number is assigned, and the dataset carrying the version number is stored.
[0134] Reference Figure 7 The diagram shows a structural schematic of a data generation apparatus provided in an embodiment of this application. The apparatus includes:
[0135] Example acquisition module 201 is used to acquire structured instruction examples; wherein, the structured instruction examples are constructed based on a preset number of vehicle control instructions, and the structured instruction examples include function names and parameters;
[0136] The first generation module 202 is used to determine the first prompt word according to the structured instruction example, and generate initial positive example data in batches according to the first prompt word;
[0137] The second generation module 203 is used to determine a second prompt word based on a preset negative example data type, and generate initial negative example data corresponding to the negative example data type according to the second prompt word;
[0138] Data detection module 204 is used to perform quality detection on the initial positive data and the initial negative data respectively, and obtain valid positive data and valid negative data that pass the quality detection;
[0139] The dataset construction module 205 is used to obtain a structured instruction dataset based on the valid positive example data and the valid negative example data.
[0140] Optionally, the example acquisition module 201 includes:
[0141] The acquisition submodule is used to acquire a preset number of vehicle control commands from the vehicle.
[0142] The parsing submodule is used to parse each of the vehicle control commands to obtain the function name and parameters of the vehicle control commands;
[0143] The formatting submodule is used to format the vehicle control commands into structured command examples according to a unified template that corresponds one-to-one with the function name and parameters.
[0144] Optionally, the first generation module 202 includes:
[0145] The first construction submodule is used to construct a first prompt word for generating initial positive example data based on the structured instruction example; the first prompt word includes the structured instruction example and a task description for generating initial positive example data.
[0146] The first processing submodule is used to input the first prompt word into a preset large language model to obtain the first positive example data output by the preset large language model in batches according to the first prompt word. The first positive example data includes function name, parameters and first query content matching the function name and parameters.
[0147] The rewrite submodule is used to rewrite the first query content in the first positive example data to obtain the second positive example data;
[0148] The first determining submodule is used to determine the first positive example data and the second positive example data as the initial positive example data.
[0149] Optionally, the first processing submodule includes:
[0150] The first processing unit is used to input the first prompt word into a preset large language model, generate the first query content based on the structured instruction example, and obtain textual positive example data;
[0151] The second processing unit is used to encapsulate the first query content, function name, and parameters into structured positive example data based on the mapping relationship between textual positive example data and structured instruction examples, so as to obtain the first positive example data output in batches by the preset large language model.
[0152] Optionally, the rewrite submodule includes:
[0153] The generation unit is used to rewrite the first query content in the first positive example data to generate candidate query content; wherein, the rewriting includes at least one of synonym replacement, sentence transformation and content rewriting based on a preset large language model;
[0154] The verification unit is used to verify the semantic consistency between the candidate query content and the function name and parameters in the corresponding first positive example data;
[0155] The combination unit is used to combine the candidate query content that has passed the semantic consistency check with the corresponding function name and parameters to obtain the second positive example data.
[0156] Optionally, the second generation module 203 includes:
[0157] The second construction submodule is used to construct a second prompt word for generating initial negative example data based on a preset negative example data type; the second prompt word includes a task description for generating at least one type of initial negative example data;
[0158] The second processing submodule is used to input the second prompt word into a preset large language model to obtain the initial negative example data output by the preset large language model in batches according to the second prompt word; the initial negative example data includes at least one type of negative example data and a second query content corresponding to the negative example data type.
[0159] Optionally, the data detection module 204 includes:
[0160] The first inspection submodule is used to perform format checks on the initial positive example data and the initial negative example data respectively based on a preset standard format.
[0161] The second inspection submodule is used to perform content inspection on the initial positive example data using a preset large language model;
[0162] The second determination submodule is used to determine the initial negative sample data that passes the format check as valid negative sample data, and to determine the initial positive sample data that passes both the format check and the content check as valid positive sample data.
[0163] Optionally, the dataset construction module 205 includes:
[0164] The third processing submodule is used to combine the effective positive data and the effective negative data based on a preset ratio of positive and negative data to obtain a structured instruction dataset.
[0165] The storage submodule is used to assign a version number to the structured instruction dataset and store the structured instruction dataset carrying the version number.
[0166] The data generation apparatus provided in this application embodiment can implement the various processes of the data generation method in the above embodiments of this application. To avoid repetition, it will not be described again here.
[0167] The data generation apparatus provided in this application embodiment acquires structured instruction examples, wherein the structured instruction examples are constructed based on a preset number of vehicle control instructions. The structured instruction examples include function names and parameters. A first prompt word is determined according to the structured instruction examples. Initial positive example data is generated in batches according to the first prompt word. A second prompt word is determined according to a preset negative example data type. Initial negative example data corresponding to the negative example data type is generated according to the second prompt word. The initial positive example data and the initial negative example data are subjected to quality checks respectively to obtain valid positive example data and valid negative example data that pass the quality check. Based on the valid positive example data and the valid negative example data, a structured instruction dataset is obtained. This application embodiment utilizes a small number of structured instruction examples formatted from vehicle control instructions to generate positive example data in batches according to predetermined instruction data formats and requirements. It also constructs negative example data by category and automatically performs quality checks on both positive and negative example data to obtain a standardized and diverse dataset of structured vehicle control instructions. The automated process of batch generation, quality inspection, and construction of high-quality structured datasets enables large-scale, low-cost instruction data generation. The structured vehicle control instruction data can be directly parsed and utilized by downstream model training channels or vehicle control systems without relying on manual operation and intervention, greatly improving data utilization and further meeting the needs of large-scale vehicle control instruction models for high-quality instruction data.
[0168] Reference Figure 8 This application also provides an electronic device, such as... Figure 8 As shown, it includes a processor 301, a communication interface 302, a memory 303, and a communication bus 304, wherein the processor 301, the communication interface 302, and the memory 303 communicate with each other through the communication bus 304.
[0169] Processor 301, memory 303 for storing processor-executable instructions;
[0170] The processor 301 is configured to execute the instructions to implement the data generation method described above.
[0171] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0172] The communication interface is used for communication between the aforementioned terminal and other devices.
[0173] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0174] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0175] In another embodiment provided in this application, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements any of the data generation methods described in the above embodiments.
[0176] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0177] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0178] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0179] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.
Claims
1. A data generation method, characterized in that, The method includes: Obtain a structured instruction example; wherein the structured instruction example is constructed based on a preset number of vehicle control instructions, and the structured instruction example includes function names and parameters; The process involves determining a first prompt word based on the structured instruction example, and generating initial positive example data in batches according to the first prompt word. This includes: constructing a first prompt word for generating initial positive example data based on the structured instruction example; inputting the first prompt word into a preset large language model; and obtaining the first positive example data output in batches by the preset large language model based on the first prompt word. The initial positive example data includes the first positive example data, and the first prompt word includes the structured instruction example and a task description for generating the initial positive example data. The second prompt word is determined according to the preset negative example data type. According to the second prompt word, the initial negative example data corresponding to the negative example data type is generated. The initial negative example data is obtained by inputting the second prompt word into the preset large language model for batch output. The initial negative example data includes at least one type of negative example data and the second query content corresponding to the negative example data type. The initial positive examples and the initial negative examples are subjected to quality checks respectively to obtain valid positive examples and valid negative examples that pass the quality checks. Based on the valid positive example data and the valid negative example data, a structured instruction dataset is obtained.
2. The method according to claim 1, characterized in that, The acquisition of structured instruction examples includes: Obtain a preset number of vehicle control commands from the vehicle; Each vehicle control command is parsed to obtain its function name and parameters. The vehicle control commands are formatted into a structured command example using a unified template that matches function names and parameters one-to-one.
3. The method according to claim 1, characterized in that, The first positive example data includes a function name, parameters, and a first query content matching the function name and parameters. The step of determining the first prompt word based on the structured instruction example and generating initial positive example data in batches according to the first prompt word includes: The first query content in the first positive example data is rewritten to obtain the second positive example data; The first positive example data and the second positive example data are determined as the initial positive example data.
4. The method according to claim 1, characterized in that, The first prompt word is input into a preset large language model to obtain the first positive example data output in batches by the preset large language model based on the first prompt word, including: The first prompt word is input into the preset large language model, and the first query content is generated based on the structured instruction example to obtain textual positive example data; Based on the mapping relationship between textual positive example data and structured instruction examples, the first query content, function name, and parameters are encapsulated into structured positive example data, resulting in the first positive example data output in batches by the preset large language model.
5. The method according to claim 3, characterized in that, The step of rewriting the first query content in the first positive example data to obtain the second positive example data includes: The first query content in the first positive example data is rewritten to generate candidate query content; wherein, the rewriting includes at least one of synonym replacement, sentence transformation and content rewriting based on a preset large language model; Verify the semantic consistency between the candidate query content and the function name and parameters in the corresponding first positive example data; The candidate query content that passes the semantic consistency check is combined with the corresponding function name and parameters to obtain the second positive example data.
6. The method according to claim 1, characterized in that, The step of determining a second prompt word based on a preset negative example data type, and generating initial negative example data corresponding to the negative example data type according to the second prompt word, includes: Based on the preset negative example data type, a second prompt word is constructed for generating initial negative example data; the second prompt word includes a task description for generating at least one type of initial negative example data; The second prompt word is input into a preset large language model to obtain the initial negative example data output by the preset large language model in batches based on the second prompt word.
7. The method according to claim 1, characterized in that, The step of performing quality checks on the initial positive and negative data respectively to obtain valid positive and negative data that pass the quality checks includes: Based on a preset standard format, the format of the initial positive example data and the initial negative example data are checked respectively. The initial positive example data is subjected to content checking using a preset large language model; Initial negative data that passes the format check is determined as valid negative data, and initial positive data that passes both the format check and the content check is determined as valid positive data.
8. The method according to claim 1, characterized in that, The structured instruction dataset obtained based on the valid positive example data and the valid negative example data includes: Based on a preset ratio of positive to negative examples, the effective positive examples and the effective negative examples are combined to obtain a structured instruction dataset. A version number is assigned to the structured instruction dataset, and the structured instruction dataset carrying the version number is stored.
9. A data generation device, characterized in that, The device includes: The example acquisition module is used to acquire structured instruction examples; wherein, the structured instruction examples are constructed based on a preset number of vehicle control instructions, and the structured instruction examples include function names and parameters; A first generation module is configured to determine a first prompt word based on the structured instruction example, and generate initial positive example data in batches according to the first prompt word. The first generation module includes: a first construction submodule, configured to construct a first prompt word for generating the initial positive example data based on the structured instruction example; and a first processing submodule, configured to input the first prompt word into a preset large language model to obtain the first positive example data output in batches by the preset large language model based on the first prompt word. The initial positive example data includes the first positive example data, and the first prompt word includes a structured instruction example and a task description for generating the initial positive example data. The second generation module is used to determine the second prompt word according to the preset negative example data type, and generate initial negative example data corresponding to the negative example data type according to the second prompt word. The initial negative example data is obtained by inputting the second prompt word into the preset large language model for batch output. The initial negative example data includes at least one type of negative example data and the second query content corresponding to the negative example data type. The data detection module is used to perform quality detection on the initial positive data and the initial negative data respectively, and obtain valid positive data and valid negative data that pass the quality detection. A dataset construction module is used to obtain a structured instruction dataset based on the valid positive example data and the valid negative example data.
10. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to execute the instructions to implement the data generation method as described in any one of claims 1 to 8.
11. A readable storage medium, characterized in that, A computer program is stored on the readable storage medium, which, when executed by a processor, implements the data generation method as described in any one of claims 1 to 8.