Data generation method, device and equipment and readable storage medium
By performing granular splitting and type statistics on the application programming interface, and combining text language models to generate API data sets, the problems of low coverage and uneven distribution in the existing technology are solved, and the high coverage and controllable distribution of the data set are achieved, providing high-quality training samples for the generative model.
Patent Information
- Application Number
- CN202411724366.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-11-28
AI Technical Summary
The prior art is difficult to generate API data sets with high coverage and customizable data distribution, resulting in poor results in generative models when learning API functions.
By splitting the application programming interface at different granularities, the type statistics results of the sub-interface are obtained to determine the generation ratio, the prompt words of the sub-interface are obtained and the text language model is input to generate data, and the instruction result pair is formed and statistics are performed until the distribution data of the data set matches the generation ratio.
It realizes that the coverage of the generated instruction result pair is more comprehensive and controllable data distribution, providing a more comprehensive and customizable training sample for the generative model.
Smart Images

Figure CN119512674A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information processing technology, and in particular to a data generation method, device, equipment and readable storage medium. Background Art
[0002] API documentation and usage guides are usually targeted at expert fields, with the goal of accurately describing the API's functionality and avoiding ambiguity. To this end, APIs are usually described and defined using standardized language and a unified format. However, when ordinary or non-professional users use APIs, they often face huge barriers to understanding, and must consult documentation to understand the API's functionality and usage. This gap in understanding significantly increases the difficulty for them to call the API correctly.
[0003] Currently, API calls and parameter settings are controlled through natural language. Due to the development of natural language processing (NLP) technology, the semantic understanding of the model and the alignment of the code are more accurate. However, although the model has excellent generalization capabilities in a wide range of fields, the data of the basic model is often difficult to cover for customized API functions. At this time, further pre-training or supervised fine-tuning (SFT) is required through a large amount of task data to enhance the model's understanding of specific fields.
[0004] In order for generative models (such as GPT) to master APIs in specific fields, they must be trained with a large number of data sets containing pairs of instructions and results (including the correspondence between input instructions and API results, where input instructions are description instructions entered by users, and API results are the instruction results of programmatic description instructions). However, the current solutions for generating such data sets have problems such as low instruction coverage and uneven data distribution, which further prevent generative models from effectively learning more comprehensive APIs.
[0005] In summary, how to effectively solve problems such as the generation of data sets for training generative models is a technical problem that technical personnel in this field urgently need to solve. Summary of the invention
[0006] The purpose of this application is to provide a data generation method, apparatus, device and readable storage medium to obtain a target data set with high instruction coverage and customizable data distribution.
[0007] In order to solve the above technical problems, this application provides the following technical solutions:
[0008] A method for generating a data set, comprising:
[0009] The application programming interface is split at different granularities to obtain multiple application programming sub-interfaces;
[0010] Performing type statistics on the plurality of application programming sub-interfaces, and determining a generation ratio based on the statistical results;
[0011] Obtain prompt words corresponding to a plurality of the application programming sub-interfaces respectively;
[0012] Inputting the prompt word into a text language model for data generation processing to obtain an instruction result pair; wherein the text language model has learned the technical documentation and usage guide of the application programming interface;
[0013] The instruction result pairs are stored in a data set, and statistics are performed on the instruction result pairs in the data set to obtain distribution data;
[0014] In a case where the distribution data matches the generation ratio, the data set is determined as a target data set.
[0015] Preferably, the application programming interface is split at different granularities to obtain multiple application programming sub-interfaces, including:
[0016] Obtaining declaration information of the application programming interface;
[0017] Based on the declaration information, determining different granularities;
[0018] The program programming interface is split at different granularities to obtain a plurality of application programming sub-interfaces.
[0019] Preferably, when the distribution data does not match the generation ratio, the method further comprises:
[0020] The data set is supplemented by reacquiring new prompt words so that the distribution data corresponding to the supplemented data set matches the generated ratio.
[0021] Preferably, the data set is supplemented by reacquiring new prompt words, including:
[0022] Comparing the distribution data with the generation ratio to determine the target type of the missing instruction-result pair;
[0023] Determine an application programming sub-interface matching the target type as a target application programming sub-interface;
[0024] Re-acquiring the prompt word corresponding to the target application programming sub-interface;
[0025] The newly acquired prompt words are input into the text language model for data generation processing to obtain a supplementary instruction result pair;
[0026] The supplemented instruction-result pair is written into the data set.
[0027] Preferably, based on the statistical results, determining the generation ratio includes:
[0028] Output the statistical results on a visual interface;
[0029] Get the input configuration information;
[0030] The generation ratio is determined using the configuration information.
[0031] Preferably, using the configuration information to determine the generation ratio includes:
[0032] The category ratios of the categories are read from the configuration information, and the generation ratio is determined based on the category ratios.
[0033] Preferably, determining whether the distribution data matches the generation ratio includes:
[0034] Using the category ratio, obtaining the subcategory ratio of the subcategories under each category;
[0035] Reading the minimum number of extension records for each subclass from the configuration information;
[0036] Determine the minimum number of records corresponding to the subcategory by using the subcategory ratio and the minimum number of expanded records;
[0037] Calculate the minimum total number of records that meet the category matching based on the minimum number of records;
[0038] Determine whether the minimum number of records, the minimum total number of records and the distribution data match;
[0039] If so, determining that the distribution data matches the generation ratio;
[0040] If not, it is determined that the distribution data does not match the generation ratio.
[0041] A data generating device, comprising:
[0042] A splitting module is used to split the application programming interface at different granularities to obtain multiple application programming sub-interfaces;
[0043] A generation ratio statistics module, used for performing type statistics on the plurality of application programming sub-interfaces, and determining a generation ratio based on the statistical results;
[0044] A prompt processing module, used for obtaining prompt words corresponding to the plurality of application programming sub-interfaces respectively;
[0045] An instruction result pair generation module, used for inputting the prompt word into a text language model for data generation processing to obtain an instruction result pair; wherein the text language model has learned the technical documentation and usage guide of the application programming interface;
[0046] An analysis module, used for storing the instruction result pairs into a data set, and performing statistics on the instruction result pairs in the data set to obtain distribution data;
[0047] A data generation module is used to determine the data set as a target data set when the distribution data matches the generation ratio.
[0048] An electronic device, comprising:
[0049] Memory for storing computer programs;
[0050] A processor is used to implement the steps of the above-mentioned data generation method when executing the computer program.
[0051] A readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned data generation method are implemented.
[0052] By applying the method provided in the embodiment of the present application, the application programming interface is split at different granularities to obtain multiple application programming sub-interfaces; type statistics are performed on the multiple application programming sub-interfaces, and a generation ratio is determined based on the statistical results; prompt words corresponding to the multiple application programming sub-interfaces are obtained; the prompt words are input into a text language model for data generation processing to obtain instruction result pairs; wherein the text language model has learned the technical documentation and user guide of the application programming interface; the instruction result pairs are stored in a data set, and the instruction result pairs in the data set are counted to obtain distribution data; when the distribution data matches the generation ratio, the data set is determined as a target data set.
[0053] The application programming interface is split at different granularities to obtain application programming sub-interfaces of different granularities. Type statistics are performed on these application programming sub-interfaces, and the generation ratio can be determined based on the statistical results. In order to make the coverage of the generated data set including instruction result pairs related to the application programming interface more comprehensive, when generating prompt words, the prompt words corresponding to these application programming sub-interfaces are obtained, and then the text language model that has learned the technical documents and user guides of the application programming interface is used to perform data generation processing to obtain instruction result pairs. The generated instruction result pairs are written into the data set, and the instruction result pairs in the data set are statistically analyzed. When the distribution data matches the production ratio, it can be determined that the data set generation is completed and the target data set is obtained.
[0054] The technical effect of the present application is as follows: when generating instruction-result pairs in a data set, by splitting the application programming interface, the instruction-result pairs can cover instructions of different granularities of the application programming interface, and by counting the application programming sub-interfaces, the generation ratio can be determined. After obtaining the distribution data of the instruction-result pairs in the data set, when it is clear that the generation ratio matches the distribution data, it is determined that the target data set is obtained, and the data distribution of the target data set finally generated can be controllable, providing comprehensive training samples with customizable data distribution for further training of generative models.
[0055] Correspondingly, the embodiments of the present application also provide a data generation device, equipment and readable storage medium corresponding to the above-mentioned data generation method, which have the above-mentioned technical effects and are not repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0057] FIG1 is a flowchart of an implementation method of a data generation method in an embodiment of the present application;
[0058] FIG2 is a schematic diagram of an implementation of a data generation method in an embodiment of the present application;
[0059] FIG3 is a schematic diagram of the structure of a data generating device in an embodiment of the present application;
[0060] FIG4 is a schematic diagram of the structure of an electronic device in an embodiment of the present application;
[0061] FIG. 5 is a schematic diagram of a specific structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0062] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0063] Please refer to FIG. 1 , which is a flow chart of a data generation method in an embodiment of the present application, and the method includes the following steps:
[0064] S101. Split the application programming interface at different granularities to obtain multiple application programming sub-interfaces.
[0065] For ease of description, the application programming interface is referred to as API, and the sub-AIP is used to refer to the application programming sub-interface. The sub-API is the sub-functional module of the corresponding API.
[0066] In the present application, different granularities may be pre-set, and then the API may be split based on the different granularities to obtain multiple sub-APIs.
[0067] For example, if the internal functions of an API are visualized as a tree structure according to the parent-child relationship and logical architecture, the path from the root node to each leaf node can correspond to a child API.
[0068] In a specific implementation of the present application, the application programming interface is split at different granularities to obtain multiple application programming sub-interfaces, including:
[0069] Step 1: Obtain declaration information of the application programming interface;
[0070] Step 2: Determine different granularities based on the declaration information;
[0071] Step 3: Split the program programming interface at different granularities to obtain multiple application programming sub-interfaces.
[0072] For ease of description, the above steps are combined for explanation below.
[0073] In this embodiment, the declaration information of the API may be obtained by reading a storage device or receiving input.
[0074] As shown in Figure 2, the declaration information may be explanatory information of the API declaration by the technician (developer). The declaration information (i.e., the root requirement) may specifically include the following features:
[0075] Description: Provide a detailed description of the overall functionality of the API, including usage scenarios and scope of application.
[0076] Type: For example, color, enumeration value, string, function, etc., clearly specify the type of the return value.
[0077] Level: Determine the level to which the current API belongs, that is, which module it is a child of.
[0078] Dependencies: Indicates whether the API needs to work with other APIs. For example, before adjusting the footer, you may need to enable the footer feature first.
[0079] Enumerable items: List the enumeration values supported by the API, such as font size (small 4, large 4, etc.) and position (top left, bottom right, etc.).
[0080] Expanded words: List the key instructions or keywords related to the current API, such as the highest, largest, and best words related to the word high.
[0081] For example, the following is the declaration information of a specific API:
[0082] {"Level 1 api": "footnote","Level 1 description": "Footnote, used for data generation","Level 1 data generation": "Data generation","Level 2 api_name": "footnote_position","Level 2 description": "Adjust the position of the footnote in the document","Level 2 type": "Enumeration value","Level 2 dependencies": ["Enable footnote"],"Level 2 enumerable items": [{"value":"Bottom left","Expanded words": ["leftbottom","Left side"]},{"value": "Bottom right","Expanded words": ["rightbottom","Right side"]},{"value": "Top","Expanded words": ["top","Top","Highest"]},{ "value": "Bottom","Expanded words": ["bottom","Bottom","Lowest"]}],"Level 2 expanded words": ["Footnote","Page footnote","Text below"],...other content}.
[0083] Based on the features in the API declaration information in the previous step, the API can be split into sub-APIs of different granularities. The splitting process specifically includes:
[0084] Type combination: Combine APIs into multiple sub-APIs based on their type, level, dependency, enumerable items, and extensions to process and generate data in a more detailed manner. For example, a complex API can be split into multiple sub-functional modules, each of which generates data independently.
[0085] Hierarchical analysis: Consider the hierarchical relationship of the API and split the top-level API from its sub-APIs to ensure that the APIs at each level are fully covered.
[0086] Through this step of splitting, the API can be operated and controlled more finely, which facilitates subsequent data processing.
[0087] For example, the declaration information of the API listed above can be split into the following three sub-APIs:
[0088] Sub-API1: {"Level 1 api":"footnote","Level 1 description":"Footnote, used for data generation","Level 1 data generation":"Data generation","Level 2 api_name":"footnote_position","Level 2 description":"Adjust the position of the footnote in the document","Level 2 type":"Enumeration value","Level 2 dependencies":["Enable footnote"],"Level 2 enumerable items":{"value":"Bottom left","Extended words":{"leftbottm"},"Level 2 extended words":["Footnote"],...other content}.
[0089] Sub-API2: {"Level 1 api":"footnote","Level 1 description":"Footnote, used for data generation","Level 1 data generation":"Data generation","Level 2 api_name":"footnote_position","Level 2 description":"Adjust the position of the footnote in the document","Level 2 type":"Enumeration value","Level 2 dependencies":["Enable footnote"],"Level 2 enumerable items":{"value":"Bottom left","Extended words":{"Left side"},"Level 2 extended words":["Page footnote"],...other content}.
[0090] Sub-API3: {"Level 1 api":"footnote","Level 1 description":"Footnote, used for data generation","Level 1 data generation":"Data generation","Level 2 api_name":"footnote_position","Level 2 description":"Adjust the position of the footnote in the document","Level 2 type":"Enumeration value","Level 2 dependencies":["Enable footnote"],"Level 2 enumerable items":{"value":"Bottom left","Extended words":{"Left side"},"Level 2 extended words":["Words below"],...other content}.
[0091] In actual applications, when generating a corresponding data set for a certain API, you can only split and subsequently process the API. When generating corresponding data sets for multiple APIs, you can split all of these APIs, or you can split and process only some of them. The actual splitting situation can be determined according to the actual training and generation model requirements, and is not limited here.
[0092] S102: Perform type statistics on multiple application programming sub-interfaces, and determine a generation ratio based on the statistical results.
[0093] After the sub-APIs are separated, the types of these sub-APIs can be counted to obtain statistical results. Based on these statistical results, the generation ratio can be determined.
[0094] After splitting out the sub-APIs, the quantity distribution information of the sub-APIs of different granularities and types can be counted. The statistical results can include the distribution of different types of sub-APIs, for example, the total number of sub-APIs, the number of sub-APIs of a certain type, and other statistical information.
[0095] After the API splitting is completed, the next step is to count the APIs of different granularities and types to obtain their quantity distribution. In this way, the distribution of the data can be clarified and provide a basis for the subsequent determination of the data ratio.
[0096] After obtaining the statistical information, you can directly specify the generation ratio based on the statistical information.
[0097] In a specific implementation of the present application, determining the generation ratio based on the statistical results includes:
[0098] Step 1: Output statistical results in the visual interface;
[0099] Step 2: Obtain input configuration information;
[0100] Step 3: Use the configuration information to determine the generation ratio.
[0101] For ease of description, the above three steps are combined for explanation below.
[0102] The statistical results can be displayed in a visual interface in the form of a list or a tree topology.
[0103] Then, the user can input configuration information according to the statistical result and actual needs. The configuration information can directly carry the generation ratio or the number of generation records of each category, so as to calculate the generation ratio based on the generation records.
[0104] In a specific implementation of the present application, using configuration information to determine the generation ratio includes:
[0105] The category ratios of each category are read from the configuration information, and the generation ratio is determined based on the category ratios.
[0106] That is to say, the generation ratio is determined directly based on the category ratio of each category. For example, if there are only three categories, A, B and C, and their ratio is 1:2:1, then the generation ratio of A, B and C can be directly 1:2:1.
[0107] S103: Obtain prompt words corresponding to a plurality of application programming sub-interfaces.
[0108] In order to enable the text language model to generate instruction result pairs for each sub-API, the prompt words corresponding to each sub-API can be obtained.
[0109] Specifically, developers can customize the design of prompt words according to the API features of different granularities. These prompt words will be combined with the API type, level, dependency, etc. to ensure that the generated data is more accurate. The design of prompt words should be refined to specific API categories to avoid interference with other API categories.
[0110] For example: a specific prompt word is as follows:
[0111] Task: Users use natural language to control the fields, properties, events, and parameters of components.
[0112] Limitations: 1. The query is an imperative statement of the user's actual needs, which should be rich and diverse and close to the user's usage habits; 2. Generate corresponding APIs for the current options and expansion words;
[0113] Note: Output in JSON format, no apology or explanation is needed, no comments are generated. Repeat, no apology or explanation is needed, no comments are generated.
[0114] Result: Use the json format to include List. Each element contains two fields: query and api. The event parameters are generated according to the content of the corresponding fields. The query is the user's natural language description, and the api is in the corresponding json format.
[0115] Example: The input is {example_input}, and the output is {example_output};
[0116] Current: Input is {d}, please output {k} results.
[0117] S104: Input the prompt word into the text language model for data generation processing to obtain an instruction result pair.
[0118] Among them, the text language model has learned the technical documentation and usage guide of the application programming interface.
[0119] It should be noted that in the embodiment of the present application, in order to enable the text language model to generate instruction result pairs based on the prompt words, the text language model can be allowed to learn the technical documentation and usage guide of the API in advance. For specific information on how to enable the text language model to learn the technical documentation and usage guide of the API, you can refer to the specific training plan of the text language model, which will not be described one by one here.
[0120] The text language model may specifically be a model such as a GPT (Generative Pretrained Transformer, i.e., a generative pre-trained Transformer, which is a language model based on a Transformer architecture) generative model.
[0121] The following takes the text language model as the GPT generation model as an example to explain in detail the generation of instruction result pairs:
[0122] The customized prompt words are input into the GPT generation model, and its powerful generation capability is used to generate a large number of structured API instruction and result pairs (i.e. instruction result pairs). This step will generate the required diversified data and provide a basis for subsequent data processing and analysis.
[0123] The instruction result pair includes the input description instruction and the coded result of the description instruction. For example, the user inputs the instruction "set the title color to red", and the coded result is {title:{color:red}}.
[0124] For example, some examples of instruction-result pairs generated by the GPT generation model are as follows:
[0125] "[{\"query\":\"Set the tab bar component to line display\",\"api\":{\"atom_tabs\":{\"type\":\"line\"}}},{\"query\":\"I want the tab bar style to be line type\",\"api\":{\"atom_tabs\":{\"type\":\"line\"}}},{\"query\":\"Modify the tab bar component to line layout\",\"api\":{\"atom_tabs\":{\"type\":\"line\"}}},{\"query\":\"Set the tab bar component to line style \",\"api\":{\"atom_tabs\":{\"type\":\"line\"}}},{\"query\":\"How to change the tab bar component to a linear display\",\"api\":{\"atom_tabs\":{\"type\":\"line\"}}},{\"query\":\"Let the tab bar component adopt a linear design\",\"api\":{\"atom_tabs\":{\"type\":\"line\"}}},{\"query\":\"Please change the tab bar to a linear style\",\"api\":{\"atom_tabs\":{\" type\":\"line\"}}},{\"query\":\"I need the tab bar component to be displayed as a line type\",\"api\":{\"atom_tabs\":{\"type\":\"line\"}}},{\"query\":\"Change the style of the tab bar component to a line type\",\"api\":{\"atom_tabs\":{\"type\":\"line\"}}},{\"query\":\"Switch the type of the tab bar component to a line type\",\"api\":{\"atom_tabs\":{\"type\":\"line\"}}},{\"quer y\":\"Set the tab bar to block type\",\"api\":{\"atom_tabs\":{\"type\":\"block\"}}},{\"query\":\"I hope the tab bar style is block type\",\"api\":{\"atom_tabs\":{\"type\":\"block\"}}},{\"query\":\"I want to change the tab bar component to block type\",\"api\":{\"atom_tabs\":{\"type\":\"block\"}}},{\"query\":\"How to make the tab bar component appear as block type\",\"api\":{\"atom_tabs\":{\"type\":\"block\"}}},{\"query\":\"Set the style of the tab bar component to block type\",\"api\":{\"atom_tabs\":{\"type\":\"block\"}}},{\"query\":\"Change the type of the tab bar component to block type\",\"api\":{\"atom_tabs\":{\"type\":\"block\"}}},{\"query\":\"Let the tab bar component display in block type\",\"api\":{\"atom _tabs\":{\"type\":\"block\"}}},{\"query\":\"I hope the tab bar component is a card type\",\"api\":{\"atom_tabs\":{\"type\":\"card\"}}},{\"query\":\"Set the tab bar component to the card type\",\"api\":{\"atom_tabs\":{\"type\":\"card\"}}},{\"query\":\"How to turn the tab bar component into a card type\",\"api\":{\"atom_tabs\":{\"type\":\"c ard\"}}},{\"query\":\"Change the style of the tab bar component to the card type\",\"api\":{\"atom_tabs\":{\"type\":\"card\"}}},{\"query\":\"I need the tab bar component to be displayed as a card type\",\"api\":{\"atom_tabs\":{\"type\":\"card\"}}},{\"query\":\"Please make the tab bar component adopt a card type layout\",\"api\":{\"atom_tabs\":{\"type\":\"card\"}}},{\"query\":\"Please make the tab bar component adopt a card type layout\",\"api\":{\"atom_tabs\":{\"type\":\"card\"}}}, ":\"Switch the type of the tab bar component to the card type\",\"api\":{\"atom_tabs\":{\"type\":\"card\"}}},{\"query\":\"Set the tab bar component to text type\",\"api\":{\"atom_tabs\":{\"type\":\"text\"}}},{\"query\":\"I want the tab bar component to be text type\",\"api\":{\"atom_tabs\":{\"type\":\"text\"}}},{\"query\":\"How to make the tab bar component appear as text type\",\"api\":{\"atom_tabs\":{\"type\":\"text\"}}},{\"query\":\"Change the style of the tab bar component to text type\",\"api\":{\"atom_tabs\":{\"type\":\"text\"}}},{\"query\":\"I need the tab bar component to be displayed as text type\",\"api\":{\"atom_tabs\":{\"type\":\"text\"}}},{\"query\":\"Let the tab bar component adopt text type design\",\"api\":{\"atom_tabs\":{ \"type\":\"text\"}}},{\"query\":\"Please set the tab bar component to text type\",\"api\":{\"atom_tabs\":{\"type\":\"text\"}}},{\"query\":\"I hope the type of the tab bar component is text type\",\"api\":{\"atom_tabs\":{\"type\":\"text\"}}},{\"query\":\"Switch the type of the tab bar component to text type\",\"api\":{\"atom_tabs\":{\"type\":\"text\"}}}]".,
[0126] S105: Store the instruction-result pairs into a data set, and perform statistics on the instruction-result pairs in the data set to obtain distribution data.
[0127] In this embodiment, a data set may be created in advance, in which the generated instruction-result pairs are stored.
[0128] In the process of generating the instruction result pairs, or after the instruction result pairs corresponding to all the prompt words are generated, the instruction result pairs in the data set may be counted to obtain distribution data of the instruction result pairs.
[0129] S106: When the distribution data matches the generation ratio, the data set is determined as a target data set.
[0130] When it is clear that the distribution data matches the generated ratio, it can be determined that the current dataset has met the requirements and the current dataset can be determined as the target dataset.
[0131] Specifically, the distribution data can be a distribution ratio calculated based on the number of instruction result pairs of different categories in the data set after the number is counted. When the distribution ratio is consistent with the generation ratio, it is determined that the distribution data matches the production ratio. Of course, the generation ratio can also be calculated with the minimum number of extended records to determine the minimum total number of records corresponding to different types. The distribution data can be specifically the total number of records corresponding to different categories. When the total number of records is greater than or equal to the minimum total number of records, it is determined that the distribution data matches the generation ratio.
[0132] By applying the method provided in the embodiment of the present application, the application programming interface is split at different granularities to obtain multiple application programming sub-interfaces; type statistics are performed on the multiple application programming sub-interfaces, and a generation ratio is determined based on the statistical results; prompt words corresponding to the multiple application programming sub-interfaces are obtained; the prompt words are input into a text language model for data generation processing to obtain instruction result pairs; wherein the text language model has learned the technical documentation and user guide of the application programming interface; the instruction result pairs are stored in a data set, and the instruction result pairs in the data set are counted to obtain distribution data; when the distribution data matches the generation ratio, the data set is determined as a target data set.
[0133] The application programming interface is split at different granularities to obtain application programming sub-interfaces of different granularities. Type statistics are performed on these application programming sub-interfaces, and the generation ratio can be determined based on the statistical results. In order to make the coverage of the generated data set including instruction result pairs related to the application programming interface more comprehensive, when generating prompt words, the prompt words corresponding to these application programming sub-interfaces are obtained, and then the text language model that has learned the technical documents and user guides of the application programming interface is used to perform data generation processing to obtain instruction result pairs. The generated instruction result pairs are written into the data set, and the instruction result pairs in the data set are statistically analyzed. When the distribution data matches the production ratio, it can be determined that the data set generation is completed and the target data set is obtained.
[0134] The technical effect of the present application is as follows: when generating instruction-result pairs in a data set, by splitting the application programming interface, the instruction-result pairs can cover instructions of different granularities of the application programming interface, and by counting the application programming sub-interfaces, the generation ratio can be determined. After obtaining the distribution data of the instruction-result pairs in the data set, when it is clear that the generation ratio matches the distribution data, it is determined that the target data set is obtained, and the data distribution of the target data set finally generated can be controllable, providing comprehensive training samples with customizable data distribution for further training of generative models.
[0135] It should be noted that, based on the above embodiments, the embodiments of the present application also provide corresponding improved solutions. In the preferred / improved embodiments, the same steps or corresponding steps as those in the above embodiments can be referenced to each other, and the corresponding beneficial effects can also be referenced to each other, which will not be described one by one in the preferred / improved embodiments of this article.
[0136] In a specific implementation of the present application, when the distribution data does not match the generation ratio, the method further includes:
[0137] The data set is supplemented by reacquiring new prompt words so that the distribution data corresponding to the supplemented data set matches the generation ratio.
[0138] That is to say, when it is found that the distribution data does not match the generation ratio, it means that the data distribution in the current data set does not meet the required generation ratio. At this time, the generation processing of the data result pair can continue, and the data set can be supplemented so that the data distribution of the supplemented data set matches the production ratio.
[0139] Specifically, the data set can be supplemented by reacquiring new prompt words, and then supplementing the data set based on the new prompt words.
[0140] In a specific implementation of the present application, the data set is supplemented by reacquiring new prompt words, including:
[0141] Step 1: Compare the distribution data with the generation ratio to determine the target type of the missing instruction-result pair;
[0142] Step 2: determining the application programming sub-interface matching the target type as the target application programming sub-interface;
[0143] Step 3: Re-acquire the prompt word corresponding to the target application programming sub-interface;
[0144] Step 4: Input the newly acquired prompt words into the text language model for data generation processing to obtain a supplementary instruction result pair;
[0145] Step 5: Write the supplemented instruction result pair into the data set.
[0146] For ease of description, the above five steps are combined for explanation below.
[0147] In this embodiment, the target type of the missing instruction result pairs can be determined by comparing the distribution data with the generation ratio. For example, assuming that the types include A, B and C, the current data distribution corresponds to a ratio of 1:2:3, and the generation ratio is 2:2:3. It can be seen that the number of instruction result pairs of type A is still missing. Therefore, type A can be determined as the target application sub-interface, and then the prompt word of type A is re-acquired, and then the instruction result pair corresponding to the prompt word is generated with the help of the text language model. For the convenience of distinction, in this embodiment, the instruction result pair generated based on the re-acquired prompt word is referred to as a supplementary instruction result pair. Then, the supplementary instruction result pair is written into the data set to supplement the data set.
[0148] After the data set is supplemented, it can be determined again whether the distribution data of the current data set is consistent with the generation ratio. If they are consistent, the target data set can be obtained; if they are inconsistent, the data in the data set can be supplemented again.
[0149] It should be noted that when the data in the dataset has met the number of records corresponding to the minimum expansion multiple, only the proportion of the distributed data does not match the generated proportion. The proportion of the distributed data in the dataset can also be matched with the generated proportion by deleting redundant data result pairs.
[0150] In a specific implementation of the present application, determining whether the distribution data matches the generation ratio includes:
[0151] Step 1: Use the category ratio to obtain the subcategory ratio of the subcategories under each category;
[0152] Step 2: Read the minimum number of extension records for each subclass from the configuration information;
[0153] Step 3: Use the sub-category ratio and the minimum number of expanded records to determine the minimum number of records corresponding to the sub-category;
[0154] Step 4: Calculate the minimum total number of records that meet the category matching based on the minimum number of records;
[0155] Step 5: Determine whether the minimum number of records, the minimum total number of records and the distribution data match;
[0156] Step 6: If yes, determine whether the distribution data matches the generated proportion;
[0157] Step 7. If not, it is determined that the distribution data does not match the generated proportion.
[0158] For ease of description, the above steps are combined for explanation below.
[0159] For category set A, A includes multiple subcategories a, b, c, d. If the category ratio is P, the ratio of each subcategory is Pa, Pb, Pc, Pd.
[0160] The minimum number of extension records required for each sub-API of each sub-category is lima, limb, limc, limd. That is, the minimum number of instruction-result pairs that the model needs to generate for each sub-API of the current sub-category.
[0161] The total number of sub-APIs is N, and the number of sub-APIs in each subcategory is Na, Nb, Nc, and Nd.
[0162] Compatibility can be determined by performing the following steps:
[0163] Step 1: Calculate the number of records that meet the minimum number requirement.
[0164] For each subcategory i in the category set A, that is, calculate the minimum number of records Mi required to satisfy each subcategory, use the minimum number of extensions limi of each sub-api of the current subcategory i, multiplied by the number of sub-APIs Ni of the current subcategory i, that is .
[0165] Step 2: Calculate the minimum total number of records that meet the matching requirement P. Calculate the minimum total number of records S for each subcategory i that meets its own matching requirement. .
[0166] Step 3: Calculate the final number of records needed for each subcategory
[0167] For each category , calculate the final number of records Si required for subcategory i, that is, .
[0168] After obtaining the final number of records required for each subcategory, and in the case of obtaining the distribution data of the data set, it can be determined whether the current statistical number of each subcategory is consistent with the final number of records. If they are consistent, it means that the distribution data matches the generated ratio. If they exceed, they can be deleted. If they are less, the data can be supplemented by supplementing the subcategory later.
[0169] For example: If there is an attribute set (i.e. a category set, in this case the attribute corresponds to the category) , and the number of records of each attribute in the original data set: ;
[0170] Ratio requirements ;
[0171] The minimum number of extension records for each sub-api is ;
[0172] Step 1: Calculate the number of records that meet the minimum expansion requirements for each subcategory a, b, c, d, namely:
[0173] , , , .
[0174] Step 2: Calculate the minimum total number of records S that meets the matching requirements: .
[0175] Step 3: Calculate the final number of records needed for each subcategory:
[0176] , , , .
[0177] Final result:
[0178] Attribute a requires 1800 records, attribute b requires 1800 records, attribute c requires 1200 records, and attribute d requires 1200 records.
[0179] Validation: The final number of records for each attribute is at least a specified multiple of the original number of records: a: 1800 > 2 * 100, b: 1800 > 3 * 200, c: 1200 = 4 * 300, d: 1200 > 3 * 400.
[0180] Final ratio: a: 1800 / 6000 = 0.3, b: 1800 / 6000 = 0.3, c: 1200 / 6000 = 0.2, d: 1200 / 6000 = 0.2.
[0181] It has been verified that the final number of records for each attribute is determined in a way that ensures that each attribute at least reaches its specified minimum expansion multiple and also meets the given ratio requirements.
[0182] In practical applications, the generated instruction result pairs can also be strictly screened to remove data with generation errors or data that does not meet the specifications, thereby ensuring that the final output data is of high quality and consistency.
[0183] After the data generation is completed, the data ratio of each API can be recalculated and compared with the previously set ratio requirements. The API with insufficient quantity can be screened out for further supplementary processing.
[0184] For APIs that are insufficient in number, customized prompt words can be used to take the existing API generation results as input to guide the model to generate new data that is different from the existing data. This helps to further enrich the diversity of the data and avoid generating similar or duplicate data.
[0185] In addition, the data can be continuously generated and optimized until the quantity and diversity requirements of all APIs are met. This iterative process ensures that the final dataset has high quality, diversity, and coverage.
[0186] To facilitate those skilled in the art to better understand and implement the data generation method provided in the embodiments of the present application, the data generation method is described in detail below with reference to relevant technical solutions and specific application scenarios as examples.
[0187] API-oriented data synthesis methods can be divided into the following three categories:
[0188] 1. Manual data construction: Create data manually, or obtain data manually generated by users by crawling historical data.
[0189] 2. Program automation generation: Through program automation, set policies for each API, automatically generate possible API results, and then reverse-annotate the corresponding input instructions.
[0190] 3. Generation based on API documentation: By building API documentation and inputting each API description, the existing open source large model is used to generate possible input and output cases to construct training data.
[0191] Among them, manually constructing data or generating it by crawling historical data has the following disadvantages:
[0192] (1) High verification cost: Each piece of data needs to be manually verified to ensure its correctness, which is time-consuming and labor-intensive.
[0193] (2) Low data generation efficiency: Relying on a large amount of manual operations, the efficiency of data generation is low and it is difficult to meet large-scale data needs.
[0194] (3) Difficulty in controlling data distribution and quantity: In terms of data size and diversity, it is difficult to perform fine-grained control through manual means, which can easily lead to data bias or insufficiency.
[0195] For automatic data generation by program, we can write a program, set a strategy for each API, automatically enumerate and generate the output results of the API, and then reverse annotate the input instructions according to the output results.
[0196] (1) High development cost: It depends on the detailed generation strategy of each API, such as color, font, preset value, etc., which requires a lot of development time and resources.
[0197] (2) Poor scalability: When adding new APIs, data types, or return values, the generation strategy needs to be redesigned and implemented, resulting in high maintenance costs.
[0198] (3) Limited flexibility: Automatically generated data is often subject to rules and is difficult to cover all possible usage scenarios of the API.
[0199] For automatic generation based on API documents and big models, by providing API documents, open source big models are used to generate API input and output sample data. There are disadvantages:
[0200] (1) Low instruction coverage: The input and output cases generated by large models often cannot fully cover all usage scenarios of the API and are prone to missing some important use cases.
[0201] (2) Unbalanced data distribution: The generated data may be biased in distribution, making it impossible to achieve comprehensive data coverage.
[0202] (3) Insufficient processing of extreme values: Less consideration is given to boundary values and abnormal situations, making it difficult to ensure the comprehensiveness of the data.
[0203] (4) Poor generalization: The generated data instructions lack flexibility and are difficult to adapt to wide applications in various API scenarios.
[0204] As can be seen from the above embodiments, the technical solution provided by this application aims to introduce features that define APIs and automatically split multiple small sub-APIs based on these features to generate dedicated business data for large model training. This method not only helps to control the distribution ratio of data, but also significantly increases the diversity and coverage of generated instructions. This allows a universal solution to automatically and controllably generate training data for multiple business parties in batches.
[0205] Specifically, this application defines a set of standard API specifications, including types, hierarchies, dependencies, enumerable items, and vocabularies, which not only provide a clear framework, but also provide a basis for subsequent automated splitting and data generation.
[0206] Based on the defined features, the API is split into different granularities, and further refined and reconstructed into sub-functional modules. This process allows for a more flexible API handling approach.
[0207] Statistics are collected on the number and distribution of APIs of different types and granularities, and the data generation ratio is calculated accordingly to control the balance and quality of the dataset.
[0208] A distributed and controllable general solution framework for APIs: By defining API features and automatically splitting them, customized and diversified generation of large model training data can be achieved. This approach allows the use of a unified framework to automatically generate business data with specific parameters and configurations for different business scenarios, while ensuring the balance and coverage of the data, improving the efficiency and quality of data generation.
[0209] Based on the target dataset generated by this application, after training the generative model, the following effects can be achieved:
[0210] Users need to use natural language to specify the corresponding components (i.e., API names) and set various parameters of the components (API parameters) to achieve quick and convenient use and increase creation efficiency.
[0211] In the front-end business construction scenario, product managers can quickly build pages and try to compare different solutions: for example, I need the tab bar component to be displayed as text type, and I want to make the third tab of the tab bar unavailable.
[0212] In the component adjustment scenario, users can quickly specify the effect without having to search for the required adjustment items in a large number of APIs: users need to use natural language to set various parameters of the component: for example, adjust the font size to size 4, enable footers, and use seasonal charts.
[0213] In the financial market chart configuration, product managers and designers can quickly compare the differences between different solutions and quickly build styles and functions for different markets: for example, the color of the candlestick chart frame uses dark red, and the cross cursor becomes blue.
[0214] Please refer to Figure 2, the specific implementation steps of this application include:
[0215] 1. Build standard API specifications: First, define a set of standard API specifications, including types, levels, dependencies, enumerable items, and extensible vocabulary. This step provides a clear framework and basis for subsequent splitting and data generation.
[0216] 2. API splitting and reconstruction: Split the API into different granularities based on the defined features. This means not only considering the functionality of the overall API, but also further refining and reconstructing the sub-functional modules therein. This helps to handle the API more flexibly and lays the foundation for subsequent data generation.
[0217] 3. Count the number and distribution: Count the number of APIs of different granularities and types to form a comprehensive data distribution chart. The purpose of this step is to ensure a clear understanding of the number and distribution of each type of API.
[0218] 4. Calculate data ratio: Based on the above distribution data, calculate the ratio required by various APIs in the data generation process. This step helps to more accurately control the amount of generated data to ensure the balance of the data set.
[0219] 5. Customized prompt word construction: Design customized prompt words for APIs of different granularities. These prompt words will be combined with specific quantity requirements to ensure that the generated data can achieve the expected results.
[0220] 6. Generate data: Use the GPT generative model to generate data based on the designed prompt words. This step takes advantage of the powerful capabilities of generative AI to generate diverse data on a large scale.
[0221] 7. Data processing and error screening: Post-process the generated data to screen and remove erroneous data. This step ensures the quality and accuracy of the final data.
[0222] 8. Data ratio calculation and API screening: Calculate the data ratio again and screen out APIs with insufficient quantity. The purpose of this step is to ensure that each API can reach the required quantity and coverage.
[0223] 9. Continue to generate data: For the APIs selected in step 8, combine the customized prompt words built in step 5, and incorporate the existing API generation results into the context to guide the model to generate new data that is different from the existing data. This step helps to complete the data ratio and ensure the diversity of rich data, avoiding duplication and uniformity.
[0224] 10. Iterative optimization: Repeat steps 6 to 9 to continuously optimize and generate data until the quantity and diversity requirements of all APIs are met.
[0225] Corresponding to the above method embodiment, the embodiment of the present application further provides a data generating device, and the data generating device described below and the data generating method described above can refer to each other.
[0226] As shown in FIG3 , the device includes the following modules:
[0227] A splitting module 101 is used to split the application programming interface at different granularities to obtain multiple application programming sub-interfaces;
[0228] A generation ratio statistics module 102 is used to perform type statistics on multiple application programming sub-interfaces and determine a generation ratio based on the statistical results;
[0229] Prompt processing module 103, used to obtain prompt words corresponding to multiple application programming sub-interfaces respectively;
[0230] The instruction result pair generation module 104 is used to input the prompt word into the text language model for data generation processing to obtain the instruction result pair; wherein the text language model has learned the technical documentation and usage guide of the application programming interface;
[0231] An analysis module 105 is used to store the instruction result pairs into a data set, and to perform statistics on the instruction result pairs in the data set to obtain distribution data;
[0232] The data generation module 106 is used to determine the data set as the target data set when the distribution data matches the generation ratio.
[0233] Using the device provided in the embodiment of the present application, the application programming interface is split at different granularities to obtain multiple application programming sub-interfaces; type statistics are performed on the multiple application programming sub-interfaces, and a generation ratio is determined based on the statistical results; prompt words corresponding to the multiple application programming sub-interfaces are obtained; the prompt words are input into a text language model for data generation processing to obtain instruction result pairs; wherein the text language model has learned the technical documentation and user guide of the application programming interface; the instruction result pairs are stored in a data set, and the instruction result pairs in the data set are counted to obtain distribution data; when the distribution data matches the generation ratio, the data set is determined as a target data set.
[0234] The application programming interface is split at different granularities to obtain application programming sub-interfaces of different granularities. Type statistics are performed on these application programming sub-interfaces, and the generation ratio can be determined based on the statistical results. In order to make the coverage of the generated data set including instruction result pairs related to the application programming interface more comprehensive, when generating prompt words, the prompt words corresponding to these application programming sub-interfaces are obtained, and then the text language model that has learned the technical documents and user guides of the application programming interface is used to perform data generation processing to obtain instruction result pairs. The generated instruction result pairs are written into the data set, and the instruction result pairs in the data set are statistically analyzed. When the distribution data matches the production ratio, it can be determined that the data set generation is completed and the target data set is obtained.
[0235] The technical effect of the present application is as follows: when generating instruction-result pairs in a data set, by splitting the application programming interface, the instruction-result pairs can cover instructions of different granularities of the application programming interface, and by counting the application programming sub-interfaces, the generation ratio can be determined. After obtaining the distribution data of the instruction-result pairs in the data set, when it is clear that the generation ratio matches the distribution data, it is determined that the target data set is obtained, and the data distribution of the target data set finally generated can be controllable, providing comprehensive training samples with customizable data distribution for further training of generative models.
[0236] In a specific implementation of the present application, the split module is specifically used to obtain declaration information of the application programming interface;
[0237] Determine different granularities based on the declared information;
[0238] At different granularities, the program programming interface is split to obtain multiple application programming sub-interfaces.
[0239] In a specific implementation of the present application, it also includes:
[0240] The supplementation module is used to supplement the data set by re-acquiring new prompt words when the distribution data does not match the generation ratio, so that the distribution data corresponding to the supplemented data set matches the generation ratio.
[0241] In a specific implementation of the present application, the supplementation module is specifically used to compare the distribution data with the generation ratio to determine the target type of the missing instruction-result pair;
[0242] determining an application programming subinterface matching the target type as a target application programming subinterface;
[0243] Re-acquire the prompt word corresponding to the target application programming sub-interface;
[0244] The newly acquired prompt words are input into the text language model for data generation processing to obtain a supplementary instruction result pair;
[0245] Write the supplemented instruction result pair into the data set.
[0246] In a specific implementation of the present application, a proportion statistics module is generated, which is specifically used to output statistical results on a visual interface;
[0247] Get the input configuration information;
[0248] Using the configuration information, determine the generation ratio.
[0249] In a specific implementation of the present application, the generation ratio statistics module is specifically used to read the category ratios of various categories from the configuration information, and determine the generation ratio based on the category ratios.
[0250] In a specific implementation of the present application, the matching judgment module is used to obtain the sub-category ratio of the sub-categories under each category by using the category ratio;
[0251] Read the minimum number of extension records for each subclass from the configuration information;
[0252] Use the subcategory ratio and the minimum number of expanded records to determine the minimum number of records corresponding to the subcategory;
[0253] Calculate the minimum total number of records that meet the category matching based on the minimum number of records;
[0254] Determine whether the minimum number of records, the minimum total number of records and the distribution data match;
[0255] If so, the distribution data is determined to match the generated proportion;
[0256] If not, it is determined that the distribution data does not match the generation scale.
[0257] Corresponding to the above method embodiment, an embodiment of the present application further provides an electronic device. The electronic device described below and the data generation method described above can refer to each other.
[0258] As shown in FIG4 , the electronic device includes:
[0259] A memory 332, for storing computer programs;
[0260] The processor 322 is used to implement the steps of the data generating method of the above method embodiment when executing a computer program.
[0261] Specifically, please refer to FIG. 5, which is a schematic diagram of the specific structure of an electronic device provided in this embodiment. The electronic device may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) (for example, one or more processors) and a memory 332, and the memory 332 stores one or more computer programs 342 or data 344. Among them, the memory 332 can be a temporary storage or a permanent storage. The program stored in the memory 332 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the data processing device. Furthermore, the processor 322 can be configured to communicate with the memory 332 to execute a series of instruction operations in the memory 332 on the electronic device 301.
[0262] The electronic device 301 may further include one or more power supplies 326 , one or more wired or wireless network interfaces 350 , one or more input and output interfaces 358 , and / or one or more operating systems 341 .
[0263] The steps in the data generating method described above can be implemented by the structure of an electronic device.
[0264] Corresponding to the above method embodiment, the embodiment of the present application further provides a readable storage medium. The readable storage medium described below and the data generation method described above can refer to each other.
[0265] A readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the data generating method of the above method embodiment.
[0266] The readable storage medium may specifically be a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or other readable storage medium that can store program codes.
[0267] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0268] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0269] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0270] Finally, it should be noted that, in this article, relationships such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms include, include or any other variations are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0271] Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A data generation method, characterized in that: include: The application programming interface is split at different granularities to obtain multiple application programming sub-interfaces; Performing type statistics on the plurality of application programming sub-interfaces, and determining a generation ratio based on the statistical results; Obtain prompt words corresponding to a plurality of the application programming sub-interfaces respectively; Inputting the prompt word into a text language model for data generation processing to obtain an instruction result pair; wherein the text language model has learned the technical documentation and usage guide of the application programming interface; Storing the instruction result pairs in a data set, and performing statistics on the instruction result pairs in the data set to obtain distribution data; In a case where the distribution data matches the generation ratio, the data set is determined as a target data set.
2. The method according to claim 1, characterized in that The application programming interface is split at different granularities to obtain multiple application programming sub-interfaces, including: Obtaining declaration information of the application programming interface; Based on the declaration information, determining different granularities; The program programming interface is split at different granularities to obtain a plurality of application programming sub-interfaces.
3. The method according to claim 1, characterized in that In the case where the distribution data does not match the generation ratio, the method further includes: The data set is supplemented by reacquiring new prompt words so that the distribution data corresponding to the supplemented data set matches the generated ratio.
4. The method according to claim 3, characterized in that The data set is supplemented by reacquiring new prompt words, including: Comparing the distribution data with the generation ratio to determine the target type of the missing instruction-result pair; Determine an application programming sub-interface matching the target type as a target application programming sub-interface; Re-acquiring the prompt word corresponding to the target application programming sub-interface; The newly acquired prompt words are input into the text language model for data generation processing to obtain a supplementary instruction result pair; The supplemented instruction-result pair is written into the data set.
5. The method according to claim 1, characterized in that: Based on the statistical results, determine the generation ratio, including: Output the statistical results on a visual interface; Get the input configuration information; The generation ratio is determined using the configuration information.
6. The method according to any one of claims 1 to 5, characterized in that: Determining the generation ratio by using the configuration information includes: The category ratios of the categories are read from the configuration information, and the generation ratio is determined based on the category ratios.
7. The method according to claim 6, characterized in that Determining whether the distribution data matches the generation ratio includes: Using the category ratio, obtaining the subcategory ratio of the subcategories under each category; Reading the minimum number of extension records for each subclass from the configuration information; Determine the minimum number of records corresponding to the subcategory by using the subcategory ratio and the minimum number of expanded records; Calculate the minimum total number of records that meet the category matching based on the minimum number of records; Determine whether the minimum number of records, the minimum total number of records and the distribution data match; If so, determining that the distribution data matches the generation ratio; If not, it is determined that the distribution data does not match the generation ratio.
8. A data generating device, characterized in that: include: A splitting module is used to split the application programming interface at different granularities to obtain multiple application programming sub-interfaces; A generation ratio statistics module, used for performing type statistics on the plurality of application programming sub-interfaces, and determining a generation ratio based on the statistical results; A prompt processing module, used for obtaining prompt words corresponding to the plurality of application programming sub-interfaces respectively; An instruction result pair generation module, used for inputting the prompt word into a text language model for data generation processing to obtain an instruction result pair; wherein the text language model has learned the technical documentation and usage guide of the application programming interface; An analysis module, used for storing the instruction result pairs into a data set, and performing statistics on the instruction result pairs in the data set to obtain distribution data; A data generation module is used to determine the data set as a target data set when the distribution data matches the generation ratio.
9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the data generation method according to any one of claims 1 to 7 when executing the computer program.
10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data generation method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
System and method for metadata-driven external interface generation of application programming interfaces
CN108701256A
Data annotation method and device, readable medium and electronic equipment
CN116127373A
End-to-end containerized big data model construction method and device, equipment and medium
CN117235527A
Real-time anomaly detection and correlation of time-series data
US20190155672A1
Cited By
Data generation method and device based on intelligent model, equipment and product
CN121765122A
A data generation method, device, equipment and product based on an intelligent model
CN121765122B