Response method and device
Through the multi-head attention mechanism combined with the bidirectional long-term memory neural network and the attention mechanism-based neural network, the problem of inaccurate intention recognition and limited response content in the intelligent dialogue system is solved, and accurate and continuous intelligent response is achieved, which improves the User experience and business satisfaction.
Patent Information
- Application Number
- CN202411248073.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2024-12-17
AI Technical Summary
The existing intelligent dialogue system cannot accurately obtain user semantic intent, resulting in inaccurate intent recognition, and the response content can only be found from the set text library, and replying outside the text library cannot be automatically generated, resulting in user problems. Get a satisfactory reply, and the response is not effective.
A multi-head attention mechanism is used to combine a two-way long-term and short-term memory neural network to classify and extract user consultation questions. Combined with the user's historical dialogue content, an intelligent response is achieved through a neural network based on the attention mechanism.
It realizes accurate and continuous intelligent responses with historical dialogue, can understand the semantic intentions of users, reduce the pressure on manual customer service, improve user experience, and meet business needs.
Smart Images

Figure CN119149672A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a response method and device. Background Art
[0002] With the development of artificial intelligence technology, artificial intelligence is gradually becoming an important force affecting the future development of the industry. Currently, common intelligent dialogue systems often use keyword matching algorithms to extract core keywords from user questions, and answer user questions and solve user needs by matching keywords with text in the text library.
[0003] In the process of implementing the present invention, the inventors found that the prior art has the following problems:
[0004] On the one hand, the existing technology uses the core keywords extracted from the user's question to characterize the user's intention, but fails to obtain the user's intention at the semantic level, resulting in inaccurate intention recognition. On the other hand, the content of the answer can only be searched from a set text library, and replies outside the text library cannot be automatically generated. This results in many users' questions not being answered satisfactorily and the response effect is poor. Summary of the invention
[0005] In view of this, the embodiments of the present invention provide a response method and device, which realize an accurate and intelligent response that is continuous with historical conversations, and utilize the ability of deep learning related algorithms to understand consulting questions to provide users with truly intelligent responses, reduce the pressure of manual customer service, enhance the user experience, and better meet business needs.
[0006] To achieve the objective, according to one aspect of an embodiment of the present invention, a response method is provided, including:
[0007] In response to receiving the answer request, obtaining the consultation question sent by the user;
[0008] A multi-head attention mechanism is used in conjunction with a bidirectional long short-term memory neural network to classify the intent of the consulting question. Based on the intent classification result, the intent of the consulting question is extracted through a self-attention encoding layer and a bidirectional long short-term memory neural network to obtain an intent recognition result.
[0009] Determining an inheritance ratio of the historical conversation content according to the intention recognition result and the historical conversation content of the user;
[0010] According to the inheritance ratio and the intention recognition result, a response result is generated using a neural network based on an attention mechanism, and the response result is returned to the user as a response result of the response request.
[0011] Optionally, a multi-head attention mechanism is used in conjunction with a bidirectional long short-term memory neural network to perform intent classification on the consulting questions, including: for each sentence in the consulting question: inputting the word vector of each word in the sentence into a first bidirectional long short-term memory neural network to obtain a word hidden vector of each word; using a multi-head attention mechanism to calculate the attention weight of each word based on the word content vector of the sentence and each word hidden vector, and then superimposing the attention weight of each word to the corresponding word hidden vector to obtain the sentence vector of the sentence; inputting the sentence vector of each sentence in the consulting question into a second bidirectional long short-term memory neural network to obtain a sentence hidden vector of each sentence; using a multi-head attention mechanism to calculate the attention weight of each sentence based on the sentence content vector of the consulting question and each sentence hidden vector, and then superimposing the attention weight of each sentence to the corresponding sentence hidden vector, and obtaining the intent classification result through activation function mapping.
[0012] Optionally, based on the result of intent classification, the intent of the consulting question is extracted through a self-attention encoding layer and a bidirectional long short-term memory neural network to obtain an intent recognition result, including: for each sentence in the consulting question: self-attention encoding is performed on the word vectors of each word in the sentence, and the self-attention encoding results of each word are spliced with the corresponding word vectors to obtain the spliced vectors of each word; the spliced vectors of each word are input into the bidirectional long short-term memory neural network to obtain the hidden vectors of each word; self-attention encoding is performed on the hidden vectors of each word, and then the result of self-attention encoding is retained, and a dot product operation is performed on the retained result of self-attention encoding and the corresponding hidden vector to obtain the business slot probability corresponding to the result of the intent classification; according to the business slot probability of each word, each word is filled into the corresponding business slot, and the filled content is used as the intent recognition result.
[0013] Optionally, based on the intention recognition result and the historical conversation content of the user, the inheritance ratio of the historical conversation content is determined, including: inputting the intention recognition result and the historical conversation content of the user into a long short-term memory network and a multi-layer perceptron, and utilizing the gate structure in the long short-term memory network and the category judgment ability of the multi-layer perceptron to calculate the inheritance ratio of the consulting question to the historical conversation content.
[0014] Optionally, after generating a response result using a neural network based on an attention mechanism, the method further includes: extracting features of the user portrait of the user through a recurrent convolutional neural network to obtain response features of the user; and converting and reconstructing the response result based on the response features to generate a response result that meets the response features.
[0015] Optionally, the method further comprises: compressing the structure of the bidirectional long short-term memory neural network, the neural network based on the attention mechanism and the self-attention encoding layer through knowledge distillation, so as to use the compressed The coding layer generates a response result of the consultation question.
[0016] Optionally, in the case where the consulting question is a voice signal, obtaining the consulting question sent by the user includes: using Fourier transform to convert each sentence in the consulting question into a numerical feature; performing dimensionality adjustment and local feature extraction on the numerical features of each sentence to obtain the word vector of the word contained in each sentence of the consulting question.
[0017] Optionally, when the response request requires the response result to be a voice signal, the response result is returned to the user as a response result of the response request, including: inputting the response result into a convolution layer, and performing an inverse Fourier transform on the output result of the convolution layer to obtain a response result of the voice signal; and returning the response result of the voice signal to the user.
[0018] According to a second aspect of an embodiment of the present invention, a response device is provided, including:
[0019] A question acquisition module, used for acquiring the consultation question sent by the user in response to receiving the answer request;
[0020] An intention recognition module is used to classify the intention of the consulting question by using a multi-head attention mechanism combined with a bidirectional long short-term memory neural network, and extract the intention of the consulting question through a self-attention encoding layer and a bidirectional long short-term memory neural network according to the intention classification result to obtain an intention recognition result;
[0021] A history inheritance module, used to determine an inheritance ratio of the historical conversation content according to the intention recognition result and the historical conversation content of the user;
[0022] A result generation module is used to generate a response result based on the inheritance ratio and the intention recognition result by using a neural network based on an attention mechanism, and return the response result to the user as a response result of the response request.
[0023] According to a third aspect of an embodiment of the present invention, there is provided an electronic device for responding, including:
[0024] one or more processors;
[0025] a storage device for storing one or more programs,
[0026] When the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the first aspect of the embodiment of the present invention.
[0027] According to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method provided by the first aspect of the embodiment of the present invention is implemented.
[0028] An embodiment of the invention has the following advantages or beneficial effects: obtaining consulting questions sent by users in response to receiving answer requests; using a multi-head attention mechanism in conjunction with a bidirectional long short-term memory neural network to classify the intent of consulting questions, and extracting the intent of consulting questions through a self-attention encoding layer and a bidirectional long short-term memory neural network based on the intent classification results to obtain intent recognition results; determining the inheritance ratio of the historical conversation content based on the intent recognition results and the user's historical conversation content; generating answer results based on the inheritance ratio and the intention recognition results using a neural network based on an attention mechanism, and returning the answer results to the user as the response result of the answer request. The technical solution realizes an accurate and continuous intelligent answer method with historical conversations, and uses the ability of deep learning related algorithms to understand consulting questions to provide users with truly intelligent answers, reduce the pressure of manual customer service, improve user experience, and better meet business needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0030] Figure 1 is a schematic diagram of the main process of the answering method according to an embodiment of the present invention;
[0031] Figure 2 is a schematic diagram of a specific algorithm principle of the intent classification method according to an embodiment of the present invention;
[0032] Figure 3 Schematic diagram of a specific algorithm principle of the intent extraction method according to an embodiment of the present invention;
[0033] Figure 4 It is a schematic diagram of the overall principle of the response method of an embodiment of the present invention;
[0034] Figure 5 It is a schematic diagram of the main algorithm flow of the answering method according to an embodiment of the present invention;
[0035] Figure 6 is a schematic diagram of main modules of a response device according to an embodiment of the present invention;
[0036] Figure 7is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0037] Figure 8 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0038] It should be noted that in the technical solution of the present invention, the collection / collection, update, analysis, use, transmission, storage and other aspects of user personal information involved are in compliance with the provisions of relevant laws and regulations, are used for legal and reasonable purposes, are not shared, leaked or sold outside of these legal uses, and are subject to supervision and management by national regulatory authorities. Necessary measures should be taken for user personal information to selectively block the use or access to personal information data to prevent illegal access to such personal information data, ensure that persons who have access to personal information data comply with the provisions of relevant laws and regulations, and ensure the security of user personal information. In addition, once these user personal information data are no longer needed, the risks should be minimized by limiting or even prohibiting data collection and / or deleting data.
[0039] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0040] On the one hand, the existing technology uses the core keywords extracted from the user's question to characterize the user's intention, but cannot obtain the user's intention at the semantic level, resulting in inaccurate intention recognition. On the other hand, the content of the answer can only be searched from a set text library, and replies outside the text library cannot be automatically generated. This results in many users' questions not getting satisfactory answers, the answer effect is poor, and cannot meet practical applications well.
[0041] In order to solve the above problems existing in the prior art, the present invention proposes a response method, which is based on the user's consulting questions and uses a multi-head attention mechanism combined with a bidirectional long short-term memory neural network to classify the consulting questions in an intent manner. Then, according to the results of the intent classification, the consulting questions are extracted in an intent manner through a self-attention encoding layer and a bidirectional long short-term memory neural network, so as to achieve accurate extraction of intentions at the semantic level, and then determine the inheritance ratio of the historical conversation content to generate an accurate response result that is continuous with the historical conversation. This realizes an accurate intelligent response method with continuous conversation capabilities, and uses the ability of deep learning related algorithms to understand consulting questions to provide users with truly intelligent responses, reduce the pressure on manual customer service, improve user experience, and better meet business needs.
[0042] Figure 1 is a schematic diagram of the main process of the answering method according to an embodiment of the present invention, such as Figure 1 As shown, the response method of the embodiment of the present invention includes the following steps S101 to S103.
[0043] Step S101: in response to receiving a response request, obtaining a consultation question sent by a user.
[0044] Specifically, the intelligent dialogue system monitors the response requests sent by the user in real time. When the response requests are monitored, the system parses the user information that needs to be responded to and the consulting questions that the user needs to answer according to the data format preset by the system. The consulting questions in the embodiments of the present invention can be a text expression with a question, or a text expression of the user's wishes, such as "Hello, are you there? I want to mail some local specialties to my friend", and each sentence in the text expression of the consulting question is segmented and vectorized to obtain a vector representation of the consulting question.
[0045] Step S102: Use a multi-head attention mechanism in conjunction with a bidirectional long short-term memory neural network to classify the consulting questions by intent. Based on the results of the intent classification, extract the intent of the consulting questions through a self-attention encoding layer and a bidirectional long short-term memory neural network to obtain intent recognition results.
[0046] Specifically, the user's intention recognition plays an important role in the construction of the response result. If the intention recognition is biased, it will directly lead to the response result not being what the user needs, which not only affects the response efficiency, but also brings a bad experience to the user. The embodiment of the present invention is committed to the intention recognition at the semantic level. The context dependency problem can be solved based on the multi-head attention mechanism cross-attention, and the bidirectional long short-term memory neural network can ensure the coherence of semantic information. The consulting question is input into the intention classification module composed of the multi-head attention mechanism and the bidirectional long short-term memory neural network to obtain the intention classification to which the consulting question belongs, that is, the business field of the consulting question, such as the express discount field. Based on the determined intention classification, the specific semantic direction of the subsequent intention extraction is determined. For example, in the express discount field, the corresponding semantics usually involve specific express companies, whether it is ordinary express or large-scale logistics, etc. The consulting question is input into the intention extraction module composed of the self-attention encoding layer and the bidirectional long short-term memory neural network to obtain the intention recognition result.
[0047] According to one embodiment of the present invention, a multi-head attention mechanism is used in conjunction with a bidirectional long short-term memory neural network to perform intent classification on the consulting questions, including: for each sentence in the consulting question: inputting the word vector of each word in the sentence into a first bidirectional long short-term memory neural network to obtain a word hidden vector of each word; using a multi-head attention mechanism to calculate the attention weight of each word according to the word content vector of the sentence and each word hidden vector, and then superimposing the attention weight of each word to the corresponding word hidden vector to obtain the sentence vector of the sentence; inputting the sentence vector of each sentence in the consulting question into a second bidirectional long short-term memory neural network to obtain a sentence hidden vector of each sentence; using a multi-head attention mechanism to calculate the attention weight of each sentence according to the sentence content vector of the consulting question and each sentence hidden vector, and then superimposing the attention weight of each sentence to the corresponding sentence hidden vector, and obtaining the intent classification result through activation function mapping.
[0048] Exemplarily, the embodiment of the present invention determines the intent classification from the word granularity and the sentence granularity. Figure 2 The user sends a message "What is this express welfare group for? The courier guy said I can get coupons. Do you have A express coupons?" After the intelligent answering system pre-processes and cleans the text, take the third sentence in the consultation question "Do you have A express coupons?" as an example, and its vector representation w 31 , w 32 , w 33 , w 34 , w 35 , w 36 , w37 First, the word vector w of each word in the sentence 31 , w 32 , w 33 , w 34 , w 35 , w 36 , w 37 Input the first bidirectional long short-term memory neural network Bi-LSTM, Bi-LSTM outputs the hidden vector h of each word 31 ,h 32 ,h 33 ,h 34 ,h 35 ,h 36 ,h 37 ; Then according to the word content vector u of the sentence obtained in advance w And the hidden vector of each word, the multi-head attention mechanism is used to calculate the attention weight a corresponding to each word 31 , a 32 , a 33 , a 34 , a 35 , a 36 , a 37 , add the attention weight of each word to the corresponding word hidden vector to obtain the sentence vector s3.
[0049] Furthermore, taking each sentence in the consulting question as the granularity, assuming that there are 8 sentences in the consulting question, the sentence vectors s1, s2, s3, s4, s5, s6, s7, s8 of the 8 sentences are input into the second bidirectional long short-term memory neural network Bi-LSTM, and Bi-LSTM outputs the sentence hidden vector h1, h2, h3, h4, h5, h6, h7, h8 of each sentence; then according to the sentence content vector u of the sentence obtained in advance s And the hidden vector of each sentence, the multi-head attention mechanism is used to calculate the attention weights a1, a2, a3, a4, a5, a6, a7, a8 of the sentence; finally, the attention weight a of each sentence is 1~ a8 is superimposed on the corresponding sentence hidden vector h 1~ h8, and obtain the output vector vector, which is then mapped by the activation function softmax to obtain the intent classification result of the consultation question.
[0050] According to another embodiment of the present invention, based on the result of intent classification, the consulting question is subjected to intent extraction through a self-attention encoding layer and a bidirectional long short-term memory neural network to obtain an intent recognition result, including: for each sentence in the consulting question: performing self-attention encoding on the word vectors of each word in the sentence, and splicing the self-attention encoding results of each word with the corresponding word vectors to obtain a spliced vector of each word; inputting the spliced vectors of each word into a bidirectional long short-term memory neural network to obtain a hidden vector of each word; performing self-attention encoding on the hidden vector of each word, and then performing retention control on the result of the self-attention encoding, performing a dot product operation on the retained result of the self-attention encoding and the corresponding hidden vector to obtain a business slot probability corresponding to the result of the intent classification; filling each word into the corresponding business slot according to the business slot probability of each word, and using the filled content as the intent recognition result.
[0051] Specifically, based on the results of the intent classification of the consulting question determined above, the business slot template corresponding to the intent classification is selected. Different intent classifications correspond to different business slot templates. The business slot template can be understood as the semantic guidance for extracting user intent. For example, for the intent classification of express discounts, the corresponding business slot template includes "the express company to which the consulting object belongs", "the consulting object", "the consulting content" and "the specific purpose of the consultation". The module for extracting intent clarifies the corresponding business slot template based on the results of intent classification, and then determines the probability of each word in each sentence of the consulting question corresponding to the business slot template based on the input consulting question.
[0052] For example, Figure 3 Schematic diagram of the specific algorithm principle of the intention extraction method of the embodiment of the present invention. First, the word vector w of each word in the sentence is 31 , w 32 , w 33 , w 34 , w 35 , w 36 , w 37 Input the self-attention encoding layer, perform self-attention encoding on the word vector, concatenate the self-attention encoding results of each word with the corresponding word vector, and obtain the concatenated vectors v1, v2, v3, v4, v5, v6, v7 of each word; then concatenate v 1~v7 inputs the bidirectional long short-term memory neural network Bi-LSTM to obtain the hidden vector of each word. Then the hidden vector of each word is input into the self-attention encoding layer for self-attention encoding, and the gating coefficient calculated by the gating unit controls the retention of the result of self-attention encoding. The gating unit has the ability to control the filtering from upstream encoding to downstream, so as to reflect the keywords in the sentence with emphasis. Finally, the dot product operation is performed on the retained self-attention encoding result and the corresponding hidden vector, and the business slot probability corresponding to each word is output. Based on the determined business slot probability, each word is filled into the business slot with the highest probability, and the filled content is connected to obtain the intent recognition result.
[0053] For example, for the question "Are there any coupons for A Express?", the intent classification result after intent classification is express discounts, and then the business slots are determined and filled, and the filled content obtained is as shown in Table 1 below. Accordingly, the intent recognition result is to inquire about the express discounts of A Express Company.
[0054] The embodiment of the present invention utilizes deep learning related algorithms to first perform semantic level intent classification on consulting questions, and then utilizes deep learning related algorithms based on the intent classification results to determine the business slot probabilities of each word in each sentence of the consulting questions, and obtains accurate intent recognition results through the slot filling method.
[0055] Step S103: Determine an inheritance ratio of the historical conversation content according to the intention recognition result and the historical conversation content of the user.
[0056] Specifically, in order to ensure the semantic integrity and logical self-consistency of multiple rounds of dialogues during the entire process of user dialogue and communication, and to avoid information interruption and missing information when the intelligent dialogue system serves users, the embodiment of the present invention retrieves the historical dialogue content of the user in the recent period, performs a correlation check on the historical dialogue content and the intention recognition result, and determines the inheritance ratio according to the correlation check index.
[0057] According to one embodiment of the present invention, the inheritance ratio of the historical conversation content is determined based on the intention recognition result and the historical conversation content of the user, including: inputting the intention recognition result and the historical conversation content of the user into a long short-term memory network and a multi-layer perceptron, and utilizing the gate structure in the long short-term memory network and the category judgment ability of the multi-layer perceptron to calculate the inheritance ratio of the consulting question to the historical conversation content.
[0058] Specifically, in order to ensure the accuracy of the inheritance ratio, the embodiment of the present invention utilizes the associative sequence information capability of the long short-term memory network LSTM, designs the corresponding gate structure, and controls the inheritance ratio between words in the current conversation; based on the inheritance ratio between words, a binary classification discriminator composed of a multi-layer perceptron MLP is used to input the first n rounds of historical conversation content that have determined the inheritance ratio between words into the binary classification discriminator, output whether each round of historical conversation is inherited, and then obtain the inheritance ratio of the consulting question to the historical conversation content, and mark whether each round of historical conversation is inherited. Based on this, the embodiment of the present invention gives the intelligent answering system the ability to have multiple rounds of conversations, ensuring that the generated answers are continuous and complete.
[0059] Step S104: Generate a response result based on the inheritance ratio and the intention recognition result using a neural network based on an attention mechanism, and return the response result to the user as a response result of the response request.
[0060] Specifically, based on the inheritance ratio of the historical conversations determined above and the inheritance probability of each round of historical conversations identified therein, the inherited historical conversations are integrated through a language generation module formed by stacking a multi-layer bidirectional transformer network, and then combined with the intention recognition results determined above, accurate and continuous response results are finally generated and returned to the user.
[0061] According to one embodiment of the present invention, after generating a response result using a neural network based on an attention mechanism, the method further includes: extracting features of the user portrait of the user through a recurrent convolutional neural network to obtain response features of the user; and converting and reconstructing the response result based on the response features to generate a response result that meets the response features.
[0062] Specifically, in order to provide users with personalized, good-experience conversation services, considering that the answering method of the embodiment of the present invention is mainly used for answers in designated business vertical fields, internal business data can be used to train related neural networks to ensure the professionalism of the answers, and internal user portraits with personal permission from the user can also be used to give the intelligent answering system a "virtual personality". Apply for user portraits through an internal dedicated interface, input the user portrait containing the user into a recurrent convolutional neural network, extract the features of the user portrait, and obtain the user's answer features. The answer features here can be specifically understood as the user's expression style, such as humorous, plain, concise, bold, etc. According to the user's answer characteristics, the answer result is rewritten, converted or reconstructed to generate an answer result consistent with the user's expression style.
[0063] The embodiment of the present invention not only utilizes deep learning related algorithms to accurately identify the intention of the user's consulting questions, but also, given that the neural network used is mainly used in designated vertical fields, it is possible to safely introduce user portraits into the intelligent answering system to generate accurate, professional, and personalized answer results to serve the customer service in this business field.
[0064] According to another embodiment of the present invention, the method further includes: compressing the structural composition of the bidirectional long short-term memory neural network, the attention mechanism-based neural network and the self-attention encoding layer through knowledge distillation, so as to generate the answer result of the consulting question using the compressed neural network and encoding layer.
[0065] Specifically, the intelligent answering system of the embodiment of the present invention includes the above-mentioned intention recognition, inheritance of historical dialogues, generation of answer results, and conversion of answer features of answer results. These main component modules, and each component module is built with different neural networks. In order to speed up the response speed and improve the user experience, the intelligent answering system is subjected to knowledge distillation, and the complete network structure of each module is used as a "teacher model", such as the neural network based on the attention mechanism in the answer result generation module, the self-attention encoding layer and bidirectional long short-term memory neural network involved in intention extraction in the intention recognition module, and the long short-term memory network and multi-layer perceptron in the module that determines the inheritance ratio of historical dialogues. Then, based on business experience, the network structure of each module is compressed, usually the number of layers of each neural network is compressed, and each compressed module is used as a "student model". Then, a large amount of training data annotated by the "teacher model" is combined with the original training data and input to the "student model" together to achieve the purpose of letting the "student model" learn the reasoning ability of the "teacher model", and after completing the knowledge distillation, the network structure of each module after compression is used to quickly generate the answer result of the consultation question.
[0066] According to yet another embodiment of the present invention, when the consulting question is a voice signal, obtaining the consulting question sent by the user includes: utilizing Fourier transform to convert each sentence in the consulting question into a numerical feature; performing dimensionality adjustment and local feature extraction on the numerical features of each sentence to obtain a word vector of the word contained in each sentence of the consulting question.
[0067] Specifically, in order to make it easier for users to use, in addition to supporting consultation questions in text format, the embodiments of the present invention can also support consultation questions in voice signals. When the consultation questions are voice signals, it is first necessary to perform Fourier transform on the voice signal through a sliding window to complete the conversion from time domain to frequency domain, and convert each sentence in the consultation question into a numerical feature. Then, the numerical features are dimensionalized and adjusted through a linear layer and a calculation function, and finally, the global features are extracted into local features through a convolutional layer to obtain the word vectors of the words contained in each sentence of the consultation question, completing the vectorization process of the consultation question of the voice signal.
[0068] According to another embodiment of the present invention, when the response result is required to be a voice signal in the response request, the response result is returned to the user as a response result of the response request, including: inputting the response result into a convolution layer, and performing an inverse Fourier transform on the output result of the convolution layer to obtain a response result of the voice signal; and returning the response result of the voice signal to the user.
[0069] Specifically, the intelligent response system of the embodiment of the present invention can not only be used to return the response result in text form to the user, but also can return the response result in the form of a voice signal. If the current user needs to listen to the response result of the voice signal, then after generating the text response result, the response result needs to be input into an audio synthesis module composed of multiple convolutional layers, and the output result of the convolutional layer is inverse Fourier transformed inside the audio synthesis module to complete the time domain conversion of the frequency domain signal to obtain the response result of the voice signal, and finally the response result of the voice signal is returned to the user.
[0070] Figure 4 It is a schematic diagram of the overall principle of the answering method of an embodiment of the present invention. The intelligent answering system in this figure can be visualized as an intelligent AI robot, and the user sends a consultation question in the form of a voice signal to the intelligent answering system. When the intelligent AI robot receives the consultation question in the form of a voice signal, it first needs to perform voice recognition, and use Fourier transform to convert each sentence in the voice consultation question into a numerical feature, and then the numerical feature is transformed and adjusted in dimension through a linear layer and a calculation function, and finally the global feature is extracted into a local feature through a convolutional layer to obtain the word vector of the word contained in each sentence of the consultation question.
[0071] After speech recognition based on consulting questions, the word vectors of the words contained in each sentence of the consulting questions are obtained. Then the language understanding of the consulting questions is performed to identify the user's intention. Specifically, the first bidirectional long short-term memory neural network, the multi-head attention mechanism and the second bidirectional long short-term memory neural network are used to first classify the intention and determine the business field to which the consulting questions belong. Then, according to the results of the intention classification, the corresponding business slot template is determined, and the probability of each word in the sentence corresponding to the business slot template is calculated using the self-attention encoding layer and the bidirectional long short-term memory neural network. The intention extraction is completed by slot filling to obtain the intention recognition result.
[0072] Based on the results of language understanding and intent recognition, historical conversations are managed according to their inheritance. The association sequence information capability of the long short-term memory network is used to design the corresponding gate structure to control the inheritance ratio between words in the current conversation. Based on the inheritance ratio between words, a binary category discriminator composed of a multi-layer perceptron is used to input the historical conversation content with the inheritance ratio between words determined into the binary category discriminator, and the inheritance ratio of the consulting question to the historical conversation content is calculated to achieve conversation management.
[0073] Subsequently, the inherited historical conversations are integrated through a response generation module composed of a multi-layer bidirectional transformer network stack, and then combined with the above-mentioned determined intent recognition results to finally generate accurate and continuous response results.
[0074] Furthermore, in order to enhance the user experience and make the response more consistent with the user's language style, the user portrait is obtained through an internal dedicated interface, and the user portrait is input into a recurrent convolutional neural network to extract the features of the user portrait and obtain the user's response features. According to the user's response features, the response results are rewritten, converted or reconstructed to generate a response result consistent with the user's personal language style, completing the style conversion of the response results.
[0075] Finally, the response result that conforms to the user's language style is input into the audio synthesis module composed of multiple convolutional layers, and the output result of the convolutional layer is inverse Fourier transformed inside the audio synthesis module to complete the time domain conversion of the frequency domain signal, and the synthesized response voice signal is obtained and returned to the user.
[0076] Figure 5This is a schematic diagram of the main algorithm flow of the answering method of an embodiment of the present invention. First, the user's voice consultation question is Fourier transformed and dimensionally adjusted to obtain the global feature vector of the voice consultation question, and then the convolution layer is used to extract local features to obtain the word vectors of the words contained in each sentence of the consultation question. Then, each word vector is input into the core algorithm area composed of intent recognition, historical dialogue inheritance management and answer generation modules to generate accurate and continuous answer results. Finally, the answer result is converted into answer features using a recurrent convolutional neural network to generate an answer result with the user's answer features, and the answer result with the answer features is subjected to audio synthesis to output the voice answer result.
[0077] In addition, based on market research and business data, the intelligent AI robot in this case is compared with the response mode of existing manual customer service, as well as the existing text library robot that searches for answers from the text library based on keyword matching. The comparison mainly involves five aspects: response time, cost, customer satisfaction, scalability and personalization. The specific comparison content is shown in Table 2 below.
[0078] In terms of response time, for manual customer service, due to limited human resources, the average response time usually ranges from a few minutes to a few hours, roughly estimated to be 5 minutes; for text library robots and intelligent AI robots, the response time is mainly subject to server performance and model throughput capacity, and the response time is usually in seconds / milliseconds, roughly estimated to be 5 seconds.
[0079] In terms of cost calculation, the cost of manual customer service is mainly labor cost, which mainly includes employee salaries and training costs, which is estimated to be around 50,000 yuan / month; the service of robot customer service mainly includes one-time development costs and daily operation and maintenance costs, which is estimated to be around 1,000 yuan / month.
[0080] In terms of user satisfaction (0~1), manual customer service can provide more humane services, while responses from text libraries are prone to irrelevant questions. Intelligent AI robots can better understand consumers by analyzing user portraits, and can therefore provide more humane services.
[0081] In terms of scalability (0~1), since new areas of manual customer service require certain training, and the algorithm models of text library robots and intelligent AI robots are easier to migrate, they have better scalability, especially intelligent AI robots, which have excellent learning and prediction capabilities.
[0082] Degree of personalization (0~1). Since both manual customer service and intelligent AI robots can better understand user needs, but manual customer service will inevitably use quick response templates in actual business, intelligent AI robots are better.
[0083] Through the above comparison of the effects of different answering methods in different aspects, it can be seen that the answering method of the embodiment of the present invention has the advantages of fast response time, high customer satisfaction, and strong scalability, and can greatly liberate labor costs, providing users with personalized answering services with "thousands of faces for thousands of people".
[0084] The embodiments of the present invention make full use of deep learning related algorithms to achieve accurate user intention recognition and give the intelligent answering system the ability to conduct multiple rounds of dialogue. At the same time, user portraits are used as features to participate in the generation of answer results, so that the output answers are more in line with user habits. In addition, through knowledge distillation, the composition of the entire answering system is compressed to speed up the response speed and improve the user experience.
[0085] Figure 6 FIG. 1 is a schematic diagram of the main modules of a response device according to an embodiment of the present invention. Figure 6 As shown, the response device 600 mainly includes a question acquisition module 601, an intention recognition module 602, a history inheritance module 603 and a result generation module 604.
[0086] The question acquisition module 601 is used to obtain the consultation question sent by the user in response to receiving the answer request;
[0087] Intent recognition module 602, used to classify the intent of the consulting question by using a multi-head attention mechanism combined with a bidirectional long short-term memory neural network, and extract the intent of the consulting question through a self-attention encoding layer and a bidirectional long short-term memory neural network according to the intent classification result to obtain an intent recognition result;
[0088] A history inheritance module 603, configured to determine an inheritance ratio of the historical conversation content according to the intention recognition result and the historical conversation content of the user;
[0089] The result generation module 604 is used to generate a response result based on the inheritance ratio and the intention recognition result by using a neural network based on an attention mechanism, and return the response result to the user as a response result of the response request.
[0090] According to one embodiment of the present invention, the intention identification module 602 is also used for: for each sentence in the consulting question: inputting the word vector of each word in the sentence into the first bidirectional long short-term memory neural network to obtain the word hidden vector of each word; according to the word content vector of the sentence and the hidden vector of each word, using a multi-head attention mechanism to calculate the attention weight of each word, and then superimposing the attention weight of each word to the corresponding word hidden vector to obtain the sentence vector of the sentence; inputting the sentence vector of each sentence in the consulting question into the second bidirectional long short-term memory neural network to obtain the sentence hidden vector of each sentence; according to the sentence content vector of the consulting question and the hidden vector of each sentence, using a multi-head attention mechanism to calculate the attention weight of each sentence, and then superimposing the attention weight of each sentence to the corresponding sentence hidden vector, and obtaining the intention classification result through activation function mapping.
[0091] According to another embodiment of the present invention, the intention recognition module 602 is also used for: for each sentence in the consulting question: performing self-attention encoding on the word vector of each word in the sentence, and splicing the self-attention encoding results of each word with the corresponding word vector to obtain the splicing vector of each word; inputting the splicing vector of each word into a bidirectional long short-term memory neural network to obtain the hidden vector of each word; performing self-attention encoding on the hidden vector of each word, and then performing retention control on the result of the self-attention encoding, performing dot product operation on the retained result of the self-attention encoding and the corresponding hidden vector to obtain the business slot probability corresponding to the result of the intention classification; filling each word into the corresponding business slot according to the business slot probability of each word, and using the filled content as the intention recognition result.
[0092] According to another embodiment of the present invention, the history inheritance module 603 is further used to: input the intention recognition result and the user's historical conversation content into a long short-term memory network and a multi-layer perceptron, and use the gate structure in the long short-term memory network and the category judgment ability of the multi-layer perceptron to calculate the inheritance ratio of the consulting question to the historical conversation content.
[0093] According to another embodiment of the present invention, the response device 600 also includes a response feature conversion module (not shown in the figure), which is used to: after generating a response result using a neural network based on an attention mechanism, perform feature extraction on the user portrait of the user through a recurrent convolutional neural network to obtain the response characteristics of the user; according to the response characteristics, convert and reconstruct the response result to generate a response result that meets the response characteristics.
[0094] According to another embodiment of the present invention, the response device 600 also includes a compression module (not shown in the figure), which is used to compress the structural composition of the bidirectional long short-term memory neural network, the attention mechanism-based neural network and the self-attention encoding layer through knowledge distillation, so as to use the compressed neural network and encoding layer to generate the response result of the consultation question.
[0095] According to another embodiment of the present invention, when the consulting question is a voice signal, the question acquisition module 601 is further used to: utilize Fourier transform to convert each sentence in the consulting question into a numerical feature; perform dimensionality adjustment and local feature extraction on the numerical features of each sentence to obtain the word vector of the word contained in each sentence of the consulting question.
[0096] According to another embodiment of the present invention, when the response result is required to be a voice signal in the response request, the result generation module 604 is also used to: input the response result into the convolution layer, and perform an inverse Fourier transform on the output result of the convolution layer to obtain the response result of the voice signal; and return the response result of the voice signal to the user.
[0097] Figure 7 is an exemplary system architecture diagram to which embodiments of the present invention can be applied.
[0098] like Figure 7 As shown, system architecture 700 may include terminal devices 701, 702, 703, network 704 and server 705. Network 704 is used to provide a medium for communication links between terminal devices 701, 702, 703 and server 705. Network 704 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0099] Users can use terminal devices 701, 702, 703 to interact with server 705 through network 704 to receive or send messages, etc. Terminal devices 701, 702, 703 can be installed with various communication client applications, such as smart answering applications, etc. (only for example).
[0100] The terminal devices 701 , 702 , and 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0101] Server 705 may be a server that provides various services, such as a background management server that provides support for responses made by users using terminal devices 701, 702, and 703 (for example only). In response to receiving a response request, the background management server may obtain the consulting questions sent by the user; use a multi-head attention mechanism in conjunction with a bidirectional long short-term memory neural network to perform intent classification on the consulting questions, and extract the intent of the consulting questions through a self-attention encoding layer and a bidirectional long short-term memory neural network based on the results of the intent classification to obtain intent recognition results; determine the inheritance ratio of the historical conversation content based on the intent recognition results and the historical conversation content of the user; generate a response result based on the inheritance ratio and the intention recognition result using a neural network based on an attention mechanism, and return the response result as the response result of the response request to the user for processing, and feed back the processing result (such as the response result, etc. - for example only) to the terminal device.
[0102] It should be noted that the response method provided in the embodiment of the present invention is generally executed by the server 705 , and accordingly, the response device is generally set in the server 705 .
[0103] It should be understood that Figure 7 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0104] Reference below Figure 8 , which shows a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. Figure 8 The terminal device or server shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0105] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 to a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other through a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0106] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.
[0107] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are executed.
[0108] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination thereof.
[0109] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0110] The units involved in the embodiments of the present invention may be implemented in software or hardware. The units described may also be set in a processor, for example, it may be described as: a processor including: a question acquisition module, an intention recognition module, a history inheritance module and a result generation module.
[0111] The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the question acquisition module can also be described as "a module for acquiring consulting questions sent by users in response to receiving a response request."
[0112] On the other hand, the present invention also provides a computer-readable medium, which may be included in the device described in the embodiment; or may exist independently and not be assembled into the device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by a device, the device includes: in response to receiving a response request, obtaining a consultation question sent by a user; using a multi-head attention mechanism combined with a bidirectional long short-term memory neural network to perform intent classification on the consultation question, and according to the result of the intent classification, extracting the intent of the consultation question through a self-attention encoding layer and a bidirectional long short-term memory neural network to obtain an intent recognition result; according to the intent recognition result and the historical conversation content of the user, determining the inheritance ratio of the historical conversation content; according to the inheritance ratio and the intent recognition result, using a neural network based on an attention mechanism to generate a response result, and returning the response result to the user as the response result of the response request.
[0113] According to the technical solution of the embodiment of the present invention, it has the following advantages or beneficial effects: by responding to receiving an answer request, obtaining the consulting question sent by the user; adopting a multi-head attention mechanism in conjunction with a bidirectional long short-term memory neural network to classify the intent of the consulting question, and according to the result of the intent classification, extracting the intent of the consulting question through a self-attention encoding layer and a bidirectional long short-term memory neural network to obtain an intention recognition result; determining the inheritance ratio of the historical conversation content according to the intention recognition result and the user's historical conversation content; according to the inheritance ratio and the intention recognition result, using a neural network based on the attention mechanism to generate an answer result, and returning the answer result to the user as a response result of the answer request. The technical solution realizes an accurate and continuous intelligent answer method with historical conversations, and uses the ability of deep learning related algorithms to understand consulting questions to provide users with truly intelligent answers, reduce the pressure of manual customer service, improve user experience, and better meet business needs.
[0114] The specific implementation methods described herein do not constitute limitations on the scope of protection of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention shall be included in the scope of protection of the present invention.
Claims
1. A response method, characterized in that: include: In response to receiving the answer request, obtaining the consultation question sent by the user; A multi-head attention mechanism is used in conjunction with a bidirectional long short-term memory neural network to classify the intent of the consulting question. Based on the intent classification result, the intent of the consulting question is extracted through a self-attention encoding layer and a bidirectional long short-term memory neural network to obtain an intent recognition result. Determining an inheritance ratio of the historical conversation content according to the intention recognition result and the historical conversation content of the user; According to the inheritance ratio and the intention recognition result, a response result is generated using a neural network based on an attention mechanism, and the response result is returned to the user as a response result of the response request.
2. The method according to claim 1, characterized in that The multi-head attention mechanism is combined with a bidirectional long short-term memory neural network to classify the intent of the consulting question, including: For each sentence in the consulting question: input the word vector of each word in the sentence into the first bidirectional long short-term memory neural network to obtain the word hidden vector of each word; according to the word content vector of the sentence and the hidden vector of each word, use the multi-head attention mechanism to calculate the attention weight of each word, and then add the attention weight of each word to the corresponding hidden vector to obtain the sentence vector of the sentence; The sentence vectors of each sentence in the consulting question are input into the second bidirectional long short-term memory neural network to obtain the sentence hidden vectors of each sentence; according to the sentence content vectors of the consulting question and the hidden vectors of each sentence, a multi-head attention mechanism is used to calculate the attention weights of each sentence, and then the attention weights of each sentence are superimposed on the corresponding sentence hidden vectors, and the intent classification results are obtained through activation function mapping.
3. The method according to claim 1, characterized in that According to the results of intent classification, the intention of the consulting question is extracted through the self-attention encoding layer and the bidirectional long short-term memory neural network to obtain the intent recognition results, including: For each sentence in the advisory question: Perform self-attention encoding on the word vector of each word in the sentence, and concatenate the self-attention encoding results of each word with the corresponding word vector to obtain the concatenated vector of each word; Inputting the concatenated vectors of each of the words into a bidirectional long short-term memory neural network to obtain a hidden vector of each of the words; Performing self-attention encoding on the hidden vector of each of the words, and then performing retention control on the result of the self-attention encoding, performing a dot product operation on the retained result of the self-attention encoding and the corresponding hidden vector, to obtain the business slot probability corresponding to the result of the intent classification; According to the business slot probability of each word, each word is filled into the corresponding business slot, and the filled content is used as the intention recognition result.
4. The method according to claim 1, characterized in that: Determining, according to the intention recognition result and the historical conversation content of the user, an inheritance ratio of the historical conversation content, including: The intention recognition result and the user's historical conversation content are input into a long short-term memory network and a multi-layer perceptron, and the inheritance ratio of the consulting question to the historical conversation content is calculated by using the gate structure in the long short-term memory network and the category judgment ability of the multi-layer perceptron.
5. The method according to claim 1, characterized in that After generating a response result using a neural network based on an attention mechanism, the method further includes: Extracting features of the user profile of the user by using a recurrent convolutional neural network to obtain response features of the user; According to the response characteristics, the response result is converted and reconstructed to generate a response result that meets the response characteristics.
6. The method according to claim 1, characterized in that The method further comprises: By knowledge distillation, the bidirectional long short-term memory neural network, the neural network based on the attention mechanism and the structure of the self-attention encoding layer are compressed so as to use the compressed The coding layer generates a response result of the consultation question.
7. The method according to claim 1, characterized in that In the case where the consultation question is a voice signal, obtaining the consultation question sent by the user includes: Using Fourier transform, convert each sentence in the consulting question into a numerical feature; The numerical features of each of the sentences are dimensionally adjusted and local features are extracted to obtain word vectors of the words contained in each of the sentences of the consulting question.
8. The method according to claim 1, characterized in that In the case where the answer request requires the answer result to be a voice signal, returning the answer result to the user as a response result of the answer request, comprising: Inputting the response result into the convolution layer, and performing inverse Fourier transform on the output result of the convolution layer to obtain the response result of the speech signal; The response result of the voice signal is returned to the user.
9. A response device, characterized in that: include: A question acquisition module, used for acquiring the consultation question sent by the user in response to receiving the answer request; An intention recognition module is used to classify the intention of the consulting question by using a multi-head attention mechanism combined with a bidirectional long short-term memory neural network, and extract the intention of the consulting question through a self-attention encoding layer and a bidirectional long short-term memory neural network according to the intention classification result to obtain an intention recognition result; A history inheritance module, used to determine an inheritance ratio of the historical conversation content according to the intention recognition result and the historical conversation content of the user; A result generation module is used to generate a response result based on the inheritance ratio and the intention recognition result by using a neural network based on an attention mechanism, and return the response result to the user as a response result of the response request.
10. A mobile electronic device terminal, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.
11. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Inquiry statement rewriting method and device
CN113673256A
Intention recognition method and device for few-sample multi-round dialogues
CN115617975A
Intelligent customer service method and system based on multiple rounds of dialogues
CN116150338A
