Model training method and device, electronic equipment and readable storage medium
Through grouping and sampling, a diversified training data set is constructed, which solves the problem of weak extraction capabilities of large language models in the vertical field of dialogue content elements, and improves the training effect and extraction accuracy of the model.
Patent Information
- Application Number
- CN202411155347.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2024-11-26
AI Technical Summary
Large language models have weak ability to extract elements of dialogue content in vertical fields, and insufficient diversity of existing training data sets leads to poor training results.
By obtaining data sets containing dialogue text, round number information and feature information, grouping by round number and sampling according to preset strategies, multiple training data sets are constructed to improve the diversity of the training data set and the training effect of the big model.
It improves the accuracy and ability of factor extraction of large-model dialogue content, and enhances the ability of factor extraction in vertical field dialogue scenarios.
Smart Images

Figure CN119025614A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of natural language processing technology, and in particular, to a model training method, device, electronic device and readable storage medium. Background Art
[0002] Instruction Tuning is a process of further training a large language model (LLM) through a specific dataset. The required dataset consists of a series of "instruction-output" pairs, where the instructions represent the tasks that the large model is expected to perform, and the outputs are the expected results of the large model following these instructions.
[0003] In the task scenario of extracting elements of conversation content with the help of a big model, conversation data in the application industry field (such as customer service, banking, etc.) is usually randomly obtained to construct a training data set for the big model. The training data set constructed in this way will make the training effect of the big model relatively poor, making the big model's ability to extract elements of conversation content weak. Summary of the invention
[0004] The embodiments of the present invention provide a model training method, device, electronic device and readable storage medium to solve the problem in the prior art that the training effect of large models is relatively poor, resulting in the weak ability of large models to extract elements of dialogue content.
[0005] In a first aspect, an embodiment of the present invention provides a model training method, the method comprising:
[0006] Acquire a first data set, the first data set including a plurality of first text data, the first text data including a first dialogue text in a target scenario, first round number information of the first dialogue text, and first element information, the first round number information being used to indicate a length of the first dialogue text;
[0007] According to the first round number information, the first text data in the first data set are grouped to obtain N second data sets under N groups, where N is an integer greater than 1;
[0008] According to M preset strategies, the first text data in the N second data sets are sampled to obtain M training data sets, wherein the preset strategies indicate the sampling ratios of the first text data in each group, and M is a positive integer;
[0009] A first model is trained according to the M training data sets, where the first model is used to extract element information of the dialogue text in the target scenario.
[0010] In a second aspect, an embodiment of the present invention provides a model training device, the device comprising:
[0011] an acquisition module, configured to acquire a first data set, wherein the first data set includes a plurality of first text data, wherein the first text data includes a first dialogue text in a target scenario, first round number information of the first dialogue text, and first element information, wherein the first round number information is used to indicate a length of the first dialogue text;
[0012] a grouping module, configured to group the first text data in the first data set according to the first round number information to obtain N second data sets under N groups, where N is an integer greater than 1;
[0013] A sampling module, used for sampling the first text data in the N second data sets according to M preset strategies to obtain M training data sets, wherein the preset strategies indicate the sampling ratio of the first text data in each group, and M is a positive integer;
[0014] A training module is used to train a first model based on the M training data sets, wherein the first model is used to extract element information of the dialogue text in the target scenario.
[0015] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the above-mentioned model training method when executed by the processor.
[0016] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned model training method are implemented.
[0017] In a fifth aspect, an embodiment of the present invention provides a computer program product, comprising computer instructions, which, when executed by at least one processor, implement the steps of the above-mentioned model training method.
[0018] In an embodiment of the present invention, text data is grouped according to the number of rounds, and text data is sampled from the grouped data sets according to multiple preset strategies to construct multiple sets of training data sets. In this way, a large model can be trained based on the multiple sets of training data sets, thereby improving the diversity of text data in the training data sets, thereby improving the training effect of the large model, and thereby improving the ability of the large model to extract elements of conversation content. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0020] Figure 1 It is a flowchart of the model training method provided by an embodiment of the present invention;
[0021] Figure 2 is a schematic diagram of the structure of a model training device provided by an embodiment of the present invention;
[0022] Figure 3 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0024] It should be noted that the model training method provided in the embodiment of the present invention may relate to the field of natural language processing technology, which mainly solves the problem that large models have weak element extraction capabilities in conversation content in vertical fields (such as customer service, banking and other industries).
[0025] The model training method provided by the embodiment of the present invention is described in detail below.
[0026] See also Figure 1 , the figure shows a schematic flow chart of the model training method provided by an embodiment of the present invention.
[0027] like Figure 1 As shown, the method may include the following steps:
[0028] Step 101, obtaining a first data set, wherein the first data set includes a plurality of first text data, wherein the first text data includes a first dialogue text in a target scenario, first round number information and first element information of the first dialogue text, wherein the first round number information is used to indicate the length of the first dialogue text.
[0029] The model training method of the embodiment of the present disclosure can be executed by the model training device of the embodiment of the present disclosure. The model training device of the embodiment of the present disclosure can be configured in any electronic device to execute the model training method of the embodiment of the present disclosure.
[0030] The target scenario can be any scenario, such as customer service scenario, banking scenario, etc.
[0031] The first text data can be constructed based on the first dialogue text. The first dialogue text can be a dialogue text in a target scenario generated by a dialogue generation system, or a dialogue text obtained by real-time translation of a dialogue voice. For example, the automatic speech recognition technology (Automatic Speech Recognition, ASR) can be used to convert dialogue voices in vertical fields (such as customer service, banking and other industries) into text, thereby obtaining a dialogue text. In some embodiments, such as the customer service industry, when a customer service call is received, the dialogue voice of the customer service call can be translated in real time to obtain a dialogue text.
[0032] In some embodiments, the first dialogue text may also be a manually written dialogue text, or may be a dialogue text obtained by generalizing the manually written dialogue text through a large model.
[0033] In some embodiments, the information type in the text data and the element name in the element extraction task scenario can be determined in combination with the element extraction task scenario in the target scenario, and the information type indicates the dialogue text, the number of rounds information of the dialogue text, and the element information respectively. The information type can also include the difficulty type of the dialogue text, and the difficulty type can indicate whether the dialogue form of the dialogue text is error correction or interference, etc.
[0034] For example, the conversation text is: {Customer service: Tell me your ID number; Customer: 420***1986, incorrect number is 1982****3300}. In the conversation text, the customer corrected the wrong content "1986" during the conversation. The information type of the conversation text is error correction.
[0035] For another example, the conversation text is: {Customer service: Tell me your ID number; Customer: 420***1986, no, it’s 1982****3300, and it seems there’s a 0 at the end}. In this conversation text, when the customer is having a conversation, since the number of digits in the ID number in the previous conversation has met the specified number of digits, the erroneous content of “it seems there’s a 0 at the end” is interference information, and no elements will be extracted from it. Therefore, the information type of this conversation text is interference.
[0036] In the case where the information type in the first text data includes the difficulty type, the large model is trained using the first text data, and the trained large model can enhance the element extraction capability in dialogue scenarios such as error correction and interference.
[0037] The conversation text can be constructed based on the element names in the element extraction task scenario, such as name, gender, and ID number, and the fifth text data can be constructed based on the information type.
[0038] For example, the fifth text data may be constructed as follows:
[0039] {Dialogue text: "Customer service: Please tell me your ID number; Customer: 420***1986, wrong, it should be 1982****3300";
[0040] The element information is: "Element name: ID number; Element value: 420***1982****3300";
[0041] The round number information is: "1 round";
[0042] Difficulty Type: "BugFix"}.
[0043] The round number information of the dialogue text constructed above is 1 round for example only. In fact, the round number information of the dialogue text constructed can be 1 round, 2 rounds, 3 rounds, etc., and the round number information indicates the length of the dialogue text. Element information may include element name and element value.
[0044] In some embodiments, the fifth text data may be used as the first text data.
[0045] In some embodiments, the constructed fifth text data can be processed, such as generalization, random combination, logical judgment and optimization, information integration, etc., to obtain the first text data, wherein the generalization processing can be generalized for the dialogue text and element values.
[0046] For example, the first text data obtained by processing is as follows:
[0047] {Conversation text is: "Customer service: Tell me your ID number; Customer: 420***1986, no, it's 1982****3300; Customer service: How many virtual coins are involved? Customer: 3600; Customer service: Is it 3600? Customer: Yes, 3600";
[0048] The element information is: "Element name: ID number; Element value: 420***1982****3300; Element name: virtual gold coins; Element value: 3600";
[0049] The round number information is: "3 rounds";
[0050] Difficulty Type: "BugFix"}.
[0051] Correspondingly, by aggregating the first text data, a first data set can be obtained.
[0052] Step 102: group the first text data in the first data set according to the first round number information to obtain N second data sets in N groups, where N is an integer greater than 1.
[0053] According to the first round number information, the first text data in the first data set can be grouped and saved to obtain N second data sets, so as to sample from the N second data sets according to different proportions to construct a training data set. The first round number information can be 2, 3, 4, 5, etc.
[0054] The number of rounds of the plurality of first text data in each second data set may be the same, and the number of rounds of the first text data in different second data sets may be different. For example, the second data set may include a plurality of first text data with a round number of 2. For another example, the second data set may include a plurality of first text data with a round number of 3.
[0055] Step 103: Sample the first text data in the N second data sets according to M preset strategies to obtain M training data sets, wherein the preset strategies indicate the sampling ratio of the first text data in each group, and M is a positive integer.
[0056] In some embodiments, a preset strategy may be to perform 100% sampling on the first text data in any second data set. For example, the second data sets with round numbers of 2, 3, 4, 5, etc. may be used as a training data set respectively.
[0057] In some embodiments, a preset strategy may be to sample the first text data in the N second data sets according to a preset ratio. For example, a training data set may be obtained by sampling the first text data in the N second data sets in equal or unequal proportions.
[0058] It should be noted that different training data sets are obtained by sampling using different preset strategies, and M training data sets can be obtained accordingly.
[0059] Step 104: training a first model based on the M training data sets, wherein the first model is used to extract element information of the dialogue text in the target scenario.
[0060] The first model may refer to a large language model, such as a large language model (LLM).
[0061] In some embodiments, the first model may be trained sequentially based on M training data sets. One training data set may be used to train the first model first, and when the text data in the training data set is trained, another training data set may be used to train the first model until the training of the first model is completed.
[0062] In this embodiment, the completion of the training of the first model may mean that the training of the text data in the M training data sets is completed, or the loss information of the first model trained based on the M training data sets reaches convergence, or the loss information of the first model is reduced to a preset threshold. The loss information of the first model indicates the difference between the element information extracted by the first model from the dialogue text of the text data and the element information in the text data.
[0063] In some embodiments, step 104 specifically includes:
[0064] Training the first model according to each of the training data sets respectively;
[0065] When the training of the first model is completed, obtaining an evaluation value of the model parameter set of the first model, and obtaining M evaluation values corresponding to the M model parameter sets one by one, wherein the evaluation value is used to indicate the accuracy of the first model under the model parameter set in extracting the elements;
[0066] A first model under a first model parameter set corresponding to a target evaluation value is determined as an application model under the target scenario, wherein the target evaluation value is an evaluation value indicating the highest accuracy of factor extraction among the M evaluation values.
[0067] In this embodiment, the completion of the training of the first model may mean that the training of the text data in the training data set is completed, or the loss information of the first model trained based on the training data set reaches convergence, or the loss information of the first model is reduced to a preset threshold.
[0068] When the first model training is completed, a model parameter set of the first model can be obtained, and the model parameter set of the first model obtained by training is different for different training data sets. The model parameter set may refer to the network parameters of the first model.
[0069] Accordingly, when the training of the first model is completed, the evaluation value of the model parameter set of the first model can be obtained, and the evaluation value is used to indicate the quality of the training of the first model. The evaluation value can be expressed as a percentage. The larger the percentage, the better the training effect of the first model, that is, the higher the accuracy of the first model in extracting elements. In some embodiments, the evaluation value can be determined by the loss information of the first model, which can be inversely proportional to the loss information, that is, the smaller the loss information of the first model, the larger the evaluation value, and vice versa.
[0070] The first model under the first model parameter set corresponding to the target evaluation value can be determined as the application model under the target scenario, that is, the first model under the first model parameter set can be applied online to extract elements from the conversation text under the target scenario. For example, the first model can be used to extract elements from the conversation text in the customer service phone in the customer service scenario.
[0071] In this embodiment, the first model is trained according to each training data set respectively, and the first model for online application is selected according to the evaluation value of the model parameter set of the first model. In this way, the accuracy of element extraction of the online model for the dialogue text in the target scenario can be improved.
[0072] In this embodiment, the text data is grouped according to the number of rounds, and text data is sampled from the grouped data sets according to multiple preset strategies to construct multiple sets of training data sets. In this way, the large model can be trained based on the multiple sets of training data sets, thereby improving the diversity of text data in the training data sets, thereby improving the training effect of the large model, and thereby improving the ability of the large model to extract elements of conversation content.
[0073] Optionally, after determining the first model under the first model parameter set corresponding to the target evaluation value as the application model under the target scenario, the method further includes:
[0074] Determine a target preset strategy among the M preset strategies, a model parameter set obtained by training the first model according to a target training data set is the first model parameter set, and the target training data set is sampled according to the target preset strategy;
[0075] Determining, according to the target preset strategy, an application strategy of the first model under the first model parameter set in the target scenario;
[0076] The application strategy indicates any one of the length and time of the conversation text from which the first model performs element extraction.
[0077] After selecting the first model for online application, an application strategy of the first model under the first model parameter set in the target scenario can be determined to further give full play to the accuracy of the first model in extracting elements of the dialogue text in the target scenario.
[0078] Among them, the application strategy may include two types, one indicating the length of the dialogue text for element extraction of the first model, for example, the application strategy may limit the element extraction of the dialogue text according to a fixed number of rounds, that is, respectively intercepting the dialogue text of a fixed number of rounds, such as 4 rounds, in the target scenario, and extracting elements from the dialogue text in sequence. The other indicating the time of the dialogue text for element extraction of the first model, for example, the application strategy may limit the element extraction of the dialogue text according to a fixed time, that is, respectively intercepting the dialogue text of a fixed time, such as 3 minutes, in the target scenario, and extracting elements from the dialogue text in sequence.
[0079] When the first model is trained with different training data sets, the model parameter sets of the first model obtained are different, and the evaluation values of the model parameter sets of the first model are also different. A target training data set corresponding to the target evaluation value or the first model parameter set can be determined, and a target preset strategy for obtaining the target training data set can be determined from the M preset strategies accordingly.
[0080] Afterwards, the application strategy of the first model under the first model parameter set in the target scenario can be determined according to the target preset strategy. In some embodiments, when the target preset strategy indicates that the sampling ratio of the first text data under the target group is 100%, and the sampling ratio of the first text data under other groups is 0, the application strategy is determined to extract elements from the dialogue text according to a fixed number of rounds of the dialogue text in the target group. When the target preset strategy indicates that the sampling ratio of the first text data under each group is greater than 0, the application strategy is determined to extract elements from the dialogue text according to a fixed time, wherein the fixed time can be a preset time.
[0081] In this embodiment, after selecting the first model for online application, the application strategy of the first model under the first model parameter set in the target scenario is determined according to the target preset strategy, so that the accuracy of the first model in extracting elements of the dialogue text in the target scenario can be further fully utilized.
[0082] With the development of natural language processing technology, multi-round dialogue generation systems have become an important tool for human-computer interaction. In some embodiments, the first text data can be generated by the dialogue generation system to construct a first data set. However, for multi-round and logical dialogue generation, a large amount of annotated data is required for training. In some industries, it is difficult to obtain multi-round dialogue content, which makes it difficult to obtain annotated data, resulting in insufficient model training of the dialogue generation system, low quality of generated dialogues, and often difficult to ensure the logical coherence of the generated dialogues. In addition, the dialogues generated by the dialogue generation system often lack diversity, and the expression of the same semantics is too single.
[0083] In some embodiments, the first data set can be constructed by manually writing the first text data. However, the cost of manually writing the contents of multiple rounds of conversations is high.
[0084] In some embodiments, the fifth text data can be generalized to generate first text data and construct a first data set. However, seed generalization often lacks sufficient logic and fluency, especially in multi-round conversations, and is prone to problems such as unnatural topic shifts, missing or repeated information.
[0085] Therefore, in the process of generating the dialogue content, how to ensure the logic and fluency of the generated data is an important issue. In this embodiment, the quality of the generated first text data is improved by randomly combining, logically processing and integrating the second text data.
[0086] Optionally, step 101 specifically includes:
[0087] Acquire a plurality of second text data, wherein the second text data includes a second dialogue text in a target scenario, second round number information and second element information of the second dialogue text;
[0088] Randomly combining different text data among the plurality of second text data to obtain a plurality of third text data;
[0089] Performing logic judgment on each of the third text data, and performing logic optimization processing on the third text data that fails the logic judgment, to obtain a plurality of fourth text data;
[0090] At least two information belonging to the same information type in each of the fourth text data are integrated to obtain the first data set, the at least two information are respectively located in different second text data, and the information types respectively indicate the dialogue text, turn information and element information in the text data.
[0091] The second text data has the same structure as the first text data.
[0092] The method for acquiring the second text data may be the same as the method for acquiring the first text data. In some embodiments, the acquiring of the plurality of second text data includes:
[0093] Acquire a plurality of fifth text data, where the fifth text data is constructed according to the first information, where the first information includes text length and a name of an element in the target scene;
[0094] The fifth text data is input into the third model to perform generalization processing on the dialogue text to obtain the plurality of second text data.
[0095] The process of obtaining the fifth text data has been described in the above embodiment, and will not be repeated here. The fifth text data can be used as seed data and generalized to generate the second text data.
[0096] The fifth text data can be input into the third model for generalization processing of the dialogue text, wherein the third model can be a large language model, so that more text data can be generated through natural language processing. Compared with traditional dialogue data generation, it usually relies on a large amount of manual annotation or historical data, which is not only time-consuming but also costly. In this embodiment, by using a small amount of seed data, dialogue data can be generated quickly and in large quantities, thereby improving the efficiency of data generation and reducing labor costs.
[0097] After obtaining a large amount of second text data, different text data in the plurality of second text data can be randomly combined by a random combination module, and the random combination module is responsible for randomly combining the second text data according to possible dialogue processes to construct dialogue segments of different rounds to obtain third text data. The third text data can be temporarily stored in a list form, and each third text data includes dialogue text, element information, and round number information.
[0098] For example, the combination seed_combine_i containing two second text data after random combination is as follows:
[0099] [{Dialogue text: "Customer service: Please tell me your ID number; Customer: 420***1986, wrong, it should be 1982****3300";
[0100] The element information is: "Element name: ID number; Element value: 420***1982****3300";
[0101] The round number information is: "1 round";
[0102] Difficulty Type: "BugFix"},
[0103] {Conversation text: "Customer service: Is it 3600? Customer: Yes, 3600";
[0104] The element information is: "Element name: virtual gold coins; element value: 3600";
[0105] The round number information is: "1 round"}].
[0106] The logic judgment and optimization module can be used to perform logic judgment on each third text data, and perform logic optimization processing on the third text data that fails the logic judgment.
[0107] In some embodiments, optionally, performing a logic judgment on each of the third text data, and performing a logic optimization process on the third text data that fails the logic judgment to obtain a plurality of fourth text data, includes:
[0108] splicing different second dialogue texts in the third text data to obtain a third dialogue text;
[0109] Inputting the third dialogue text into the second model for logical judgment;
[0110] When the third dialogue text fails the logical judgment, a fourth dialogue text output by the second model is obtained to obtain the fourth text data, wherein the fourth dialogue text is obtained after performing logical optimization processing on the third dialogue text, and the fourth text data includes the fourth dialogue text.
[0111] That is, the logic judgment and optimization module can traverse each random combination, take out the second dialogue text and splice it, and after splicing, the third dialogue text text_combine_i can be obtained. For example, the third dialogue text is "Customer service: Tell me your ID number; Customer: 420***1986, no, it is 1982****3300; Customer service: Is it 3600? Customer: Yes, it is 3600."
[0112] Afterwards, the spliced third dialogue text can be used as input information of the second model, or the third dialogue text and the third text data can be used as input information of the second model. The second model can perform a logical judgment on the third dialogue text. If the logical judgment fails, the second model is used to perform a logical optimization process on the third dialogue text, thereby obtaining a logically correct fourth dialogue text, and correspondingly optimizing to obtain the fourth text data.
[0113] Among them, the second model can be a large language model, and the logical judgment results of the second model can include multiple types, such as causal relationships, conditional relationships, sequential relationships, etc. When the second model fails the logical judgment on the third text data, it can perform logical optimization processing on the third text data according to the logical judgment results.
[0114] For example, text_combine_i fails the logical judgment of the second model, and the result of its logical judgment is that the sequence relationship lacks a transition statement. After logical optimization processing, the fourth dialogue text can be obtained, which is "Customer Service: Tell me your ID number; Customer: 420***1986, no, it is 1982****3300; Customer Service: How many virtual gold coins are involved? Customer: 3600; Customer Service: Is it 3600? Customer: Yes, it is 3600."
[0115] Accordingly, the fourth text data may be as follows:
[0116] [{Dialogue text: "Customer service: Please tell me your ID number; Customer: 420***1986, wrong, it should be 1982****3300";
[0117] The element information is: "Element name: ID number; Element value: 420***1982****3300";
[0118] The round number information is: "1 round";
[0119] Difficulty Type: "BugFix"},
[0120] {Dialogue text: "Customer Service: How many virtual coins are involved? Customer: 3600";
[0121] The element information is: "Element name: virtual gold coins; element value: 3600";
[0122] The round number information is: "1 round"},
[0123] {Conversation text: "Customer service: Is it 3600? Customer: Yes, 3600";
[0124] The element information is: "Element name: virtual gold coins; element value: 3600";
[0125] The round number information is: "1 round"}].
[0126] Afterwards, at least two information belonging to the same information type in the fourth text data can be integrated by the information integration module to obtain the first text data, and accordingly the first data set can be constructed. The information integration module performs information integration on the fourth text data, that is, splicing the content of the dialogue text, splicing the content of the element information, and adding the number of rounds, so as to obtain the integrated dialogue text, element information and number of rounds information.
[0127] In this embodiment, by randomly combining text data and optimizing the logic and coherence of the conversation content, the high quality, naturalness, accuracy and coherence of the generated text data are ensured, thereby improving the performance of the text data and increasing the diversity of the generated data, further improving the quality and diversity of the generated data. In addition, the generation of text data does not rely on historical data, is applicable to vertical industry fields, can generate text data in batches, improve the efficiency of manual annotation, and reduce costs.
[0128] The model training device provided by an embodiment of the present invention is described below.
[0129] See also Figure 2 , the figure shows a schematic diagram of the structure of the model training device provided by an embodiment of the present invention, such as Figure 2 As shown, the model training device 200 includes:
[0130] An acquisition module 201 is used to acquire a first data set, where the first data set includes a plurality of first text data, where the first text data includes a first dialogue text in a target scenario, first round number information of the first dialogue text, and first element information, where the first round number information is used to indicate the length of the first dialogue text;
[0131] A grouping module 202, configured to group the first text data in the first data set according to the first round number information to obtain N second data sets under N groups, where N is an integer greater than 1;
[0132] A sampling module 203 is used to sample the first text data in the N second data sets according to M preset strategies to obtain M training data sets, wherein the preset strategies indicate the sampling ratio of the first text data in each group, and M is a positive integer;
[0133] The training module 204 is used to train a first model based on the M training data sets, where the first model is used to extract element information of the dialogue text in the target scenario.
[0134] Optionally, the training module 204 is specifically configured to:
[0135] Training the first model according to each of the training data sets respectively;
[0136] When the training of the first model is completed, obtaining an evaluation value of the model parameter set of the first model, and obtaining M evaluation values corresponding to the M model parameter sets one by one, wherein the evaluation value is used to indicate the accuracy of the first model under the model parameter set in extracting the elements;
[0137] A first model under a first model parameter set corresponding to a target evaluation value is determined as an application model under the target scenario, wherein the target evaluation value is an evaluation value indicating the highest accuracy of factor extraction among the M evaluation values.
[0138] Optionally, the device further comprises:
[0139] A first determination module is used to determine a target preset strategy among the M preset strategies, wherein a model parameter set obtained by training the first model according to a target training data set is the first model parameter set, and the target training data set is sampled according to the target preset strategy;
[0140] A second determination module, configured to determine an application strategy of the first model under the first model parameter set in the target scenario according to the target preset strategy;
[0141] The application strategy indicates any one of the length and time of the conversation text from which the first model performs element extraction.
[0142] Optionally, the acquisition module 201 includes:
[0143] An acquiring unit, configured to acquire a plurality of second text data, wherein the second text data includes a second dialogue text in a target scenario, second round number information, and second element information of the second dialogue text;
[0144] A combining unit, used for randomly combining different text data among the plurality of second text data to obtain a plurality of third text data;
[0145] a logic processing unit, configured to perform logic judgment on each of the third text data, and perform logic optimization processing on the third text data that fails the logic judgment, to obtain a plurality of fourth text data;
[0146] An integration unit is used to integrate at least two information belonging to the same information type in each of the fourth text data to obtain the first data set, wherein the at least two information are respectively located in different second text data, and the information types respectively indicate the dialogue text, turn information and element information in the text data.
[0147] Optionally, the logic processing unit is specifically used to:
[0148] splicing different second dialogue texts in the third text data to obtain a third dialogue text;
[0149] Inputting the third dialogue text into the second model for logical judgment;
[0150] When the third dialogue text fails the logical judgment, a fourth dialogue text output by the second model is obtained to obtain the fourth text data, wherein the fourth dialogue text is obtained after performing logical optimization processing on the third dialogue text, and the fourth text data includes the fourth dialogue text.
[0151] Optionally, the acquisition unit is specifically used to:
[0152] Acquire a plurality of fifth text data, where the fifth text data is constructed according to the first information, where the first information includes text length and a name of an element in the target scene;
[0153] The fifth text data is input into the third model to perform generalization processing on the dialogue text to obtain the plurality of second text data.
[0154] The model training device 200 can implement each process implemented in the above-mentioned model training method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described here.
[0155] The electronic device provided by the embodiment of the present invention is described below.
[0156] See also Figure 3 , the figure shows a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 3 As shown, the electronic device 300 includes: a processor 301 , a memory 302 , a user interface 303 and a bus interface 304 .
[0157] The processor 301 is used to read the program in the memory 302 and execute the following process:
[0158] Acquire a first data set, the first data set including a plurality of first text data, the first text data including a first dialogue text in a target scenario, first round number information of the first dialogue text, and first element information, the first round number information being used to indicate a length of the first dialogue text;
[0159] According to the first round number information, the first text data in the first data set are grouped to obtain N second data sets under N groups, where N is an integer greater than 1;
[0160] According to M preset strategies, the first text data in the N second data sets are sampled to obtain M training data sets, wherein the preset strategies indicate the sampling ratios of the first text data in each group, and M is a positive integer;
[0161] A first model is trained according to the M training data sets, where the first model is used to extract element information of the dialogue text in the target scenario.
[0162] exist Figure 3 In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically linking various circuits of one or more processors represented by processor 301 and memory represented by memory 302. The bus architecture may also link various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface 304 provides an interface. For different user devices, the user interface 303 may also be an interface that can connect external or internal devices, and the connected devices include but are not limited to keypads, displays, speakers, microphones, joysticks, etc.
[0163] The processor 301 is responsible for managing the bus architecture and general processing, and the memory 302 can store data used by the processor 301 when performing operations.
[0164] Optionally, the processor 301 is further configured to:
[0165] Training the first model according to each of the training data sets respectively;
[0166] When the training of the first model is completed, obtaining an evaluation value of the model parameter set of the first model, and obtaining M evaluation values corresponding to the M model parameter sets one by one, wherein the evaluation value is used to indicate the accuracy of the first model under the model parameter set in extracting the elements;
[0167] A first model under a first model parameter set corresponding to a target evaluation value is determined as an application model under the target scenario, wherein the target evaluation value is an evaluation value indicating the highest accuracy of factor extraction among the M evaluation values.
[0168] Optionally, the processor 301 is further configured to:
[0169] Determine a target preset strategy among the M preset strategies, a model parameter set obtained by training the first model according to a target training data set is the first model parameter set, and the target training data set is sampled according to the target preset strategy;
[0170] Determining, according to the target preset strategy, an application strategy of the first model under the first model parameter set in the target scenario;
[0171] The application strategy indicates any one of the length and time of the conversation text from which the first model performs element extraction.
[0172] Optionally, the processor 301 is further configured to:
[0173] Acquire a plurality of second text data, wherein the second text data includes a second dialogue text in a target scenario, second round number information and second element information of the second dialogue text;
[0174] Randomly combining different text data among the plurality of second text data to obtain a plurality of third text data;
[0175] Performing logic judgment on each of the third text data, and performing logic optimization processing on the third text data that fails the logic judgment, to obtain a plurality of fourth text data;
[0176] At least two information belonging to the same information type in each of the fourth text data are integrated to obtain the first data set, the at least two information are respectively located in different second text data, and the information types respectively indicate the dialogue text, turn information and element information in the text data.
[0177] Optionally, the processor 301 is further configured to:
[0178] splicing different second dialogue texts in the third text data to obtain a third dialogue text;
[0179] Inputting the third dialogue text into the second model for logical judgment;
[0180] When the third dialogue text fails the logical judgment, a fourth dialogue text output by the second model is obtained to obtain the fourth text data, wherein the fourth dialogue text is obtained after performing logical optimization processing on the third dialogue text, and the fourth text data includes the fourth dialogue text.
[0181] Optionally, the processor 301 is further configured to:
[0182] Acquire a plurality of fifth text data, where the fifth text data is constructed according to the first information, where the first information includes text length and a name of an element in the target scene;
[0183] The fifth text data is input into the third model to perform generalization processing on the dialogue text to obtain the plurality of second text data.
[0184] Preferably, an embodiment of the present invention further provides an electronic device, comprising a processor 301, a memory 302, and a computer program stored in the memory 302 and executable on the processor 301. When the computer program is executed by the processor 301, each process of the above-mentioned model training method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0185] The embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, each process of the above-mentioned model training method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0186] An embodiment of the present invention also provides a computer program product, including computer instructions. When the computer instructions are executed by at least one processor, the various processes of the above-mentioned model training method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, they are not repeated here.
[0187] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can 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 the present invention.
[0188] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0189] In the embodiments provided in the present application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0190] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present invention.
[0191] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0192] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.
[0193] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A model training method, characterized in that: The method comprises: Acquire a first data set, the first data set including a plurality of first text data, the first text data including a first dialogue text in a target scenario, first round number information of the first dialogue text, and first element information, the first round number information being used to indicate a length of the first dialogue text; According to the first round number information, the first text data in the first data set are grouped to obtain N second data sets under N groups, where N is an integer greater than 1; According to M preset strategies, the first text data in the N second data sets are sampled to obtain M training data sets, wherein the preset strategies indicate the sampling ratios of the first text data in each group, and M is a positive integer; A first model is trained according to the M training data sets, where the first model is used to extract element information of the dialogue text in the target scenario.
2. The method according to claim 1, characterized in that: The step of training the first model according to the M training data sets includes: Training the first model according to each of the training data sets respectively; When the training of the first model is completed, obtaining an evaluation value of the model parameter set of the first model, and obtaining M evaluation values corresponding to the M model parameter sets one by one, wherein the evaluation value is used to indicate the accuracy of the first model under the model parameter set in extracting the elements; A first model under a first model parameter set corresponding to a target evaluation value is determined as an application model under the target scenario, wherein the target evaluation value is an evaluation value indicating the highest accuracy of factor extraction among the M evaluation values.
3. The method according to claim 2, characterized in that After determining the first model under the first model parameter set corresponding to the target evaluation value as the application model under the target scenario, the method further includes: Determine a target preset strategy among the M preset strategies, a model parameter set obtained by training the first model according to a target training data set is the first model parameter set, and the target training data set is sampled according to the target preset strategy; Determining, according to the target preset strategy, an application strategy of the first model under the first model parameter set in the target scenario; The application strategy indicates any one of the length and time of the conversation text from which the first model performs element extraction.
4. The method according to claim 1, characterized in that: The obtaining of the first data set includes: Acquire a plurality of second text data, wherein the second text data includes a second dialogue text in a target scenario, second round number information and second element information of the second dialogue text; Randomly combining different text data among the plurality of second text data to obtain a plurality of third text data; Performing logic judgment on each of the third text data, and performing logic optimization processing on the third text data that fails the logic judgment, to obtain a plurality of fourth text data; At least two information belonging to the same information type in each of the fourth text data are integrated to obtain the first data set, the at least two information are respectively located in different second text data, and the information types respectively indicate the dialogue text, turn information and element information in the text data.
5. The method according to claim 4, characterized in that The step of performing a logical judgment on each of the third text data and performing a logical optimization process on the third text data that fails the logical judgment to obtain a plurality of fourth text data includes: splicing different second dialogue texts in the third text data to obtain a third dialogue text; Inputting the third dialogue text into the second model for logical judgment; When the third dialogue text fails the logical judgment, a fourth dialogue text output by the second model is obtained to obtain the fourth text data, wherein the fourth dialogue text is obtained after performing logical optimization processing on the third dialogue text, and the fourth text data includes the fourth dialogue text.
6. The method according to claim 4, characterized in that The step of obtaining a plurality of second text data comprises: Acquire a plurality of fifth text data, where the fifth text data is constructed according to the first information, where the first information includes text length and a name of an element in the target scene; The fifth text data is input into the third model to perform generalization processing on the dialogue text to obtain the plurality of second text data.
7. A model training device, characterized in that: The device comprises: an acquisition module, configured to acquire a first data set, wherein the first data set includes a plurality of first text data, wherein the first text data includes a first dialogue text in a target scenario, first round number information of the first dialogue text, and first element information, wherein the first round number information is used to indicate a length of the first dialogue text; a grouping module, configured to group the first text data in the first data set according to the first round number information to obtain N second data sets under N groups, where N is an integer greater than 1; A sampling module, used for sampling the first text data in the N second data sets according to M preset strategies to obtain M training data sets, wherein the preset strategies indicate the sampling ratio of the first text data in each group, and M is a positive integer; A training module is used to train a first model based on the M training data sets, wherein the first model is used to extract element information of the dialogue text in the target scenario.
8. An electronic device, characterized in that: The electronic device comprises: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the model training method as described in any one of claims 1 to 6.
9. A readable storage medium, characterized in that: The readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the model training method according to any one of claims 1 to 6.
10. A computer program product, characterized in that It comprises computer instructions, which, when executed by at least one processor, implement the steps of the model training method as described in any one of claims 1 to 6.
