Intention recognition model training method, intention recognition method, device, and medium
By training generative and intent classification models, semantic completion and intent prediction are performed based on intermediate speech transcription results. This solves the problem that outbound call robots need to wait for users to finish speaking, and achieves faster intent recognition and more efficient human-computer interaction.
Patent Information
- Application Number
- CN202211606254.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-14
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2042-12-14
AI Technical Summary
Existing outbound call robots need to wait for the user to finish speaking before they can perform speech recognition, resulting in low human-computer interaction efficiency, long response time, and a negative impact on the call experience.
By training generative and intent classification models, semantic completion and intent prediction are performed based on the user's intermediate speech transcription results, thus determining the user's intent in advance and reducing response time.
The ability to predict user intent before they complete a response reduces overall response time and improves human-computer interaction efficiency and call experience.
Smart Images

Figure CN116401342B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computers, in particular to a training method of an intention recognition model, an intention recognition method, device and medium. BACKGROUND
[0002] An outbound robot is a task-oriented dialogue system, which refers to a system in which a machine makes a call to a person (and vice versa, a system in which a person makes a call to a machine is called an inbound robot). The goal of the system is to complete a preset specific task (for example, determining whether someone is at home to receive express delivery or whether they are willing to participate in a certain marketing activity, etc.). During the dialogue process, the robot guides the effective progress of the dialogue, and is widely used in actual application scenarios.
[0003] Under the strong demand of enterprises pursuing cost reduction and efficiency improvement and lean user operation, the outbound robot, as a mature industrial application of artificial intelligence (AI) technology, is receiving more and more attention and popularity. It can help enterprises and organizations to accurately and efficiently reach users, and achieve subsequent growth goals such as service improvement and marketing conversion through high-quality human-computer interaction. However, as outbound robots are used more and more frequently in daily life and work, users have higher and higher requirements for the degree of realism. Once there are problems such as answering irrelevant questions and slow response, the user may directly hang up the phone, affecting business indicators such as conversion rate.
[0004] Currently, when a user's intention is recognized during the process of calling by an outbound robot, the intention is usually recognized based on the voice recognition result corresponding to the complete speaking content of the user after the user finishes speaking. The response time of human-computer voice interaction is long, and the efficiency of human-computer interaction is low. SUMMARY
[0005] The embodiments of the present application provide a training method of an intention recognition model, an intention recognition method, device and medium. The method can perform semantic completion based on an intermediate transcription result of speech transcription and predict the intention of a user when the user has not finished answering. The method can perform subsequent process processing in advance when the explicit intention of the user is predicted, reduce the overall response time, respond to the user faster, improve the efficiency of human-computer interaction, and improve the call experience.
[0006] In one aspect, the embodiments of the present application provide a training method of an intention recognition model, the intention recognition model comprising a generation model and an intention classification model, the method comprising:
[0007] obtaining first original data, the first original data comprising first question information and first reply information corresponding to the first question information;
[0008] input the first original data into the generation model for reply information prediction to generate a generation result containing a plurality of first predicted reply information;
[0009] input the first question information and each of the first predicted reply information in the generation result into the intention classification model for intention prediction to generate a candidate intention set;
[0010] determine first training data based on the first original data, the candidate intention set and a first intention label;
[0011] train the intention recognition model based on the first training data to obtain a trained intention recognition model, wherein, when training the intention recognition model, a first training target is that first predicted intention information output by the intention recognition model conforms to the first intention label.
[0012] In another aspect, the embodiment of the present application provides an intention recognition method, which comprises:
[0013] obtaining to-be-processed data, wherein the to-be-processed data comprises target question information and real-time reply information corresponding to the target question information, the target question information is question information broadcast by an outbound robot, and the real-time reply information comprises incomplete reply information of an object to the target question information which is not completed;
[0014] performing intention recognition on the to-be-processed data based on the trained intention recognition model to obtain target intention information corresponding to the to-be-processed data, wherein the trained intention recognition model is obtained according to the training method of the intention recognition model in any one of the above embodiments.
[0015] In another aspect, the embodiment of the present application provides a training device of an intention recognition model, wherein the intention recognition model comprises a generation model and an intention classification model, and the device comprises:
[0016] a first obtaining unit configured to obtain first original data, wherein the first original data comprises first question information and first reply information corresponding to the first question information;
[0017] a first processing unit configured to input the first original data into the generation model for reply information prediction to generate a generation result containing a plurality of first predicted reply information;
[0018] a second processing unit configured to input the first question information and each of the first predicted reply information in the generation result into the intention classification model for intention prediction to generate a candidate intention set;
[0019] The determining unit is configured to determine first training data based on the first original data, the candidate intent set, and the first intent label.
[0020] The training unit is configured to train the intent recognition model based on the first training data to obtain a trained intent recognition model, wherein, when the intent recognition model is trained, a first training target is that first predicted intent information output by the intent recognition model is consistent with the first intent label.
[0021] In another aspect, an embodiment of the present application provides an intent recognition device, and the device comprises:
[0022] The second obtaining unit is configured to obtain to-be-processed data, wherein the to-be-processed data comprises target question information and real-time reply information corresponding to the target question information, the target question information is question information broadcast by an outbound robot, and the real-time reply information comprises incomplete reply information of an object to the target question information.
[0023] The recognition unit is configured to perform intent recognition on the to-be-processed data based on the trained intent recognition model to obtain target intent information corresponding to the to-be-processed data, wherein the trained intent recognition model is obtained according to the training method of the intent recognition model in any one of the above embodiments.
[0024] In another aspect, an embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores a computer program, the computer program is adapted to be loaded by a processor to execute the method in any one of the above embodiments.
[0025] In another aspect, an embodiment of the present application provides a computer device, and the computer device comprises a processor and a memory, the memory stores a computer program, and the processor is configured to execute the training method of the intent recognition model in any one of the above embodiments by calling the computer program stored in the memory.
[0026] In another aspect, an embodiment of the present application provides a computer program product, and the computer program product comprises computer instructions, and the computer instructions are executed by a processor to implement the method in any one of the above embodiments.
[0027] In the embodiment of the present application, the intent recognition model includes a generation model and an intent classification model. The first original data is obtained, the first original data including first question information and first reply information corresponding to the first question information. The first original data is input into the generation model for reply information prediction to generate a generation result including a plurality of first predicted reply information. The first question information and each first predicted reply information in the generation result are input into the intent classification model for intent prediction to generate a candidate intent set. The first training data is determined based on the first original data, the candidate intent set, and the first intent label. The intent recognition model is trained based on the first training data to obtain a trained intent recognition model. When the intent recognition model is trained, the first training target is that the first predicted intent information output by the intent recognition model conforms to the first intent label.
[0028] The embodiment of the present application can use the generation model to perform semantic completion on the incomplete reply information corresponding to the first original data to generate a generation result including a plurality of first predicted reply information. Then, the intent classification model is used to perform intent prediction on each first predicted reply information to generate a candidate intent set. The first training data is determined based on the first original data, the candidate intent set, and the first intent label. Then, the intent recognition model is trained based on the first training data to obtain a trained intent recognition model. When the trained intent recognition model is used to determine the intent of the user, it is not necessary to wait for the user to finish speaking. Instead, the semantic completion can be performed based on the intermediate transcription result of the speech transcription of the collected to-be-processed data, and the intent of the user can be predicted when the user has not finished answering. In other words, the embodiment of the present application can perform the processing of the subsequent process in advance when the explicit intent of the user is predicted. Compared with the case of waiting for the user to finish speaking and then confirming the intent, the embodiment of the present application can advance the time of determining the intent, reduce the overall response time, respond to the user more quickly, improve the human-computer interaction efficiency, and improve the call experience. BRIEF DESCRIPTION OF DRAWINGS
[0029] Figure 1 The flowchart of the training method of the intent recognition model provided by the embodiment of the present application is shown.
[0030] Figure 2 The first application scenario diagram of the training method of the intent recognition model provided by the embodiment of the present application is shown.
[0031] Figure 3 The second application scenario diagram of the training method of the intent recognition model provided by the embodiment of the present application is shown.
[0032] Figure 4 The first flowchart of the intent recognition method provided by the embodiment of the present application is shown.
[0033] Figure 5A first application scenario of the intent recognition method provided by the embodiments of the present application is shown in the figure.
[0034] Figure 6 A second flow of the intent recognition method provided by the embodiments of the present application is shown in the figure.
[0035] Figure 7 A structure of the training device of the intent recognition model provided by the embodiments of the present application is shown in the figure.
[0036] Figure 8 A structure of the intent recognition device provided by the embodiments of the present application is shown in the figure.
[0037] Figure 9 A structure of the computer device provided by the embodiments of the present application is shown in the figure. DETAILED DESCRIPTION
[0038] The embodiments of the present application provide a training method of an intent recognition model, an intent recognition method, an apparatus and a medium. Specifically, the training method of the intent recognition model of the embodiments of the present application can be executed by a computer device, wherein the computer device can be a terminal or a server and the like. The terminal can be a smart phone, a tablet computer, a notebook computer, a smart television, a smart speaker, a wearable smart device, a smart vehicle terminal and the like, and the terminal can further include a client, which can be a video client, a browser client, an instant messaging client or an applet and the like. The server can be a standalone physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content distribution networks (CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
[0039] The embodiments of the present application can be applied to scenarios such as human-computer interaction dialogues.
[0040] First, some nouns or terms appearing in the process of describing the embodiments of the present application are explained as follows:
[0041] Deep learning (DL): a branch of machine learning, mainly through constructing a multi-layer artificial neural network to learn the internal law and representation vector of sample data, for the analysis of data such as text, image and sound.
[0042] Natural Language Processing (NLP): Using deep learning and other technologies to mathematically model human language, understand the semantics of human language, and mine the rules and patterns in language to solve various practical tasks such as text classification, entity extraction, article writing, and question answering.
[0043] Automatic Speech Recognition (ASR): Also known as automatic speech recognition, its goal is to use computers to automatically convert human speech content into corresponding text, so that the converted text content can be further analyzed using natural language processing technology.
[0044] Language Model (LM): A language model is simply a probability distribution of a sequence of words. Its role is to determine a probability distribution P for a text of length m, indicating the likelihood of the existence of this text.
[0045] BERT (Bidirectional Encoder Representations from Transformers): A language model based on self-attention mechanism, used to convert text into vectors in real space. By training on large-scale unlabeled samples, it greatly improves the performance of vector representation.
[0046] UniLM: A pre-trained language model based on BERT, called Unified Pre-training Language Model. It uses three special Mask pre-training objectives, so that the model can be used for natural language generation (NLG), while achieving the same effect as BERT in natural language understanding (NLU) tasks. UniLM can complete one-way, sequence-to-sequence, and bidirectional prediction tasks.
[0047] GLAT (Glancing Transformer for Non-Autoregressive Neural Machine Translation): A non-autoregressive generation algorithm that trains in two decodings. After the first decoding, the distance between the predicted result and the target is calculated, and the input is randomly replaced with the target text to help learn the dependency between words. It can be used in scenarios such as machine translation.
[0048] DA-Transformer (Directed Acyclic Transformer for Non-Autoregressive Machine Translation): A non-autoregressive generation algorithm that trains a transition probability matrix based on a directed acyclic graph (DAG), which can generate multiple possible results at once and can be used in scenarios such as machine translation.
[0049] Directed Acyclic Graph (DAG): A directed graph without loops. It consists of a finite number of vertices and directed edges, each of which points from one vertex to another. From any given vertex, it is not possible to return to the original vertex by following the directed edges. A directed acyclic graph is a graph in which, starting from any point, it is not possible to return to the original point, no matter how many branching points are passed through.
[0050] Currently, the mainstream implementation of outbound robots is in a serial form. The speech of the user being called is sequentially processed through six modules: Automatic Speech Recognition (ASR), Natural Language Understanding (NLU), Dialog State Tracking (DST), Dialog Policy (DP), Natural Language Generation (NLG), and Text To Speech (TTS). The functions of each module are as follows:
[0051] ASR: Converts the user's speech input into text for subsequent semantic understanding;
[0052] NLU: Extracts relevant intent and slot information from the ASR-transcribed text through semantic recognition;
[0053] DST: Updates the current dialog state based on the extracted intent, slot information, historical dialog state, and historical system policy;
[0054] DP: Determines the next system policy based on the current dialog state;
[0055] NLG: Converts the system policy into natural language text output that the robot will broadcast;
[0056] TTS: Converts the robot's output text into speech and plays it to the user.
[0057] The present application focuses on the intent recognition process of the NLU module, which is to obtain the intent from the ASR transcribed text. Current ASR technology is divided into offline recognition and real-time recognition. Offline recognition takes the entire recording as input, and transcribes the speech based on complete speech context information during recognition, usually with lower error rate; real-time recognition takes the received speech stream as input, and transcribes in real time based on incomplete speech information in the speech stream, which is commonly used in real-time interactive scenarios.
[0058] The current common outbound robot adopts real-time recognition method for ASR transcription. In the transcription process, the maximum silence duration parameter is used to determine whether the user has finished speaking a sentence. When it is determined that the user has finished speaking, the user's speaking content is transmitted to the NLU module for intent recognition, and after obtaining the user's intent, the subsequent DST, DP and other processes are processed. Although the current ASR can receive the speaker's speech and perform real-time speech recognition at the same time, the subsequent NLU module still waits for the sentence to be finished before performing intent recognition based on the entire sentence. The entire process is as follows: S1, detecting that the user starts speaking; S2, ASR obtains the speech stream for real-time transcription; S3, determining whether the user has finished speaking, if yes, performing S4, if not, returning to perform S2; S4, performing ASR transcription on the speech that has been finished, obtaining the final transcription result; performing intent recognition on the final transcription result to obtain the user's intent, and performing subsequent processes such as subsequent dialog state tracking, dialog strategy, natural language generation and speech synthesis based on the user's intent.
[0059] In the related art process, when the ASR module obtains the speech stream for real-time transcription, there is actually an intermediate transcription result. For example, the user speaks "I don't have time, how about tomorrow, can it work tomorrow?", the ASR transcription result can be:
[0060] ASR intermediate transcription result 1: "I don't have";
[0061] ASR intermediate transcription result 2: "I don't have time, how about";
[0062] ASR intermediate transcription result 3: "I don't have time, how about tomorrow";
[0063] ASR final transcription result 4: "I don't have time, how about tomorrow, can it work tomorrow".
[0064] The conventional intent recognition method of the related technology only uses the final transcription result for recognition, and directly discards all intermediate results. If the intent recognition is based on the intermediate transcription result, the intent can be recognized in time and the subsequent process can be processed when the user clearly expresses the intent, the subsequent process is advanced, the overall response delay is reduced, and the corresponding speech can be played when the user finishes speaking, improving the call experience. This intent recognition is called streaming intent recognition. For the above example, the streaming intent recognition method recognizes the explicit intent "no time" from the second ASR intermediate transcription result "I have no time, or not", and directly processes the subsequent process. At this time, the user is still continuing to speak. When the user finishes speaking, the entire system has completed the processing of the subsequent process, directly plays the prepared speech to reply, and the response delay is significantly reduced.
[0065] However, directly applying the conventional intent recognition method to streaming intent recognition will have certain problems. The goal of conventional intent recognition is to directly predict the intent of the user's speech content, while streaming intent recognition cannot directly predict based on the speech content because the user's speech is not complete. For example, in the above example, the first ASR intermediate transcription result is "I don't have", if the user finishes speaking, it can be judged as a "negative" intent, but if it is an intermediate result, there are many possibilities, such as "I don't have time", "I don't understand", "I don't hear clearly", etc. At this time, there are multiple intents. In addition, if the ASR intermediate transcription result is "I don't have today", although it does not explicitly say "no time", but the subsequent probability is "I don't have time today", "I don't have time today", etc. At this time, the intent is basically determined as "no time", but if it is directly predicted based on "I don't have today", the accuracy rate is difficult to guarantee due to the lack of information.
[0066] Therefore, streaming intent recognition needs to complete the semantics based on the current speech content of the user to predict all possible intents, that is, content generation is needed. Only through the generation model to complete the semantic information of the user, the actual intent that the user wants to express can be more accurately judged, and a high accuracy rate can be achieved.
[0067] Among them, streaming intent recognition involves a generation task, if multiple possible results are to be generated, multiple calculations are usually needed using a generation model, and there is not a small challenge in the response time of the generation task. In addition, if multiple generation results are directly input into the intent classification model for prediction, there is also not a small performance pressure on the intent classification task.
[0068] This application provides a high-performance streaming intent recognition scheme that can be used in outbound call robots during telephone calls. It eliminates the need to wait for the user to finish speaking; instead, based on the intermediate ASR transcription results, it uses a non-autoregressive approach to perform semantic completion and predict the user's intent. It boasts a response time similar to conventional intent recognition and can proactively process subsequent steps when the user's explicit intent is predicted. Compared to waiting for the user to finish speaking before confirming intent, this application's embodiments can advance the intent determination time, reducing overall response time, responding to users faster, improving human-computer interaction efficiency, and enhancing the call experience.
[0069] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the priority of the embodiments.
[0070] Please see Figures 1 to 3 , Figure 1 This is a flowchart illustrating the training method of the intent recognition model provided in an embodiment of this application. Figures 2 to 3 This diagram illustrates an application scenario of the training method for the intent recognition model provided in this embodiment. The intent recognition model includes a generation model and an intent classification model, and the method may include steps 110 to 150.
[0071] Step 110: Obtain first raw data, which includes first question information and first response information corresponding to the first question information.
[0072] For example, online call data is acquired and processed in a question-and-answer format to obtain a first raw dataset. This first raw dataset may contain multiple first raw data sets. Each first raw data set includes a first question and its corresponding first response. The first question is a question raised by the outbound call robot, and the first response is a user's reply to that question. For example, the first question might be, "This call is to invite you to tonight's live course. Do you have time tonight?" or "Do you have time tonight?", and the first response might be, "I don't have time."
[0073] Step 120: Input the first raw data into the generation model to predict the response information, so as to generate a generation result containing multiple first predicted response information.
[0074] For example, for each first original data in the first original data set, the first reply information in the first original data is randomly truncated to simulate the intermediate transcription result of the speech stream generated when the user replies to the question, and the first question information in the first original data and the randomly truncated first reply information are taken as inputs to perform reply information prediction by using the pre-trained generation model to generate a generation result containing a plurality of first predicted reply information.
[0075] The generation model can be a DA-Transformer model. In view of the fact that the intent recognition model needs to train and predict all possible intents based on the generated content, in order to improve the performance of the intent recognition model, the generation model in the intent recognition model can adopt a non-autoregressive generation algorithm, such as a DA-Transformer model, and the model encoding needs to contain information corresponding to all possible intents, so that the intent recognition model can be directly trained and predicted based on the model encoding.
[0076] Optionally, step 120 can be implemented by steps 121 to 127 (not shown in the figure), specifically:
[0077] In step 121, first model input information is generated according to the first original data, the first model input information including the first question information, first truncated reply information corresponding to the first reply information, and first mask information.
[0078] Optionally, the first model input information is generated according to the first original data, including:
[0079] The first reply information is truncated to obtain the first truncated reply information corresponding to the first reply information.
[0080] The first question information and the first truncated reply information are spliced to obtain first spliced information.
[0081] The first spliced information is masked based on a first character length to obtain first spliced information with first mask information.
[0082] The first spliced information with first mask information is subjected to a forward truncation operation or a backward padding operation based on a second character length to obtain the first model input information, the total character length of the first model input information being equal to the second character length.
[0083] For example, the first question information is “Do you have time in the evening?” and the first reply information is “I don't have time, ha.”
[0084] First, the first reply information is truncated to obtain the first truncated reply information corresponding to the first reply information, such as the first truncated reply information being “I don't have.”
[0085] Then, the first question information and the first truncated reply information are spliced to obtain first spliced information, such as the first spliced information being "[CLS] Do you have time at night? [SEP] I don't".
[0086] Then, the first spliced information is mask processed based on a first character length g to obtain first spliced information with first mask information, such as g = 4, that is, four [MASK] are supplemented, and the first spliced information with first mask information being:
[0087] "[CLS] Do you have time at night? [SEP] I don't [MASK] [MASK] [MASK] [MASK]".
[0088] The first character length g can be a power of 2.
[0089] Then, the first spliced information with first mask information is forward truncated or backward padded based on a second character length m to obtain first model input information, the total character length of the first model input information being equal to the second character length, such as m = 16, if the total character length of the first spliced information with first mask information is less than 16, the first spliced information with first mask information is backward padded to obtain the first model input information, which can be:
[0090] For example, the second character length m is more than the average length of all possible first spliced information, and the second character length m is a power of 2.
[0091] Wherein, [CLS] represents the beginning of a sentence, the [CLS] mark is placed at the beginning of the sentence; [SEP] is used to separate two input sentences, for example, input sentences A and B, [SEP] marks are added after the sentences A and B; [MASK] is used to cover some words in the sentence; [PAD] represents that the sentence is processed to a specific length, and [PAD] is supplemented before or after the sentence.
[0092] Step 122, self-attention encoding is performed on the first model input information to obtain a first model encoding vector corresponding to the first model input information.
[0093] For example, the generation model includes a self-attention encoding model, such as the self-attention encoding model being implemented by a UniLM model or a BERT model. The generation model is obtained by pre-training an initial generation model using second original data.
[0094] For example, the first model input information is input into the generation model, and the self-attention encoding model in the generation model performs self-attention encoding to obtain a first model encoding vector corresponding to the first model input information, such as the first model encoding vector being:
[0095] .
[0096] As shown in Figure 2 , before self-attention encoding, the first model input information can be converted into vector representations, including token embeddings, segment embeddings, and position embeddings; then the above three vector representations are added to obtain the input of the self-attention encoding model. Then the self-attention encoding is performed through the compilation blocks (Transformer Block1, Transformer Block2 to Transformer Blockn) in the self-attention encoding model to obtain the first model encoding vector corresponding to the first model input information.
[0097] Step 123, taking the last n characters of the first truncated reply information and all characters of the first mask information as first target extraction positions, extracting the encoding vectors corresponding to the first target extraction positions from the first model encoding vector to obtain a second model encoding vector, n being a positive integer.
[0098] For example, the second encoding vector includes the encoding vectors corresponding to the last n characters of the first truncated reply information and the encoding vectors corresponding to all characters of the first mask information. The last n characters of the first truncated reply information and all [MASK] corresponding characters in the first model encoding vector are extracted, which are used for subsequent decoding processes, where n≥1, for example, for convenience of calculation, n is usually taken as 1.
[0099] For example, the first model input information is “[CLS] You have time at night [SEP] I don't [MASK] [MASK] [MASK] [MASK] [PAD]”, the corresponding text characters of the first target extraction position are “don't [MASK] [MASK] [MASK] [MASK]”, and the second model encoding vector obtained according to the first model encoding vector corresponding to the first model input information in the above example is:
[0100] .
[0101] As shown in Figure 2 , the text information corresponding to the second model encoding vector is “no empty time to listen to Ming Qing understand white reason S”.
[0102] Step 124, decoding the second model coding vector to obtain a first decoding vector.
[0103] For example, as Figure 2 For example, the first decoding vector obtained by decoding the second model coding vector corresponds to the text information "no empty time to listen to the clear and white reason S".
[0104] Step 125, performing first processing on the first decoding vector to obtain a first character probability matrix, the first character probability matrix representing the probability of each position in the first target extraction position corresponding to different characters.
[0105] For example, the first processing on the first decoding vector to obtain the first character probability matrix includes linear transformation processing and normalization processing on the first decoding vector to obtain the first character probability matrix.
[0106] Step 126, performing second processing on the first decoding vector to obtain a first transition probability matrix, the first transition probability matrix representing the jump probability of each position in the first target extraction position to other positions.
[0107] For example, the second processing on the first decoding vector to obtain the first transition probability matrix includes twice linear transformation processing on the first decoding vector, and calculating the inner product and performing normalization processing to obtain the first transition probability matrix.
[0108] Step 127, based on the first character probability matrix and the first transition probability matrix, calculating the first text probability corresponding to different first candidate texts, sorting the first text probability from large to small, and taking the first candidate text corresponding to the first text probability ranked in the first m as the multiple first predicted reply information in the generated result, m is a positive integer.
[0109] As Figure 2 The generation model includes a directed acyclic graph (DAG), and the above steps S125 to S127 can be processed based on the DAG to finally obtain a generated result containing multiple first predicted reply information.
[0110] For example, the first text probability corresponding to different candidate texts can be calculated using the dynamic programming principle in the DAG.
[0111] For example, after the processing of the above steps S121 to S127, the generated result containing multiple first predicted reply information output by the generation model can be:
[0112] I'm busy; I'm in a hurry; I didn't understand; I didn't hear clearly; I didn't hear clearly; I don't have time.
[0113] Optionally, the method further comprises:
[0114] S10, obtaining second original data, the second original data comprising second question information and second reply information corresponding to the second question information;
[0115] S20, pre-training an initial generation model using the second original data to obtain the generation model, wherein, during the pre-training of the initial generation model, a second training target is that second predicted reply information output by the initial generation model conforms to the second reply information.
[0116] For example, online call data is obtained, processed in the form of one question and one answer, and second original data sets are obtained, which can contain multiple second original data. Each second original data comprises second question information and second reply information corresponding to the second question information. The second question information is a question asked by an outbound robot, and the second reply information is user reply information for the second question information. For example, the second question information is "This call is to invite you to attend the live course tonight. Do you have time tonight?" or "Do you have time tonight?", and the second reply information is "I don't have time."
[0117] Then, the initial generation model is pre-trained using the second original data to obtain the generation model. For example, the initial generation model can be a DA-Transformer model, and the generation model is a pre-trained DA-Transformer model.
[0118] Optionally, step S20 can be implemented by steps S21 to S28 (not shown in the figure), specifically:
[0119] S21, generating second model input information according to the second original data, the second model input information comprising the second question information, second truncated reply information corresponding to the second reply information, and second mask information.
[0120] Optionally, the second model input information is generated according to the second original data, comprising:
[0121] Truncating the second reply information to obtain second truncated reply information corresponding to the second reply information;
[0122] Splicing the second question information and the second truncated reply information to obtain second spliced information;
[0123] mask the second concatenation information based on a first character length, to obtain second concatenation information with second mask information;
[0124] perform a forward truncation operation or a backward padding operation on the second concatenation information with the second mask information based on a second character length, to obtain the second model input information, a total character length of the second model input information being equal to the second character length.
[0125] For example, the second question information is “Please ask you have time at night?” and the second reply information is “I have no time, ha.” First, the second reply information is truncated to obtain first truncated reply information corresponding to the second reply information, such as the first truncated reply information being “I have no”. Then, the second question information and the second truncated reply information are concatenated to obtain second concatenation information, such as the second concatenation information being “[CLS] Please ask you have time at night? [SEP] I have no”. Then, the second concatenation information is masked based on a first character length g to obtain second concatenation information with second mask information, such as g = 4, that is, 4 [MASK] are supplemented, and the second concatenation information with second mask information is “[CLS] Please ask you have time at night? [SEP] I have no [MASK] [MASK] [MASK] [MASK]”. The first character length g can be a power of 2. Then, the second concatenation information with second mask information is subjected to a forward truncation operation or a backward padding operation based on a second character length m to obtain the second model input information, a total character length of the second model input information being equal to the second character length, such as m = 16. If the total character length of the second concatenation information with second mask information is greater than 16, the second concatenation information with second mask information is subjected to a forward truncation operation, and “please” is truncated, and the obtained second model input information can be “[CLS] ask you have time at night? [SEP] I have no [MASK] [MASK] [MASK] [MASK]”. For example, the second character length m is more than the average length of all possible second concatenation information, and the second character length m is a power of 2.
[0126] For example, the second question is "Do you have time tonight?", and the second reply is "I don't have time." First, the second reply is truncated to obtain the corresponding first truncated reply, for example, "I don't." Then, the second question and the second truncated reply are concatenated to obtain the second concatenated information, for example, "[CLS]Do you have time tonight?[SEP]I don't." Then, the second concatenated information is masked based on the first character length g, resulting in the second concatenated information with the second mask. For example, if g=4, four "[MASK]" characters are added, and the second concatenated information with the second mask becomes: "[CLS]Do you have time tonight?[SEP]I don't [MASK][MASK][MASK][MASK]". Then, based on the second character length m, the second concatenated information with the second mask information is subjected to forward truncation or backward padding to obtain the second model input information. The total character length of the second model input information is equal to the second character length, for example, m=16. If the total character length of the second concatenated information with the second mask information is less than 16, the second concatenated information with the second mask information is subjected to backward padding, adding "[PAD]". The resulting second model input information can be: "[CLS]Do you have time tonight? [SEP]I don't have time. [MASK][MASK][MASK][MASK][PAD]".
[0127] S22, perform self-attention encoding on the second model input information to obtain the third model encoding vector corresponding to the second model input information.
[0128] For example, the initial generative model includes a self-attention encoding model, which can be implemented using a UniLM model or a BERT model.
[0129] For example, the input information of the second model is input into the initial generator model. The self-attention encoding model in the initial generator model performs self-attention encoding to obtain the third model encoding vector corresponding to the input information of the second model. For example, the third model encoding vector is:
[0130] .
[0131] like Figure 3As shown, before self-attention encoding is performed, the second model input information can be converted into vector representations, including token embeddings, segment embeddings, and position embeddings; then the above three vector representations are added to obtain the input of the self-attention encoding model. Then, the self-attention encoding is performed through the compilation blocks (Transformer Block1, Transformer Block2 to Transformer Blockn) in the self-attention encoding model to obtain the third model encoding vector corresponding to the second model input information.
[0132] As shown in Figure 3 , the text information corresponding to the third model encoding vector is "[CLS] Do you have time at night [SEP] I have no time to listen to Ming Qing Comprehension White S".
[0133] S23, taking the last n characters of the second truncated reply information and all characters of the second mask information as second target extraction positions, extracting the encoding vector corresponding to the second target extraction positions from the third model encoding vector to obtain a fourth model encoding vector, n is a positive integer.
[0134] For example, the fourth encoding vector includes the encoding vector corresponding to the last n characters of the second truncated reply information and the encoding vector corresponding to all characters of the second mask information. Extract the last n characters of the second truncated reply information and all [MASK] corresponding to all characters in the third model encoding vector, which are used for subsequent decoding processes, where n≥1, for example, for convenience of calculation, n is usually taken as 1.
[0135] For example, the second model input information is "[CLS] Do you have time at night [SEP] I have no [MASK] [MASK] [MASK] [MASK] [PAD]", and the corresponding text characters of the second target extraction position are "[MASK] [MASK] [MASK] [MASK]". According to the third model encoding vector corresponding to the second model input information in the above example, the fourth model encoding vector obtained is:
[0136] .
[0137] As shown in Figure 3 , the text information corresponding to the fourth model encoding vector is "I have no time to listen to Ming Qing Comprehension White S".
[0138] S24, decoding the fourth model encoding vector to obtain a second decoding vector.
[0139] AsFigure 3 As shown, the fourth model coding vector is decoded to obtain the second decoding vector, and the text information corresponding to the second decoding vector is "no empty time to listen to Ming Qing clear white reason S".
[0140] S25, the second decoding vector is processed to obtain a second character probability matrix, and the second character probability matrix represents the probability of each position corresponding to different characters in the second target extraction position.
[0141] For example, the second decoding vector is processed to obtain a second character probability matrix, including linear transformation processing and normalization processing of the second decoding vector to obtain a second character probability matrix.
[0142] S26, the second decoding vector is processed to obtain a second transition probability matrix, and the second transition probability matrix represents the jump probability of each position to other positions in the second target extraction position.
[0143] For example, the second decoding vector is processed to obtain a second transition probability matrix, including twice linear transformation processing of the second decoding vector, and calculating the inner product and performing normalization processing to obtain a second transition probability matrix.
[0144] S27, based on the second character probability matrix and the second transition probability matrix, the second text probability corresponding to different second candidate texts is calculated, the second text probability is sorted from large to small, and the second candidate text corresponding to the first m second text probability is taken as the second predicted reply information, m is a positive integer.
[0145] As Figure 3 As shown, the initial generation model includes a directed acyclic graph (DAG), and the above steps S25 to S27 can be processed based on the DAG to finally obtain the second predicted reply information.
[0146] For example, the second text probability corresponding to different candidate texts can be calculated using the dynamic programming principle in the DAG.
[0147] For example, after the processing of the above steps S21 to S27, the second predicted reply information output by the initial generation model can be:
[0148] I have no time; I have no time; I have not understood; I have not heard clearly; I have not understood; I have no time.
[0149] S28, according to the second predicted reply information and the second reply information, the initial generation model is pre-trained based on the loss function constructed based on the second training target to obtain the generation model.
[0150] For example, according to the second predicted reply information and the second reply information, the loss function constructed based on the second training target is used to pre-train the initial generation model to obtain the generation model. The second training target is that the second predicted reply information output by the initial generation model conforms to the second reply information.
[0151] In step 130, the first question information and each of the first predicted reply information in the generation result are input into the intention classification model for intention prediction to generate a candidate intention set.
[0152] Optionally, the inputting of the first question information and each of the first predicted reply information in the generation result into the intention classification model for intention prediction to generate a candidate intention set comprises:
[0153] Each of the first predicted reply information in the generation result is traversed, and each time the first question information and one of the first predicted reply information in the generation result are input into the intention classification model for intention prediction to obtain candidate intention information corresponding to each of the first predicted reply information, and the candidate intention set is generated according to the candidate intention information corresponding to each of the first predicted reply information.
[0154] For example, the first question information is “Do you have time in the evening?”, the generation result containing a plurality of first predicted reply information is “I have no time; I have no time; I don't understand; I don't hear clearly; I don't hear clearly; I don't hear clearly; I don't have time.”, the first question information and each of the first predicted reply information in the generation result are input into the intention classification model for intention prediction to generate a candidate intention set, such as the candidate intention set “no time; no money; no understanding; no hearing”.
[0155] Optionally, the method further comprises:
[0156] Obtaining second training data, the training data comprising third original data and a second intention label, the third original data comprising third question information and third reply information corresponding to the third question information;
[0157] Pre-training an initial intention classification model using the second training data to obtain the intention classification model, wherein, when the initial intention classification model is pre-trained, a third training target is that second predicted intention information output by the initial intention classification model conforms to the second intention label.
[0158] For example, the third original data set can be manually labeled to obtain a second intention label corresponding to each third original data. For example, the initial intention classification model can be a TextCNN, LSTM, BERT, or the like. For example, the BERT model with higher accuracy can be used as the initial intention classification model for training. For example, the third question information in the third original data is "This call is to invite you to participate in the live course tonight. Do you have time tonight?", the third reply information is "I don't have time.", and the second intention label is "no time".
[0159] After pre-training, the final training target is that the second predicted intention information output by the initial intention classification model matches the second intention label, such as the second predicted intention information output by the initial intention classification model being "no time". After pre-training, the intention classification model is obtained.
[0160] Step 140, determining first training data based on the first original data, the candidate intention set, and the first intention label.
[0161] For example, the first training data includes:
[0162] The first question information in the first original data is "Do you have time tonight?";
[0163] The first reply information in the first original data is "I don't have time."
[0164] The candidate intention set is "no time; no money; not understood; not clear."
[0165] The first intention label is "no time."
[0166] Step 150, training the intention recognition model based on the first training data to obtain a trained intention recognition model, wherein the first training target is that the first predicted intention information output by the intention recognition model matches the first intention label.
[0167] Optionally, step 150 can be implemented by steps 151 to 156 (not shown in the figure), specifically:
[0168] Step 151, encoding the text of each candidate intention information in the candidate intention set in the first training data using the intention classification model to obtain first intention text encoding.
[0169] As shown in Figure 2 the text of each candidate intention information in the candidate intention set in the first training data is encoded using the intention classification model to obtain first intention text encoding, such as first intention text encoding:
[0170] .
[0171] Step 152, generating first model input information according to the first original data in the first training data, and performing self-attention coding on the first model input information by using the generation model to obtain a first model coding vector corresponding to the first model input information.
[0172] For example, the specific implementation of step 152 can refer to steps 121-122 described above, which will not be repeated here.
[0173] Step 153, calculating attention weights based on the first intention text coding and the first model coding vector to obtain first intention attention coding.
[0174] As shown in the following formula (1), the first intention text coding and the first model coding vector are input into a label-wise attention layer to calculate attention weights, so as to extract attention coding vectors related to each intention in the first model coding vector, and obtain first intention attention coding. Figure 2
[0175] Step 154, performing linear transformation processing and normalization processing on the first intention attention coding to obtain a first intention probability corresponding to each candidate intention information of the candidate intention set.
[0176] As shown in the following formula (2), the first intention attention coding is subjected to linear transformation processing and normalization processing based on a multi-tabel classification layer to obtain a first intention probability corresponding to each candidate intention information of the candidate intention set, such as “0.91; 0.12; 0.81; 0.78” corresponding to “no time; no money; not understood; not clearly heard”. Figure 2
[0177] Step 155, determining the first predicted intention information according to the first intention probability.
[0178] For example, the first intention probability corresponding to “no time” is the highest, so the first predicted intention information is determined to be “no time”.
[0179] Step 156, training the intention recognition model based on the loss function constructed based on the first training target according to the first predicted intention information and the first intention label to obtain the trained intention recognition model.
[0180] For example, when the first predicted intention information output by the intention recognition model (such as "no time") matches the first intention label (such as "no time"), the training is ended, and the trained intention recognition model is obtained.
[0181] All the technical solutions described above can be combined in any manner to form optional embodiments of the present application, which will not be described one by one here.
[0182] In the embodiments of the present application, the intention recognition model includes a generation model and an intention classification model. The first original data is obtained, the first original data including first question information and first reply information corresponding to the first question information. The first original data is input into the generation model for reply information prediction to generate a generation result including a plurality of first predicted reply information. The first question information and each first predicted reply information in the generation result are input into the intention classification model for intention prediction to generate a candidate intention set. The first training data is determined based on the first original data, the candidate intention set, and the first intention label. The intention recognition model is trained based on the first training data to obtain a trained intention recognition model, wherein, when the intention recognition model is trained, the first training target is that the first predicted intention information output by the intention recognition model matches the first intention label. In the embodiments of the present application, the generation model can be used to perform semantic completion on the incomplete reply information corresponding to the first original data to generate a generation result including a plurality of first predicted reply information. Then, the intention classification model is used to perform intention prediction on each first predicted reply information to generate a candidate intention set. The first training data is determined based on the first original data, the candidate intention set, and the first intention label. Then, the intention recognition model is trained based on the first training data to obtain a trained intention recognition model. When the trained intention recognition model is used to determine the intention of the user, it is not necessary to wait for the user to finish speaking, but the semantic completion can be performed based on the intermediate transcription result of the speech transcription of the collected to-be-processed data, and the intention of the user can be predicted when the user has not finished answering. In other words, the embodiments of the present application can perform the processing of the subsequent process in advance when the explicit intention of the user is predicted. Compared with the case of waiting for the user to finish speaking and then confirming the intention, the embodiments of the present application can advance the time of determining the intention, reduce the overall response time, respond to the user more quickly, improve the human-computer interaction efficiency, and improve the call experience.
[0183] Please refer to Figures 4 to 6 , Figure 4 and Figure 6 the flowchart of the intention recognition method provided by the embodiments of the present application, Figure 5 the application scenario diagram of the intention recognition method provided by the embodiments of the present application. The method can include the following steps 210 to 220.
[0184] In step 210, the to-be-processed data is obtained, the to-be-processed data including target question information and real-time reply information corresponding to the target question information, the target question information being question information broadcast by the outbound robot, and the real-time reply information including incomplete reply information of the object to the target question information.
[0185] For example, the to-be-processed data includes: the target question information being "Do you have time in the evening?"; and the real-time reply information corresponding to the target question information being "I don't". The real-time reply information is an intermediate transcription result in ASR.
[0186] Optionally, the obtaining of the to-be-processed data includes:
[0187] The question voice segment of the question information broadcast by the outbound robot is obtained, and speech recognition is performed on the question voice segment to obtain the target question information.
[0188] The reply voice segment of the object to the question voice segment is obtained in real time, and speech recognition is performed on the reply voice segment to obtain the real-time reply information corresponding to the target question information.
[0189] In step 220, the to-be-processed data is subjected to intent recognition based on the trained intent recognition model to obtain target intent information corresponding to the to-be-processed data, wherein the trained intent recognition model is obtained according to the intent recognition model training method. Figure 1
[0190] Optionally, step 220 can be implemented through steps 221 to 226 (not shown in the figure), specifically as follows:
[0191] In step 221, a preset intent set corresponding to the target question information is obtained, and a text of each preset intent information of the preset intent set is encoded by using an intent classification model in the trained intent recognition model to obtain a second intent text encoding.
[0192] For example, the preset intent set is "no time; no money; not understood; not clearly heard".
[0193] As shown in FIG. Figure 5 The text of each preset intent information of the preset intent set is encoded by using an intent classification model in the trained intent recognition model to obtain a second intent text encoding, and the text information corresponding to the second intent text encoding includes "no time; no money; not understood; not clearly heard".
[0194] In step 222, a generation model in the trained intent recognition model is used to perform self-attention encoding on the to-be-processed data to generate a target model encoding vector corresponding to the to-be-processed data.
[0195] As shown in Figure 5 , the text information corresponding to the generated target model encoding vector is “[CLS] Do you have time at night [SEP] I have no time to listen to Ming Qing understand white reason S”.
[0196] Step 223, calculate the attention weight based on the second intention text encoding and the target model encoding vector, and obtain the target intention attention encoding.
[0197] As shown in Figure 5 , the second intention text encoding and the target model encoding vector are input into the label attention (Label-wise Attention) layer to calculate the attention weight, so as to extract the attention encoding vector related to each intention in the target model encoding vector, and obtain the target intention attention encoding.
[0198] Step 224, perform linear transformation and normalization processing on the target intention attention encoding, to obtain the target intention probability corresponding to each preset intention information of the preset intention set.
[0199] As shown in Figure 5 , the target intention attention encoding is linearly transformed and normalized by the multi-label classification (Multi-tabel Classification) layer, to obtain the target intention probability corresponding to each preset intention information of the preset intention set, such as “no time; no money; not understood; not clear” corresponding to the target intention probability “0.91; 0.12; 0.81; 0.78”.
[0200] Step 225, determine the preset intention information corresponding to the target intention probability greater than the probability threshold as the output intention information in the prediction result.
[0201] For example, the probability threshold is 0.5, and the output intention information in the prediction result includes “no time; not understood; not clear”.
[0202] Step 226, if the prediction result contains multiple output intention information, return to execute the step of obtaining the data to be processed until only one output intention information is contained in the prediction result, and determine the only one output intention information contained in the prediction result as the target intention information corresponding to the data to be processed.
[0203] For example, after predicting the intention, if the prediction result is multiple output intention information or no output intention information, it indicates that the user's intention is not clear, and the subsequent ASR intermediate transcription result needs to be continued to wait. For example, the prediction result in the above example is "no time; not understood; not clear", which represents that the user's actual intention has multiple possibilities, and the subsequent user reply needs to be continued to wait. When the prediction result has only one output intention information, it indicates that the user's intention is clear, and the subsequent process can be directly processed based on the target intention information to perform subsequent processes such as dialogue state tracking, dialogue strategy, natural language generation, and speech synthesis based on the target intention information.
[0204] Optionally, if the prediction result contains multiple output intention information, before returning to perform the step of obtaining the to-be-processed data, the method further includes:
[0205] determining whether the real-time reply information in the to-be-processed data is complete reply information that the object has replied to the target question information;
[0206] if the real-time reply information in the to-be-processed data is complete reply information that the object has replied to the target question information, determining the output intention information with the maximum target intention probability in the multiple output intention information as the target intention information corresponding to the to-be-processed data; or
[0207] if the real-time reply information in the to-be-processed data is incomplete reply information that the object has not replied to the target question information, returning to perform the step of obtaining the to-be-processed data, and until the prediction result contains only one output intention information, determining the output intention information contained in the prediction result as the target intention information corresponding to the to-be-processed data.
[0208] For example, in order to better understand the intention recognition method of the embodiments of the present application, please refer to S61 to S69 in Figure 6
[0209] S61, after the target question is issued by the outbound robot, it is detected that the user starts to speak;
[0210] S62, the ASR module obtains the speech stream to perform real-time transcription;
[0211] S63, obtaining the ASR intermediate transcription result;
[0212] S64, performing stream intention recognition, such as performing stream intention recognition on the ASR intermediate transcription result based on the trained intention recognition model to obtain a stream intention recognition result (such as the prediction result in step 225 above);
[0213] S65, determining whether the intent in the streaming intent recognition result is clear; if yes, performing S69; if no, returning to perform S63;
[0214] S66, determining whether the user has finished speaking; if yes, performing S67; if no, returning to perform S62;
[0215] S67, obtaining the final transcription result of ASR;
[0216] S68, performing regular intent recognition, such as performing regular intent recognition on the final transcription result of ASR based on a regular intent recognition method;
[0217] S69, subsequent processes, such as performing subsequent processes of dialogue state tracking, dialogue strategy, natural language generation, and speech synthesis.
[0218] All the technical solutions above can be combined in any manner to form optional embodiments of the present application, which will not be described one by one here.
[0219] In the embodiment of the present application, the intent recognition model includes a generation model and an intent classification model. First, first original data is obtained, the first original data including first question information and first reply information corresponding to the first question information; the first original data is input into the generation model for reply information prediction to generate a generation result including a plurality of first predicted reply information; the first question information and each first predicted reply information in the generation result are input into the intent classification model for intent prediction to generate a candidate intent set; first training data is determined based on the first original data, the candidate intent set, and a first intent label; the intent recognition model is trained based on the first training data to obtain a trained intent recognition model, wherein, when the intent recognition model is trained, the first training target is that the first predicted intent information output by the intent recognition model conforms to the first intent label; then, processing data is obtained, the processing data including target question information and real-time reply information corresponding to the target question information, the target question information being question information broadcast by an outbound robot, the real-time reply information including incomplete reply information of an object to the target question information, and the processing data is subjected to intent recognition based on the trained intent recognition model to obtain target intent information corresponding to the processing data. The embodiment of the present application can utilize the generation model to perform semantic completion on the incomplete reply information corresponding to the first original data to generate a generation result including a plurality of first predicted reply information, then use the intent classification model to perform intent prediction on each first predicted reply information to generate a candidate intent set, and determine first training data based on the first original data, the candidate intent set, and a first intent label, and then train the intent recognition model based on the first training data to obtain a trained intent recognition model. When the trained intent recognition model is used to determine the intent of a user, it is not necessary to wait for the user to finish speaking, but can perform semantic completion and intent prediction based on the intermediate transcription result of the speech transcription of the collected processing data when the user has not finished answering, in other words, the embodiment of the present application can perform subsequent process processing in advance when the explicit intent of the user is predicted. Compared with the case of waiting for the user to finish speaking and then confirming the intent, the embodiment of the present application can advance the time of determining the intent, reduce the overall response time, respond to the user more quickly, improve the human-computer interaction efficiency, and improve the call experience.
[0220] To better implement the training method of the intent recognition model of the embodiment of the present application, the embodiment of the present application further provides a training device of an intent recognition model. Please refer to Figure 7 , Figure 7 The training device of the intent recognition model provided by the embodiment of the present application is shown in the structural diagram. The intent recognition model includes a generation model and an intent classification model, and the training device 300 of the intent recognition model can include:
[0221] The first obtaining unit 310 is configured to obtain first original data, the first original data comprising first question information and first reply information corresponding to the first question information;
[0222] The first processing unit 320 is configured to input the first original data into the generative model to perform reply information prediction, so as to generate a generative result comprising a plurality of first predicted reply information;
[0223] The second processing unit 330 is configured to input the first question information and each of the first predicted reply information in the generative result into the intent classification model to perform intent prediction, so as to generate a candidate intent set;
[0224] The determining unit 340 is configured to determine first training data based on the first original data, the candidate intent set and a first intent label;
[0225] The training unit 350 is configured to train the intent recognition model based on the first training data, so as to obtain a trained intent recognition model, wherein, when the intent recognition model is trained, a first training target is that first predicted intent information output by the intent recognition model conforms to the first intent label.
[0226] Optionally, the first processing unit 320 is configured to:
[0227] generate first model input information according to the first original data, the first model input information comprising the first question information, first truncated reply information corresponding to the first reply information and first mask information;
[0228] perform self-attention coding on the first model input information, so as to obtain a first model coding vector corresponding to the first model input information;
[0229] take the last n characters of the first truncated reply information and all characters of the first mask information as a first target extraction position, extract a coding vector corresponding to the first target extraction position from the first model coding vector, so as to obtain a second model coding vector, n being a positive integer;
[0230] decode the second model coding vector, so as to obtain a first decoding vector;
[0231] perform first processing on the first decoding vector, so as to obtain a first character probability matrix, the first character probability matrix representing probabilities of different characters corresponding to each position in the first target extraction position;
[0232] perform second processing on the first decoding vector, so as to obtain a first transition probability matrix, the first transition probability matrix representing jump probabilities of each position in the first target extraction position to other positions.
[0233] Based on the first character probability matrix and the first transition probability matrix, a first text probability corresponding to different first candidate texts is calculated, the first text probabilities are sorted in descending order, and the first candidate texts corresponding to the first text probabilities ranked in the top m are taken as the plurality of first predicted reply information in the generation result, m is a positive integer.
[0234] Optionally, the first processing unit 320, when generating the first model input information according to the first original data, is configured to:
[0235] Truncating the first reply information to obtain first truncated reply information corresponding to the first reply information;
[0236] Splicing the first question information and the first truncated reply information to obtain first spliced information;
[0237] Performing mask processing on the first spliced information based on a first character length to obtain first spliced information with first mask information;
[0238] Performing a forward truncation operation or a backward padding operation on the first spliced information with first mask information based on a second character length to obtain the first model input information, and a total character length of the first model input information is equal to the second character length.
[0239] Optionally, the intent recognition model training apparatus 300 further includes a first pre-training unit configured to:
[0240] Obtain second original data, the second original data including second question information and second reply information corresponding to the second question information;
[0241] Pre-train an initial generation model using the second original data to obtain the generation model, wherein, when pre-training the initial generation model, a second training target is that second predicted reply information output by the initial generation model conforms to the second reply information.
[0242] Optionally, the first pre-training unit, when pre-training the initial generation model using the second original data to obtain the generation model, is configured to:
[0243] Generate second model input information according to the second original data, the second model input information including the second question information, second truncated reply information corresponding to the second reply information, and second mask information;
[0244] Perform self-attention encoding on the second model input information to obtain a third model encoding vector corresponding to the second model input information;
[0245] extracting, from the third model coding vector, a coding vector corresponding to a second target extraction position of all characters of the second mask information and last n characters of the second truncated reply information, to obtain a fourth model coding vector, n being a positive integer;
[0246] decoding the fourth model coding vector to obtain a second decoding vector;
[0247] performing first processing on the second decoding vector to obtain a second character probability matrix, the second character probability matrix representing probabilities of different characters corresponding to each position in the second target extraction position;
[0248] performing second processing on the second decoding vector to obtain a second transition probability matrix, the second transition probability matrix representing jump probabilities of each position in the second target extraction position to other positions;
[0249] based on the second character probability matrix and the second transition probability matrix, calculating second text probabilities corresponding to different second candidate texts, sorting the second text probabilities from large to small, and taking second candidate texts corresponding to the first m second text probabilities as the second predicted reply information, m being a positive integer;
[0250] According to the second predicted reply information and the second reply information, the initial generation model is pre-trained based on a loss function constructed based on the second training target to obtain the generation model.
[0251] Optionally, the first pre-training unit, when generating the second model input information according to the second original data, is configured to:
[0252] truncating the second reply information to obtain second truncated reply information corresponding to the second reply information;
[0253] splicing the second question information and the second truncated reply information to obtain second spliced information;
[0254] performing mask processing on the second spliced information based on a first character length to obtain second spliced information with second mask information;
[0255] performing a forward truncation operation or a backward padding operation on the second spliced information with second mask information based on a second character length to obtain the second model input information, a total character length of the second model input information being equal to the second character length.
[0256] Optionally, the second processing unit 330 is configured to:
[0257] Traverse each of the first predicted reply information in the generation result, input the first question information and the first predicted reply information in the generation result into the intention classification model for intention prediction each time to obtain candidate intention information corresponding to each of the first predicted reply information, and generate the candidate intention set according to the candidate intention information corresponding to each of the first predicted reply information.
[0258] Optionally, the training apparatus 300 of the intention recognition model further comprises a second pre-training unit, configured to:
[0259] obtain second training data, wherein the training data comprises third original data and a second intention label, the third original data comprises third question information and third reply information corresponding to the third question information;
[0260] pre-train an initial intention classification model by using the second training data to obtain the intention classification model, wherein when the initial intention classification model is pre-trained, a third training target is that second predicted intention information output by the initial intention classification model is consistent with the second intention label.
[0261] Optionally, the training unit 350 is configured to:
[0262] encode text of each candidate intention information of the candidate intention set in the first training data by using the intention classification model to obtain first intention text encoding;
[0263] generate first model input information according to the first original data in the first training data, and perform self-attention encoding on the first model input information by using the generation model to obtain a first model encoding vector corresponding to the first model input information;
[0264] calculate attention weight based on the first intention text encoding and the first model encoding vector to obtain first intention attention encoding;
[0265] perform linear transformation processing and normalization processing on the first intention attention encoding to obtain first intention probability corresponding to each candidate intention information of the candidate intention set;
[0266] determine the first predicted intention information according to the first intention probability;
[0267] train the intention recognition model based on a loss function constructed based on the first training target according to the first predicted intention information and the first intention label to obtain the trained intention recognition model.
[0268] Embodiments of the present application further provide an intention recognition apparatus. Please refer to Figure 8 ,Figure 8 A structural schematic diagram of an intention recognition device provided for an embodiment of the present application. The intention recognition device 400 can include:
[0269] A second acquisition unit 410 is configured to acquire to-be-processed data, the to-be-processed data including target question information and real-time reply information corresponding to the target question information, the target question information being question information broadcast by an outbound robot, and the real-time reply information including incomplete reply information of an object to the target question information that has not been replied to completely;
[0270] An identification unit 420 is configured to perform intention recognition on the to-be-processed data based on a trained intention recognition model to obtain target intention information corresponding to the to-be-processed data, wherein the trained intention recognition model is obtained by training the intention recognition model according to the intention recognition model training method. Figure 1
[0271] Optionally, the identification unit 420 is configured to:
[0272] acquire a preset intention set corresponding to the target question information, and encode a text of each preset intention information of the preset intention set by using an intention classification model in the trained intention recognition model to obtain second intention text encoding;
[0273] encode the to-be-processed data by using a generation model in the trained intention recognition model to generate a target model encoding vector corresponding to the to-be-processed data;
[0274] calculate attention weights based on the second intention text encoding and the target model encoding vector to obtain target intention attention encoding;
[0275] perform linear transformation processing and normalization processing on the target intention attention encoding to obtain a target intention probability corresponding to each preset intention information of the preset intention set;
[0276] determine preset intention information corresponding to the target intention probability greater than a probability threshold as output intention information in a prediction result;
[0277] If the prediction result contains multiple output intention information, return to perform the step of acquiring to-be-processed data until the prediction result contains only one output intention information, and determine the output intention information contained only in the prediction result as target intention information corresponding to the to-be-processed data.
[0278] Optionally, if the prediction result contains multiple output intention information, the identification unit 420, before returning to perform the step of acquiring to-be-processed data, is further configured to:
[0279] determine whether the real-time reply information in the to-be-processed data is complete reply information that the object has replied to the target problem information;
[0280] If the real-time reply information in the to-be-processed data is complete reply information that the object has replied to the target problem information, the output intent information with the maximum target intent probability in the plurality of output intent information is determined as the target intent information corresponding to the to-be-processed data.
[0281] If the real-time reply information in the to-be-processed data is incomplete reply information that the object has not replied to the target problem information, the step of obtaining to-be-processed data is returned to be executed, and when the prediction result contains only one output intent information, the output intent information contained only in the prediction result is determined as the target intent information corresponding to the to-be-processed data.
[0282] Optionally, the second obtaining unit 410 is configured to:
[0283] obtain a question voice segment of the problem information broadcasted by the outbound robot, and perform voice recognition on the question voice segment to obtain the target problem information;
[0284] obtain a reply voice segment of the object in reply to the question voice segment in real time, and perform voice recognition on the reply voice segment to obtain real-time reply information corresponding to the target problem information.
[0285] Each unit in the training device or the intent recognition device can be realized by software, hardware, or a combination thereof. Each unit can be embedded in or independent of a processor in a computer device in a hardware form, or stored in a memory in a computer device in a software form, so as to be called and executed by a processor to perform operations corresponding to each unit.
[0286] The training device or the intent recognition device can be integrated in a terminal or a server with a storage and a processor, or the device can be the terminal or the server.
[0287] Optionally, the present application further provides a computer device including a memory and a processor, and the memory stores a computer program, and the processor executes the computer program to implement the steps in each method embodiment.
[0288] Figure 9 A structural schematic diagram of a computer device provided by the embodiments of the present application is shown in FIG. 1. The computer device can be a terminal or a server. As shown in FIG. 1, the computer device includes a processor 10 and a memory 20. The memory 20 stores a computer program, and the processor 10 executes the computer program to implement the steps in each method embodiment. Figure 9As shown, the computer device 500 can include a communication interface 501, a memory 502, a processor 503 and a communication bus 504. The communication interface 501, the memory 502 and the processor 503 can communicate with each other through the communication bus 504. The communication interface 501 can be configured to perform data communication between the computer device 500 and an external device. The memory 502 can be configured to store software programs and modules. The processor 503 can execute the software programs and modules stored in the memory 502, for example, the software programs corresponding to the operations in the foregoing method embodiments.
[0289] Optionally, the processor 503 can invoke the software programs and modules stored in the memory 502 to perform the following operations: obtaining first original data, the first original data including first question information and first reply information corresponding to the first question information; inputting the first original data into a generation model to perform reply information prediction, to generate a generation result including a plurality of first predicted reply information; inputting the first question information and each first predicted reply information in the generation result into an intent classification model to perform intent prediction, to generate a candidate intent set; determining first training data based on the first original data, the candidate intent set and a first intent label; training the intent recognition model based on the first training data, to obtain a trained intent recognition model, wherein, when the intent recognition model is trained, the first training target is that the first predicted intent information output by the intent recognition model is consistent with the first intent label.
[0290] Optionally, the processor 503 can invoke the software programs and modules stored in the memory 502 to perform the following operations: obtaining to-be-processed data, the to-be-processed data including target question information and real-time reply information corresponding to the target question information, the target question information being question information broadcast by an outbound robot, and the real-time reply information including incomplete reply information of an object to the target question information which has not been replied; performing intent recognition on the to-be-processed data based on the trained intent recognition model, to obtain target intent information corresponding to the to-be-processed data, wherein the trained intent recognition model is obtained according to the training method of the intent recognition model in any of the embodiments.
[0291] The present application also provides a computer readable storage medium for storing a computer program. The computer readable storage medium can be applied to a computer device, and the computer program causes the computer device to perform the corresponding procedures in the training method of the intent recognition model or the intent recognition method in the embodiments of the present application. For brevity, details are not repeated here.
[0292] The application further provides a computer program product, which comprises computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device executes corresponding procedures in the training method of the intent recognition model or the intent recognition method in the embodiments of the application. For brevity, details are not repeated here.
[0293] The application further provides a computer program, which comprises computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device executes corresponding procedures in the training method of the intent recognition model or the intent recognition method in the embodiments of the application. For brevity, details are not repeated here.
[0294] It should be understood that the processor of the application can be an integrated circuit chip with processing capability of signals. In the implementation process, each step of the above method embodiments can be completed by integrated logic circuits or instructions in the form of software in the processor. The processor mentioned above can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a ready programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. Each method, step and logic block disclosed in the embodiments of the application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiments of the application can be directly embodied as hardware code processor execution, or executed by a combination of hardware and software modules in the code processor. The software module can be located in a random access memory, a flash memory, a read only memory, a programmable read only memory or an electrically erasable programmable memory, a register or other mature storage medium in the art. The storage medium is located in the memory, and the processor reads the information in the memory, and combines the hardware to complete the steps of the above method.
[0295] It is to be understood that the memory in the embodiments of the present application can be a volatile memory or a nonvolatile memory, or can include both volatile and nonvolatile memory. Among them, the nonvolatile memory can be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically EPROM (EEPROM), or a flash memory. The volatile memory can be a Random Access Memory (RAM) used as an external cache. By way of example, but not limitation, many forms of RAM can be used, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DR RAM). It should be noted that the memory of the system and method described herein is intended to include, but not be limited to, these and any other suitable types of memory.
[0296] Those skilled in the art can appreciate that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether the functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. A person 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 the present application.
[0297] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be described here.
[0298] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other manners. For example, the division of the units is only a logical function division, and there can be another division manner for the actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between the units can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electrical, mechanical or other forms.
[0299] The above descriptions are only specific embodiments of the present application, but the protection scope of the present application is not limited to this. Any person skilled in the art can easily think of changes or replacements within the technical range disclosed in the present application, and all these changes and replacements should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for training an intent recognition model, the method comprising: The intention recognition model comprises a generation model and an intention classification model, and the method comprises: obtaining first original data, the first original data comprising first question information and first reply information corresponding to the first question information; inputting the first original data into the generation model for reply information prediction to generate a generation result comprising a plurality of first predicted reply information; inputting the first question information and each of the first predicted reply information in the generation result into the intention classification model for intention prediction to generate a candidate intention set; determining first training data based on the first original data, the candidate intention set and a first intention label; training the intention recognition model based on the first training data to obtain a trained intention recognition model, wherein, when training the intention recognition model, the first training target is that the first predicted intention information output by the intention recognition model conforms to the first intention label. 2.The method of claim 1, wherein, The first original data is input into the generation model for reply information prediction to generate a generation result comprising a plurality of first predicted reply information, comprising: generating first model input information according to the first original data, the first model input information comprising the first question information, first truncated reply information corresponding to the first reply information and first mask information; performing self-attention coding on the first model input information to obtain a first model coding vector corresponding to the first model input information; taking the last n characters of the first truncated reply information and all characters of the first mask information as a first target extraction position, extracting a coding vector corresponding to the first target extraction position from the first model coding vector to obtain a second model coding vector, n being a positive integer; decoding the second model coding vector to obtain a first decoding vector; performing first processing on the first decoding vector to obtain a first character probability matrix, the first character probability matrix representing the probability of different characters corresponding to each position in the first target extraction position; performing second processing on the first decoding vector to obtain a first transition probability matrix, the first transition probability matrix representing the jump probability of each position in the first target extraction position to other positions; based on the first character probability matrix and the first transition probability matrix, calculating a first text probability corresponding to different first candidate texts, sorting the first text probability from large to small, and taking the first candidate texts corresponding to the first text probability ranked in the first m positions as the plurality of first predicted reply information in the generation result, m being a positive integer. 3.The method of claim 2, wherein the training the intent recognition model comprises: training the intent recognition model using the training data and the intent label. The first model input information is generated according to the first original data, comprising: truncating the first reply information to obtain first truncated reply information corresponding to the first reply information; splicing the first question information and the first truncated reply information to obtain first spliced information; masking the first spliced information based on a first character length to obtain first spliced information with first mask information; perform a forward truncation operation or a backward padding operation on the first spliced information with the first mask information based on a second character length, to obtain the first model input information, and a total character length of the first model input information is equal to the second character length. 4.The method of claim 1-3, wherein, The method further comprises: obtaining second original data, the second original data comprising second question information and second reply information corresponding to the second question information; pre-training an initial generation model using the second original data to obtain the generation model, wherein, when the initial generation model is pre-trained, a second training target is that second predicted reply information output by the initial generation model conforms to the second reply information. 5.The method of claim 4, wherein, The pre-training of the initial generation model using the second original data to obtain the generation model comprises: generating second model input information according to the second original data, the second model input information comprising the second question information, second truncated reply information corresponding to the second reply information, and second mask information; performing self-attention encoding on the second model input information to obtain a third model encoding vector corresponding to the second model input information; extracting an encoding vector corresponding to a second target extraction position from the third model encoding vector, the last n characters of the second truncated reply information and all characters of the second mask information being the second target extraction position, n being a positive integer; decoding the fourth model encoding vector to obtain a second decoding vector; performing first processing on the second decoding vector to obtain a second character probability matrix, the second character probability matrix representing probabilities of different characters corresponding to each position in the second target extraction position; performing second processing on the second decoding vector to obtain a second transition probability matrix, the second transition probability matrix representing jump probabilities of each position in the second target extraction position to other positions; based on the second character probability matrix and the second transition probability matrix, calculating second text probabilities corresponding to different second candidate texts, sorting the second text probabilities from large to small, and taking second candidate texts corresponding to the first m second text probabilities as the second predicted reply information, m being a positive integer; pre-training the initial generation model using a loss function constructed based on the second training target according to the second predicted reply information and the second reply information to obtain the generation model. 6.The method of claim 5, wherein, The generating of the second model input information according to the second original data comprises: truncating the second reply information to obtain second truncated reply information corresponding to the second reply information; splicing the second question information and the second truncated reply information to obtain second spliced information; performing mask processing on the second spliced information based on a first character length to obtain second spliced information with second mask information; perform a forward truncation operation or a backward padding operation on the second spliced information with the second mask information based on a second character length, to obtain the second model input information, and a total character length of the second model input information is equal to the second character length. 7.The method of claim 1, wherein, The inputting the first question information and each of the first predicted reply information in the generation result into the intent classification model for intent prediction to generate a candidate intent set comprises: traversing each of the first predicted reply information in the generation result, inputting the first question information and one of the first predicted reply information in the generation result into the intent classification model for intent prediction each time to obtain candidate intent information corresponding to each of the first predicted reply information, and generating the candidate intent set according to the candidate intent information corresponding to each of the first predicted reply information. 8.The method of claim 1 or 7, wherein, The method further comprises: obtaining second training data, wherein the training data comprises third original data and a second intent label, the third original data comprises third question information and third reply information corresponding to the third question information; pre-training an initial intent classification model using the second training data to obtain the intent classification model, wherein when the initial intent classification model is pre-trained, a third training target is that second predicted intent information output by the initial intent classification model conforms to the second intent label. 9.The method of claim 1, wherein, The training of the intent recognition model based on the first training data to obtain a trained intent recognition model comprises: encoding text of each candidate intent information of the candidate intent set in the first training data using the intent classification model to obtain first intent text encoding; generating first model input information according to the first original data in the first training data, and performing self-attention encoding on the first model input information using the generation model to obtain a first model encoding vector corresponding to the first model input information; calculating attention weights based on the first intent text encoding and the first model encoding vector to obtain first intent attention encoding; performing linear transformation processing and normalization processing on the first intent attention encoding to obtain first intent probability corresponding to each candidate intent information of the candidate intent set; determining the first predicted intent information according to the first intent probability; training the intent recognition model based on a loss function constructed based on the first training target according to the first predicted intent information and the first intent label to obtain the trained intent recognition model.
10. An intention recognition method characterized by comprising: The method comprises: obtaining to-be-processed data, wherein the to-be-processed data comprises target question information and real-time reply information corresponding to the target question information, the target question information is question information broadcast by an outbound robot, and the real-time reply information comprises incomplete reply information of an object to the target question information which is not completed. performing intent recognition on the to-be-processed data based on the trained intent recognition model, to obtain target intent information corresponding to the to-be-processed data, wherein the trained intent recognition model is obtained by training the intent recognition model according to the method for training an intent recognition model in any one of claims 1-9.
11. The intention recognition method of claim 10, wherein, The intent recognition based on the trained intent recognition model on the to-be-processed data obtains target intent information corresponding to the to-be-processed data, and includes: obtaining a preset intent set corresponding to the target question information, and encoding the text of each preset intent information in the preset intent set by using an intent classification model in the trained intent recognition model, to obtain a second intent text encoding; encoding the to-be-processed data by using a generation model in the trained intent recognition model to generate a target model encoding vector corresponding to the to-be-processed data; calculating an attention weight based on the second intent text encoding and the target model encoding vector to obtain a target intent attention encoding; performing linear transformation and normalization processing on the target intent attention encoding to obtain a target intent probability corresponding to each preset intent information in the preset intent set; determining the preset intent information with a target intent probability greater than a probability threshold as output intent information in a prediction result; if the prediction result contains multiple output intent information, returning to perform the step of obtaining to-be-processed data until the prediction result contains only one output intent information, and determining the only one output intent information in the prediction result as the target intent information corresponding to the to-be-processed data.
12. The intention recognition method of claim 11, wherein, If the prediction result contains multiple output intent information, before returning to perform the step of obtaining to-be-processed data, it further includes: determining whether the real-time reply information in the to-be-processed data is complete reply information that the object has replied to the target question information; if the real-time reply information in the to-be-processed data is complete reply information that the object has replied to the target question information, determining the output intent information with the maximum target intent probability in the multiple output intent information as the target intent information corresponding to the to-be-processed data; or if the real-time reply information in the to-be-processed data is incomplete reply information that the object has not replied to the target question information, returning to perform the step of obtaining to-be-processed data until the prediction result contains only one output intent information, and determining the only one output intent information in the prediction result as the target intent information corresponding to the to-be-processed data.
13. The intention recognition method of claim 10, wherein, The step of obtaining to-be-processed data includes: obtaining a question voice segment of the outbound robot broadcast question information, and performing speech recognition on the question voice segment to obtain the target question information; real-time obtaining a reply voice segment of the object in reply to the question voice segment, and performing speech recognition on the reply voice segment to obtain real-time reply information corresponding to the target question information. 14.A device for training an intention recognition model, comprising: The intent recognition model includes a generation model and an intent classification model, and the device includes: The first obtaining unit is configured to obtain first original data, the first original data comprising first question information and first reply information corresponding to the first question information; The first processing unit is configured to input the first original data into the generation model for reply information prediction to generate a generation result comprising a plurality of first predicted reply information; The second processing unit is configured to input the first question information and each of the first predicted reply information in the generation result into the intent classification model for intent prediction to generate a candidate intent set; The determining unit is configured to determine first training data based on the first original data, the candidate intent set, and a first intent label; The training unit is configured to train the intent recognition model based on the first training data to obtain a trained intent recognition model, wherein, when the intent recognition model is trained, a first training target is that first predicted intent information output by the intent recognition model conforms to the first intent label. 15.The intention recognition model training apparatus of claim 14, wherein The first processing unit is configured to: generate first model input information from the first original data, the first model input information comprising the first question information, first truncated reply information corresponding to the first reply information, and first mask information; perform self-attention encoding on the first model input information to obtain a first model encoding vector corresponding to the first model input information; extract an encoding vector corresponding to a first target extraction position from the first model encoding vector, taking the last n characters of the first truncated reply information and all characters of the first mask information as the first target extraction position, n being a positive integer, to obtain a second model encoding vector; decode the second model encoding vector to obtain a first decoding vector; perform first processing on the first decoding vector to obtain a first character probability matrix, the first character probability matrix representing probabilities of different characters corresponding to each position in the first target extraction position; perform second processing on the first decoding vector to obtain a first transition probability matrix, the first transition probability matrix representing jump probabilities of each position in the first target extraction position to other positions; based on the first character probability matrix and the first transition probability matrix, calculate first text probabilities corresponding to different first candidate texts, sort the first text probabilities from large to small, and take first candidate texts corresponding to the first text probabilities ranked in the top m as the plurality of first predicted reply information in the generation result, m being a positive integer. 16.The intention recognition model training apparatus of claim 15, wherein When the first processing unit generates first model input information from the first original data, it is configured to: truncate the first reply information to obtain first truncated reply information corresponding to the first reply information; concatenate the first question information and the first truncated reply information to obtain first concatenated information; perform mask processing on the first concatenated information based on a first character length to obtain first concatenated information with first mask information; perform a forward truncation operation or a backward padding operation on the first spliced information with the first mask information based on a second character length, to obtain the first model input information, and a total character length of the first model input information is equal to the second character length.
17. The intention recognition model training apparatus according to any one of claims 14 to 16, wherein The apparatus further includes a first pre-training unit configured to: obtain second original data, the second original data including second question information and second reply information corresponding to the second question information; pre-train an initial generation model using the second original data to obtain the generation model, wherein, when pre-training the initial generation model, a second training target is that second predicted reply information output by the initial generation model conforms to the second reply information. 18.The intention recognition model training apparatus of claim 17, wherein, When the first pre-training unit pre-trains the initial generation model using the second original data to obtain the generation model, the first pre-training unit is configured to: generate second model input information according to the second original data, the second model input information including the second question information, second truncated reply information corresponding to the second reply information, and second mask information; perform self-attention encoding on the second model input information to obtain a third model encoding vector corresponding to the second model input information; extract an encoding vector corresponding to a second target extraction position from the third model encoding vector, the second target extraction position being the last n characters of the second truncated reply information and all characters of the second mask information, n being a positive integer, to obtain a fourth model encoding vector; decode the fourth model encoding vector to obtain a second decoding vector; perform first processing on the second decoding vector to obtain a second character probability matrix, the second character probability matrix representing probabilities of different characters corresponding to each position in the second target extraction position; perform second processing on the second decoding vector to obtain a second transition probability matrix, the second transition probability matrix representing jump probabilities of each position in the second target extraction position to other positions; based on the second character probability matrix and the second transition probability matrix, calculate second text probabilities corresponding to different second candidate texts, sort the second text probabilities from large to small, and take second candidate texts corresponding to the first m second text probabilities as the second predicted reply information, m being a positive integer; based on the second predicted reply information and the second reply information, pre-train the initial generation model using a loss function constructed based on the second training target to obtain the generation model. 19.The intention recognition model training apparatus of claim 18, wherein When the first pre-training unit generates second model input information according to the second original data, the first pre-training unit is configured to: truncate the second reply information to obtain second truncated reply information corresponding to the second reply information; splice the second question information and the second truncated reply information to obtain second spliced information; perform mask processing on the second spliced information based on a first character length to obtain second spliced information with second mask information; perform a forward truncation operation or a backward padding operation on the second spliced information with the second mask information based on a second character length, to obtain the second model input information, and a total character length of the second model input information is equal to the second character length. 20.The intention recognition model training apparatus of claim 14, wherein, The second processing unit is configured to: traverse each of the first predicted reply information in the generation result, input the first question information and each of the first predicted reply information in the generation result into the intent classification model each time to perform intent prediction, to obtain candidate intent information corresponding to each of the first predicted reply information, and generate the candidate intent set according to the candidate intent information corresponding to each of the first predicted reply information.
21. The intention recognition model training apparatus according to claim 14 or 20, wherein The device further includes a second pre-training unit configured to: obtain second training data, the training data including third original data and a second intent label, the third original data including third question information and third reply information corresponding to the third question information; pre-train an initial intent classification model using the second training data to obtain the intent classification model, wherein, when the initial intent classification model is pre-trained, a third training target is that second predicted intent information output by the initial intent classification model conforms to the second intent label.
22. The intention recognition model training apparatus of claim 21, wherein The training unit is configured to: encode text of each candidate intent information of the candidate intent set in the first training data using the intent classification model to obtain first intent text encoding; generate first model input information according to the first original data in the first training data, and perform self-attention encoding on the first model input information using the generation model to obtain a first model encoding vector corresponding to the first model input information; calculate attention weights based on the first intent text encoding and the first model encoding vector to obtain first intent attention encoding; perform linear transformation processing and normalization processing on the first intent attention encoding to obtain first intent probability corresponding to each candidate intent information of the candidate intent set; determine the first predicted intent information according to the first intent probability; train the intent recognition model based on a loss function constructed based on the first training target according to the first predicted intent information and the first intent label, to obtain the trained intent recognition model.
23. An intention recognition apparatus characterized by comprising: The device includes: a second obtaining unit configured to obtain to-be-processed data, the to-be-processed data including target question information and real-time reply information corresponding to the target question information, the target question information being question information broadcast by an outbound robot, and the real-time reply information including incomplete reply information of an object to the target question information which is not completed; an identifying unit configured to perform intent recognition on the to-be-processed data based on a trained intent recognition model to obtain target intent information corresponding to the to-be-processed data, wherein the trained intent recognition model is obtained by training the intent recognition model according to the intent recognition model training method in any one of claims 1-9.
24. The intention recognition apparatus according to claim 23, wherein The identifying unit is configured to: obtain a preset intent set corresponding to the target problem information, and encode text of each preset intent information of the preset intent set by using an intent classification model in the trained intent recognition model to obtain second intent text encoding; encode the to-be-processed data by using a generation model in the trained intent recognition model to generate a target model encoding vector corresponding to the to-be-processed data; calculate an attention weight based on the second intent text encoding and the target model encoding vector to obtain target intent attention encoding; perform linear transformation processing and normalization processing on the target intent attention encoding to obtain a target intent probability corresponding to each preset intent information of the preset intent set; determine preset intent information corresponding to the target intent probability greater than a probability threshold as output intent information in a prediction result; if the prediction result contains multiple output intent information, return to perform the step of obtaining to-be-processed data until the prediction result contains only one output intent information, and determine the output intent information contained in the prediction result as target intent information corresponding to the to-be-processed data.
25. The intention recognition apparatus of claim 24, wherein If the prediction result contains multiple output intent information, the recognition unit, before returning to perform the step of obtaining to-be-processed data, is further configured to: determine whether real-time reply information in the to-be-processed data is complete reply information that the object has replied to the target problem information; if the real-time reply information in the to-be-processed data is complete reply information that the object has replied to the target problem information, determine output intent information with a maximum target intent probability in the multiple output intent information as target intent information corresponding to the to-be-processed data; or if the real-time reply information in the to-be-processed data is incomplete reply information that the object has not replied to the target problem information, return to perform the step of obtaining to-be-processed data until the prediction result contains only one output intent information, and determine the output intent information contained in the prediction result as target intent information corresponding to the to-be-processed data. The second obtaining unit is configured to:
26. The intention recognition apparatus of claim 23, wherein obtain a question voice segment of the outbound robot broadcast problem information, and perform voice recognition on the question voice segment to obtain the target problem information; obtain a reply voice segment of the object in reply to the question voice segment in real time, and perform voice recognition on the reply voice segment to obtain real-time reply information corresponding to the target problem information. The computer readable storage medium stores a computer program, and the computer program is adapted to be loaded by the processor to execute the intent recognition model training method according to any one of claims 1-9 or the intent recognition method according to any one of claims 10-13.
27. A computer-readable storage medium, characterized in that, 28. A computer device, comprising: The computer device comprises a processor and a memory, and the memory stores a computer program; the processor is configured to execute the computer program stored in the memory, and is configured to execute the training method of the intent recognition model according to any one of claims 1-9 or the intent recognition method according to any one of claims 10-13.
29. A computer program product comprising computer instructions, characterized in that, The computer instructions are executed by the processor to implement the training method of the intent recognition model according to any one of claims 1-9 or the intent recognition method according to any one of claims 10-13.
Citation Information
Patent Citations
Intention understanding method and device, equipment and storage medium
CN113901837A
Intelligent question and answer method, system and device and computer readable storage medium
CN114756663A