CN-116483979-B - Dialog model training method, device, equipment and medium based on artificial intelligence
Abstract
The invention is suitable for the field of financial science and technology, and particularly relates to a dialogue model training method, device, equipment and medium based on artificial intelligence. According to the invention, the initial question text, the initial answer text and the preset category prompt term are spliced into the first sample, the amplified question text, the amplified answer text and the amplified answer keyword are obtained through back-translation, the second sample is obtained through splicing, the text data volume is expanded, the problem that the question text and the answer text are easy to be confused in the splicing result is solved, the first question-answer category of the initial answer keyword is obtained and spliced into the label of the first sample, the second question-answer category of the amplified answer keyword is obtained and spliced into the label of the second sample, the reply performance of the dialogue model on different category questions is improved through adding question-answer category information into the label, the accuracy of the dialogue model is improved through training, and the dialogue accuracy of the customer service robot and the service efficiency and quality of the financial service are improved in the field of financial technology.
Inventors
- LI ZHITAO
- WANG JIANZONG
- CHENG NING
Assignees
- 平安科技(深圳)有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20230519
Claims (8)
- 1. An artificial intelligence based dialog model training method, characterized in that the dialog model training method comprises: Splicing the acquired initial question text, initial answer text and preset category prompt vocabulary terms, and determining a corresponding splicing result as a first sample; Extracting initial answer keywords according to the initial answer text, inputting the initial answer keywords into a pre-trained question-answer classification model to obtain a first question-answer category, splicing the initial answer keywords and the first question-answer category, and determining a splicing result as a label of the first sample; Respectively inputting the initial question text, the initial answer text and the initial answer keyword into a trained text back translation model to obtain an amplified question text, an amplified answer text and an amplified answer keyword, splicing the amplified question text, the amplified answer text and the preset category prompt term, and determining a corresponding splicing result as a second sample; Inputting the amplified answer keywords into the pre-trained question-answer classification model to obtain a second question-answer category, splicing the amplified answer keywords and the second question-answer category, and determining that the splicing result is the label of the second sample; training a preset dialogue model by taking the first sample and the second sample as training samples and taking the label of the first sample and the label of the second sample as training labels to obtain a trained dialogue model; The step of splicing the acquired initial question text, initial answer text and preset category prompt term, and determining the corresponding splicing result as a first sample comprises the following steps: The preset category prompt vocabulary terms comprise a first sub-vocabulary term and a second sub-vocabulary term, and the acquired initial problem text and the first sub-vocabulary terms are spliced to obtain a problem prompt text; splicing the obtained initial answer text and the second sub-term to obtain an answer prompt text; Splicing the question prompt text and the answer prompt text, and determining a corresponding splicing result as a first sample; the step of respectively inputting the initial question text, the initial answer text and the initial answer keyword into a trained text back translation model to obtain an amplified question text, an amplified answer text and an amplified answer keyword, comprising the following steps: The text back translation model comprises a first language conversion sub-model and a second language conversion sub-model; Respectively inputting the initial question text, the initial answer text and the initial answer keyword into the first language conversion sub-model to obtain a first initial question text, a first initial answer text and a first initial answer keyword; Respectively inputting the first initial question text, the first initial answer text and the first initial answer keyword into the second language conversion sub-model to obtain a second initial question text, a second initial answer text and a second initial answer keyword; And performing de-duplication processing on the initial question text, the initial answer keyword, the second initial question text, the second initial answer text and the second initial answer keyword to obtain an amplified question text, an amplified answer text and an amplified answer keyword.
- 2. The method for training a dialogue model according to claim 1, wherein performing a de-duplication process on the initial question text, the initial answer keyword, the second initial question text, the second initial answer text, and the second initial answer keyword to obtain an amplified question text, an amplified answer text, and an amplified answer keyword comprises: calculating first similarity between the initial question text and the second initial question text, and taking the second initial question text with the first similarity not larger than a first preset threshold value as the amplified question text; calculating a second similarity between the initial answer text and the second initial answer text, and taking the second initial answer text with the second similarity not larger than a second preset threshold value as the amplified answer text; And calculating a third similarity between the initial answer keywords and the second initial answer keywords, and taking the second initial answer keywords with the third similarity not larger than a third preset threshold value as the amplified answer keywords.
- 3. The method for training a conversation model according to claim 1, wherein the training a preset conversation model with the first sample and the second sample as training samples and with the label of the first sample and the label of the second sample as training labels to obtain a trained conversation model includes: The dialogue model comprises an encoder and a decoder, the first sample and the second sample are used as training samples, and the training samples are input to the encoder for feature extraction to obtain question-answer features; inputting the question-answer features to the decoder to obtain sample answers; inputting the sample answers into a pre-trained question-answer classification model to obtain sample question-answer categories; and calculating a first model loss according to the sample answers, the sample question-answer categories and the corresponding training labels, and reversely correcting parameters of the encoder and the decoder according to a gradient descent method until the first model loss converges to obtain a trained dialogue model.
- 4. A dialog model training method in accordance with claim 3, characterized in that the calculating a first model loss from the sample answers, the sample question-answer categories and corresponding training labels comprises: the training label comprises a corresponding initial answer keyword and a corresponding question-answer category; Calculating a first loss between the sample answers and the corresponding initial answer keywords, and calculating a second loss between the sample question-answer category and the first question-answer category or the second question-answer category; substituting the first loss and the second loss into a preset loss relation model, and calculating to obtain the loss of the first model.
- 5. A dialogue model training method as claimed in claim 3, wherein the question-answer classification model comprises a classification encoder and a full-connection layer, wherein sample answer keywords are determined according to the sample answers, the sample answer keywords are used as training samples, and actual question-answer categories of the training samples are used as training labels; The training process of the question-answer classification model comprises the following steps: inputting the sample answer keywords into the classification encoder for feature extraction to obtain sample category features; inputting the sample category characteristics to the full-connection layer to obtain a sample question-answer category; and calculating second model loss according to the sample question-answer category and the actual question-answer category, and reversely correcting parameters of the classification encoder and the full-connection layer according to a gradient descent method until the second model loss converges to obtain a trained question-answer classification model.
- 6. An artificial intelligence based dialog model training device, the dialog model training device comprising: the first sample splicing module is used for splicing the acquired initial question text, the initial answer text and the preset category prompt term, and determining a corresponding splicing result as a first sample; The first label splicing module is used for extracting initial answer keywords according to the initial answer text, inputting the initial answer keywords into a pre-trained question-answer classification model to obtain a first question-answer category, splicing the initial answer keywords with the first question-answer category, and determining that a splicing result is a label of the first sample; The second sample splicing module is used for respectively inputting the initial question text, the initial answer text and the initial answer keyword into a trained text back translation model to obtain an amplified question text, an amplified answer text and an amplified answer keyword, splicing the amplified question text, the amplified answer text and the preset category prompt term, and determining a corresponding splicing result as a second sample; The second label splicing module is used for inputting the amplified answer keywords into the pre-trained question-answer classification model to obtain a second question-answer category, splicing the amplified answer keywords with the second question-answer category, and determining a splicing result as a label of the second sample; The dialogue model training module is used for training a preset dialogue model by taking the first sample and the second sample as training samples and taking the label of the first sample and the label of the second sample as training labels to obtain a trained dialogue model; The first sample stitching module includes: The first splicing sub-module is used for presetting a category prompt term comprising a first sub-term and a second sub-term, and splicing the acquired initial problem text and the first sub-term to obtain a problem prompt text; The second splicing sub-module is used for splicing the acquired initial answer text and the second sub-term to obtain an answer prompt text; the third splicing sub-module is used for splicing the question prompt text and the answer prompt text, and determining a corresponding splicing result as a first sample; the second sample stitching module includes: A text-back model determination sub-module for determining that the text-back model includes a first language-conversion sub-model and a second language-conversion sub-model; The first language conversion sub-module is used for respectively inputting the initial question text, the initial answer text and the initial answer keyword into the first language conversion sub-model to obtain a first initial question text, a first initial answer text and a first initial answer keyword; the second language conversion sub-module is used for respectively inputting the first initial question text, the first initial answer text and the first initial answer keyword into the second language conversion sub-module to obtain a second initial question text, a second initial answer text and a second initial answer keyword; And the amplification data determination submodule is used for carrying out de-duplication processing on the initial question text, the initial answer keyword, the second initial question text, the second initial answer text and the second initial answer keyword to obtain an amplification question text, an amplification answer text and an amplification answer keyword.
- 7. A computer device, characterized in that it comprises a processor, a memory and a computer program stored in the memory and executable on the processor, which processor implements the dialog model training method according to any of claims 1 to 5 when the computer program is executed.
- 8. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the dialog model training method of any of claims 1 to 5.
Description
Dialog model training method, device, equipment and medium based on artificial intelligence Technical Field The invention is suitable for the field of financial science and technology, and particularly relates to a dialogue model training method, device, equipment and medium based on artificial intelligence. Background The conversation model can identify semantics according to information input by a user, then corresponding replies are generated according to the semantic information of the user, and along with the development of artificial intelligence technology, the utilization rate of the conversation model in virtual assistants, intelligent sound boxes and chatting conversations is gradually improved, for example, in the financial field, a virtual customer service robot can communicate with a customer based on the conversation model, and the conversation model has outstanding contribution in the aspects of solving customer questions, guiding customer transactions, providing after-sales services and the like, so that the service efficiency in the financial field is effectively improved. The current dialogue model mainly prefers to directly splice dialogue questions and dialogue answers into input contents, the dialogue model generates corresponding replies by extracting semantic features of the input contents, according to the method, the dialogue questions and the dialogue answers in the spliced results are possibly confused, so that semantic understanding of the dialogue model on input contents is reduced, complex redundant information in the dialogue answers is learned, and the accuracy of the dialogue model is further reduced. Therefore, in the dialogue scenario in the financial field, how to improve the accuracy of the dialogue model is a problem to be solved. Disclosure of Invention In view of the above, the embodiments of the present invention provide a method, apparatus, device, and medium for training a dialogue model based on artificial intelligence, so as to solve the problem of low accuracy of the existing dialogue model. In a first aspect, an embodiment of the present invention provides an artificial intelligence based dialog model training method, where the dialog model training method includes: Splicing the acquired initial question text, initial answer text and preset category prompt vocabulary terms, and determining a corresponding splicing result as a first sample; Extracting initial answer keywords according to the initial answer text, inputting the initial answer keywords into a pre-trained question-answer classification model to obtain a first question-answer category, splicing the initial answer keywords and the first question-answer category, and determining a splicing result as a label of the first sample; Respectively inputting the initial question text, the initial answer text and the initial answer keyword into a trained text back translation model to obtain an amplified question text, an amplified answer text and an amplified answer keyword, splicing the amplified question text, the amplified answer text and the preset category prompt term, and determining a corresponding splicing result as a second sample; Inputting the amplified answer keywords into the pre-trained question-answer classification model to obtain a second question-answer category, splicing the amplified answer keywords and the second question-answer category, and determining that the splicing result is the label of the second sample; and training a preset dialogue model by taking the first sample and the second sample as training samples and taking the label of the first sample and the label of the second sample as training labels to obtain a trained dialogue model. In a second aspect, an embodiment of the present invention provides an artificial intelligence based dialog model training device, including: the first sample splicing module is used for splicing the acquired initial question text, the initial answer text and the preset category prompt term, and determining a corresponding splicing result as a first sample; The first label splicing module is used for extracting initial answer keywords according to the initial answer text, inputting the initial answer keywords into a pre-trained question-answer classification model to obtain a first question-answer category, splicing the initial answer keywords with the first question-answer category, and determining that a splicing result is a label of the first sample; The second sample splicing module is used for respectively inputting the initial question text, the initial answer text and the initial answer keyword into a trained text back translation model to obtain an amplified question text, an amplified answer text and an amplified answer keyword, splicing the amplified question text, the amplified answer text and the preset category prompt term, and determining a corresponding splicing result as a second sample; The second label splicing module is used for