An intent classification model training method, device, and equipment, and a storage medium
Patent Information
- Application Number
- CN202310093829.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-02
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2043-02-02
AI Technical Summary
[0003]但是使用现有技术进行意图识别可能造成以下几个问题:第一个问题是资源占用问题,在意图识别过程中,意图的个数可能会经常变换,每次出现新意图就对模型进行相应的训练会占用大量资源与时间;第二个问题是相似句生成问题,当有一个新的意图出现时,生成的相似句数量过少,人工添加的相似句质量不高,且人工制造相似句会消耗大量人力与时间资源,并且使用相似句生成模型生成的相似句质量不可控
[0039]In this application, firstly, a preset real-time iteration component is used to receive corpus information data input from the user terminal. Based on a preset knowledge discovery component, knowledge data from the corpus information data is obtained and added to a preset knowledge base. Then, a preset language model for generating similar sentences is trained using collected historical similar sentences and a preset sentence generation component to obtain a trained language model. A similar sentence generation scoring model is generated by comparing the target evaluation scoring model for evaluating and scoring similar sentences with the trained language model, and it is determined whether new intent data has been added. If so, the new intent data is processed using the similar sentence generation scoring model to obtain a target similar sentence corresponding to the new intent data. Finally, the target similar sentence is preprocessed based on the preset real-time iteration component and the knowledge data in the preset knowledge base. The preprocessed similar sentence is used to iteratively train a preset lightweight model, and the training results are updated locally. Therefore, the intent classification model training method described in this application can extract knowledge data from the corpus information using a preset knowledge discovery component, and generate a similar sentence generation scoring model using the trained language model obtained through a preset sentence generation component. Then, when a new intent is added, the preset lightweight model is iteratively trained based on the similar sentences obtained through the knowledge data and the similar sentence generation scoring model, and the training results are updated locally. In this way, the preset knowledge discovery component, sentence generation component, and iterative implementation component can be used to automatically generate highly similar sentences and automatically update the model, effectively reducing the manpower and time costs required to generate similar sentences and improving the efficiency of model updates.
Smart Images

