Training data generation method and related equipment
By generating diverse training data through clustering and guided constraints, the problem of monotonous training data in existing technologies is solved, thereby improving the diverse understanding ability and accuracy of natural language processing models.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2026-04-03
AI Technical Summary
The existing training datasets are relatively homogeneous, which means that natural language processing models can only understand a single way of expressing ideas and cannot adapt to diverse user expressions.
The seed data is divided into multiple clusters by clustering algorithm, and diverse target seed data is selected. Diverse training data is generated based on guiding constraints and guiding templates. The generated results are filtered by combining credibility verification and voting mechanism to ensure the diversity and reliability of the data.
It improves the understanding ability of natural language processing models, enabling them to adapt to diverse user expressions and enhancing the model's performance and accuracy.
Smart Images

Figure CN121787481A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer science, and in particular to methods and equipment for generating training data. Background Technology
[0002] Natural Language Processing (NLP) is an important branch of computer science and artificial intelligence that focuses on enabling computers to understand and process human language. NLP can be applied in various scenarios, such as voice assistants on mobile phones. These assistants recognize the user's speech and convert it into commands, allowing the phone to perform corresponding tasks. For example, if a user says, "Check the weather for region A tomorrow," the voice assistant will recognize the speech, convert it into a command, and the phone will check the weather and display it to the user.
[0003] However, to enable NLP to better understand the meaning expressed by users, it is necessary to rely on high-quality datasets to improve model performance. In existing methods of acquiring datasets, the acquired datasets are usually relatively homogeneous, and a single instruction may only have one way of being expressed. As a result, the trained NLP can only understand a single way of expressing the instruction. For example, NLP can only understand "the weather in region A tomorrow", but cannot understand "please help me check the weather conditions for region A tomorrow". Summary of the Invention
[0004] This application provides a training data generation method and related equipment, which can ensure the diversity of training data, thereby improving model performance.
[0005] Firstly, some embodiments of this application provide a training data generation method. This training data generation method may include: determining multiple target seed data from multiple seed clusters in a seed pool, wherein the seed clusters are obtained by clustering the seed pool using a clustering algorithm, and each seed cluster includes one or more seed data, with seed data in the same seed cluster having the same representation type; determining a guiding constraint corresponding to each target seed data, the guiding constraint being used to constrain the output of a first model; determining a first guiding principle corresponding to each target seed data, the first guiding principle being obtained by concatenating a guiding template, guiding constraints, and target seed data, the guiding template being used to provide an output framework for the first model; and obtaining first data corresponding to one or more target seed data based on the first model and the first guiding principle corresponding to each target seed data, the first data being used to train a second model, and the second model being used for natural language processing.
[0006] By selecting target seed data from different seed clusters in the above manner, the representation type of the selected seed data is diversified. The first guide is obtained by splicing the target seed data, so the first data obtained based on the first guide and the first model is also diverse, which ensures the diversity of training data. In this way, the second model obtained by training with the first data can improve the model performance.
[0007] In one possible implementation, based on the first model and the first guide corresponding to each target seed data, one or more first data corresponding to the target seed data are obtained, including: inputting the first guide corresponding to each target seed data into the first model to obtain the generation result corresponding to each target seed data; performing a credibility verification on the generation result corresponding to each target seed data to obtain one or more first data corresponding to the target seed data.
[0008] By using the above method, the credibility of the generated results of the first model is verified, ensuring that the first data used to train the second model are all reliable and valid data.
[0009] In one possible implementation, the credibility of the generated results corresponding to each target seed data is verified to obtain one or more first data corresponding to the target seed data. This includes: voting on the generated results corresponding to each target seed data from preset dimensions based on a third model to obtain the voting results of the generated results corresponding to each target seed data. The preset dimensions include: the naturalness of the generated results, and / or intent slot verification, and / or whether the generated results meet the guidance requirements; and obtaining one or more first data corresponding to the target seed data based on the voting results of the generated results corresponding to each target seed data.
[0010] By using the above method, a third model is introduced to vote on the generated results corresponding to each target seed data through different dimensions, thereby accurately filtering all generated results to obtain the first data and training the first model.
[0011] In one possible implementation, before determining multiple target seed data from multiple seed clusters in the seed pool, the method further includes: determining the distance between a first seed data in the seed pool and the cluster center of an existing seed cluster in the seed pool, wherein the first seed data is seed data in the seed pool that has not yet been clustered; if a first seed cluster exists, then the first seed data is added to the first seed cluster, and the cluster center of the first seed cluster is updated, wherein the distance between the cluster center of the first seed cluster and the first seed data is less than a first distance threshold; if a first seed cluster does not exist, then a new seed cluster is constructed for the first seed data.
[0012] By calculating the distance between the un-clustered seed data and the cluster centers of existing seed clusters, the seed cluster to which the un-clustered seed data should be assigned can be accurately determined. If there is no seed cluster that meets the requirements, a new seed cluster is added for the seed data, thereby achieving accurate clustering of all seed data in the seed pool.
[0013] In one possible implementation, determining the distance between the first seed data in the seed pool and the cluster centers of existing seed clusters in the seed pool includes: determining the distance between the first seed data in the seed pool and the cluster centers of existing seed clusters in the seed pool based on a distance function, wherein the distance function is a function determined based on the task scenario.
[0014] By using the above methods, different distance functions are customized for different task scenarios, thereby performing different clustering for different task scenarios. This makes the training data more targeted, and the final trained model can be better adapted to different tasks.
[0015] In one possible implementation, the first data is added to a second seed cluster based on the distance between the cluster center of the seed cluster in the seed pool and the first data, wherein the distance between the cluster center of the second seed cluster and the first data is less than a second distance threshold.
[0016] By using the above method, the seed data in the second seed cluster is dynamically updated, making the seed pool richer.
[0017] Secondly, this application provides a training data generation apparatus. This apparatus can be an electronic device, a device within an electronic device, or a device compatible with an electronic device. The apparatus can also be a chip system. The training data generation apparatus can execute the methods performed by the electronic device in the first aspect. The functions of the training data generation apparatus can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more units corresponding to the aforementioned functions. These units can be software and / or hardware. The operations performed by the training data generation apparatus and its beneficial effects can be found in the methods and effects described in the first aspect above; repetitions will not be repeated.
[0018] Thirdly, this application provides an electronic device including one or more processors and one or more memories. The one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, including computer instructions, which, when executed by the one or more processors, cause the electronic device to perform the training data generation method in any possible implementation of the first aspect described above.
[0019] Fourthly, this application provides a chip system including a processor and an interface, the processor and the interface being coupled; the interface is used to receive or output signals, and the processor is used to execute code instructions to perform the training data generation method in any possible implementation of the first aspect above.
[0020] Fifthly, this application provides a computer-readable storage medium storing a computer program / instructions that, when the computer program product is run on a computer, cause the computer to execute the training data generation method in any possible implementation of the first aspect described above.
[0021] Sixthly, this application provides a computer program product that, when run on a computer, causes the computer to execute the training data generation method in any possible implementation of the first aspect above. Attached Figure Description
[0022] Figure 1 A flowchart illustrating a training data generation method provided in an embodiment of this application;
[0023] Figure 2A A schematic diagram of a guide template provided in an embodiment of this application;
[0024] Figure 2B A schematic diagram illustrating a credibility verification method provided in an embodiment of this application;
[0025] Figure 2C A flowchart illustrating another training data generation method provided in this application embodiment;
[0026] Figure 2D A schematic diagram of a voice-activated intelligent assistant provided in an embodiment of this application;
[0027] Figure 3 This is a hardware schematic diagram of a terminal device provided in an embodiment of this application;
[0028] Figure 4 This application provides a schematic diagram of the software architecture of a terminal device.
[0029] Figure 5 This is a schematic diagram of the structure of a training data generation device provided in an embodiment of this application;
[0030] Figure 6 This is a schematic diagram of the structure of a chip provided in an embodiment of this application. Detailed Implementation
[0031] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; "and / or" in the text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.
[0032] It should be understood that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0033] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this application can be combined with other embodiments.
[0034] The following is a description of some of the technical terms used in this application, including:
[0035] I. Large Language Model (LLM)
[0036] Large language models, also known as big models or large-scale language models, are a type of artificial intelligence model designed to understand and generate human language. They are trained on massive amounts of text data and can perform a wide range of tasks, including text summarization, translation, sentiment analysis, and more. A key characteristic of LLMs is their sheer size, containing billions of parameters that help them learn complex patterns in language data.
[0037] In the application of LLM, prompts can guide the LLM to generate specific text content. These prompts, also known as cue words, aim to convey the intended purpose or required task type to the model in an efficient and precise way, enabling the model to generate corresponding text, images, and other forms of response based on these prompts.
[0038] II. Natural Language Processing (NLP)
[0039] Natural Language Processing (NLP) is a subfield of computer science, information engineering, and artificial intelligence, focusing on human-computer language interaction and exploring how to process and utilize natural language. This NLP can be applied to voice assistants in mobile phones. These assistants can understand the user's speech and convert it into corresponding commands. For example, after activating the voice assistant, a user might say, "Send a text message to colleague A, telling them that documents need to be prepared tomorrow." The voice assistant, after recognizing the user's words, will automatically send the corresponding text message to colleague A.
[0040] The training data generation method provided in the embodiments of this application is further described below: Please refer to Figure 1 As shown, Figure 1 This is a flowchart illustrating a training data generation method provided in an embodiment of this application. The training data generation method includes the following steps 101-104. Figure 1 The method shown can be executed by an electronic device. Or Figure 1 The subject of the method shown can be a chip or chip system in an electronic device, but this application does not limit it. Figure 1 The method will be explained using an electronic device as the executing entity. Specifically:
[0041] 101. The electronic device determines multiple target seed data from multiple seed clusters in the seed pool. The seed cluster is obtained by clustering the seed pool based on a clustering algorithm. The seed cluster includes one or more seed data, and the seed data in the same seed cluster are of the same representation type.
[0042] The seed pool stores multiple seed data, which are expressions of one or more standards corresponding to one or more instructions. One instruction can correspond to one seed data, or one instruction can correspond to multiple seed data.
[0043] For example, regarding command A (query the weather), the seed pool can correspond to the following seed data: "query the weather for region A tomorrow", "Please help me query the weather for region A tomorrow", "Weather for region A tomorrow". These three seed data represent the same command, and they are the standard expressions for command A.
[0044] Optionally, different expression types refer to the same instruction but expressed in different ways. For example, the expression type for querying the weather is more complex in the seed data "Please help me query the weather for region A tomorrow," while the expression type for "Tomorrow's weather for region A" is more concise.
[0045] Optionally, seed data within the same seed cluster may have the same representation type, while seed data in different seed clusters may have different representation types. For example, seed data A in seed cluster A and seed data C in seed cluster A may have the same representation type, while seed data A in seed cluster A and seed data C in seed cluster B may have different representation types.
[0046] Optionally, a seed data belongs to one and only one seed cluster. That is, a seed data cannot belong to two different seed clusters at the same time, and a seed data will only exist in one seed cluster.
[0047] Optionally, the seed data in the same seed cluster are of the same representation type, and the seed data in the same seed cluster are seed data corresponding to one or more instructions.
[0048] For example, the seed pool includes the following seed clusters: Seed cluster A (simple expression type): "Tomorrow's weather in region A", "8 o'clock alarm", "Navigate to region B"; Seed cluster B (complex expression type): "Please help me check the weather in region A tomorrow", "Please set an alarm for me to go off at 8 o'clock tomorrow morning", "Navigate to region B for me".
[0049] Optionally, the seed data in the same seed cluster are of the same representation type, and the seed data in the same seed cluster are the seed data corresponding to the same instruction.
[0050] In one possible embodiment, the electronic device determines multiple target seed data from multiple seed clusters in a seed pool, specifically by uniformly selecting multiple target seed data from multiple seed clusters in the seed pool. Alternatively, for a given selection, the electronic device can determine multiple target seed data from multiple seed clusters in the seed pool based on previously selected seed clusters and seed selection rules, whereby the seed selection rules include uniformly selecting seed data from each seed cluster.
[0051] For example, the seed pool includes three seed clusters: seed cluster A, seed cluster B, and seed cluster C. If an electronic device needs to select three seed data, it arbitrarily selects one seed data from seed cluster A, arbitrarily selects one seed data from seed cluster B, and arbitrarily selects the same seed data from seed cluster C.
[0052] Alternatively, when the electronic device needs to select seed data (currently the fifth selection), it first determines the previously selected seed clusters (assuming the seed clusters selected in the previous four selections are: seed cluster A, seed cluster B, and seed cluster C). Since seed cluster A was selected twice, while seed clusters B and C were each selected only once, the fifth selection will choose seed data from either seed cluster B or seed cluster C. If any seed data from seed cluster B was selected in the fifth selection, the next time the electronic device selects seed data (the sixth selection), it will choose any seed data from seed cluster C.
[0053] In one possible embodiment, for a particular selection of seed data from the seed pool, the electronic device can determine the target seed cluster from multiple seed clusters in the seed pool based on previously selected seed clusters and seed selection rules; the electronic device then determines the target seed data from the target seed cluster based on previously selected seed data.
[0054] This is understandable; that is, after identifying the target seed cluster, target seed data that has not been selected before can be chosen from that target seed cluster.
[0055] For example, when selecting seed data for the fifth time, the previously selected seed clusters are first determined (assuming the seed clusters selected in the first four times are: seed cluster A, seed cluster B, and seed cluster C). For the fifth time, seed cluster B is selected as the target seed cluster. Seed cluster B includes the following three seed data: seed data 1, seed data 2, and seed data 3. Since seed data 1 has been selected before, seed data 2 is selected as the target seed data (or seed data 3 is selected as the target seed data) for the fifth time.
[0056] Since the seed pool is clustered, and seed data within the same seed cluster share the same representation type while data in different seed clusters differ, determining multiple target seed data from multiple seed clusters in the seed pool can enrich the representation types of the target seed data, covering various representation types. The seed pool is pre-initialized and divided into multiple seed clusters based on a clustering algorithm. The clustering process of this seed pool is described below:
[0057] In one possible embodiment, before the electronic device determines multiple target seed data from multiple seed clusters in a seed pool, the method further includes: the electronic device determining the distance between a first seed data in the seed pool and the cluster center of an existing seed cluster in the seed pool, wherein the first seed data is seed data in the seed pool that has not yet been clustered; if a first seed cluster exists, the electronic device adds the first seed data to the first seed cluster and updates the cluster center of the first seed cluster, wherein the distance between the cluster center of the first seed cluster and the first seed data is less than a first distance threshold; if a first seed cluster does not exist, the electronic device constructs a new seed cluster for the first seed data.
[0058] The cluster center of the seed cluster is determined based on all the seed data in the seed cluster. The first distance threshold can be a preset default value or a value set based on the current task scenario.
[0059] In other words, for seed data in the seed pool that has not yet been clustered, the distance between the first seed data and the existing seed clusters in the seed pool is calculated. If the distance between the first seed data and a seed cluster is less than a first distance threshold, the first seed data is assigned to that seed cluster. If no seed cluster is less than the first distance threshold, a new seed cluster is constructed for the first seed data.
[0060] Optionally, if there are multiple seed clusters and the distance between the first seed data and the first seed data is less than the first distance threshold, that is, if there are multiple first seed clusters, select the seed cluster with the smallest distance and assign the first seed data to the seed cluster with the smallest distance.
[0061] For example, suppose the seed pool currently contains the following seed clusters: seed cluster A, seed cluster B, and seed cluster C. The distance between the first seed data and seed cluster B is L1, and the distance between the first seed data and seed cluster C is L2. Both L1 and L2 are less than the first distance threshold, and L1>L2. Then the first seed data is assigned to seed cluster C.
[0062] Optionally, seed pool clustering is complete when all seed data in the seed pool has been assigned to seed clusters.
[0063] In one possible embodiment, the electronic device determines the distance between the first seed data in the seed pool and the cluster center of an existing seed cluster in the seed pool, including: the electronic device determines the distance between the first seed data in the seed pool and the cluster center of an existing seed cluster in the seed pool based on a distance function, wherein the distance function is a function determined based on the task scenario.
[0064] Optionally, different task scenarios have different focuses in the text, and the same two texts may use different distance functions to calculate different similarities.
[0065] For example, suppose we have two texts: text A "Check tomorrow's weather" and text B "Check the weather the day after tomorrow". Using distance function A, which focuses on actions, text A is seen as "Check the weather for data" and text B is also seen as "Check the weather for data". In other words, the distance between text A and text B calculated by distance function A is 0 (or the similarity is 1). Text A and text B are the same in the eyes of distance function A.
[0066] Assuming we use distance function B, which focuses on entities, then text B appears as "tomorrow" in the eyes of distance function B, and as "the day after tomorrow" in the eyes of distance function B. In other words, the distance between text A and text B calculated using distance function B is 0.5 (or the similarity is 0.5), and text A and text B are different in the eyes of distance function B.
[0067] Therefore, different distance functions can be used depending on the task scenario, or rather, on the different focus requirements of the task (e.g., the focus is on actions, or the focus is on entities). In other words, different distance functions result in different focuses on the text. Therefore, different distance functions can be customized based on different task scenarios to achieve different focuses in different task scenarios.
[0068] Optionally, before the electronic device determines the distance between the first seed data in the seed pool and the cluster centers of existing seed clusters in the seed pool based on the distance function, the method may further include: the electronic device determining the distance function based on the task scenario and the mapping relationship between the task scenario and the distance function. The mapping relationship between the task scenario and the preset function may be pre-set.
[0069] Optionally, the distance function can also be an existing distance function, such as model-based vector similarity, edit distance, etc. Specifically, the vector similarity can be standardized Euclidean distance, relative entropy, cosine similarity, etc.
[0070] Optionally, the distance function includes: a self-supervised learning method based on contrastive learning to train the embedding model, and using the similarity of the embeddings as the distance function. This embedding similarity can specifically be cosine similarity or standardized Euclidean distance.
[0071] Optionally, the loss function of this embedding model can satisfy the following formula:
[0072]
[0073] Here, the loss represents the loss value of the embedding model. The smaller the loss value, the better the training effect of the embedding model.
[0074] In one possible embodiment, the seed pool clustering process can also be the following:
[0075] First, let the seed pool be S = {S1, S2...S}. n Let S1 be the seed data. n is the total number of data in the seed pool. When performing clustering on the seed pool, first read a seed data S1 from the seed pool, and use this seed data S1 to construct a new seed cluster C1, such that C1 = {S1}.
[0076] Then set i = 2 to represent the index of the currently read seed data. Calculate the distance between S2 and the existing seed cluster C1. If the distance between S2 and the existing seed cluster C1 is less than the first distance threshold, then add S2 to the seed cluster C1, C1 = {S1, S2}.
[0077] Then set i=3, calculate the distance between S3 and the existing seed cluster C1. If the distance between S3 and the existing seed cluster C1 is greater than or equal to the first distance threshold, then construct a new seed cluster C2 for S3, C2={S3}.
[0078] Next, set i=4, and calculate the distance between S4 and the existing seed cluster C1 and the distance between S4 and the existing seed cluster C2 respectively. If the distance between S4 and the existing seed cluster C1 is less than the first distance threshold, and the distance between S4 and the existing seed cluster C2 is less than the first distance threshold, then select the seed cluster C with the smallest distance. min ,Right now Add S4 to the seed cluster with the smallest distance. Assume C min If the value is C2, then add S4 to C2.
[0079] When i > n, clustering is complete, and all seed data in the seed pool has been assigned to the corresponding seed clusters. At this point, the initialization of the seed pool is complete.
[0080] 102. The electronic device determines the guiding constraints corresponding to each target seed data, and the guiding constraints are used to constrain the output of the first model.
[0081] The guiding constraints are used to constrain the output of the first model. Optionally, the electronic device determines the guiding constraints corresponding to each target seed data point by selecting the guiding constraints corresponding to each target seed data point from a preset set of guiding constraints. This selection can be random, meaning the electronic device randomly selects the guiding constraints corresponding to the target seed data point from the set of guiding constraints each time.
[0082] Optionally, since the guiding constraint can be randomly selected, different target seed data can correspond to the same guiding constraint.
[0083] Optionally, guiding constraints can also be selected uniformly. For example, the set of guiding constraints includes the following: guiding constraint A, guiding constraint B, and guiding constraint C. The first time a guiding constraint is selected, guiding constraint A is chosen; the second time, guiding constraint B is chosen; the third time, guiding constraint C is chosen, and so on. If six guiding constraints need to be selected, guiding constraint A is selected twice, guiding constraint B twice, and guiding constraint C twice to achieve uniform selection.
[0084] Optionally, the first model is a large language model, or it can also be called a large model. Specifically, the first model can be ChatGPT, which is a large model.
[0085] Optionally, the guiding constraint is also used to indicate the role the first model should play in generating the result. For example, playing the role of an elderly person / child / woman, etc. Since different roles express the same instructions differently, guiding constraints are needed to indicate the role the first model should play in order to generate results with different expressions.
[0086] 103. The electronic device determines the first guide corresponding to each target seed data. The first guide is obtained by splicing the guide template, guide constraints and target seed data. The guide template is used to provide an output framework for the first model.
[0087] Optionally, the guidance template can be a pre-set fixed template. Alternatively, the guidance template can be a template customized based on the task scenario. This application does not impose any restrictions on this.
[0088] For example, the guide template can be found here. Figure 2A As shown, Figure 2A This is a guide template. Figure 2A The speaker requirements in the provided guidance template are guidance constraints.
[0089] Optionally, the electronic device determines the first guide corresponding to the target seed data. Specifically, the electronic device concatenates the guide template, guide constraints, and target seed data using a concatenation function to obtain the first guide. This concatenation function can be an existing concatenation function, such as concat() or merge(), or it can be a newly constructed concatenation function.
[0090] 104. The electronic device obtains one or more first data corresponding to the target seed data based on the first model and the first guidance corresponding to each target seed data. The first data is used to train the second model, and the second model is used for natural language processing.
[0091] Optionally, the first data includes dialogue data and tagging information. The tagging information is used to label the intent slots in the dialogue data.
[0092] For example, dialogue data A is: What's the weather like in region A tomorrow? The tag information corresponding to dialogue data A is: query weather city = city A, date = tomorrow. Here, the query weather city can also be called a slot, and the date can also be called a slot. That is to say, the value corresponding to the slot "query weather city" is "city A", and the value corresponding to the slot "date" is "tomorrow".
[0093] Optionally, the second model can be an NLP model, which can be applied to a voice-enabled intelligent assistant.
[0094] In one possible embodiment, the electronic device obtains one or more first data corresponding to each target seed data based on the first model and the first guide corresponding to each target seed data. Specifically, the electronic device inputs the first guide corresponding to each target seed data into the first model to obtain the generation result corresponding to each target seed data; the electronic device performs a credibility verification on the generation result corresponding to each target seed data to obtain one or more first data corresponding to each target seed data.
[0095] Optionally, the generated results include dialogue data and labeling information. The labeling information is used to annotate the intent slots in the dialogue data.
[0096] Optionally, the number of generated results corresponding to the target seed data is greater than or equal to the number of first data. In other words, during the credibility verification process, some generated results that do not meet the credibility requirements will be removed. One target seed data corresponds to one or more first guides, one target seed data can correspond to one or more generated results, and one target seed data can also correspond to one or more first data.
[0097] Optionally, after inputting the first guide into the first model, a generated result can be obtained.
[0098] For example, suppose there are a total of 5 first guides. After inputting the 5 first guides into the first model, we get 5 generated results output by the first model. We then perform credibility verification on each of the 5 generated results and remove the generated results that do not meet the credibility requirements. Finally, we get 4 first data.
[0099] The credibility verification can be based on large model voting, K-Fold cross-validation, or other methods; this application does not impose any restrictions on these methods. To better understand the credibility verification, the large model voting method and the K-Fold cross-validation method are described below.
[0100] The voting method for large models:
[0101] In one possible embodiment, the electronic device performs credibility verification on the generated results corresponding to each target seed data to obtain first data corresponding to one or more target seed data. This includes: the electronic device voting on the generated results corresponding to each target seed data from preset dimensions based on a third model to obtain voting results for the generated results corresponding to each target seed data. The preset dimensions include: the naturalness of the generated results of the electronic device, and / or intent slot verification, and / or whether the generated results meet the guidance requirements; the electronic device obtains first data corresponding to one or more target seed data based on the voting results of the generated results corresponding to each target seed data.
[0102] Optionally, the third model can be a large model, such as ChatGPT. The third model and the first model can be the same model or different models.
[0103] Optionally, the electronic device votes on the generated results corresponding to each target seed data from a preset dimension based on a third model, and obtains the voting results of the generated results corresponding to each target seed data. Specifically, the electronic device uses N preset third models to vote on the generated results corresponding to each target seed data from a preset dimension, and obtains the voting results of the generated results corresponding to each target seed data.
[0104] The naturalness of the generated result is mainly used to judge whether the generated result is smooth and reasonable. For example, the generated result "Check the weather for region A tomorrow" is unreasonable.
[0105] Intent slots are used to understand user intent and extract key information. The intent refers to the purpose or action expressed by the user through natural language, such as "check the weather" or "book a flight." An intent defines the type of action the user wants to perform. Slots are specific pieces of information associated with a particular intent; they are the key data needed to complete that intent. For example, in the intent to "check the weather," the slots might include "location" and "date." Slot filling refers to the process of identifying this key information from the user's natural language input. This typically involves entity recognition, i.e., recognizing named entities in the text such as names, locations, and dates. Once the intent slot is filled, it becomes the label information in the generated result. In other words, intent slot validation can be understood as validation of the label information.
[0106] The guidance requirements mainly include guidance templates and guidance constraints. In other words, it is necessary to determine whether the generated result meets the guidance templates and guidance constraints.
[0107] In one possible embodiment, the electronic device obtains one or more first data corresponding to the target seed data based on the voting results of the generation results corresponding to each target seed data. Specifically, the electronic device obtains one or more first data corresponding to the target seed data based on the voting results of the generation results corresponding to each target seed data and a preset voting threshold.
[0108] For example, taking a generated result as an example, the electronic device uses N third-party models to vote on the generated result, resulting in N voting results. If more than a certain number of these N voting results meet the requirements, then the generated result is used as the first data; otherwise, the generated result is discarded.
[0109] K-Fold cross-validation method:
[0110] K-Fold cross-validation divides the original dataset into multiple parts, one part serving as the training set and the other as the validation set. The model is first trained using the training set, and then tested using the validation set. This process of training and validating the model is repeated over and over again.
[0111] For example, such as Figure 2B As shown, the resulting outputs are divided into multiple parts. Figure 2B It is divided into five parts. Figure 2B Five third models were used in the study. Figure 2B The training set in the dataset represents the generated results. Different data sets are selected as validation sets for each of the five models. Pred1.1-Pred1.5 represent the evaluation values.
[0112] Optionally, validation sets with evaluation values less than a threshold are marked as erroneous data, which means that the generated results corresponding to the pred with evaluation values less than the threshold are removed.
[0113] In one possible embodiment, the method further includes: the electronic device adding the first data to a second seed cluster based on the distance between the cluster center of the seed cluster in the seed pool and the first data, wherein the distance between the cluster center of the second seed cluster and the first data is less than a second distance threshold.
[0114] In other words, after the first data is determined, it is assigned to the corresponding seed cluster in the seed pool. The second distance threshold and the first distance threshold can be the same or different.
[0115] Optionally, the electronic device adds the first data to the second seed cluster based on the cluster center of the seed cluster in the seed pool, the first data, and the fourth model, wherein the distance between the cluster center of the second seed cluster and the first data is less than a second distance threshold.
[0116] The fourth model is a pre-trained embedding model, and the similarity of this embedding is used as the distance function. The calculation of the similarity of this embedding satisfies the following formula:
[0117]
[0118] Where d is the distance between the first seed data and the cluster centers of existing seed clusters, and s i For the first data, emb_s i For s i The result obtained after conversion is the emb_s i It can be a vector, that is, emb_s i This could be the result of converting text into a vector. j The cluster center of the seed clusters in the seed pool, emb_c j For c j The result obtained after conversion is the emb_c j It can be a vector, that is, emb_c j It can be the result of converting text into a vector.
[0119] Optionally, if the distance between the cluster center of a seed cluster in the seed pool and the first data is less than a second distance threshold, a new seed cluster is constructed for the first data.
[0120] The following is combined with Figure 2C The training data generation method provided in this application embodiment will be further described. First, a guiding template is designed, denoted as P. Then, seed pool data is initialized (the seed pool data is clustered), denoted as S. A seed data is selected from the seed pool S, denoted as s. i Where i represents the index of the seed data, s i In seed pool S, that is, s i in S.
[0121] Randomly select a guiding constraint from the constraint set C, and denote this guiding constraint as c. j , where j represents the index of the guiding constraint.
[0122] Guide template P, seed data s i and guiding constraints c j Concatenate them into the first guide, denoted as p kWhere K represents the index of the first bootstrap, p k =f(P, s) i c j f() is the concatenation function. This will concatenate the p... k The input is fed into the first model M to generate the corresponding generated result (the generated result includes label information), denoted as r. l Where l represents the index of the generated result, r l =M(p k ).
[0123] For the generated result r l Perform a credibility test, denoted by the test function V. If V(r) l If ) = True, continue with the following steps; otherwise, return to the steps above for selecting seed data from the seed pool.
[0124] For the generated result r l Diversity filtering is performed on the seed data in the seed pool S, and the filtering function is denoted as F. If F(r) l If S) = True, then r l Add to the seed pool, i.e., S = S + r l Optionally, this diversity filtering can refer to the method described above of adding the first data to the seed cluster in the seed pool. The filtering function F can be found in Formula 2 above.
[0125] The r l Add it to the first data set R, i.e., R = R + r l .
[0126] Then, seed data is selected from the seed pool, and the above steps are iterated until the generated data meets the condition, which is denoted as satisfying condition Q, i.e., Q(R) = True, and the entire process of generating the first data ends.
[0127] Optionally, the condition Q can be specifically defined as: the number of first data points generated is greater than a preset threshold. For example, if 100 first data points need to be generated, the entire iteration process stops when the 100th first data point is generated.
[0128] Optionally, after obtaining a sufficient amount of first data, the first data set R is used to train the second model. Specifically, the electronic device trains the second model based on the loss function and the first data set R.
[0129] Optionally, the trained second model can be applied to a voice assistant, which can be built into a terminal device. The terminal device is pre-loaded with the second model trained using the first data generated by the aforementioned electronic device.
[0130] The application scenarios for this voice assistant can be found in [reference]. Figure 2D As shown, after a user wakes up the voice assistant on their terminal device, they ask the voice assistant, "Check the weather for region A tomorrow." The voice assistant completes the corresponding task and displays the answer to the user. Optionally, the voice assistant can be woken up by voice or by operating a corresponding hardware button, etc., and this application does not impose any restrictions on this.
[0131] To enable the voice assistant to understand various types of user responses, diverse data is needed when training the corresponding second model. The training data generation method provided in this application incorporates a clustering algorithm during the data generation process of the large model (first model). In each iteration of data generation, the first guidance is dynamically concatenated, and seed data is selected using a uniform selection method, ensuring the diversity of the generated results. Furthermore, the generated results are validated for credibility, guaranteeing the accuracy of the final first data. Ultimately, this allows the second model trained on the first data to more accurately handle questions posed by various types of users.
[0132] The hardware structure of the terminal device is described below:
[0133] Please see Figure 3 , Figure 3 This is a schematic diagram of the hardware structure of the terminal device 100 provided in the embodiments of this application.
[0134] Terminal device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0135] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the terminal device 100. In other embodiments of this application, the terminal device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0136] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0137] The controller can serve as the central nervous system and command center of the terminal device 100. The controller can generate operation control signals based on the instruction opcode and timing signals to control the fetching and execution of instructions.
[0138] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can directly retrieve it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system. The processor 110 retrieves the instructions or data stored in the memory, causing the terminal device 100 to execute the shooting method performed by the terminal device in the following method embodiments.
[0139] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0140] The charging management module 140 is used to receive charging input from the charger. The charger can be a wireless charger or a wired charger.
[0141] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, internal memory 121, external memory, display 194, camera 193, and wireless communication module 160, etc. In some other embodiments, the power management module 141 may also be located in the processor 110.
[0142] The wireless communication function of the terminal device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.
[0143] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal device 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with a tuning switch.
[0144] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the terminal device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.
[0145] A modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor.
[0146] The wireless communication module 160 can provide solutions for wireless communication applications on the terminal device 100, including wireless local area networks (WLAN) (such as Wi-Fi), Bluetooth (BT), BLE broadcasting, global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR). The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.
[0147] In some embodiments, the antenna 1 of the terminal device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the terminal device 100 can communicate with the network and other devices through wireless communication technology.
[0148] Terminal device 100 implements display functions through a GPU, display screen 194, and application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0149] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments, the terminal device 100 may include one or N display screens 194, where N is a positive integer greater than 1. The display screen 194 may include an OLED screen.
[0150] Optionally, the display 194 may further include: an OLED glass layer, an OLED light-emitting unit, a fingerprint recognition sensor, a microlens array, etc. The display 194 supports optical in-display fingerprint recognition.
[0151] Terminal device 100 can perform shooting functions through an ISP, camera 193, video codec, GPU, display screen 194, and application processor. The ISP processes data fed back by camera 193. Camera 193 captures still images or videos. Camera 193 may include a front-facing camera and a rear-facing camera; the front-facing camera is located on the display area of the screen, and the rear-facing camera is located on the back area of the screen. The digital signal processor processes digital signals, including digital image signals and other digital signals. The video codec compresses or decompresses digital video. Terminal device 100 may support one or more video codecs.
[0152] NPU stands for Neural-Network (NN) Computing Processor. By drawing inspiration from the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can quickly process input information and continuously learn on its own.
[0153] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the terminal device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to perform data storage functions.
[0154] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of terminal device 100 by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as a sound playback function), etc. The data storage area may store data created during the use of terminal device 100 (such as audio data), etc. Furthermore, internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as flash memory devices.
[0155] Terminal device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.
[0156] The audio module 170 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170 may be located in the processor 110, or some functional modules of the audio module 170 may be located in the processor 110.
[0157] A speaker 170A, also called a "loudspeaker," is used to convert audio electrical signals into sound signals. A receiver 170B, also called a "handpiece," is used to convert audio electrical signals into sound signals. A microphone 170C, also called a "microphone" or "voice transducer," is used to convert sound signals into electrical signals. A headphone jack 170D is used to connect wired headphones. A pressure sensor 180A is used to sense pressure signals and can convert the pressure signals into electrical signals. In some embodiments, the pressure sensor 180A may be located on the display screen 194. A gyroscope sensor 180B can be used to determine the motion posture of the terminal device 100. A barometric pressure sensor 180C is used to measure barometric pressure. A magnetic sensor 180D includes a Hall effect sensor. An accelerometer 180E can detect the magnitude of acceleration of the terminal device 100 in various directions (generally three axes). A distance sensor 180F is used to measure distance. A proximity sensor 180G may include, for example, a light-emitting diode (LED) and a photosensor. An ambient light sensor 180L is used to sense ambient light intensity. A fingerprint sensor 180H is used to collect fingerprints. Temperature sensor 180J is used to detect temperature. Touch sensor 180K, also known as a "touch panel," can be located on display screen 194. The touch sensor 180K and display screen 194 together form a touchscreen, also known as a "touch screen." Touch sensor 180K detects touch operations applied to or near it. Bone conduction sensor 180M can acquire vibration signals. Buttons 190 include power button, volume buttons, etc. Motor 191 can generate vibration prompts. Indicator 192 can be an indicator light, used to indicate charging status, battery level changes, messages, missed calls, notifications, etc. SIM card interface 195 is used to connect a SIM card.
[0158] In addition, an operating system runs on top of the aforementioned components. Examples include iOS and Android. The operating system of the terminal device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses the layered architecture Android system as an example to exemplify the software structure of the terminal device 100. It should be noted that although this application embodiment uses the Android system as an example for illustration, its basic principles are equally applicable to terminal devices with other operating systems.
[0159] For example, Figure 4This is a schematic diagram of the software architecture of a terminal device provided in an embodiment of this application. The layered architecture divides the terminal device's software system into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system can be divided into three layers: the application layer, the application framework layer, and the kernel layer.
[0160] The application layer can include a series of application packages. The application layer runs applications by calling the application programming interface (API) provided by the application framework layer. For example... Figure 4 As shown, the application package may include applications such as a voice assistant, calendar, and calling.
[0161] The application framework layer provides APIs and a programming framework for applications within the application layer. The application framework layer includes predefined functions. For example... Figure 4 As shown, the application framework layer may include a SoundTrigger service and an Audio Record service.
[0162] The kernel layer is the layer between hardware and software. It drives the hardware, enabling it to function. The kernel layer includes a sound trigger driver and an audio stream input driver. It may also include, at a minimum, a camera driver and a fingerprint driver, but this embodiment does not limit the scope of the application.
[0163] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of a training data generation device 500 provided in an embodiment of this application. Figure 5 The training data generation device shown can be an electronic device, a device within an electronic device, or a device that can be used in conjunction with an electronic device. Figure 5 The training data generation apparatus shown may include a determining unit 501 and a processing unit 502.
[0164] in:
[0165] The determining unit 501 is used to determine multiple target seed data from multiple seed clusters in the seed pool. The seed cluster is obtained by clustering the seed pool based on a clustering algorithm. The seed cluster includes one or more seed data, and the seed data in the same seed cluster are of the same representation type.
[0166] The determining unit 501 is also used to determine the guiding constraints corresponding to each target seed data, and the guiding constraints are used to constrain the output of the first model;
[0167] The determining unit 501 is also used to determine the first guide corresponding to each target seed data. The first guide is obtained by splicing the guide template, guide constraints and target seed data. The guide template is used to provide an output framework for the first model.
[0168] The processing unit 502 is used to obtain first data corresponding to one or more target seed data based on the first model and the first guidance corresponding to each target seed data. The first data is used to train the second model, and the second model is used for natural language processing.
[0169] In one possible implementation, the processing unit 502 is further configured to input the first guide corresponding to each target seed data into the first model to obtain the generation result corresponding to each target seed data; and to perform a credibility verification on the generation result corresponding to each target seed data to obtain one or more first data corresponding to the target seed data.
[0170] In one possible implementation, the processing unit 502 is further configured to vote on the generation results corresponding to each target seed data from a preset dimension based on the third model, to obtain the voting results of the generation results corresponding to each target seed data. The preset dimensions include: the naturalness of the generation results, and / or intent slot validation, and / or whether the generation results meet the guidance requirements; and based on the voting results of the generation results corresponding to each target seed data, to obtain the first data corresponding to one or more target seed data.
[0171] In one possible implementation, the determining unit 501 is further configured to determine the distance between the first seed data in the seed pool and the cluster center of the existing seed clusters in the seed pool, wherein the first seed data is seed data in the seed pool that has not yet been clustered.
[0172] The processing unit 502 is further configured to, if a first seed cluster exists, add the first seed data to the first seed cluster and update the cluster center of the first seed cluster, wherein the distance between the cluster center of the first seed cluster and the first seed data is less than a first distance threshold; if a first seed cluster does not exist, construct a new seed cluster for the first seed data.
[0173] In one possible implementation, the determining unit 501 is further configured to determine the distance between the first seed data in the seed pool and the cluster center of the existing seed cluster in the seed pool based on a distance function, wherein the distance function is a function determined based on the task scenario.
[0174] In one possible implementation, the processing unit 502 is further configured to add the first data to a second seed cluster based on the distance between the cluster center of the seed cluster in the seed pool and the first data, wherein the distance between the cluster center of the second seed cluster and the first data is less than a second distance threshold.
[0175] For cases where the training data generation device can be a chip or a chip system, please refer to [link / reference]. Figure 6 The diagram shows the structure of the chip. Figure 6 The chip 600 shown includes a processor 601 and an interface 602. Optionally, it may also include a memory 603. The number of processors 601 can be one or more, and the number of interfaces 602 can be multiple.
[0176] For cases where the chip is used to implement the electronic device in the embodiments of this application:
[0177] The interface 602 is used to receive or output signals;
[0178] The processor 601 is used to perform data processing operations of the electronic device.
[0179] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
[0180] It is understood that some optional features in the embodiments of this application can be implemented independently in certain scenarios without relying on other features, such as the current solution on which they are based, to solve the corresponding technical problems and achieve the corresponding effects. Alternatively, they can be combined with other features as needed in certain scenarios. Accordingly, the audio data archiving device given in the embodiments of this application can also implement these features or functions, which will not be elaborated here.
[0181] It should be understood that the processor in the embodiments of this application can be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method embodiments can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor described above can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0182] It is understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0183] This application also provides a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed on an electronic device, implement the functions of any of the above method embodiments.
[0184] This application also provides a computer program product that, when run on a computer, enables the computer to perform the functions of any of the above method embodiments.
[0185] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer 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 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 accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., high-density digital video discs (DVDs)), or semiconductor media (e.g., solid-state disks (SSDs)).
[0186] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for generating training data, characterized in that, The method includes: Multiple target seed data are determined from multiple seed clusters in the seed pool. The seed clusters are obtained by clustering the seed pool based on a clustering algorithm. Each seed cluster includes one or more seed data, and the seed data in the same seed cluster are of the same representation type. Determine the guiding constraints corresponding to each of the target seed data, and the guiding constraints are used to constrain the output of the first model; A first guide is determined for each target seed data. The first guide is obtained by concatenating the guide template, the guide constraints, and the target seed data. The guide template is used to provide an output framework for the first model. Based on the first model and the first guidance corresponding to each of the target seed data, one or more first data corresponding to the target seed data are obtained. The first data is used to train the second model, and the second model is used for natural language processing.
2. The method according to claim 1, characterized in that, The step of obtaining one or more first data corresponding to the target seed data based on the first model and the first guidance corresponding to each of the target seed data includes: The first guide corresponding to each target seed data is input into the first model to obtain the generation result corresponding to each target seed data; The credibility of the generated result corresponding to each of the target seed data is verified to obtain one or more first data corresponding to the target seed data.
3. The method according to claim 2, characterized in that, The step of performing a credibility verification on the generation result corresponding to each of the target seed data to obtain one or more first data corresponding to the target seed data includes: Based on the third model, the generated results corresponding to each target seed data are voted on from preset dimensions to obtain the voting results of the generated results corresponding to each target seed data. The preset dimensions include: the naturalness of the generated results, and / or intent slot validation, and / or whether the generated results meet the guidance requirements. Based on the voting results of the generation results corresponding to each of the target seed data, one or more first data corresponding to the target seed data are obtained.
4. The method according to any one of claims 1-3, characterized in that, Before determining multiple target seed data from multiple seed clusters in the seed pool, the method further includes: Determine the distance between the first seed data in the seed pool and the cluster center of the existing seed clusters in the seed pool, wherein the first seed data is the seed data in the seed pool that has not yet been clustered; If a first seed cluster exists, the first seed data is added to the first seed cluster, and the cluster center of the first seed cluster is updated. The distance between the cluster center of the first seed cluster and the first seed data is less than a first distance threshold. If the first seed cluster does not exist, a new seed cluster is constructed for the first seed data.
5. The method according to claim 4, characterized in that, Determining the distance between the first seed data in the seed pool and the cluster center of an existing seed cluster in the seed pool includes: Based on a distance function, the distance between the first seed data in the seed pool and the cluster center of the existing seed clusters in the seed pool is determined. The distance function is a function determined based on the task scenario.
6. The method according to claim 1 or 4, characterized in that, The method further includes: Based on the distance between the cluster center of the seed cluster in the seed pool and the first data, the first data is added to the second seed cluster, where the distance between the cluster center of the second seed cluster and the first data is less than a second distance threshold.
7. An electronic device comprising one or more memories and one or more processors, characterized in that, The memory is used to store a computer program; the processor is used to invoke the computer program, causing the electronic device to perform the method of any one of claims 1-6.
8. A chip system for use in electronic devices, characterized in that, The chip system includes at least one processor and an interface for receiving instructions and transmitting them to the at least one processor; the at least one processor executes the instructions to cause the electronic device to perform the method as described in any one of claims 1-6.
9. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method as described in any one of claims 1-6.
10. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method as described in any one of claims 1-6.