Sl-lstm-based multi-turn dialogue self-learning algorithm and electronic device
By using a multi-turn dialogue self-learning algorithm based on SL-LSTM to obtain the word vectors and slot vectors of the current dialogue, and combining them with the historical dialogue states to track the dialogue state, the problems of controllability, consistency and interpretability of multi-turn dialogue are solved, and high-coverage dialogue responses are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 哈尔滨工业大学人工智能研究院有限公司
- Filing Date
- 2023-04-03
- Publication Date
- 2026-05-05
AI Technical Summary
Existing technologies cannot simultaneously maintain the controllability, consistency, and high coverage of multi-turn dialogues, and lack interpretability.
A multi-turn dialogue self-learning algorithm based on SL-LSTM is adopted. By acquiring the word vectors and slot vectors of the current dialogue, and combining them with the historical dialogue state, the dialogue state is tracked. The dialogue strategy is learned through neural network, and finally, the dialogue response is synthesized.
It achieves controllability, consistency, and high coverage in multi-turn dialogues, while also possessing high interpretability.
Smart Images

Figure CN116383355B_ABST
Abstract
Description
Technical Field
[0001] This application relates to a multi-turn dialogue self-learning algorithm and electronic device based on SL-LSTM, belonging to the field of natural language processing technology. Background Technology
[0002] With the rapid development of the artificial intelligence industry, AI is being applied to more and more aspects of life. Natural language processing (NLP), as an important branch of AI, is mainly used in the scenario of intelligent chatbots. Intelligent chatbots receive information from users, analyze their intentions, and ultimately provide responses based on their own decision-making systems. This technology can be traced back to the early 1990s, introduced to save on human customer service costs. Although it involves advanced technology, users only need to ask and answer simple questions to get answers, greatly saving human and material resources.
[0003] The difficulty of chatbots lies in the algorithmic implementation of multi-turn dialogues, which aims to maintain controllability, consistency, and interpretability. Most existing solutions are based entirely on finite state machines to configure dialogue paths, offering strong controllability but poor diversity and weak coverage of user responses. To improve user response coverage, a deep learning model-based approach for learning dialogue paths has been proposed, avoiding configuration and using an end-to-end method to solve the multi-turn dialogue problem. This results in improved user coverage but decreased consistency and controllability. Therefore, current solutions have the following drawbacks: (1) they cannot simultaneously maintain controllability, consistency, and high coverage; (2) they cannot provide an efficient and interpretable dialogue learning algorithm. Summary of the Invention
[0004] The purpose of this application is to provide a multi-turn dialogue self-learning algorithm and electronic device based on SL-LSTM. Based on the SL-LSTM network, a new SL-LSTM process architecture is proposed, which maintains the controllability, consistency and high coverage of the dialogue, and has high interpretability.
[0005] To achieve the above objectives, the first aspect of this application provides a multi-turn dialogue self-learning algorithm based on SL-LSTM, comprising:
[0006] Repeat the following steps until the multi-round dialogue ends:
[0007] The system acquires the natural language text input by the user in the current dialogue and extracts the encoded information. It then obtains the word vectors and slot vectors of the current dialogue through a neural network, wherein the neural network is an SL-LSTM network.
[0008] The dialogue state of historical dialogues is obtained, and the short-term state of the current dialogue is obtained by combining the word vectors and the slot vectors through the neural network.
[0009] The dialogue state is tracked based on the dialogue state of the historical dialogue and the short-term state of the current dialogue to obtain the dialogue state of the current dialogue. At the same time, the dialogue strategy is learned through the neural network.
[0010] The output statements are synthesized according to the dialogue strategy to achieve a response to the current dialogue.
[0011] In one implementation, after synthesizing the output statement based on the decision result, the method further includes updating the parameters of the neural network based on the cumulative gradient obtained in the current dialogue.
[0012] In one implementation, obtaining the natural language text input by the user in the current dialogue and extracting the encoded information includes:
[0013] Get the natural language text input by the user in the current conversation;
[0014] The corresponding word segmentation and slots are obtained by extracting from the natural language text.
[0015] In one embodiment, the neural network includes: an embedding layer;
[0016] The step of obtaining the word vectors and slot vectors of the current dialogue through the neural network includes: obtaining the word vectors and slot vectors through the embedding layer based on the word segmentation and slots.
[0017] In one implementation, the neural network includes: a feed-forward network and switch gates;
[0018] The process of obtaining the short-term state of the current dialogue through the neural network includes:
[0019] By combining the dialogue state of the historical dialogue, the word vectors, and the slot vectors, the control state vector and statement state vector of the current dialogue are obtained through the feedforward network and the switch gates.
[0020] The short-term state is obtained by concatenating the control state vector and the statement state vector.
[0021] In one implementation, the neural network includes: combined states with a slot value update layer;
[0022] The step of tracking the dialogue state based on the dialogue state of the historical dialogue and the short-term state of the current dialogue, and obtaining the dialogue state of the current dialogue, includes:
[0023] Based on the dialogue states of the historical dialogues and the short-term state of the current dialogue, the dialogue states of the historical dialogues are updated through the combinedstates with slot value update layer to obtain the dialogue state of the current dialogue.
[0024] In one implementation, learning and obtaining a dialogue strategy through the neural network includes:
[0025] The dialogue strategy is learned through the combined states with slot value update layer.
[0026] In one implementation, after learning and obtaining the dialogue strategy through the neural network, the method further includes:
[0027] The output vector of the combined states with slot value update layer is connected with the downstream dialogue task to obtain the prediction result. The downstream dialogue task includes intent classification, sentence vector prediction, slot prediction, word vector prediction and word position prediction.
[0028] The process of synthesizing output statements according to the dialogue strategy includes:
[0029] The output statement is synthesized based on the dialogue strategy and the prediction result.
[0030] A second aspect of this application provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the first aspect or any embodiment of the first aspect.
[0031] A third aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the first aspect or any embodiment of the first aspect.
[0032] As can be seen from the above, this application provides a multi-turn dialogue self-learning algorithm and electronic device based on SL-LSTM, solving the problem that existing technologies cannot simultaneously guarantee the controllability, consistency, and interpretability of multi-turn dialogues. Based on the SL-LSTM network, a novel SL-LSTM process architecture is proposed, including: acquiring the natural language text input by the user in the current dialogue and extracting the encoded information, and obtaining the word vectors and slot vectors of the current dialogue through a neural network; acquiring the dialogue states of historical dialogues, and combining the word vectors and the slot vectors to obtain the short-term state of the current dialogue through the neural network; then, based on the dialogue states of historical dialogues and the short-term state of the current dialogue, performing dialogue state tracking to obtain the dialogue state of the current dialogue, and simultaneously learning and obtaining a dialogue strategy through the neural network; finally, synthesizing output sentences based on the dialogue strategy to achieve a response to the current dialogue. This approach maintains the controllability, consistency, and high coverage of the dialogue, while also possessing high interpretability. It is suitable for scenarios where intelligent dialogue robots engage in multi-turn dialogues. Attached Figure Description
[0033] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0034] Figure 1 This is a flowchart illustrating a multi-turn dialogue self-learning algorithm based on SL-LSTM provided in an embodiment of this application. Detailed Implementation
[0035] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of this application with unnecessary detail.
[0036] It should be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0037] It should also be understood that the terminology used in this application specification is for the purpose of describing particular embodiments only and is not intended to limit the application. As used in this application specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0038] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0039] Many specific details are set forth in the following description in order to provide a full understanding of this application. However, this application may also be implemented in other ways different from those described herein. Those skilled in the art can make similar extensions without departing from the spirit of this application. Therefore, this application is not limited to the specific embodiments disclosed below.
[0040] Example 1
[0041] This application provides a multi-turn dialogue self-learning algorithm based on SL-LSTM, such as... Figure 1 As shown, the algorithm includes:
[0042] Repeat the following steps until the multi-round dialogue ends:
[0043] The system acquires the natural language text input by the user in the current dialogue and extracts the encoded information. It then obtains the word vectors and slot vectors of the current dialogue through a neural network, wherein the neural network is an SL-LSTM network (i.e., a sentence-level long short-term memory network).
[0044] The dialogue state of historical dialogues is obtained, and the short-term state of the current dialogue is obtained by combining the word vectors and the slot vectors through the neural network.
[0045] The dialogue state is tracked based on the dialogue state of the historical dialogue and the short-term state of the current dialogue to obtain the dialogue state of the current dialogue. At the same time, the dialogue strategy is learned through the neural network.
[0046] The output statements are synthesized according to the dialogue strategy to achieve a response to the current dialogue.
[0047] In one application scenario, the multi-turn dialogue self-learning algorithm provided in this application embodiment follows the following process: First, user input information is extracted, that is, effective encoded information is constructed based on the natural language text input by the user; then, dialogue state tracking is performed, the encoded information recorded in the multi-turn dialogue process is maintained, and the dialogue state of historical dialogues is updated; and a dialogue strategy is learned from dialogue samples based on SL-LSTM; finally, natural language text is synthesized based on the dialogue strategy to respond to the current dialogue. The dialogue samples may include pre-set learning samples or dialogue samples from historical dialogues in multi-turn dialogues, as long as SL-LSTM can be trained and a dialogue strategy can be learned, which is not limited here.
[0048] Optionally, after synthesizing the output statement based on the decision result, the method further includes updating the parameters of the neural network based on the cumulative gradient obtained in the current dialogue.
[0049] Optionally, a positive integer t represents the turn of the dialogue, and the step of obtaining the natural language text input by the user in the current dialogue and extracting encoded information includes:
[0050] Obtain the natural language text U(t) input by the user in the t-th round of dialogue (i.e., the current dialogue);
[0051] The corresponding word segmentation and slots are obtained by extracting from the natural language text U(t).
[0052] Optionally, the neural network includes: an embedding layer;
[0053] The step of obtaining the word vector and slot vector of the current dialogue through the neural network includes: obtaining the word vector W(t) and the slot vector S(t) through the embedding layer based on the word segmentation and slots.
[0054] Optionally, the neural network includes: a feed-forward network and switchgates;
[0055] The process of obtaining the short-term state of the current dialogue through the neural network includes:
[0056] By combining the dialogue state of the historical dialogue, the word vectors, and the slot vectors, the control state vector and statement state vector of the current dialogue are obtained through the feedforward network and the switch gates.
[0057] The short-term state is obtained by concatenating the control state vector and the statement state vector.
[0058] Specifically, the dialogue state of the historical dialogue, i.e. the dialogue state of the (t-1)th round of dialogue, includes the internal state C(t-1) and the external state H(t-1). The internal state C(t-1), the external state H(t-1), the word vector W(t), and the slot vector S(t) are combined and processed through the feed forward network and switch gates to obtain the control state vector CS(t) and the statement state vector WS(t) of the current dialogue, respectively. The control state vector CS(t) and the statement state vector WS(t) are concatenated to obtain the short-term state ST(t).
[0059] Optionally, the neural network includes: combined states with a slot value update layer;
[0060] The step of tracking the dialogue state based on the dialogue state of the historical dialogue and the short-term state of the current dialogue, and obtaining the dialogue state of the current dialogue, includes:
[0061] Based on the dialogue states of the historical dialogues and the short-term state of the current dialogue, the dialogue states of the historical dialogues are updated through the combinedstates with slot value update layer to obtain the dialogue state of the current dialogue.
[0062] Specifically, the external state H(t-1) of the (t-1)th round of dialogue is updated based on the short-term state ST(t) of the t-th round of dialogue to obtain the dialogue state H(t) of the t-th round of dialogue; the internal state C(t-1) of the (t-1)th round of dialogue is updated based on the short-term state ST(t) of the t-th round of dialogue through the combinedstates with slot value update layer to obtain the dialogue state C(t) of the t-th round of dialogue. By maintaining and updating the dialogue state through dialogue state tracking, the dialogue state of the t-th round of dialogue is obtained, which can provide a data foundation for the subsequent (t+1)th round of dialogue.
[0063] Optionally, the learning of the dialogue strategy through the neural network includes:
[0064] The dialogue strategy is learned through the combined states with slot value update layer.
[0065] Optionally, after learning and obtaining the dialogue strategy through the neural network, the method further includes:
[0066] The output vector of the combined states with slot value update layer is connected with the downstream dialogue task to obtain the prediction result. The downstream dialogue task includes intent classification, sentence vector prediction, slot prediction, word vector prediction and word position prediction.
[0067] The process of synthesizing output statements according to the dialogue strategy includes:
[0068] The output statement is synthesized based on the dialogue strategy and the prediction result.
[0069] Specifically, natural language text can be synthesized by setting corresponding rules or generating models, and the final output statement A(t) can be obtained. No restrictions are imposed here.
[0070] As can be seen from the above, this application provides a multi-turn dialogue self-learning algorithm based on SL-LSTM, solving the problem that existing technologies cannot simultaneously guarantee the controllability, consistency, and interpretability of multi-turn dialogues. Based on the SL-LSTM network, an SL-LSTM process architecture is proposed, including: acquiring the natural language text input by the user in the current dialogue and extracting the encoded information, and obtaining the word vectors and slot vectors of the current dialogue through a neural network; acquiring the dialogue state of historical dialogues, and combining the word vectors and the slot vectors to obtain the short-term state of the current dialogue through the neural network; then tracking the dialogue state based on the dialogue state of historical dialogues and the short-term state of the current dialogue to obtain the dialogue state of the current dialogue, and simultaneously learning and obtaining a dialogue strategy through the neural network; finally, synthesizing the output statement based on the dialogue strategy to achieve a response to the current dialogue. This approach maintains the controllability, consistency, and high coverage of the dialogue, and also has high interpretability. It is suitable for scenarios where intelligent chatbots conduct multi-turn dialogues.
[0071] Example 2
[0072] This application provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor. The memory stores software programs and modules, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory. The memory and processor are connected via a bus. Specifically, the processor implements any of the steps in Embodiment 1 by running the computer program stored in the memory.
[0073] It should be understood that, in the embodiments of this application, the processor may be a Central Processing Unit (CPU), but it may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0074] Memory may include read-only memory, flash memory, and random access memory, and provides instructions and data to the processor. Some or all of the memory may also include non-volatile random access memory.
[0075] As can be seen from the above, the electronic device provided in this application embodiment implements the following steps by running a computer program stored in the memory: acquiring the natural language text input by the user in the current dialogue and extracting the encoded information, and obtaining the word vectors and slot vectors of the current dialogue through a neural network; acquiring the dialogue state of the historical dialogue, and combining the word vectors and the slot vectors to obtain the short-term state of the current dialogue through the neural network; then tracking the dialogue state based on the dialogue state of the historical dialogue and the short-term state of the current dialogue to obtain the dialogue state of the current dialogue, and simultaneously learning and obtaining a dialogue strategy through the neural network; finally, synthesizing the output statement based on the dialogue strategy to achieve a response to the current dialogue. This maintains the controllability, consistency, and high coverage of the dialogue, and has high interpretability. It is suitable for scenarios where intelligent chatbots conduct multi-turn dialogues.
[0076] It should be understood that if the integrated modules / units described above are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction.
[0077] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0078] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the above device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0079] It should be noted that the methods and detailed examples provided in the above embodiments can be incorporated into the apparatus and devices provided in the embodiments, and can be referred to each other, without further elaboration.
[0080] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0081] In the embodiments provided in this application, it should be understood that the disclosed apparatus / terminal devices and methods can be implemented in other ways. For example, the apparatus / device embodiments described above are merely illustrative. For instance, the division of the modules or units described above is merely a logical functional division, and in actual implementation, it can be divided in other ways. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0082] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A multi-turn dialogue self-learning algorithm based on SL-LSTM, characterized in that, include: Repeat the following steps until the multi-round dialogue ends: The system acquires the natural language text input by the user in the current dialogue and extracts the encoded information. It then obtains the word vectors and slot vectors of the current dialogue through a neural network, wherein the neural network is an SL-LSTM network. The dialogue state of historical dialogues is obtained, and the short-term state of the current dialogue is obtained by combining the word vectors and the slot vectors through the neural network. The dialogue state is tracked based on the dialogue state of the historical dialogue and the short-term state of the current dialogue to obtain the dialogue state of the current dialogue. At the same time, the dialogue strategy is learned through the neural network. The output statement is synthesized according to the dialogue strategy to achieve a response to the current dialogue; The neural network includes: a feed-forward network and switch gates; The process of obtaining the short-term state of the current dialogue through the neural network includes: By combining the dialogue state of the historical dialogue, the word vectors, and the slot vectors, the control state vector and statement state vector of the current dialogue are obtained through the feed forward network and the switch gates; The short-term state is obtained by concatenating the control state vector and the statement state vector.
2. The multi-turn dialogue self-learning algorithm as described in claim 1, characterized in that, The process of synthesizing the output statement according to the dialogue strategy further includes: The parameters of the neural network are updated based on the cumulative gradient obtained in the current dialogue.
3. The multi-turn dialogue self-learning algorithm as described in claim 1, characterized in that, The step of obtaining the natural language text input by the user in the current dialogue and extracting the encoded information includes: Get the natural language text input by the user in the current conversation; The corresponding word segmentation and slots are obtained by extracting from the natural language text.
4. The multi-turn dialogue self-learning algorithm as described in claim 3, characterized in that, The neural network includes: an embedding layer; The step of obtaining the word vectors and slot vectors of the current dialogue through the neural network includes: obtaining the word vectors and slot vectors through the embedding layer based on the word segmentation and slots.
5. The multi-turn dialogue self-learning algorithm as described in claim 1, characterized in that, The neural network includes: a combined states with slot value update layer; The step of tracking the dialogue state based on the dialogue state of the historical dialogue and the short-term state of the current dialogue, and obtaining the dialogue state of the current dialogue, includes: Based on the dialogue states of the historical dialogues and the short-term state of the current dialogue, the dialogue states of the historical dialogues are updated through the combinedstates with slot value update layer to obtain the dialogue state of the current dialogue.
6. The multi-turn dialogue self-learning algorithm as described in claim 5, characterized in that, The process of learning and obtaining a dialogue strategy through the neural network includes: The dialogue strategy is learned through the combined states with slot value update layer.
7. The multi-turn dialogue self-learning algorithm as described in claim 6, characterized in that, After learning and obtaining the dialogue strategy through the neural network, the process further includes: The output vector of the combined states with slot value update layer is connected with the downstream dialogue task to obtain the prediction result. The downstream dialogue task includes intent classification, sentence vector prediction, slot prediction, word vector prediction and word position prediction. The process of synthesizing output statements according to the dialogue strategy includes: The output statement is synthesized based on the dialogue strategy and the prediction result.
8. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor, when executing the computer program, implements the steps of the algorithm as claimed in any one of claims 1 to 7.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the algorithm as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Dialogue response and response strategy matching model training method and device
CN113326359A
Conversation state prediction-based multi-round conversation method, device, and computer apparatus
WO2021179445A1