Figure CN116070116B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing, and in particular to an intention classification model training method, apparatus, device, and storage medium. Background Technology
[0002] In chatbot question-answering scenarios, intent recognition determines the content of the user's intent based on the text input. Most intents have relatively clear similarities and solutions. If an intent cannot be handled, it can be transferred to a human for consultation to resolve the issue. Current technologies for intent recognition primarily utilize entity extraction to extract knowledge, the SimBERT model for generating similar sentences, and machine learning and / or deep learning models for intent recognition.
[0003] However, using existing technologies for intent recognition may cause the following problems: The first problem is resource consumption. During the intent recognition process, the number of intents may change frequently, and training the model accordingly each time a new intent appears will consume a lot of resources and time. The second problem is the generation of similar sentences. When a new intent appears, the number of generated similar sentences is too small, the quality of manually added similar sentences is not high, and manually generating similar sentences will consume a lot of human and time resources. Furthermore, the quality of similar sentences generated by similar sentence generation models is uncontrollable. Summary of the Invention
[0004] In view of this, the purpose of this invention is to provide a method, apparatus, device, and storage medium for training an intent classification model. This method utilizes preset knowledge discovery components, sentence generation components, and implementation iteration components to automatically generate highly similar sentences and automatically update the intent classification model. This effectively reduces the human and time costs required to generate similar sentences and improves the efficiency of model updates. The specific solution is as follows:
[0005] In a first aspect, this application discloses an intent classification model training method applied to a server, comprising:
[0006] The system uses a preset real-time iteration component to receive corpus information data input from the user terminal, and uses a preset knowledge discovery component to obtain knowledge data from the corpus information data and add it to a preset knowledge base.
[0007] The collected historical similar sentences and the preset sentence generation component are used to train a preset language model for generating similar sentences to obtain a trained language model. The trained language model is then used to generate a similar sentence generation scoring model by comparing it with a target evaluation scoring model for evaluating and scoring similar sentences. The similar sentence generation scoring model is a model used to generate similar sentences and evaluate and score the generated similar sentences.
[0008] Determine if new intent data has been added. If so, use the similar sentence generation scoring model to process the new intent data to obtain the target similar sentence corresponding to the new intent data.
[0009] Based on the preset real-time iterative component and using the knowledge data in the preset knowledge base, the target similar sentences are preprocessed, and the preset lightweight model is iteratively trained using the preprocessed similar sentences, and the training results are updated locally; the preset lightweight model is a model used to classify intents.
[0010] Optionally, the step of receiving corpus information data input from the user terminal using a preset real-time iteration component, and obtaining knowledge data from the corpus information data based on a preset knowledge discovery component and adding it to a preset knowledge base includes:
[0011] The system uses a preset real-time iteration component to receive corpus information data input from the user terminal and determines the data type of the corpus information data.
[0012] If the data type of the corpus information is audio data, then the audio data is converted into text data using an automatic speech recognition algorithm, and the text data is sent to the preset knowledge discovery component. If the data type of the corpus information is text data, then the text data is sent directly to the preset knowledge discovery component.
[0013] The text data is segmented based on the N-Gram model in the preset knowledge discovery component to obtain several knowledge data with different Gram lengths;
[0014] The similarity scores of several knowledge data of different Gram lengths are scored using Jaccard distance, and knowledge data of Gram lengths with similarity scores less than a preset similarity threshold are added to the preset knowledge base.
[0015] Optionally, the step of training a preset language model for generating similar sentences using collected historical similar sentences and a preset sentence structure generation component to obtain a trained language model includes:
[0016] Collect historical similar sentences and vectorize them using the SimCSE model in the preset sentence generation component to obtain vectorized corpus information data;
[0017] The vectorized corpus information data is retrieved using the Annoy algorithm, and the target vectorized corpus information data with a point value greater than a preset point value threshold is used to train the preset language model to obtain the trained language model.
[0018] Optionally, before generating the similar sentence generation scoring model using the target evaluation scoring model for evaluating and scoring similar sentences and the trained language model, the process may further include:
[0019] Several evaluation and scoring models are obtained, and the historical similar sentences are scored and evaluated by the several evaluation and scoring models respectively to obtain several comprehensive scores corresponding to the several evaluation and scoring models;
[0020] The evaluation scoring model with the highest overall score is selected as the target evaluation scoring model.
[0021] Optionally, the determination of whether new intent data has been added, and if so, the similar sentence generation and scoring model is used to process the new intent data to obtain a target similar sentence corresponding to the new intent data, including:
[0022] Determine if new intent data has been added; if so, generate several similar sentences to be evaluated based on the new intent data using the similar sentence generation scoring model.
[0023] The similar sentence generation scoring model is used to score and evaluate the several similar sentences to be evaluated, so as to obtain the evaluation score corresponding to each of the similar sentences to be evaluated, and the similar sentences to be evaluated with an evaluation score greater than a preset evaluation threshold are determined as the target similar sentences corresponding to the new intent data.
[0024] Optionally, the step of preprocessing the target similar sentences based on the preset real-time iterative component and utilizing the knowledge data in the preset knowledge base, iteratively training the preset lightweight model using the preprocessed similar sentences, and updating the training results locally includes:
[0025] The target similar sentence is added to the historical similar sentences to obtain the similar sentences to be processed;
[0026] The preset real-time iteration component is used to perform knowledge replacement and symbol preprocessing operations on the similar sentences to be processed, so as to obtain preprocessed similar sentences;
[0027] The preprocessed similar sentences are used to train a preset lightweight model to obtain the target training result, and the target training result is updated to the local machine within a preset time period.
[0028] Optionally, the intention classification model training method may further include:
[0029] The preset sentence generation component is used to generate a target test set, so that the preset lightweight model can be tested using the target test set.
[0030] Secondly, this application discloses an intent classification model iteration apparatus, applied to a server, comprising:
[0031] The data addition module is used to receive corpus information data input by the user terminal using a preset real-time iteration component, and to obtain knowledge data from the corpus information data based on a preset knowledge discovery component and add it to a preset knowledge base.
[0032] The model generation module is used to train a preset language model for generating similar sentences using collected historical similar sentences and preset sentence generation components to obtain a trained language model. The trained language model is then used to generate a similar sentence generation scoring model by comparing the target evaluation scoring model for evaluating and scoring similar sentences with the trained language model. The similar sentence generation scoring model is a model used to generate similar sentences and evaluate and score the generated similar sentences.
[0033] The data generation module is used to determine whether new intent data has been added. If so, the similar sentence generation scoring model is used to process the new intent data to obtain the target similar sentence corresponding to the new intent data.
[0034] The data update module is used to preprocess the target similar sentences based on the preset real-time iteration component and the knowledge data in the preset knowledge base, use the preprocessed similar sentences to iteratively train the preset lightweight model, and update the training results to the local machine; the preset lightweight model is a model used to classify intents.
[0035] Thirdly, this application discloses an electronic device, including:
[0036] Memory, used to store computer programs;
[0037] A processor for executing the computer program to implement the intent classification model training method as described above.
[0038] Fourthly, this application discloses a computer-readable storage medium for storing a computer program, which, when executed by a processor, implements the intent classification model training method as described above.
[0039] In this application, firstly, a preset real-time iteration component is used to receive corpus information data input from the user terminal. Based on a preset knowledge discovery component, knowledge data from the corpus information data is obtained and added to a preset knowledge base. Then, a preset language model for generating similar sentences is trained using collected historical similar sentences and a preset sentence generation component to obtain a trained language model. A similar sentence generation scoring model is generated by comparing the target evaluation scoring model for evaluating and scoring similar sentences with the trained language model, and it is determined whether new intent data has been added. If so, the new intent data is processed using the similar sentence generation scoring model to obtain a target similar sentence corresponding to the new intent data. Finally, the target similar sentence is preprocessed based on the preset real-time iteration component and the knowledge data in the preset knowledge base. The preprocessed similar sentence is used to iteratively train a preset lightweight model, and the training results are updated locally. Therefore, the intent classification model training method described in this application can extract knowledge data from the corpus information using a preset knowledge discovery component, and generate a similar sentence generation scoring model using the trained language model obtained through a preset sentence generation component. Then, when a new intent is added, the preset lightweight model is iteratively trained based on the similar sentences obtained through the knowledge data and the similar sentence generation scoring model, and the training results are updated locally. In this way, the preset knowledge discovery component, sentence generation component, and iterative implementation component can be used to automatically generate highly similar sentences and automatically update the model, effectively reducing the manpower and time costs required to generate similar sentences and improving the efficiency of model updates. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0041] Figure 1 A flowchart of an intent classification model training method provided in this application;
[0042] Figure 2 A timing diagram of an intent classification model training method provided in this application;
[0043] Figure 3 A flowchart illustrating a specific intention classification model training method provided in this application;
[0044] Figure 4 A text data splitting graph provided in this application;
[0045] Figure 5 A schematic diagram for calculating knowledge data scores provided in this application;
[0046] Figure 6 A flowchart illustrating a specific intention classification model training method provided in this application;
[0047] Figure 7 A flowchart of the training process for a similar sentence generation model provided in this application;
[0048] Figure 8 A flowchart illustrating a specific intention classification model training method provided in this application;
[0049] Figure 9 A schematic diagram of similar sentence preprocessing provided for this application;
[0050] Figure 10 A schematic diagram of the device structure for an intent classification model training method provided in this application;
[0051] Figure 11 This application provides a structural diagram of an electronic device. Detailed Implementation
[0052] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0053] In existing technologies, the number of intents may change frequently during intent recognition. Training the model for each new intent consumes a lot of resources and time. Furthermore, when a new intent appears, the number of similar sentences generated is too small, the quality of manually added similar sentences is not high, and manually creating similar sentences consumes a lot of human and time resources. Moreover, the quality of similar sentences generated by similar sentence generation models is uncontrollable.
[0054] To overcome the aforementioned technical problems, this application provides an intent classification model training method, apparatus, device, and storage medium. It can automatically generate highly similar sentences by utilizing preset knowledge discovery components, sentence generation components, and implementation iteration components, and automatically update the intent classification model. This effectively reduces the manpower and time costs required to generate similar sentences and improves the efficiency of model updates.
[0055] See Figure 1 As shown, this embodiment of the invention discloses an intent classification model training method, applied to a server, comprising:
[0056] Step S11: Receive the corpus information data input by the user terminal using a preset real-time iteration component, and obtain the knowledge data in the corpus information data based on the preset knowledge discovery component and add it to the preset knowledge base.
[0057] In this embodiment, as Figure 2 As shown, a preset implementation iteration component can receive corpus information data input from the user terminal, and then determine the data type of the corpus information data. If the data type of the corpus information data is audio data, the ASR (Automatic Speech Recognition) algorithm is used to recognize the speech information in the audio data, and the recognized speech information is converted into text data. The converted text data is then sent to the preset knowledge discovery component. If the data type of the corpus information data is text data, the corpus information data is directly sent to the preset knowledge discovery component. After the preset knowledge discovery component receives text data sent by the preset implementation iteration component, it needs to segment the text data using an N-Gram model to obtain several knowledge data of different Gram lengths. For example, if the text data "I just ate" is segmented into 3 Grams, the resulting knowledge data will be "I just ate", "just ate", and "ate". After obtaining knowledge data of different Gram lengths, the similarity score of the knowledge data of different Gram lengths needs to be calculated using the Jaccard distance formula. If there is knowledge data of Gram length with a similarity score less than a preset similarity threshold of 0.3, then the knowledge data of that Gram length is marked as knowledge data to be reviewed. It should be noted that the knowledge data to be reviewed needs to be manually reviewed. After the manual review is passed, it can be added to the preset knowledge base, and the preset similarity threshold can be set by the user according to the user's needs.
[0058] Step S12: Use the collected historical similar sentences and the preset sentence generation component to train the preset language model for generating similar sentences to obtain the trained language model, and use the target evaluation scoring model for evaluating and scoring similar sentences and the trained language model to generate a similar sentence generation scoring model; the similar sentence generation scoring model is a model used to generate similar sentences and evaluate and score the generated similar sentences.
[0059] In this embodiment, as Figure 2As shown, after the preset sentence generation component collects historical similar sentences, the SimCSE (Simple Contrastive Learning of Sentence Embeddings) model is used to vectorize the collected historical similar sentences. The Annoy algorithm is then used to retrieve the vectorized corpus data to obtain the retrieval point values corresponding to the vectorized corpus data. Vectorized corpus data with retrieval point values greater than a preset threshold of 0.8 are retained for training the preset language model (roformer-sim model). It should be noted that the preset language model has insufficient similar sentence data and its sentence encoding function is inadequate; therefore, historical similar sentences are needed to train the preset language model to obtain the trained language model.
[0060] After training the preset language model to obtain the trained language model, a pre-determined target evaluation and scoring model for evaluating and scoring similar sentences is needed, along with a similar sentence generation and scoring model generated by the trained language model. It should be noted that the target evaluation and scoring model is the one with the best evaluation performance selected from multiple evaluation and scoring models, and the similar sentence generation and scoring model is used to generate similar sentences and evaluate and score the generated similar sentences.
[0061] Step S13: Determine if new intent data has been added. If so, use the similar sentence generation scoring model to process the new intent data to obtain the target similar sentence corresponding to the new intent data.
[0062] In this embodiment, when new intent data is added, the generated similar sentence evaluation and scoring model needs to generate several similar sentences corresponding to the new intent data based on the new intent data, and score the generated similar sentences. It should be noted that only similar sentences with scores greater than a similarity threshold of 0.8 can be used after evaluation and scoring, and the similarity threshold can be adjusted according to the user's needs. In this way, after receiving new intent data, the similar sentence generation and scoring model can generate similar sentences corresponding to the new intent data that can be trained and used in the header image, effectively improving the effectiveness and reliability of the intent classification model training method described in this application.
[0063] Step S14: Based on the preset real-time iterative component and using the knowledge data in the preset knowledge base, preprocess the target similar sentences, use the preprocessed similar sentences to iteratively train the preset lightweight model, and update the training results locally; the preset lightweight model is a model used to classify intents.
[0064] In this embodiment, a preset implementation iteration component is needed to preprocess similar sentences generated by the similar sentence generation and scoring model using knowledge data from a preset knowledge base. This preprocessing involves knowledge substitution and punctuation removal of the similar sentences. Specifically, knowledge substitution involves replacing some nouns in the similar sentences using knowledge data from the preset knowledge base. For example, if the generated similar sentence is "Can I reduce the premium during the cooling-off period for a newly purchased product A?", and the knowledge base determines that the knowledge data corresponding to "product A" is "insurance product", then after performing knowledge substitution and punctuation removal, the target similar sentence obtained is "Can I reduce the premium during the cooling-off period for a newly purchased insurance product?"
[0065] It should be noted that, such as Figure 2 As shown, after obtaining the preprocessed similar sentences, it is necessary to determine whether the preprocessed similar sentences are in the new training corpus. If they are in the new training corpus, it means that it is not necessary to use the preprocessed similar sentences to train the preset lightweight model, and the corresponding similar sentences can be directly returned to the client. If they are not in the new training corpus, it means that it is necessary to use the preprocessed similar sentences to train the preset lightweight model, and update the training results to the local server at a preset time point. The preset time point can be set by the client according to its needs.
[0066] In this embodiment, firstly, a preset real-time iteration component is used to receive corpus information data input from the user terminal. Based on a preset knowledge discovery component, knowledge data from the corpus information data is obtained and added to a preset knowledge base. Then, the collected historical similar sentences and a preset sentence generation component are used to train a preset language model for generating similar sentences to obtain a trained language model. A similar sentence generation scoring model is generated by comparing the target evaluation scoring model for evaluating and scoring similar sentences with the trained language model, and it is determined whether new intent data has been added. If so, the similar sentence generation scoring model is used to process the new intent data to obtain a target similar sentence corresponding to the new intent data. Finally, the target similar sentence is preprocessed based on the preset real-time iteration component and the knowledge data in the preset knowledge base. The preprocessed similar sentence is used to iteratively train a preset lightweight model, and the training results are updated locally. Therefore, the intent classification model training method in this application can extract knowledge data from the corpus information using a preset knowledge discovery component, and generate a similar sentence generation scoring model using the trained language model obtained through a preset sentence generation component. Then, when a new intent is added, the preset lightweight model is iteratively trained based on the similar sentences obtained through the knowledge data and the similar sentence generation scoring model, and the training results are updated locally. In this way, the preset knowledge discovery component, sentence generation component, and iterative implementation component can be used to automatically generate highly similar sentences and automatically update the model, effectively reducing the manpower and time costs required to generate similar sentences and improving the efficiency of model updates.
[0067] As can be seen from the previous embodiment, after receiving the corpus information data sent by the user terminal, this application needs to process the corpus information data and send the processed corpus information data to a preset knowledge base. Therefore, this embodiment provides a detailed explanation of how to process the corpus information and send it to the preset knowledge base. See [link to relevant documentation]. Figure 3 As shown, this embodiment of the invention discloses a method for training an intent classification model, including:
[0068] Step S21: Receive the corpus information data input by the user terminal using a preset real-time iteration component, and determine the data type of the corpus information data.
[0069] In this embodiment, after the preset implementation iteration component receives the corpus information data input by the user, it needs to determine the data type of the corpus information data input by the user. When inputting corpus information, the user may directly input text data via keyboard input or input audio data via voice input tool. In this way, determining the type of corpus information data input by the user can improve the efficiency of subsequent processing of the input corpus information data.
[0070] Step S22: if the data type of the corpus information data is audio data, converting the audio data into text data by using an automatic speech recognition algorithm, and sending the text data to a preset knowledge discovery component; if the data type of the corpus information data is text data, directly sending the text data to the preset knowledge discovery component.
[0071] In this embodiment, if it is determined that the data type of the input corpus information is audio data, it is necessary to perform speech recognition on the audio data through an ASR algorithm, extract speech information from the audio data, and convert the extracted speech information into text data, so as to segment the text data subsequently; if it is determined that the data type of the input corpus information is text data, the text data is directly processed. It should be noted that typos may occur during keyboard input. To avoid recognition errors in intention recognition, in the present application, when processing text data, pinyin of the text data needs to be automatically generated and combined with the text data to perform intention recognition. For example, if the text data is "购物 (shopping)", the pinyin "购物gouwu" of the text data is automatically generated.
[0072] Step S23: segmenting the text data based on an N-Gram model in the preset knowledge discovery component to obtain a plurality of pieces of knowledge data with different Gram lengths.
[0073] In this embodiment, as Figure 4 shown, after the text data is determined, the N-Gram model is required to segment the text data. For example, if the obtained text data is "Can I reduce the coverage of the newly insured Product A during the cooling-off period?", after being split by the N-Gram model, the obtained 2-gram knowledge data is "Can I", " I", "I re", "reduce", "educe", "duce t", "ce th", "e the", " the", "the n", "he new", "e newly", "newly insu", "wly insur", "ly insure", "y insured", " insured", "insured th", "nsured the", "ured the n", "red the ne", "ed the new", "d the newly", " the newly", "the newly i", "he newly in", "e newly ins", " newly insu", "newly insur" and so on, and 3-gram knowledge data, 4-gram knowledge data and 5-gram knowledge data obtained after splitting by the N-Gram model can all be deduced by analogy. After the text data is segmented, pinyin needs to be automatically added to the segmented text data. It should be noted that automatically adding pinyin to the segmented text data can be implemented by writing a program in computer languages such as Java, Python and C language, and can also be implemented by a third-party tool.
[0074] Step S24: performing similarity scoring on the plurality of pieces of knowledge data with different Gram lengths by using Jaccard distance, and adding the knowledge data with a Gram length whose similarity is less than a preset similarity threshold to the preset knowledge base.
[0075] In this embodiment, as Figure 5 As shown, after obtaining knowledge data of different Gram lengths, it is necessary to use Jaccard distance to calculate the similarity score of the knowledge data of different Gram lengths, and the calculation formula is as follows:
[0076]
[0077] Where A represents a standard name, B represents a gram name, and J(A, B) represents the similarity coefficient between A and B.
[0078] It should be noted that after calculating the similarity scores of knowledge data of different Gram lengths, the segmented knowledge data needs to be filtered. Knowledge data with scores lower than a preset similarity threshold can be marked as pending review. If the review is passed, it is saved to a preset knowledge base. If the score of the knowledge data is not lower than the preset similarity threshold, it is not used. Figure 5 As shown, if the standard name is set to "product achanpina", the 2-gram knowledge data "toubao" scores 0.8 and the 3-gram knowledge data "product AchanpinA" scores 0.27. Therefore, the 3-gram knowledge data "product AchanpinA" is marked as knowledge data to be reviewed and saved to the preset knowledge base after the review is passed.
[0079] Step S25: Use the collected historical similar sentences and the preset sentence generation component to train the preset language model for generating similar sentences to obtain the trained language model, and use the target evaluation scoring model for evaluating and scoring similar sentences and the trained language model to generate a similar sentence generation scoring model; the similar sentence generation scoring model is a model used to generate similar sentences and evaluate and score the generated similar sentences.
[0080] Step S26: Determine if new intent data has been added. If so, use the similar sentence generation scoring model to process the new intent data to obtain the target similar sentence corresponding to the new intent data.
[0081] Step S27: Based on the preset real-time iterative component and using the knowledge data in the preset knowledge base, preprocess the target similar sentences, use the preprocessed similar sentences to iteratively train the preset lightweight model, and update the training results locally; the preset lightweight model is a model used to classify intents.
[0082] It should be noted that a more detailed description of steps S25, S26, and S27 can be found in the foregoing embodiments, and will not be repeated here.
[0083] Therefore, in this embodiment, after receiving the corpus information data sent by the user terminal, it is necessary to process the corpus information data and send the processed corpus information data to the preset knowledge base. First, a preset real-time iterative component is used to receive the corpus information data input by the user terminal and determine the data type of the corpus information data. If the data type of the corpus information data is audio data, an automatic speech recognition algorithm is used to convert the audio data into text data, and the text data is sent to the preset knowledge discovery component. If the data type of the corpus information data is text data, the text data is directly sent to the preset knowledge discovery component. Then, based on the N-Gram model in the preset knowledge discovery component, the text data is segmented to obtain several knowledge data of different Gram lengths. Finally, Jaccard distance is used to score the similarity of the several knowledge data of different Gram lengths, and knowledge data of Gram lengths with similarity less than a preset similarity threshold are added to the preset knowledge base. In this way, by segmenting the text data and evaluating the segmented knowledge data, higher-quality knowledge data can be obtained, effectively improving the reliability of the intent classification model training method described in this application.
[0084] As can be seen from the previous embodiment, when a new intent is discovered in this application, it is necessary to automatically generate similar sentences based on the new intent and using a model. Therefore, this application provides a detailed explanation of how to generate a model for generating similar sentences. (See [link to previous document]). Figure 6 As shown, this embodiment of the invention discloses a method for training an intent classification model, including:
[0085] Step S31: Receive the corpus information data input by the user terminal using the preset real-time iteration component, and obtain the knowledge data in the corpus information data based on the preset knowledge discovery component and add it to the preset knowledge base.
[0086] Step S32: Collect historical similar sentences and vectorize them using the SimCSE model in the preset sentence generation component to obtain vectorized corpus information data.
[0087] In this embodiment, before generating the final similar sentence evaluation and scoring model used to generate similar sentences, it is necessary to first train a preset language model, that is, the Roformer-Sim model, and the training material is historical similar sentences, such as... Figure 7As shown, it is necessary to first collect historical similar sentences. It should be noted that historical similar sentences can be collected by obtaining similar sentence data stored on a local server or by manually inputting historical similar sentences. After inputting historical similar sentences, the SimCSE model in the preset sentence generation component needs to be used to vectorize the historical similar sentences to obtain vectorized corpus information data. Furthermore, it should be noted that vectorizing text data can improve the efficiency of computer analysis and processing of text data, thereby effectively improving the processing efficiency of the intent classification model training method described in this application.
[0088] Step S33: Retrieve the vectorized corpus information data using the Annoy algorithm, and use the target vectorized corpus information data with a point value greater than a preset point value threshold after retrieval to train the preset language model, so as to obtain the trained language model.
[0089] In this embodiment, as Figure 7 As shown, after obtaining vectorized corpus information data through vectorization processing, the Annoy algorithm is used to retrieve the vectorized corpus information data to obtain the dot product value of the vectorized corpus information data. It should be noted that the vectorized corpus information data includes usable data and unusable data. Vectorized corpus information data with a dot product value greater than a preset dot product value threshold after retrieval is usable data, and correspondingly, vectorized corpus information data with a dot product value less than or equal to the preset dot product value threshold is unusable data. Furthermore, the preset dot product value threshold can be set by the user according to the user's needs. In this application, the preset dot product value threshold is 0.8. If the dot product value after retrieval is greater than 0.8, the preset Roformer-Sim model can be trained using the historical similar sentences corresponding to the corresponding vectorized corpus information data.
[0090] Step S34: Generate a similar sentence generation scoring model by using the target evaluation scoring model for evaluating and scoring similar sentences and the trained language model; the similar sentence generation scoring model is a model used to generate similar sentences and evaluate and score the generated similar sentences.
[0091] In this embodiment, before generating a similar sentence generation scoring model using the target evaluation scoring model for evaluating and scoring similar sentences and the trained language model, the method further includes: acquiring several evaluation scoring models, and using the several evaluation scoring models to score and evaluate the historical similar sentences respectively, to obtain several comprehensive scores corresponding to the several evaluation scoring models; and determining the evaluation scoring model with the highest comprehensive score as the target evaluation scoring model. That is, before generating the similar sentence generation scoring model, it is necessary to first determine the target evaluation scoring model used to generate the similar sentence generation scoring model. It should be noted that the target evaluation scoring model is determined from several evaluation scoring models. Multiple models are selected to score and evaluate different standard questions, similar questions, and dissimilar questions in historical similar sentences. Then, the model with the best comprehensive performance is selected according to a preset evaluation formula to score the similar sentences generated by roformer-sim. The preset evaluation formula is as follows:
[0092]
[0093] Where N is the number of standard question-similar question-dissimilar question groups, k is the k-th group, and I sim Let I be the number of similar questions in a given group. dissim Let be the number of dissimilar questions in a given group, sim be the dot product function, α be the similar sentence, β be the standard sentence, and γ be the dissimilar sentence.
[0094] In this way, the target evaluation scoring model with the best evaluation effect can be determined from the several evaluation scoring models.
[0095] After obtaining the target evaluation scoring model, it is necessary to use the target evaluation scoring model and the trained roformer-sim model to generate the similar sentence generation scoring model, so as to generate similar sentences using the generated similar sentence generation scoring model, and to score and evaluate the generated similar sentences to obtain similar sentences of higher quality.
[0096] Step S35: Determine if new intent data has been added. If so, use the similar sentence generation scoring model to process the new intent data to obtain the target similar sentence corresponding to the new intent data.
[0097] Step S36: Based on the preset real-time iterative component and using the knowledge data in the preset knowledge base, preprocess the target similar sentences, use the preprocessed similar sentences to iteratively train the preset lightweight model, and update the training results locally; the preset lightweight model is a model used to classify intents.
[0098] It should be noted that a more detailed description of steps S31, S35, and S36 in this embodiment can be found in the foregoing embodiments, and will not be repeated here.
[0099] In this embodiment, during the process of generating a similar sentence generation and scoring model, historical similar sentences are first collected. These historical similar sentences are then vectorized using the SimCSE model in the preset sentence generation component to obtain vectorized corpus information data. Next, the Annoy algorithm is used to retrieve this vectorized corpus information data. The retrieved target vectorized corpus information data with a point value greater than a preset point value threshold is then used to train a preset language model to obtain a trained language model. Finally, a similar sentence generation and scoring model is generated using a target evaluation and scoring model for evaluating and scoring similar sentences, along with the trained language model. This allows the generated similar sentence generation and scoring model to produce higher-quality similar sentences, making the intent classification model training method described in this application more reliable.
[0100] As can be seen from the previous embodiment, after saving the knowledge data to the preset knowledge base and obtaining the similar sentence generation and scoring model in this application, it is necessary to iterate the preset lightweight model. This embodiment provides a detailed explanation of how to iterate the preset lightweight model. See [link to relevant documentation]. Figure 8 As shown, this embodiment of the invention discloses a method for training an intent classification model, including:
[0101] Step S41: Receive the corpus information data input by the user terminal using a preset real-time iteration component, and obtain the knowledge data in the corpus information data based on the preset knowledge discovery component and add it to the preset knowledge base.
[0102] Step S42: Use the collected historical similar sentences and the preset sentence generation component to train the preset language model for generating similar sentences to obtain the trained language model, and use the target evaluation scoring model for evaluating and scoring similar sentences and the trained language model to generate a similar sentence generation scoring model; the similar sentence generation scoring model is a model used to generate similar sentences and evaluate and score the generated similar sentences.
[0103] Step S43: Determine if new intent data has been added. If so, generate several similar sentences to be evaluated based on the new intent data using the similar sentence generation scoring model.
[0104] In this embodiment, when a new intent is added by the user or manually, a scoring model can be used to generate similar sentences. Based on the new intent, similar sentences to be evaluated are generated. It should be noted that the similar sentences to be evaluated are not used directly, but need to be scored and evaluated before it can be determined whether they can be used.
[0105] Step S44: Use the similar sentence generation scoring model to score and evaluate the several similar sentences to be evaluated, so as to obtain the evaluation score corresponding to each of the similar sentences to be evaluated, and determine the similar sentences to be evaluated with an evaluation score greater than a preset evaluation threshold as the target similar sentences corresponding to the new intent data.
[0106] In this embodiment, after obtaining the similar sentences to be evaluated, it is necessary to score and evaluate the similar sentences to be evaluated. Only similar sentences with scores greater than a preset evaluation threshold can be used. It should be noted that the preset evaluation threshold can be set according to the user's needs. In this application, the preset evaluation threshold is 0.8, and the number of similar sentences generated is 30, that is, 30 similar sentences with scores greater than 0.8 are generated.
[0107] Step S45: Add the target similar sentence to the historical similar sentences to obtain the similar sentences to be processed.
[0108] In this embodiment, after obtaining the target similar sentence corresponding to the new intention, the target similar sentence needs to be added to the historical training corpus, that is, the historical similar sentences, to obtain the similar sentence to be processed, and the similar sentence to be processed is preprocessed so as to use the preprocessed similar sentence to train the preset lightweight model.
[0109] Step S46: Use the preset real-time iteration component to perform knowledge replacement and symbol preprocessing operations on the similar sentences to be processed, so as to obtain preprocessed similar sentences.
[0110] In this embodiment, a preset real-time iteration component is needed to perform knowledge replacement and symbol preprocessing operations on the similar sentences to be processed, such as... Figure 9 As shown, the similar sentence is "Can I reduce the premium during the cooling-off period for a newly purchased product A?". The knowledge base defines "product A" as "insurance product". After knowledge substitution, the similar sentence becomes "Can I reduce the premium during the cooling-off period for a newly purchased insurance product?". Then, symbol preprocessing is performed on the substituted similar sentence, resulting in the sentence "Can I reduce the premium during the cooling-off period for a newly purchased insurance product?". In this way, by performing knowledge substitution and symbol preprocessing on similar sentences, the resource consumption during model training can be effectively reduced, improving training efficiency.
[0111] Step S47: Use the preprocessed similar sentences to train the preset lightweight model to obtain the target training result, and update the target training result to the local machine within a preset time period.
[0112] In this application, after obtaining the preprocessed similar sentences, it is necessary to use the preprocessed similar sentences to iteratively train a preset lightweight model, that is, to train a preset Albert-Tiny model, and automatically update the training results to the local server during a preset time period each day. It should be noted that the update time period for the training results can be set by the user client according to their needs. Furthermore, the intent classification model training method described in this application also includes: generating a target test set using the preset sentence generation component, so as to test the preset lightweight model using the target test set. That is, it is necessary to use the preset sentence generation component to generate entirely new similar sentences to obtain the target test set, and then use the target test set to test the Albert-Tiny model to determine the intent classification performance of the Albert-Tiny model.
[0113] It should be noted that for a more detailed description of steps S41, S42, and S43 in this embodiment, please refer to the foregoing embodiments, and they will not be repeated here.
[0114] Therefore, in this embodiment, during the iteration of the preset lightweight model, the similar sentence generation and scoring model is first used to score and evaluate the several similar sentences to be evaluated, so as to obtain the evaluation score corresponding to each similar sentence to be evaluated. The similar sentences to be evaluated with evaluation scores greater than a preset evaluation threshold are identified as the target similar sentences corresponding to the new intent data, and the target similar sentences are added to the historical similar sentences to obtain the similar sentences to be processed. Then, the preset real-time iteration component is used to perform knowledge replacement and symbol preprocessing operations on the similar sentences to be processed to obtain preprocessed similar sentences. Finally, the preset lightweight model is trained using the preprocessed similar sentences to obtain the target training result, and the target training result is updated locally within a preset time period. In this way, the model can be automatically updated, effectively improving the efficiency of model update.
[0115] See Figure 10 As shown, an embodiment of the present invention discloses an intent classification model iteration device, applied to a server, comprising:
[0116] Data addition module 11 is used to receive corpus information data input by the user terminal using a preset real-time iteration component, and to obtain knowledge data in the corpus information data based on a preset knowledge discovery component and add it to a preset knowledge base;
[0117] The model generation module 12 is used to train a preset language model for generating similar sentences using collected historical similar sentences and preset sentence generation components to obtain a trained language model, and to generate a similar sentence generation scoring model by using a target evaluation scoring model for evaluating and scoring similar sentences and the trained language model; the similar sentence generation scoring model is a model used to generate similar sentences and evaluate and score the generated similar sentences.
[0118] The data generation module 13 is used to determine whether new intent data has been added. If so, the new intent data is processed using the similar sentence generation scoring model to obtain the target similar sentence corresponding to the new intent data.
[0119] The data update module 14 is used to preprocess the target similar sentence based on the preset real-time iteration component and the knowledge data in the preset knowledge base, use the preprocessed similar sentence to iteratively train the preset lightweight model, and update the training result to the local machine; the preset lightweight model is a model used to classify intent.
[0120] In this embodiment, firstly, a preset real-time iteration component is used to receive corpus information data input from the user terminal. Based on a preset knowledge discovery component, knowledge data from the corpus information data is obtained and added to a preset knowledge base. Then, the collected historical similar sentences and a preset sentence generation component are used to train a preset language model for generating similar sentences to obtain a trained language model. A similar sentence generation scoring model is generated by comparing the target evaluation scoring model for evaluating and scoring similar sentences with the trained language model, and it is determined whether new intent data has been added. If so, the similar sentence generation scoring model is used to process the new intent data to obtain a target similar sentence corresponding to the new intent data. Finally, the target similar sentence is preprocessed based on the preset real-time iteration component and the knowledge data in the preset knowledge base. The preprocessed similar sentence is used to iteratively train a preset lightweight model, and the training results are updated locally. Therefore, the intent classification model training method in this application can extract knowledge data from the corpus information using a preset knowledge discovery component, and generate a similar sentence generation scoring model using the trained language model obtained through a preset sentence generation component. Then, when a new intent is added, the preset lightweight model is iteratively trained based on the similar sentences obtained through the knowledge data and the similar sentence generation scoring model, and the training results are updated locally. In this way, the preset knowledge discovery component, sentence generation component, and iterative implementation component can be used to automatically generate highly similar sentences and automatically update the model, effectively reducing the manpower and time costs required to generate similar sentences and improving the efficiency of model updates.
[0121] In some embodiments, the data adding module 11 may specifically include:
[0122] The data receiving unit is used to receive corpus information data input by the user terminal using a preset real-time iteration component;
[0123] Data type determination unit. Used to determine the data type of the corpus information data;
[0124] The first data sending unit is configured to, if the data type of the corpus information data is audio data, convert the audio data into text data using an automatic speech recognition algorithm and send the text data to a preset knowledge discovery component; if the data type of the corpus information data is text data, directly send the text data to the preset knowledge discovery component.
[0125] The data segmentation unit is used to segment the text data based on the N-Gram model in the preset knowledge discovery component to obtain several knowledge data with different Gram lengths.
[0126] A data evaluation unit is used to score the similarity of the knowledge data of different Gram lengths using Jaccard distance.
[0127] The second data sending unit is used to add knowledge data of length Gram with a similarity less than a preset similarity threshold to the preset knowledge base.
[0128] In some embodiments, the model generation module 12 may specifically include:
[0129] The similar sentence vectorization unit is used to collect historical similar sentences and vectorize the historical similar sentences through the SimCSE model in the preset sentence generation component to obtain vectorized corpus information data.
[0130] The model generation unit is used to retrieve the vectorized corpus information data using the Annoy algorithm, and to train the preset language model using the target vectorized corpus information data whose point value is greater than the preset point value threshold after retrieval, so as to obtain the trained language model.
[0131] In some embodiments, the intent classification model iteration apparatus may further include:
[0132] The model evaluation module is used to obtain several evaluation and scoring models, and to score and evaluate the historical similar sentences using the several evaluation and scoring models respectively, so as to obtain several comprehensive scores corresponding to the several evaluation and scoring models.
[0133] The model determination module is used to determine the evaluation scoring model with the highest comprehensive score as the target evaluation scoring model.
[0134] In some embodiments, the data generation module 13 may specifically include:
[0135] The similar sentence generation unit is used to determine whether new intent data has been added. If so, it generates several similar sentences to be evaluated based on the new intent data through the similar sentence generation and scoring model.
[0136] The similar sentence determination unit is used to score and evaluate the several similar sentences to be evaluated using the similar sentence generation and scoring model, so as to obtain the evaluation score corresponding to each of the similar sentences to be evaluated, and to determine the similar sentences to be evaluated with an evaluation score greater than a preset evaluation threshold as the target similar sentences corresponding to the new intent data.
[0137] In some embodiments, the data update module 14 may specifically include:
[0138] The similar sentence adding unit is used to add the target similar sentence to the historical similar sentences to obtain the similar sentence to be processed;
[0139] The similar sentence preprocessing unit is used to perform knowledge replacement and symbol preprocessing operations on the similar sentences to be processed using the preset real-time iteration component to obtain preprocessed similar sentences;
[0140] The data update unit is used to train a preset lightweight model using the preprocessed similar sentences to obtain the target training result, and to update the target training result to the local machine within a preset time period.
[0141] In some embodiments, the intent classification model iteration apparatus may further include:
[0142] The model testing module is used to generate a target test set using the preset sentence generation component, so as to test the preset lightweight model using the target test set.
[0143] Furthermore, embodiments of this application also disclose an electronic device, Figure 11 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0144] Figure 11This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the intent classification model training method disclosed in any of the foregoing embodiments. Alternatively, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0145] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0146] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0147] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the intent classification model training method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include a computer program capable of performing other specific tasks.
[0148] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned intention classification model training method. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0149] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0150] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0151] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0152] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0153] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for training an intent classification model, characterized in that, Applied to servers, including: The system uses a preset real-time iteration component to receive corpus information data input from the user terminal, and uses a preset knowledge discovery component to obtain knowledge data from the corpus information data and add it to a preset knowledge base. The collected historical similar sentences and the preset sentence generation component are used to train a preset language model for generating similar sentences to obtain a trained language model. The trained language model is then used to generate a similar sentence generation scoring model by comparing it with a target evaluation scoring model for evaluating and scoring similar sentences. The similar sentence generation scoring model is a model used to generate similar sentences and evaluate and score the generated similar sentences. Determine if new intent data has been added. If so, use the similar sentence generation scoring model to process the new intent data to obtain the target similar sentence corresponding to the new intent data. Based on the preset real-time iterative component and using the knowledge data in the preset knowledge base, the target similar sentences are preprocessed, and the preset lightweight model is iteratively trained using the preprocessed similar sentences, and the training results are updated locally; the preset lightweight model is a model used to classify intents; The step of receiving corpus information data input from the user terminal using a preset real-time iteration component, and obtaining knowledge data from the corpus information data based on a preset knowledge discovery component and adding it to a preset knowledge base includes: The system uses a preset real-time iteration component to receive corpus information data input from the user terminal and determines the data type of the corpus information data. If the data type of the corpus information is audio data, then the audio data is converted into text data using an automatic speech recognition algorithm, and the text data is sent to the preset knowledge discovery component. If the data type of the corpus information is text data, then the text data is sent directly to the preset knowledge discovery component. The text data is segmented based on the N-Gram model in the preset knowledge discovery component to obtain several knowledge data with different Gram lengths; The similarity score of several knowledge data of different Gram lengths is scored using Jaccard distance, and knowledge data of Gram length with similarity scores less than a preset similarity threshold is added to the preset knowledge base; The method further includes, before the target evaluation and scoring model for evaluating and scoring similar sentences is used, and before the similar sentence generation and scoring model is generated by the trained language model, the following steps are also included: Several evaluation and scoring models are obtained, and the historical similar sentences are scored and evaluated based on a preset evaluation formula using the several evaluation and scoring models to obtain several comprehensive scores corresponding to the several evaluation and scoring models. The evaluation scoring model with the highest overall score is selected as the target evaluation scoring model. The preset evaluation formula is as follows: ; Where N is the number of standard question-similar question-dissimilar question groups, and k is the k-th group. To find the number of similar questions for a given group, Let be the number of dissimilar questions in a given group, sim be the dot product function, α be the similar sentence, β be the standard sentence, and γ be the dissimilar sentence.
2. The intention classification model training method according to claim 1, characterized in that, The process of training a pre-defined language model for generating similar sentences using collected historical similar sentences and a pre-defined sentence structure generation component to obtain a trained language model includes: Collect historical similar sentences and vectorize them using the SimCSE model in the preset sentence generation component to obtain vectorized corpus information data; The vectorized corpus information data is retrieved using the Annoy algorithm, and the target vectorized corpus information data with a point value greater than a preset point value threshold is used to train the preset language model to obtain the trained language model.
3. The intention classification model training method according to claim 1, characterized in that, The determination of whether new intent data has been added, and if so, the similar sentence generation and scoring model is used to process the new intent data to obtain target similar sentences corresponding to the new intent data, including: Determine if new intent data has been added; if so, generate several similar sentences to be evaluated based on the new intent data using the similar sentence generation scoring model. The similar sentence generation scoring model is used to score and evaluate the several similar sentences to be evaluated, so as to obtain the evaluation score corresponding to each of the similar sentences to be evaluated, and the similar sentences to be evaluated with an evaluation score greater than a preset evaluation threshold are determined as the target similar sentences corresponding to the new intent data.
4. The intention classification model training method according to any one of claims 1 to 3, characterized in that, The process of preprocessing the target similar sentences based on the preset real-time iterative component and utilizing knowledge data in the preset knowledge base, iteratively training the preset lightweight model using the preprocessed similar sentences, and updating the training results locally includes: The target similar sentence is added to the historical similar sentences to obtain the similar sentences to be processed; The preset real-time iteration component is used to perform knowledge replacement and symbol preprocessing operations on the similar sentences to be processed, so as to obtain preprocessed similar sentences; The preprocessed similar sentences are used to train a preset lightweight model to obtain the target training result, and the target training result is updated to the local machine within a preset time period.
5. The intention classification model training method according to claim 4, characterized in that, Also includes: The preset sentence generation component is used to generate a target test set, so that the preset lightweight model can be tested using the target test set.
6. An iterative apparatus for an intent classification model, characterized in that, Applied to servers, including: The data addition module is used to receive corpus information data input by the user terminal using a preset real-time iteration component, and to obtain knowledge data from the corpus information data based on a preset knowledge discovery component and add it to a preset knowledge base. The model generation module is used to train a preset language model for generating similar sentences using collected historical similar sentences and preset sentence generation components to obtain a trained language model. The trained language model is then used to generate a similar sentence generation scoring model by comparing the target evaluation scoring model for evaluating and scoring similar sentences with the trained language model. The similar sentence generation scoring model is a model used to generate similar sentences and evaluate and score the generated similar sentences. The data generation module is used to determine whether new intent data has been added. If so, the similar sentence generation scoring model is used to process the new intent data to obtain the target similar sentence corresponding to the new intent data. The data update module is used to preprocess the target similar sentences based on the preset real-time iteration component and the knowledge data in the preset knowledge base, use the preprocessed similar sentences to iteratively train the preset lightweight model, and update the training results to the local machine; the preset lightweight model is a model used to classify intents; The data adding module includes: The data receiving unit is used to receive corpus information data input by the user terminal using a preset real-time iteration component; A data type determination unit is used to determine the data type of the corpus information data; The first data sending unit is configured to, if the data type of the corpus information data is audio data, convert the audio data into text data using an automatic speech recognition algorithm and send the text data to a preset knowledge discovery component; if the data type of the corpus information data is text data, directly send the text data to the preset knowledge discovery component. The data segmentation unit is used to segment the text data based on the N-Gram model in the preset knowledge discovery component to obtain several knowledge data with different Gram lengths. A data evaluation unit is used to score the similarity of the knowledge data of different Gram lengths using Jaccard distance. The second data sending unit is used to add knowledge data of length Gram with a similarity less than a preset similarity threshold to the preset knowledge base; The intent classification model iterative device further includes: The model evaluation module is used to acquire several evaluation scoring models and to score and evaluate the historical similar sentences based on a preset evaluation formula using the several evaluation scoring models, so as to obtain several comprehensive scores corresponding to the several evaluation scoring models. The model determination module is used to determine the evaluation scoring model with the highest comprehensive score as the target evaluation scoring model; The preset evaluation formula is as follows: ; Where N is the number of standard question-similar question-dissimilar question groups, and k is the k-th group. To find the number of similar questions for a given group, Let be the number of dissimilar questions in a given group, sim be the dot product function, α be the similar sentence, β be the standard sentence, and γ be the dissimilar sentence.
7. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the intention classification model training method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, Used to store a computer program, which, when executed by a processor, implements the intent classification model training method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Intention recognition model training method and device and intention recognition method and device
CN112347760A
Intelligent question and answer method, device and equipment and storage medium
CN114416927A