Dialogue state tracking method, device and dialogue state tracking model training method
The dialogue state tracking model is trained through adaptive optimization loss function, which solves the problem of slot imbalance, improves the processing efficiency and accuracy of the model, and improves the user experience of the dialogue system.
Patent Information
- Application Number
- CN202010462879.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-05-27
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2040-05-27
AI Technical Summary
There is a problem of slot imbalance in the existing dialogue state tracking model, which leads to an imbalance in the learning difficulty of the more difficult to slot and difficult samples, limiting the tracking ability and processing efficiency of complex dialogue states.
The dialogue state tracking model is trained using adaptive optimization loss function, and the loss function is dynamically adjusted through the slot optimization coefficient and sample optimization coefficient, improving the model's processing efficiency for different slots and conversations, including feature extraction and normalization processing to obtain dialogue state.
It improves the accuracy and processing efficiency of the dialogue state tracking model, and improves the user experience and interaction efficiency of the dialogue system.
Smart Images

Figure CN111708871B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and more specifically, to a conversation state tracking method, a conversation state tracking device, a conversation state tracking model training method, a conversation state tracking model training device, a computer-readable storage medium, and an electronic device. Background Art
[0002] With the development of various applications and the emergence of smart electronic devices, people can carry out various tasks through smart electronic devices, such as ordering meals, booking hotels, navigation, etc. through human-computer interaction. The realization of these functions is mainly based on the dialogue system in artificial intelligence.
[0003] Dialogue systems are categorized by function into chat, task-based, knowledge question-answering, and recommendation-based types. Task-based dialogue systems are the most commonly used, and the most important component of task-based dialogue systems is dialogue state tracking. Dialogue state tracking automatically identifies structured dialogue states from multi-turn, diversely expressed conversations. Dialogue states typically consist of predefined slots and their corresponding values. For example, in a food ordering task, there would be slots such as "food type," "restaurant location," and "price," along with known values (from a predefined state library). Currently, dialogue state tracking suffers from slot imbalance, meaning that the learning difficulty of different slots and different samples is uneven. This hinders the model's optimization for more difficult slots and samples, thereby limiting the model's ability to track more complex dialogue states.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the Invention
[0005] Embodiments of the present disclosure provide a conversation state tracking method, a conversation state tracking device, a conversation state tracking model training method, a conversation state tracking model training device, a computer-readable storage medium, and an electronic device, thereby, at least to a certain extent, improving the adaptability of the conversation state tracking model, improving the conversation state extraction efficiency and conversation state generation quality of the conversation state tracking model, and thereby improving the user experience and interaction efficiency of the conversation system.
[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by practice of the present disclosure.
[0007] According to one aspect of an embodiment of the present disclosure, a method for tracking a dialogue state is provided, comprising: obtaining historical dialogues and a current-round dialogue, and inputting the historical dialogues, the current-round dialogues, the slots in the current-round dialogues, and the value sets corresponding to the slots in the current-round dialogues into a dialogue state tracking model; performing feature extraction on the historical dialogues, the current-round dialogues, the slots in the current-round dialogues, and the value sets corresponding to the slots in the current-round dialogues through the dialogue state tracking model to obtain a dialogue state corresponding to the current-round dialogue; wherein the dialogue state tracking model is trained based on an adaptive optimization loss function, the adaptive optimization loss function includes a slot optimization coefficient and a sample optimization coefficient, and the slot optimization coefficient is determined based on the accuracy of each slot on a validation dataset, and the sample optimization coefficient is determined based on the confidence of samples in each dialogue round.
[0008] According to one aspect of an embodiment of the present disclosure, a dialogue state tracking device is provided, comprising: an information acquisition module, configured to acquire historical dialogues and a current dialogue turn, and input the historical dialogues, the current dialogue turn, the slots in the current dialogue turn, and the value sets corresponding to the slots in the current dialogue turn into a dialogue state tracking model; a dialogue state generation module, configured to perform feature extraction on the historical dialogues, the current dialogue turn, the slots in the current dialogue turn, and the value sets corresponding to the slots in the current dialogue turn through the dialogue state tracking model, so as to acquire a dialogue state corresponding to the current dialogue turn; wherein the dialogue state tracking model is trained based on an adaptive optimization loss function, wherein the adaptive optimization loss function includes a slot optimization coefficient and a sample optimization coefficient, wherein the slot optimization coefficient is determined based on the accuracy of each slot on a validation dataset, and the sample optimization coefficient is determined based on the confidence of samples in each dialogue turn.
[0009] In some embodiments of the present disclosure, based on the aforementioned scheme, the dialogue state generation module includes: a feature extraction unit, configured to encode the slots in the current round of dialogue to obtain a slot vector, encode each value in the value set corresponding to the slots in the current round of dialogue to obtain a value vector, and simultaneously encode the historical dialogue and the current round of dialogue to obtain a dialogue vector; a first processing unit, configured to process the slot vector and the dialogue vector based on an attention mechanism to obtain a feature vector related to the slot in the dialogue; a normalization unit, configured to calculate the distance between the feature vector and each value vector, and normalize the distance to obtain the probability of each value, and determine the dialogue state corresponding to the current round of dialogue according to the value with the largest probability.
[0010] In some embodiments of the present disclosure, based on the aforementioned scheme, the normalization unit is configured to: construct a slot-value pair based on the slots in the current round of dialogue and the value with the highest probability, and take the set of slot-value pairs corresponding to all slots in the current round of dialogue as the dialogue state.
[0011] In some embodiments of the present disclosure, based on the aforementioned scheme, the dialogue state tracking device further includes: a sample acquisition module, configured to acquire a training data set and a verification data set, wherein the training data set includes the dialogue samples of each round; the verification data set includes verification dialogue samples and dialogue state labels corresponding to the verification dialogue samples; and a model training module, configured to iteratively train the dialogue state tracking model to be trained based on the training data set and the slot optimization coefficient, verify the performance of the dialogue state tracking model to be trained after each round of training based on the verification data set, and update the slot optimization coefficient.
[0012] In some embodiments of the present disclosure, based on the aforementioned scheme, the model training module includes: a first input unit, used to input the dialogue samples of each round into the dialogue state tracking model to be trained for feature extraction to obtain a first confidence level of the dialogue samples of each round; a first parameter adjustment unit, used to construct an initial loss function based on the first confidence level and the initial slot optimization coefficient, and adjust the parameters of the dialogue state tracking model to be trained based on the initial loss function to obtain a target dialogue state tracking model to be trained, wherein the initial loss function has the same expression as the adaptive optimization loss function.
[0013] In some embodiments of the present disclosure, based on the aforementioned scheme, the model training module includes: a slot optimization coefficient updating unit, configured to verify the performance of the target dialogue state tracking model to be trained based on the verification data set to obtain an updated slot optimization coefficient; a model retraining unit, configured to retrain the target dialogue state tracking model to be trained based on the training data set and the updated slot optimization coefficient; and a loop unit, configured to use the retrained dialogue state tracking model to be trained as the target dialogue state tracking model to be trained, and repeat the above steps until the loss function of the dialogue state tracking model to be trained converges or a preset number of training times is completed.
[0014] In some embodiments of the present disclosure, based on the aforementioned scheme, the slot optimization coefficient updating unit includes: a second input unit, used to input the verification dialogue sample into the target dialogue state tracking model to be trained to obtain a dialogue state prediction corresponding to the verification dialogue sample; and an updated slot optimization coefficient determination unit, used to determine the updated slot optimization coefficient based on the dialogue state prediction and the dialogue state label.
[0015] In some embodiments of the present disclosure, the verification dialogue sample includes multiple slots, and each slot-value pair in the dialogue state label corresponds to each slot respectively; based on the above scheme, the updated slot optimization coefficient determination unit is configured to: calculate the accuracy of each slot on the verification data set according to the dialogue state prediction and dialogue state label corresponding to each slot; calculate the difference between the accuracy rates corresponding to each slot respectively to obtain the first information corresponding to each slot; divide the first information corresponding to each slot by the sum of the first information corresponding to all slots respectively to obtain the second information corresponding to each slot; multiply each second information by the number of slots respectively to obtain the updated slot optimization coefficient corresponding to each slot.
[0016] In some embodiments of the present disclosure, based on the aforementioned scheme, the model retraining unit includes: a third input unit, used to input the dialogue samples of each round into the target dialogue state tracking model to be trained, and perform feature extraction on the dialogue samples of each round through the target dialogue state tracking model to be trained to obtain a second confidence of the dialogue samples of each round; a second parameter adjustment unit, used to construct an adaptive optimization loss function according to the second confidence and the update slot optimization coefficient, and adjust the parameters of the target dialogue state tracking model to be trained according to the adaptive optimization loss function.
[0017] In some embodiments of the present disclosure, based on the aforementioned scheme, the second parameter adjustment unit is configured to: calculate a difference between the second confidences corresponding to the dialogue samples of each round, and perform an exponential power operation on the difference according to a preset exponent to determine the sample optimization coefficient; calculate the logarithm of the second confidence corresponding to the dialogue samples of each round to obtain an optimization factor; multiply the updated slot optimization coefficient, sample optimization coefficient and optimization factor corresponding to the same slot in the dialogue samples of each round and take the negative value to obtain a loss function factor; add the loss function factors corresponding to each slot in the dialogue samples of each round to obtain the adaptive optimization loss function.
[0018] In some embodiments of the present disclosure, based on the aforementioned scheme, the dialogue state tracking device is further configured to: input the dialogue samples of each round into the dialogue state tracking model to be trained for feature extraction to obtain the confidence corresponding to the dialogue samples of each round; determine the cross-entropy loss function according to the confidence, and pre-tune the dialogue state tracking model to be trained based on the cross-entropy loss function.
[0019] In some embodiments of the present disclosure, based on the aforementioned scheme, the dialogue state tracking apparatus is further configured to: obtain slots in the dialogue samples of each turn, perform feature extraction on the slots in the dialogue samples of each turn and the dialogue samples of each turn using the dialogue state tracking model to be trained, so as to obtain feature vectors corresponding to the slots in the dialogue samples of each turn; encode each value in a value set corresponding to the slots in the dialogue samples of each turn using the dialogue state tracking model to be trained, so as to obtain a value vector; calculate the distance between the feature vector and each value vector, and normalize each distance; obtain a label value corresponding to the slots in the dialogue samples of each turn from the dialogue state labels in the training data set, the label value being included in the value set corresponding to the slots in the dialogue samples of each turn; and use the normalized result corresponding to the label value as the confidence corresponding to the dialogue samples of each turn.
[0020] According to one aspect of an embodiment of the present disclosure, a method for training a dialogue state tracking model is provided, comprising: obtaining a training dataset and a validation dataset, the training dataset including dialogue samples from each round; iteratively training the dialogue state tracking model to be trained based on the dialogue samples from each round, and obtaining confidences corresponding to the dialogue samples from each round as sample optimization coefficients during each round of training; verifying the performance of the dialogue state tracking model to be trained after each round of training based on the validation dataset, and obtaining the accuracy of each slot on the validation dataset as the slot optimization coefficient; determining an adaptive optimization loss function based on the sample optimization coefficients and the slot optimization coefficients, and adjusting parameters of the dialogue state tracking model to be trained during each round of training based on the adaptive optimization loss function.
[0021] According to one aspect of an embodiment of the present disclosure, a dialog state tracking model training device is provided, comprising: an acquisition module for acquiring a training data set and a validation data set, the training data set comprising dialogue samples from each round; a training module for iteratively training a dialog state tracking model to be trained based on the dialogue samples from each round, and obtaining confidences corresponding to the dialogue samples from each round as sample optimization coefficients during each round of training; a verification module for verifying the performance of the dialog state tracking model to be trained after each round of training based on the validation data set, and obtaining the accuracy of each slot on the validation data set as the slot optimization coefficient; and a parameter adjustment module for determining an adaptive optimization loss function based on the sample optimization coefficients and the slot optimization coefficients, and adjusting parameters of the dialog state tracking model to be trained during each round of training based on the adaptive optimization loss function.
[0022] In some embodiments of the present disclosure, based on the aforementioned scheme, the dialogue state tracking model training device is further configured to: before adjusting the parameters of the dialogue state tracking model to be trained in each round of training according to the adaptive optimization loss function, input the dialogue samples of each round into the dialogue state tracking model to be trained for feature extraction to obtain the confidence corresponding to the dialogue samples of each round; determine the cross-entropy loss function according to the confidence, and pre-adjust the parameters of the dialogue state tracking model to be trained based on the cross-entropy loss function.
[0023] According to one aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method for tracking the dialog state or the method for training a dialog state tracking model as described in the above embodiments is implemented.
[0024] According to one aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: one or more processors; and a storage device, wherein the storage device is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors execute the dialog state tracking method or the dialog state tracking model training method as described in the above embodiments.
[0025] In some embodiments of the present disclosure, the technical solutions provided first obtain historical conversations and the current conversation turn. Then, the historical conversations, the current conversation turn, the slots in the current conversation turn, and the value sets corresponding to the slots in the current conversation turn are input into a conversation state tracking model. Finally, the conversation state tracking model performs feature extraction on the historical conversations, the current conversation turn, the slots in the current conversation turn, and the value sets corresponding to the slots in the current conversation turn to obtain the conversation state corresponding to the current conversation turn. The conversation state tracking model is trained based on an adaptive optimization loss function, which includes a slot optimization coefficient and a sample optimization coefficient. The slot optimization coefficient is determined based on the accuracy of each slot on a validation dataset, and the sample optimization coefficient is determined based on the confidence level of each conversation sample in each conversation turn. The technical solutions of the present disclosure can, on the one hand, construct an adaptive optimization loss function based on the slot optimization coefficient and the sample optimization coefficient, and adjust model parameters based on the adaptive optimization loss function, thereby improving the processing efficiency of the conversation state tracking model for slots and conversations of different difficulty levels, further improving the accuracy of the conversation state. On the other hand, based on the improved performance of the conversation state tracking model, it can also improve the user experience and interaction efficiency of the dialogue system.
[0026] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The accompanying drawings are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and those skilled in the art can derive other drawings based on these drawings without inventive effort. In the drawings:
[0028] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solutions of the embodiments of the present disclosure can be applied;
[0029] Figure 2 The following schematically shows a flow chart of a method for tracking a conversation state according to an embodiment of the present disclosure;
[0030] Figure 3 A schematic diagram schematically illustrates a conversation turn according to an embodiment of the present disclosure;
[0031] Figure 4 The following schematically shows a flow chart of training a dialogue state tracking model to be trained according to an embodiment of the present disclosure;
[0032] Figure 5 A schematic diagram of a process for performing initial training on a dialogue state tracking model to be trained according to an embodiment of the present disclosure is shown;
[0033] Figure 6 A schematic diagram of a process for retraining a dialogue state tracking model to be trained according to an embodiment of the present disclosure is shown;
[0034] Figure 7 The following schematically shows a flow chart of obtaining an update slot optimization coefficient according to an embodiment of the present disclosure;
[0035] Figure 8 The following schematically illustrates a flow chart of determining an update slot optimization coefficient according to an embodiment of the present disclosure;
[0036] Figure 9 The following schematically illustrates a flow chart of retraining a target dialogue state tracking model to be trained according to an embodiment of the present disclosure;
[0037] Figure 10 The following schematically illustrates a process flow diagram for constructing an adaptive optimization loss function according to an embodiment of the present disclosure;
[0038] Figure 11 The following schematically shows a structural diagram of a conversation state tracking model according to an embodiment of the present disclosure;
[0039] Figure 12Schematically shows a block diagram of a conversation state tracking device according to an embodiment of the present disclosure;
[0040] Figure 13 Schematically shows a block diagram of a dialog state tracking model training device according to an embodiment of the present disclosure;
[0041] Figure 14 A schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0042] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art.
[0043] In addition, the described features, structures or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, well-known methods, devices, implementations or operations are not shown or described in detail to avoid blurring various aspects of the present disclosure.
[0044] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically separate entities. That is, these functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0045] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, while others may be combined or partially combined. Therefore, the actual execution order may vary depending on the actual situation.
[0046] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solutions of the embodiments of the present disclosure can be applied is shown.
[0047] like Figure 1As shown, the system architecture 100 includes a terminal device 101, a network 102 and a server 103, wherein the terminal device 101 can be any electronic device with a display screen that has a voice input device such as a microphone and / or a text input device, such as a tablet computer, a laptop computer, a desktop computer, a smart phone, a smart TV and other electronic devices; the network 102 is used to provide a medium for a communication link between the terminal device 101 and the server 103, and the network 102 can include various connection types, such as a wired communication link, a wireless communication link, etc.
[0048] It should be understood that Figure 1 The number of terminal devices 101, networks 102, and servers 103 in the embodiment is merely illustrative. Any number of terminal devices 101, networks 102, and servers 103 may be provided according to actual needs.
[0049] In one embodiment of the present disclosure, users can log in to various service platforms installed in the terminal device 101 to conduct human-computer dialogue to complete corresponding tasks, such as ordering meals through a meal ordering platform, booking a room through a hotel reservation platform, etc. Specifically, users can conduct human-computer dialogue through built-in or external voice input devices and / or text input devices, such as keyboards, in the terminal device 101. After receiving the user's voice and / or text input, terminal device 101 can send this information to server 103 via network 102. After receiving the user's input information, server 103 can first determine the historical conversation and the current conversation turn. Based on the current conversation turn and the system-maintained slot set, server 103 can determine the slots in the current conversation turn. Based on the slots in the current conversation turn, server 103 can then obtain the value set corresponding to the slots in the current conversation turn from the system-maintained value set. The historical conversation, the current conversation turn, the slots in the current conversation turn, and the value set corresponding to the slots in the current conversation turn are then input into a conversation state tracking model. Finally, the conversation state tracking model performs feature extraction on the historical conversation, the current conversation turn, the slots in the current conversation turn, and the value set corresponding to the slots in the current conversation turn to obtain the conversation state corresponding to the current conversation turn. A conversation state is a set of slot-value pairs consisting of multiple slots and corresponding values. The dialogue state tracking model is trained using an adaptive optimization loss function. This adaptive optimization loss function includes a slot optimization coefficient and a sample optimization coefficient. The slot optimization coefficient is determined based on the accuracy of each slot on the validation dataset, and the sample optimization coefficient is determined based on the confidence of the dialogue samples in each round. Since the slot optimization coefficient and sample optimization coefficient are determined based on the accuracy and sample confidence of the slot, the loss function can be dynamically adjusted according to the learning difficulty of different slots and samples, thus obtaining an adaptive optimization loss function. The dialogue state tracking model trained using the adaptive optimization loss function can then process various dialogues containing different slots with high quality and efficiency, obtain the dialogue states therein, and formulate corresponding dialogue strategies based on the obtained dialogue states. Furthermore, before training the model using the adaptive optimization loss function, the model can be trained using the cross-entropy loss function, which can further improve the performance of the dialogue state tracking model and enhance the accuracy of the dialogue states.
[0050] On the one hand, the technical solution of the disclosed embodiment can construct an adaptive optimization loss function based on the slot optimization coefficient and the sample optimization coefficient, and adjust the model parameters based on the adaptive optimization loss function, so that the dialogue state tracking model can better optimize slots and dialogues of different difficulties, improve processing efficiency and the accuracy of dialogue state, and further improve the effect of dialogue state tracking; on the other hand, it can improve the user experience and interaction efficiency of the dialogue system based on the performance improvement of the dialogue state tracking model.
[0051] It should be noted that the conversation state tracking method provided in the embodiments of the present disclosure can be executed by a server, and accordingly, the conversation state tracking device can be set in the server. However, in other embodiments of the present disclosure, the conversation state tracking method provided in the embodiments of the present disclosure can also be executed by a terminal device.
[0052] In the related art in this field, when solving the problem of dialogue state tracking, a neural network method for solving the dialogue state tracking problem is usually adopted.
[0053] Neural network approaches to solving the dialogue state tracking problem primarily include: using neural networks to solve the dialogue state tracking problem; using feedforward neural networks or convolutional neural networks to model the interaction between slot-value pairs and the current dialogue; using pointer networks to alleviate the problem of identifying unknown slot values in dialogue state tracking; using global modules and local modules to model common features and slot-specific features, respectively; using a long short-term memory network to encode relevant information for each turn in the dialogue history; using a simple attention mechanism to aggregate relevant information in the dialogue history and transfer knowledge between different domains; using heuristic rules to filter out relevant turns in the dialogue history; or introducing the dialogue state of the previous turn and using a hierarchical encoder-decoder structure to generate the dialogue state. However, neural network approaches use the same cross-entropy function across different slots, making it impossible to adjust the loss function across different slots and samples to help the model improve learning for more difficult slots and samples (those that occur less frequently in the dataset). This results in slot imbalance when using neural network approaches for dialogue state tracking, resulting in poor tracking of complex dialogue states, poor processing efficiency, and low dialogue state accuracy.
[0054] In view of the problems existing in the related art, the embodiments of the present disclosure provide a method for tracking a conversation state, which is implemented through a machine learning model and relates to the field of artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a manner similar to human intelligence. Artificial intelligence is the study of the design principles and implementation methods of various intelligent machines, giving them the functions of perception, reasoning, and decision-making.
[0055] Artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0056] Computer vision (CV) is the science of making machines "see." Specifically, it refers to machine vision, where cameras and computers replace the human eye in identifying, tracking, and measuring objects. This involves further processing the images, transforming them into images more suitable for human observation or transmission to instruments. As a scientific discipline, computer vision studies related theories and technologies, attempting to build artificial intelligence systems capable of extracting information from images or multidimensional data. Computer vision technologies typically include image processing, image recognition, image semantic understanding, image retrieval, optical character recognition (OCR), video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping, and common biometric recognition technologies such as facial recognition and fingerprint recognition.
[0057] Machine learning (ML) is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers can simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is at the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications span all areas of AI. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning.
[0058] With the research and advancement of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, autonomous driving, drones, robots, smart medical care, smart customer service, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0059] The solutions provided by the embodiments of the present disclosure involve artificial intelligence speech processing technology and natural language processing technology, which are specifically described through the following embodiments:
[0060] Figure 2A flowchart of a method for tracking a conversation state according to an embodiment of the present disclosure is schematically shown. The method can be executed by a server. Figure 1 The service 103 shown in FIG can also be executed by a terminal device. Next, the conversation state tracking method executed by a server is described as an example. Figure 2 As shown, the conversation state tracking method includes at least steps S210 to S220, which are described in detail as follows:
[0061] In step S210, historical conversations and current-round conversations are obtained, and the historical conversations, the current-round conversations, the slots in the current-round conversations, and the value sets corresponding to the slots in the current-round conversations are input into a conversation state tracking model.
[0062] In one embodiment of the present disclosure, dialogue state tracking refers to deriving the dialogue state of the current round through an algorithm given the past dialogue history and the current round of dialogue, which is usually represented by a number of slot-value pairs. Therefore, when performing the dialogue state tracking task, it is first necessary to obtain the historical dialogue and the current round of dialogue. The historical dialogue is the dialogue associated with the current round of dialogue. For example, if the current round of dialogue is the 4th round of dialogue, then the historical dialogue is the dialogue of rounds 1-3. In the embodiment of the present disclosure, a complete dialogue can be divided into multiple turns. Figure 3 A diagram showing a conversation turn is shown, Figure 3 As shown in the figure, the first sentence initiated by the user is turn 1, which mainly reflects the user's intention, for example, the user wants to find a cheap restaurant in the city center; the subsequent dialogue can be divided into multiple turns based on the dialogue between the machine and the user. That is, each turn after turn 1 contains a system response and a user statement. For example, the dialogue contained in turn 2 is "R: Do you have any specific type of food you would like? U: No, I'm not picky as long as the price is low", etc.
[0063] In one embodiment of the present disclosure, before the dialogue state tracking model is used to process the historical dialogue and the current dialogue to obtain the dialogue state of the current dialogue, it is also necessary to determine the slots in the current dialogue and the value sets corresponding to the slots in the current dialogue. Figure 3For example, the conversation between turn 1 and turn 2 in the conversation state tracking task is performed, where the slots are price and food. In the embodiments of the present disclosure, a slot set is maintained in the system for a long period of time. This slot set contains all possible slots that may appear in the conversation state tracking task. After obtaining the current conversation turn, the corresponding slot can be determined from the slot set based on the current conversation turn. At the same time, the system also maintains a value set corresponding to each slot, which contains all candidate values corresponding to the slot. For example, if the slot is food, then the candidate values that may be included in its corresponding value set include Chinese food, Japanese food, French food, Italian food, and so on.
[0064] In one embodiment of the present disclosure, after determining the slots and value sets corresponding to the current conversation turn, the historical conversations, the current conversation turn, the slots in the current conversation turn, and the value sets corresponding to the slots in the current conversation turn can be input into a conversation state tracking model for processing to obtain the conversation state in the current conversation turn. It is worth noting that the number of slots in the current conversation turn may be one or more, and accordingly, the number of value sets corresponding to the slots may also be one or more.
[0065] In step S220, feature extraction is performed on the historical conversation, the current round of conversation, the slots in the current round of conversation, and the value sets corresponding to the slots in the current round of conversation through the conversation state tracking model to obtain the conversation state corresponding to the current round of conversation; wherein the conversation state tracking model is trained based on an adaptive optimization loss function, the adaptive optimization loss function includes a slot optimization coefficient and a sample optimization coefficient, and the slot optimization coefficient is determined based on the accuracy of each slot on the verification data set, and the sample optimization coefficient is determined based on the confidence of the conversation samples in each round.
[0066] In one embodiment of the present disclosure, after historical conversations, the current round of conversations, the slots in the current round of conversations, and the value sets corresponding to the slots in the current round of conversations are input into a conversation state tracking model, the conversation state tracking model can first encode the historical conversations and the current round of conversations to obtain conversation vectors, encode the slots in the current round of conversations to obtain slot vectors, and encode each value in the value set corresponding to the slots in the current round of conversations to obtain a value vector; then, the slot vectors and the conversation vectors can be processed based on an attention mechanism to obtain feature vectors related to the slots in the conversation; finally, the distances between the feature vectors and each value vector can be calculated, and each distance can be normalized to obtain the probability of each value, and then the conversation state corresponding to the current round of conversation can be determined based on the value with the highest probability.
[0067] Furthermore, when determining the dialogue state corresponding to the current round of dialogue based on the value with the highest probability, a slot-value pair can be constructed based on the slots in the current round of dialogue and the value with the highest probability, and the set of slot-value pairs corresponding to all slots in the current round of dialogue can be used as the dialogue state corresponding to the current round of dialogue.
[0068] In one embodiment of the present disclosure, before applying a conversation state tracking model to conversation state tracking, the model to be trained can be trained to obtain a stable conversation state tracking model. Given that using the same loss function across different slots when using neural network methods for conversation state tracking can lead to slot imbalance, the present disclosure optimizes and improves the loss function used in the conversation state tracking process. During multiple experiments using different methods, the inventors discovered that the Focal Loss loss function can assign different weights to different samples based on the conventional cross-entropy function, enabling the model to automatically increase the loss for difficult samples, thereby encouraging the model to optimize for these samples and alleviate the class imbalance problem in object detection. This problem is related to slot imbalance, so the inventors attempted to apply the Focal Loss loss function to address the slot imbalance problem in conversation state tracking. However, the parameters in the Focal Loss loss function require manual adjustment, typically requiring multiple experiments to screen and determine appropriate values. Furthermore, the Focal Loss loss function cannot dynamically adjust parameters during training, resulting in low training efficiency and stability. Therefore, it is necessary to design an adaptive optimization loss function that can automatically and dynamically adjust weights for different slots and different samples to optimize the slot imbalance problem and improve the training efficiency and stability of the dialogue state tracking model.
[0069] In one embodiment of the present disclosure, when training a dialogue state tracking model, specifically, a training data set and a validation data set can be first obtained, where the training data set includes dialogue samples from each round; then, the dialogue state tracking model to be trained can be iteratively trained based on the dialogue samples from each round, and the confidence corresponding to the dialogue samples from each round can be obtained during each round of training as a sample optimization coefficient; then, the performance of the dialogue state tracking model to be trained after each round of training can be verified based on the validation data set, and the accuracy of each slot on the validation data set can be obtained as the slot optimization coefficient; finally, an adaptive optimization loss function can be determined based on the sample optimization coefficient and the slot optimization coefficient, and the parameters of the dialogue state tracking model to be trained during each round of training can be adjusted based on the adaptive optimization loss function. In order to make the dialogue state tracking model training method in the embodiment of the present disclosure clearer, the above training process is described in detail below:
[0070] In one embodiment of the present disclosure, Figure 4A flow chart of training the dialogue state tracking model to be trained is shown in FIG. Figure 4 As shown, in step S401, a training data set and a verification data set are obtained, where the training data set includes dialogue samples of each round; the verification data set includes verification dialogue samples and dialogue state labels corresponding to the verification dialogue samples; in step S402, the dialogue state tracking model to be trained is iteratively trained based on the training data set and the slot optimization coefficient, and the performance of the dialogue state tracking model to be trained after each round of training is verified based on the verification data set and the slot optimization coefficient is updated.
[0071] Next, Figure 4 The training process diagram shown is explained in detail.
[0072] In one embodiment of the present disclosure, both the training dataset and the validation dataset are formed by collecting conversations between people and annotating the conversation states within those conversations. These datasets contain conversation samples from various scenarios, such as booking air tickets, booking restaurants, and booking hotels. Specifically, the training dataset contains conversation samples from each round and the corresponding conversation state labels, while the validation dataset contains validation conversation samples and the corresponding conversation state labels. The training dataset is used to iteratively train the conversation state tracking model to be trained in conjunction with slot optimization coefficients. The conversation state tracking model is obtained when the loss function of the conversation state tracking model to be trained converges or a preset number of training cycles are completed. The validation dataset is used to verify the performance of the conversation state tracking model to be trained after each round of training and to update the slot optimization coefficients. The conversation state labels contained in the validation dataset can be used to verify the accuracy of the conversation state predictions output by the model and to calculate the accuracy of the slots on the validation dataset. After obtaining the training dataset, the conversation state tracking model to be trained can be iteratively trained based on the conversation samples from each round, the slots within each round, and the value sets corresponding to the slots within each round.
[0073] In one embodiment of the present disclosure, training the dialogue state tracking model to be trained according to the training data set can be divided into initial training and retraining. Figure 5 The flowchart of the initial training of the dialogue state tracking model to be trained is shown in FIG. Figure 5As shown, in step S501, each conversation sample is input into the to-be-trained conversation state tracking model for feature extraction to obtain a first confidence score for each conversation sample. In step S502, an initial loss function is constructed based on the first confidence score and the initial slot optimization coefficient. The parameters of the to-be-trained conversation state tracking model are adjusted based on the initial loss function to obtain a target to-be-trained conversation state tracking model. The initial loss function and the adaptive optimization loss function have the same expression. The initial slot optimization coefficient in step S502 is a pre-set initial value, such as 1, and is not specifically limited in this disclosure.
[0074] In one embodiment of the present disclosure, after the initial training of the target dialogue state tracking model to be trained is completed, the target dialogue state tracking model to be trained may be retrained once or multiple times. Figure 6 A schematic diagram of the process of retraining the dialogue state tracking model to be trained is shown in FIG. Figure 6 As shown, in step S601, the performance of the target to-be-trained dialogue state tracking model is verified based on the validation dataset to obtain updated slot optimization coefficients. In step S602, the target to-be-trained dialogue state tracking model is retrained based on the training dataset and the updated slot optimization coefficients. In step S603, the retrained to-be-trained dialogue state tracking model is used as the target to-be-trained dialogue state tracking model, and the above steps are repeated until the loss function of the to-be-trained dialogue state tracking model converges or a preset number of training cycles are completed. The data processing flow during the training of the to-be-trained dialogue state tracking model is the same as that of the dialogue state tracking model in the above embodiment and will not be further described here.
[0075] Among them, since the validation dataset can verify the performance of the trained target dialogue state tracking model to be trained, that is, to determine whether the dialogue state prediction output by the model is the same or similar to the labeled dialogue state label, that is, to determine the accuracy of each slot on the validation dataset, if the accuracy is high, it means that the model performance is good, and if the accuracy is low, it means that the model performance is poor. Therefore, the slot optimization coefficient can be determined based on the accuracy of each slot on the validation dataset, and the slot optimization coefficient can be used to guide subsequent model training. In the embodiment of the present disclosure, model training and model performance verification are performed alternately. That is, after completing the first round of model training, the trained model is verified and the corresponding updated slot optimization coefficient is determined; then, the model is trained for a second round using the updated slot optimization coefficient as a parameter. After completing the second round of model training, the trained model is verified again and a new updated slot optimization coefficient is determined. This cycle is repeated until the model performance is optimized or a preset number of model trainings are completed.
[0076] Figure 7The flowchart of obtaining the optimization coefficient of the update slot is shown in FIG. Figure 7 As shown, in step S701, the verification dialogue sample is input into the target dialogue state tracking model to be trained to obtain the dialogue state prediction corresponding to the verification dialogue sample; in step S702, the update slot optimization coefficient is determined based on the dialogue state prediction and the dialogue state label.
[0077] In one embodiment of the present disclosure, when training and verifying the performance of a dialogue state tracking model to be trained, the input dialogue sample is a complete dialogue, which includes multiple rounds of dialogue. Unlike the model application, the model processes historical dialogues and the current round of dialogue. After the dialogue state tracking model to be trained extracts features from the dialogue sample, the slots in the dialogue sample, and the value sets corresponding to the slots, it can output the dialogue state corresponding to the dialogue sample, that is, the dialogue state prediction, which includes multiple slot-value pairs formed by slots and corresponding values. Figure 3 Take the dialogue shown as an example, which contains slots such as food, name, price, time, area, and people. By tracking the dialogue state through the dialogue state tracking model, we can obtain Figure 3 The dialog state of the dialogue shown is {food=Chinese,name=Dojo noodle bar,price=cheap,time=17:30,area=center of the city,people=8people}. Correspondingly, the dialog state labels in the validation dataset also contain slot-value pairs corresponding to each slot in the validation dialogue sample.
[0078] In one embodiment of the present disclosure, Figure 8 A schematic diagram of the process of determining the optimization coefficient of the update slot is shown, as Figure 8 As shown, in step S801, the accuracy of each slot on the verification data set is calculated based on the dialogue state prediction and dialogue state label corresponding to each slot; in step S802, the difference between the accuracy rates corresponding to each slot is calculated to obtain the first information corresponding to each slot; in step S803, the first information corresponding to each slot is divided by the sum of the first information corresponding to all slots to obtain the second information corresponding to each slot; in step S804, each second information is multiplied by the number of slots to obtain the updated slot optimization coefficient corresponding to each slot.
[0079] In one embodiment of the present disclosure, the calculation formula of the slot optimization coefficient is shown in formula (1):
[0080]
[0081] Among them, α s is the slot optimization coefficient, is the accuracy of each slot on the validation dataset, is the accuracy of all slots on the validation dataset, S is the set of all slots, |S| is the number of slots, It is the first information. It is the second information.
[0082] From the analysis of formula (1), we can see that for those slots with low accuracy on the verification dataset, a larger loss function weight can be obtained, thereby encouraging the dialogue state tracking model to optimize these slots. At the same time, formula (1) is also a normalization operation, through which the learning difficulty of all slots can be balanced. Therefore, in order to improve the dialogue state tracking model's excellent processing ability for slots of different difficulty levels, the parameters of the dialogue state tracking model to be trained can be adjusted according to the adaptive optimization loss function constructed based on the slot optimization coefficient.
[0083] In one embodiment of the present disclosure, updating the slot optimization coefficient involves the accuracy of the slot on the validation dataset. When calculating the accuracy, the number of true positive predictions and true negative predictions in the dialogue state prediction can be counted. The sum of the true positive predictions and the true negative predictions is then compared with the total number of predictions to obtain the accuracy of the operation information in the dialogue sample on the validation dataset. A true positive prediction indicates that the slot-value pair exists in the dialogue state label and in the dialogue state prediction generated by the model (i.e., a "true positive"), a true negative prediction indicates that the slot-value pair does not exist in the dialogue state label and in the dialogue state prediction generated by the model (i.e., a "true negative"), and the total number of predictions is the total number of predictions.
[0084] In one embodiment of the present disclosure, although an adaptive optimization loss function can be constructed based on the slot optimization coefficient, so that the dialogue state tracking model adjusted according to the adaptive optimization loss function can handle slots of different difficulties, there is still a major input for determining the dialogue state through the dialogue state tracking model, that is, the dialogue. Different dialogues have different difficulties. Therefore, in order to improve the accuracy of the dialogue state output by the model, it is also necessary to adjust the model parameters according to the adaptive optimization loss function constructed based on the sample optimization coefficient.
[0085] In one embodiment of the present disclosure, Figure 9 A schematic diagram of the process of retraining the target dialogue state tracking model to be trained is shown in FIG. Figure 9As shown, in step S901, each conversation sample from each round is input into the target to-be-trained conversation state tracking model. The target to-be-trained conversation state tracking model then performs feature extraction on each conversation sample to obtain a second confidence level for each conversation sample. In step S902, an adaptive optimization loss function is constructed based on the second confidence level and the updated slot optimization coefficient, and the parameters of the target to-be-trained conversation state tracking model are adjusted based on the adaptive optimization loss function. Because the second confidence level and the updated slot optimization coefficient change with each retraining, repeated retraining can help the to-be-trained conversation state tracking model converge and reach a stable state.
[0086] In one embodiment of the present disclosure, the slot optimization coefficient is determined based on the accuracy of each slot on the validation dataset, and the sample optimization coefficient is determined based on the confidence of each round of dialogue samples. Therefore, in order to ensure that the dialogue state tracking model can extract features from slots and dialogues of different difficulty levels, an adaptive optimization loss function can be constructed based on the slot optimization coefficient and the sample optimization coefficient. Figure 10 A schematic diagram of the process of constructing an adaptive optimization loss function is shown in FIG. Figure 10 As shown, in step S1001, a difference between the second confidences corresponding to the dialogue samples of each round is calculated, and an exponential power operation is performed on the difference according to a preset exponent to determine the sample optimization coefficient; in step S1002, the logarithm of the second confidence corresponding to the dialogue samples of each round is calculated to obtain the optimization factor; in step S1003, the updated slot optimization coefficient, the sample optimization coefficient and the optimization factor corresponding to the same slot in the dialogue samples of each round are multiplied and the negative value is taken to obtain the loss function factor; in step S1004, the loss function factors corresponding to each slot in the dialogue samples of each round are added to obtain the adaptive optimization loss function.
[0087] In one embodiment of the present disclosure, a first confidence level is a sample confidence level obtained during initial training of the dialog state tracking model to be trained, and a second confidence level is a sample confidence level obtained during retraining of the dialog state tracking model to be trained. The two confidence levels are calculated in the same manner. Specifically, slots in each dialog sample turn are first obtained, and features are extracted from the slots and each dialog sample turn using the dialog state tracking model to be trained to obtain feature vectors corresponding to the slots in each dialog sample turn. Simultaneously, the dialog state tracking model to be trained encodes each value in a value set corresponding to the slot in each dialog sample turn to obtain a value vector. Distances between the feature vectors and each value vector are then calculated, and each distance is normalized. Label values corresponding to the slots in each dialog sample turn are then obtained from the dialog state labels in the training dataset. The label values are included in the value set corresponding to the slots in each dialog sample turn. Finally, the normalized results corresponding to the label values are used as the confidence levels corresponding to each dialog sample turn. The normalization process for each distance may specifically be a softmax process, and of course other normalization processes may also be used.
[0088] Furthermore, the initial loss function and the adaptive optimization loss function are constructed in the same way. The only difference is that the initial slot optimization coefficient is a preset value, while the updated slot optimization coefficient is determined based on the slot's accuracy on the validation dataset. Therefore, below, the first confidence level and the second confidence level are collectively referred to as the confidence level of each conversation sample, the initial slot optimization coefficient and the updated slot optimization coefficient are collectively referred to as the slot optimization coefficient, and the adaptive optimization loss function is determined based on the sample confidence level and the slot optimization coefficient.
[0089] In one embodiment of the present disclosure, the expressions of the sample optimization coefficient and the optimization factor are shown in equations (2)-(3):
[0090] β(s,v t )=(1-p(s,v t )) γ (2)
[0091] ω=log(p(s,v t )) (3)
[0092] Among them, p(s,v t ) is the confidence level corresponding to each round of dialogue samples, β(s,v t ) is the sample optimization coefficient, γ is the preset index, which is a manually set hyperparameter, and ω is the optimization factor.
[0093] From the analysis of formula (2), we can see that for two samples {(U t1 ,R t1 ),(s1,vt1 )}、{(U t2 ,R t2 ),(s2,v t2 )}, when the confidence of the t1-round dialogue sample is lower than that of the t2-round dialogue sample, it means that the t1-round dialogue sample is more difficult, and its corresponding sample optimization coefficient is larger, so the model can automatically increase the loss function weight of the dialogue sample, thereby encouraging the model to optimize the dialogue sample.
[0094] In one embodiment of the present disclosure, after obtaining the slot optimization coefficient, sample optimization coefficient, and optimization factor corresponding to the slot, the adaptive optimization target of the model optimization can be determined according to these parameters corresponding to the same slot. Based on the adaptive optimization target, an adaptive optimization loss function can be constructed. Therefore, the adaptive optimization target can be recorded as a loss function factor, as shown in Formula (4):
[0095] L adapt (s,v t )=-αsβ(s,v t )log(p(s,v t )) (4)
[0096] Among them, L adapt (s,v t ) is the adaptive optimization objective, α s is the slot optimization coefficient, β(s,v t ) is the sample optimization coefficient, log(p(s,v t )) is the optimization factor.
[0097] In one embodiment of the present disclosure, since the slot optimization coefficient changes with the accuracy of the slot on the verification data set, and the sample optimization coefficient changes with the sample confidence, the adaptive optimization target can be adjusted according to slots of different difficulty levels and dialogue samples of different difficulty levels, so that the trained dialogue state tracking model can better handle dialogues of different difficulty levels, improve the tracking ability of more complex dialogue states, and improve the processing efficiency and accuracy of the dialogue state, further improving the user experience and interaction efficiency of the entire dialogue system.
[0098] In one embodiment of the present disclosure, the adjustment of model parameters in each round is performed after the trained dialogue state tracking model to be trained is verified based on the validation dataset, and then based on an adaptive loss function constructed based on the adaptive optimization objective. At the same time, since the purpose of each round of parameter adjustment is to make the dialogue state prediction output by the dialogue state tracking model to be trained similar to or identical to the dialogue state label in the training dataset or the validation dataset, when constructing the adaptive optimization loss function, it is necessary to construct it based on the label value corresponding to the slot in each round of dialogue samples. The label value is also the manually labeled value corresponding to the slot. In the embodiment of the present disclosure, when training the dialogue state tracking model to be trained, a complete dialogue sample is input into the dialogue state tracking model to be trained, and training is performed based on all dialogue states output by the dialogue state tracking model to be trained. Therefore, the adaptive optimization loss function finally constructed should include the slot optimization coefficients corresponding to all slots in the dialogue sample and the sample optimization coefficients and optimization factors corresponding to each round of dialogue samples. In other words, the adaptive optimization loss function can be obtained by adding the loss function factors corresponding to each slot. The specific expression is shown in formula (5):
[0099]
[0100] Among them, L finetune For adaptive optimization of the loss function, S is all slots, T is all dialogue rounds, is the label value of slot s in the t-turn dialogue sample.
[0101] In one embodiment of the present disclosure, an adaptive optimization loss function includes a slot optimization coefficient and a sample optimization coefficient. The slot optimization coefficient is constructed based on the accuracy of the slot on a validation dataset, and the sample optimization coefficient is constructed based on the confidence of the conversation samples in each round. Therefore, the adaptive optimization loss function can be used to fine-tune the conversation state tracking model. However, due to inaccurate estimation of the slot accuracy on the validation dataset in the early stages of training, using only the adaptive optimization loss function to train the conversation state tracking model to be trained can result in model instability and large errors in the output results. Therefore, before using the adaptive optimization loss function to fine-tune the conversation state tracking model to be trained, a conventional cross-entropy loss function can be used to pre-adjust the parameters of the conversation state tracking model to be trained. After the conversation state tracking model to be trained stabilizes, the adaptive optimization loss function can be used to fine-tune the conversation state tracking model to be trained. This can further improve the performance of the conversation state tracking model and increase the accuracy of the conversation state.
[0102] In one embodiment of the present disclosure, a cross-entropy loss function is used to train a conversation state tracking model to be trained. First, each round of conversation samples can be input into the conversation state tracking model to be trained for feature extraction to obtain the confidence level corresponding to each round of conversation samples. Then, a cross-entropy loss function is determined based on the confidence level. Finally, the parameters of the conversation state tracking model to be trained are pre-adjusted based on the cross-entropy loss function. The expression of the cross-entropy loss function is shown in Equation (6):
[0103]
[0104] Among them, L cross is the cross entropy loss function, S is all slots, T is all dialogue turns, is the label value of slot s in the t-turn dialogue sample.
[0105] In one embodiment of the present disclosure, the same conversation sample can be used to train the conversation state tracking model for multiple rounds. In each round of model training, the model will re-evaluate the accuracy of each slot on the validation dataset and update the slot optimization coefficient α. s , through multiple rounds of training, until the loss function of the dialogue state tracking model to be trained approaches the minimum value, the model training can be considered completed. Of course, the number of training times can also be set in advance. When the number of model training times reaches the preset number of training times, the model training can be considered completed.
[0106] The dialogue state tracking method in the disclosed embodiments uses an adaptive optimization loss function for fine-tuning during model training, effectively processing slots and dialogues of varying difficulty levels, thereby obtaining accurate dialogue states. Compared to Focal Loss, the adaptive optimization loss function used to train the model automatically calculates the slot optimization coefficient, eliminating the need to manually run multiple sets of experiments to screen for the appropriate coefficient, saving time and manpower. Furthermore, when Focal Loss is used on multi-classification tasks, all categories have the same parameters and cannot balance the different categories. However, the adaptive optimization objective can dynamically set the weights of different slots in the loss function, allowing for better data fit and fully realizing the potential of labeled data. By encouraging the dialogue state tracking model to optimize for more difficult slots and samples, it learns to track complex dialogue states, thereby improving the effectiveness of the dialogue state tracking model in addressing the dialogue state tracking problem.
[0107] In one embodiment of the present disclosure, a dialog state tracking model trained with an adaptive optimization loss function can alleviate the slot imbalance problem in dialog state tracking. At the same time, the slot imbalance problem can be alleviated by fine-tuning without affecting the model training process. Other dialog state tracking models can be easily integrated. In other words, any dialog state tracking model can be used to execute the dialog state tracking method in the embodiment of the present disclosure, such as Figure 2 The dialog state tracking method shown. Figure 11 A structural diagram of a dialogue state tracking model is shown in FIG. Figure 11 As shown, the dialogue state tracking model 1100 includes a dialogue processing unit 1101, a slot processing unit 1102, a value set processing unit 1103, a multi-head attention network layer 1104, a recurrent neural network layer 1105, a layer normalization layer 1106, a distance calculation layer 1107 and an output layer 1108. The dialogue processing unit 1101, the slot processing unit 1102 and the value set processing unit 1103 have the same structure and all adopt the BERT structure. BERT is a powerful pre-trained language model, which includes multiple EMB (embedding) layers and multiple conversion layers Trm, which are used to respectively groove Sum Encode and get the dialogue vector U of t rounds of dialogue t , slot vector q s The value vector of the candidate value corresponding to the slot at time t Getting U t ,q s and After,U t and q s At the same time, it is input into the multi-head attention network layer 1104 for processing to obtain the vector of the slot in the t-round dialogue then It is input to the recurrent neural network layer 1105, and the hidden state at time t-1 is processed by the recurrent neural network layer 1105. and Process to obtain the hidden state at time t Then pass the layer normalization layer 1106 to By processing, we can obtain the feature vector corresponding to the slot in the t-round dialogue Finally, the distance calculation layer 1107 is used to calculate With each The distance between them is normalized to obtain the probability of each value, and the value with the largest probability and the corresponding slot are combined into a slot-value pair, which is output through the output layer 1108.
[0108] Figure 11The dialogue state tracking model 1100 shown uses a recurrent neural network layer 1105, which has the function of encoding history, so it can input the current dialogue turn one by one. In essence, it also obtains the feature vector related to the slot in the dialogue based on the historical dialogue, the current dialogue turn, the slot and the value set. It is worth noting that Figure 11 [CLS] and [SEP] in it are the start and end marks respectively.
[0109] The dialog state tracking method in the disclosed embodiments utilizes a dialog state tracking model trained using an adaptive optimization loss function to extract features from historical conversations, the current conversation turn, slots in the current conversation turn, and the value sets corresponding to the slots in the current conversation turn, thereby obtaining the dialog state corresponding to the current conversation turn. The adaptive optimization loss function includes a slot optimization coefficient determined based on the accuracy of each slot on a validation dataset and a sample optimization coefficient determined based on the confidence level of each conversation turn sample. Therefore, the disclosed technical solution can improve the performance of the dialog state tracking model, alleviate slot imbalance in dialog state tracking tasks, increase the dialog state tracking model's processing efficiency for slots and conversations of varying difficulty, and further enhance the accuracy of dialog states. Furthermore, it can enhance the user experience and interaction efficiency of the dialog system based on the improved performance of the dialog state tracking model.
[0110] The following describes an apparatus embodiment of the present disclosure, which can be used to implement the conversation state tracking method in the above-mentioned embodiment of the present disclosure. For details not disclosed in the apparatus embodiment of the present disclosure, please refer to the above-mentioned embodiment of the conversation state tracking method of the present disclosure.
[0111] Figure 12 A block diagram of a conversation state tracking device according to an embodiment of the present disclosure is schematically shown. The device can be used to execute corresponding steps in the method provided in the embodiment of the present application.
[0112] Reference Figure 12 As shown, a dialog state tracking device 1200 according to an embodiment of the present disclosure includes: an information acquisition module 1201 and a dialog state generation module 1202 .
[0113] Among them, the information acquisition module 1201 is used to obtain historical conversations and current-round conversations, and input the historical conversations, the current-round conversations, the slots in the current-round conversations, and the value sets corresponding to the slots in the current-round conversations into the conversation state tracking model; the conversation state generation module 1202 is used to perform feature extraction on the historical conversations, the current-round conversations, the slots in the current-round conversations, and the value sets corresponding to the slots in the current-round conversations through the conversation state tracking model to obtain the conversation state corresponding to the current-round conversation; wherein the conversation state tracking model is obtained by training based on an adaptive optimization loss function, the adaptive optimization loss function includes a slot optimization coefficient and a sample optimization coefficient, and the slot optimization coefficient is determined based on the accuracy of each slot on the verification data set, and the sample optimization coefficient is determined based on the confidence of the conversation samples in each round.
[0114] In one embodiment of the present disclosure, the dialogue state generation module 1202 includes: a feature extraction unit, configured to encode the slots in the current round of dialogue to obtain a slot vector, encode each value in the value set corresponding to the slot in the current round of dialogue to obtain a value vector, and simultaneously encode the historical dialogue and the current round of dialogue to obtain a dialogue vector; a first processing unit, configured to process the slot vector and the dialogue vector based on an attention mechanism to obtain a feature vector related to the slot in the dialogue; and a normalization unit, configured to calculate the distance between the feature vector and each value vector, and normalize the distance to obtain the probability of each value, and determine the dialogue state corresponding to the current round of dialogue according to the value with the highest probability.
[0115] In one embodiment of the present disclosure, the normalization unit is configured to: construct a slot-value pair based on the slot in the current round of dialogue and the value with the highest probability, and take the set of slot-value pairs corresponding to all slots in the current round of dialogue as the dialogue state.
[0116] In one embodiment of the present disclosure, the dialogue state tracking apparatus 1200 further includes: a sample acquisition module for acquiring a training data set and a verification data set, wherein the training data set includes the dialogue samples of each round; the verification data set includes verification dialogue samples and dialogue state labels corresponding to the verification dialogue samples; and a model training module for iteratively training the dialogue state tracking model to be trained based on the training data set and the slot optimization coefficient, verifying the performance of the dialogue state tracking model to be trained after each round of training based on the verification data set and updating the slot optimization coefficient.
[0117] In one embodiment of the present disclosure, the model training module includes: a first input unit, used to input the dialogue samples of each round into the dialogue state tracking model to be trained for feature extraction to obtain a first confidence level of the dialogue samples of each round; a first parameter adjustment unit, used to construct an initial loss function based on the first confidence level and an initial slot optimization coefficient, and adjust the parameters of the dialogue state tracking model to be trained based on the initial loss function to obtain a target dialogue state tracking model to be trained, wherein the initial loss function has the same expression as the adaptive optimization loss function.
[0118] In one embodiment of the present disclosure, the model training module includes: a slot optimization coefficient updating unit, configured to verify the performance of the target to-be-trained dialogue state tracking model based on the verification data set to obtain an updated slot optimization coefficient; a model retraining unit, configured to retrain the target to-be-trained dialogue state tracking model based on the training data set and the updated slot optimization coefficient; and a loop unit, configured to use the retrained to-be-trained dialogue state tracking model as the target to-be-trained dialogue state tracking model, and repeat the above steps until the loss function of the to-be-trained dialogue state tracking model converges or a preset number of trainings are completed.
[0119] In one embodiment of the present disclosure, the slot optimization coefficient updating unit includes: a second input unit, used to input the verification dialogue sample into the target dialogue state tracking model to be trained to obtain a dialogue state prediction corresponding to the verification dialogue sample; and an updated slot optimization coefficient determining unit, used to determine the updated slot optimization coefficient based on the dialogue state prediction and the dialogue state label.
[0120] In one embodiment of the present disclosure, the verification dialogue sample includes multiple slots, and each slot-value pair in the dialogue state label corresponds to each slot respectively; the updated slot optimization coefficient determination unit is configured to: calculate the accuracy of each slot on the verification data set based on the dialogue state prediction and dialogue state label corresponding to each slot; calculate the difference between the accuracy rates corresponding to each slot respectively to obtain the first information corresponding to each slot; divide the first information corresponding to each slot by the sum of the first information corresponding to all slots respectively to obtain the second information corresponding to each slot; multiply each second information by the number of slots respectively to obtain the updated slot optimization coefficient corresponding to each slot.
[0121] In one embodiment of the present disclosure, the model retraining unit includes: a third input unit, configured to input the dialogue samples of each round into the target dialogue state tracking model to be trained, and perform feature extraction on the dialogue samples of each round through the target dialogue state tracking model to be trained to obtain a second confidence level for the dialogue samples of each round; and a second parameter adjustment unit, configured to construct an adaptive optimization loss function based on the second confidence level and the update slot optimization coefficient, and adjust the parameters of the target dialogue state tracking model to be trained based on the adaptive optimization loss function.
[0122] In one embodiment of the present disclosure, the second parameter adjustment unit is configured to: calculate a difference between the second confidences corresponding to the dialogue samples of each round, and perform an exponential power operation on the difference according to a preset exponent to determine the sample optimization coefficient; calculate the logarithm of the second confidence corresponding to the dialogue samples of each round to obtain an optimization factor; multiply the updated slot optimization coefficient, sample optimization coefficient and optimization factor corresponding to the same slot in the dialogue samples of each round and take the negative value to obtain a loss function factor; add the loss function factors corresponding to each slot in the dialogue samples of each round to obtain the adaptive optimization loss function.
[0123] In one embodiment of the present disclosure, the dialogue state tracking device 1200 is further configured to: input the dialogue samples of each round into the dialogue state tracking model to be trained for feature extraction to obtain confidence levels corresponding to the dialogue samples of each round; determine a cross-entropy loss function based on the confidence levels, and pre-adjust parameters of the dialogue state tracking model to be trained based on the cross-entropy loss function.
[0124] In one embodiment of the present disclosure, the dialogue state tracking apparatus 1200 is further configured to: obtain slots in the dialogue samples of each turn, perform feature extraction on the slots in the dialogue samples of each turn and the dialogue samples of each turn using the dialogue state tracking model to be trained to obtain feature vectors corresponding to the slots in the dialogue samples of each turn; encode each value in a value set corresponding to the slots in the dialogue samples of each turn using the dialogue state tracking model to be trained to obtain a value vector; calculate the distance between the feature vector and each value vector, and normalize each distance; obtain a label value corresponding to the slots in the dialogue samples of each turn from the dialogue state labels in the training dataset, the label value being included in the value set corresponding to the slots in the dialogue samples of each turn; and use the normalized result corresponding to the label value as the confidence level corresponding to the dialogue samples of each turn.
[0125] Figure 13A block diagram of a dialog state tracking model training apparatus according to an embodiment of the present disclosure is schematically shown. The apparatus can be used to execute the corresponding steps in the dialog state tracking model training method provided in the embodiment of the present application.
[0126] Reference Figure 13 As shown, according to an embodiment of the present disclosure, a dialogue state tracking model training device 1300 includes: an acquisition module 1301, a training module 1302, a verification module 1303 and a parameter adjustment module 1304.
[0127] Among them, the acquisition module 1301 is used to obtain a training data set and a verification data set, where the training data set includes dialogue samples from each round; the training module 1302 is used to iteratively train the dialogue state tracking model to be trained based on the dialogue samples from each round, and obtain the confidence corresponding to the dialogue samples from each round as the sample optimization coefficient during each round of training; the verification module 1303 is used to verify the performance of the dialogue state tracking model to be trained after each round of training based on the verification data set, and obtain the accuracy of each slot on the verification data set as the slot optimization coefficient; the parameter adjustment module 1304 is used to determine the adaptive optimization loss function based on the sample optimization coefficient and the slot optimization coefficient, and adjust the parameters of the dialogue state tracking model to be trained in each round of training based on the adaptive optimization loss function.
[0128] In one embodiment of the present disclosure, the dialogue state tracking model training device 1300 is further configured to: before adjusting the parameters of the dialogue state tracking model to be trained in each round of training according to the adaptive optimization loss function, input the dialogue samples of each round into the dialogue state tracking model to be trained for feature extraction to obtain the confidence corresponding to the dialogue samples of each round; determine the cross-entropy loss function according to the confidence, and pre-adjust the parameters of the dialogue state tracking model to be trained based on the cross-entropy loss function.
[0129] Figure 14 A schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present disclosure is shown.
[0130] It should be noted that Figure 14 The computer system 1400 of the electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0131] like Figure 14As shown, the computer system 1400 includes a central processing unit (CPU) 1401, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1402 or the program loaded from the storage part 1408 to the random access memory (RAM) 1403 to implement the image annotation method described in the above embodiment. Various programs and data required for system operation are also stored in the RAM 1403. The CPU 1401, ROM 1402 and RAM 1403 are connected to each other via a bus 1404. An input / output (I / O) interface 1405 is also connected to the bus 1404.
[0132] The following components are connected to the I / O interface 1405: an input section 1406 including a keyboard, a mouse, and the like; an output section 1407 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 1408 including a hard disk; and a communication section 1409 including a network interface card such as a LAN (Local Area Network) card or a modem. The communication section 1409 performs communication processing via a network such as the Internet. A drive 1410 is also connected to the I / O interface 1405 as needed. Removable media 1411, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 1410 as needed, so that computer programs read from the removable media can be installed in the storage section 1408 as needed.
[0133] In particular, according to an embodiment of the present disclosure, the process described below with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 1409, and / or installed from a removable medium 1411. When the computer program is executed by the central processing unit (CPU) 1401, various functions defined in the system of the present disclosure are performed.
[0134] It should be noted that the computer-readable medium shown in the embodiments of the present disclosure 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 component, 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), a 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 disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, or any suitable combination thereof.
[0135] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order 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 flowchart, and the combination of boxes in the block diagram or flowchart, 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.
[0136] The units involved in the embodiments described in this disclosure may be implemented in software or hardware, and the units described may also be provided in a processor. In some cases, the names of these units do not constitute limitations on the units themselves.
[0137] As another aspect, the present disclosure further provides a computer-readable medium, which may be included in the object state tracking device described in the above embodiments, or may exist independently and not incorporated into the electronic device. The computer-readable medium carries one or more programs, which, when executed by an electronic device, enable the electronic device to implement the methods described in the above embodiments.
[0138] It should be noted that although several modules or units of the device for action execution are mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.
[0139] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
[0140] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein.
[0141] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for tracking a conversation state, characterized in that: include: Obtaining historical conversations and a current conversation round, and inputting the historical conversations, the current conversation round, the slots in the current conversation round, and the value sets corresponding to the slots in the current conversation round into a conversation state tracking model; performing feature extraction on the historical conversation, the current conversation round, the slots in the current conversation round, and the value sets corresponding to the slots in the current conversation round using the conversation state tracking model to obtain a conversation state corresponding to the current conversation round; In which, the dialogue state tracking model is trained based on an adaptive optimization loss function, wherein the adaptive optimization loss function includes slot optimization coefficients corresponding to multiple slots and sample optimization coefficients corresponding to multiple rounds of dialogue samples, and each slot optimization coefficient is determined based on the accuracy of each slot on the verification data set, and each sample optimization coefficient is determined based on the confidence of each round of dialogue samples. Each slot optimization coefficient is inversely correlated with the accuracy of the corresponding slot on the verification data set, and each sample optimization coefficient is inversely correlated with the confidence of the corresponding round of dialogue samples.
2. The method for tracking the conversation state according to claim 1, wherein: The extracting features of the historical dialogue, the current dialogue, the slots in the current dialogue, and the value sets corresponding to the slots in the current dialogue using the dialogue state tracking model to obtain the dialogue state includes: Encoding the slots in the current round of conversation to obtain a slot vector, encoding each value in a value set corresponding to the slots in the current round of conversation to obtain a value vector, and encoding the historical conversation and the current round of conversation to obtain a conversation vector; Processing the slot vector and the conversation vector based on an attention mechanism to obtain a feature vector related to the slot in the conversation; Calculating the distance between the feature vector and each of the value vectors, and normalizing the distance to obtain the probability of each of the values; A slot-value pair is constructed according to the slots in the current round of dialogue and the value with the highest probability, and a set of slot-value pairs corresponding to all slots in the current round of dialogue is used as the dialogue state.
3. The method for tracking a conversation state according to claim 1, further comprising: Obtaining a training data set and a validation data set, wherein the training data set includes dialogue samples of each round; The verification data set includes verification dialogue samples and dialogue state labels corresponding to the verification dialogue samples; The dialog state tracking model to be trained is iteratively trained according to the training data set and the slot optimization coefficient, and the performance of the dialog state tracking model to be trained after each round of training is verified according to the verification data set and the slot optimization coefficient is updated.
4. The method for tracking the conversation state according to claim 3, wherein: The iterative training of the dialogue state tracking model to be trained according to the training data set and the slot optimization coefficient includes: Inputting the dialogue samples of each round into the dialogue state tracking model to be trained for feature extraction to obtain a first confidence level of the dialogue samples of each round; An initial loss function is constructed based on the first confidence level and the initial slot optimization coefficient, and parameters of the dialogue state tracking model to be trained are adjusted based on the initial loss function to obtain a target dialogue state tracking model to be trained, wherein the initial loss function has the same expression as the adaptive optimization loss function.
5. The method for tracking the conversation state according to claim 4, wherein: The iteratively training the to-be-trained dialog state tracking model according to the training data set and the slot optimization coefficient, verifying the performance of the trained to-be-trained dialog state tracking model according to the verification data set and updating the slot optimization coefficient, includes: Verifying the performance of the target to-be-trained dialogue state tracking model based on the verification data set to obtain an updated slot optimization coefficient; Retraining the target to-be-trained dialogue state tracking model based on the training data set and the update slot optimization coefficient; The retrained dialog state tracking model to be trained is used as the target dialog state tracking model to be trained, and the above steps are repeated until the loss function of the dialog state tracking model to be trained converges or a preset number of training times are completed.
6. The method for tracking the conversation state according to claim 5, wherein: The verifying the performance of the target to-be-trained dialogue state tracking model based on the verification data set to obtain an updated slot optimization coefficient includes: Inputting the verification dialogue sample into the target to-be-trained dialogue state tracking model to obtain a dialogue state prediction corresponding to the verification dialogue sample; The update slot optimization coefficient is determined according to the dialog state prediction and the dialog state label.
7. The method for tracking the conversation state according to claim 6, wherein: The verification dialogue sample includes a plurality of slots, and each slot-value pair in the dialogue state tag corresponds to each of the slots; The determining the update slot optimization coefficient according to the dialog state prediction and the dialog state label includes: Calculating the accuracy of each slot on the validation dataset based on the dialog state prediction and dialog state label corresponding to each slot; respectively calculating a difference between the accuracy rates corresponding to the respective slots to obtain first information corresponding to the respective slots; Dividing the first information corresponding to each slot by the sum of the first information corresponding to all slots to obtain second information corresponding to each slot; Each piece of the second information is multiplied by the number of the slots to obtain an updated slot optimization coefficient corresponding to each slot.
8. The method for tracking the conversation state according to claim 5, wherein: The retraining of the target to-be-trained dialogue state tracking model according to the training data set and the updated slot optimization coefficient includes: Inputting the dialogue samples of each round into the target dialogue state tracking model to be trained, and performing feature extraction on the dialogue samples of each round using the target dialogue state tracking model to be trained to obtain a second confidence level of the dialogue samples of each round; An adaptive optimization loss function is constructed according to the second confidence and the update slot optimization coefficient, and parameters of the target to-be-trained dialogue state tracking model are adjusted according to the adaptive optimization loss function.
9. The method for tracking the conversation state according to claim 8, wherein: Constructing an adaptive optimization loss function according to the second confidence of each round of dialogue samples and the updated slot optimization coefficient, including: Calculating a difference between the second confidence levels corresponding to the dialogue samples of each round, and performing an exponential power operation on the difference according to a preset exponent to determine the sample optimization coefficient; Calculating the logarithm of the second confidence level corresponding to each round of dialogue samples to obtain an optimization factor; Multiplying the update slot optimization coefficient, sample optimization coefficient, and optimization factor corresponding to the same slot in each round of dialogue samples and taking the negative value to obtain a loss function factor; The loss function factors corresponding to each slot in each round of dialogue samples are added to obtain the adaptive optimization loss function.
10. The method for tracking the conversation state according to claim 4 or 8, wherein: The method further comprises: Obtaining slots in the dialogue samples of each round, and performing feature extraction on the slots in the dialogue samples of each round and the dialogue samples of each round using the dialogue state tracking model to be trained to obtain feature vectors in the dialogue samples corresponding to the slots in the dialogue samples of each round; encoding each value in the value set corresponding to the slot in each round of dialogue samples by the to-be-trained dialogue state tracking model to obtain a value vector; Calculating the distance between the feature vector and each of the value vectors, and normalizing each of the distances; Obtaining, from the dialogue state labels in the training dataset, label values corresponding to the slots in the dialogue samples of each round, the label values being included in the value set corresponding to the slots in the dialogue samples of each round; The normalized result corresponding to the label value is used as the confidence corresponding to the dialogue samples of each round.
11. A method for training a dialogue state tracking model, characterized in that: include: Obtaining a training dataset and a validation dataset, wherein the training dataset includes dialogue samples of each round; Iteratively training the to-be-trained dialogue state tracking model based on the dialogue samples of each round, and obtaining the confidence corresponding to the dialogue samples of each round during each training round as a sample optimization coefficient corresponding to the dialogue samples of each round, wherein each sample optimization coefficient is inversely correlated with the confidence of the corresponding dialogue sample of the round; Verifying the performance of the to-be-trained dialog state tracking model after each round of training based on the validation dataset, and obtaining the accuracy of each slot on the validation dataset as the slot optimization coefficient corresponding to each slot; each slot optimization coefficient is inversely correlated with the accuracy of the corresponding slot on the validation dataset; An adaptive optimization loss function is determined based on multiple sample optimization coefficients and multiple slot optimization coefficients, and parameters of the to-be-trained dialogue state tracking model in each round of training are adjusted based on the adaptive optimization loss function.
12. The method for training a dialogue state tracking model according to claim 11, wherein: Before adjusting parameters of the to-be-trained dialogue state tracking model in each round of training according to the adaptive optimization loss function, the method further includes: Inputting the dialogue samples of each round into the dialogue state tracking model to be trained for feature extraction to obtain confidence scores corresponding to the dialogue samples of each round; A cross entropy loss function is determined according to the confidence level, and parameters of the to-be-trained dialogue state tracking model are pre-tuned based on the cross entropy loss function.
13. A conversation state tracking device, characterized in that: include: An information acquisition module is configured to acquire historical conversations and a current conversation round, and input the historical conversations, the current conversation round, the slots in the current conversation round, and the value sets corresponding to the slots in the current conversation round into a conversation state tracking model; a dialogue state generation module configured to extract features from the historical dialogue, the current dialogue round, the slots in the current dialogue round, and the value sets corresponding to the slots in the current dialogue round using the dialogue state tracking model to obtain a dialogue state corresponding to the current dialogue round; In which, the dialogue state tracking model is trained based on an adaptive optimization loss function, wherein the adaptive optimization loss function includes slot optimization coefficients corresponding to multiple slots and sample optimization coefficients corresponding to multiple rounds of dialogue samples, and each slot optimization coefficient is determined based on the accuracy of each slot on the verification data set, and each sample optimization coefficient is determined based on the confidence of each round of dialogue samples. Each slot optimization coefficient is inversely correlated with the accuracy of the corresponding slot on the verification data set, and each sample optimization coefficient is inversely correlated with the confidence of the corresponding round of dialogue samples.
14. A dialogue state tracking model training device, characterized in that: include: An acquisition module is used to acquire a training data set and a validation data set, wherein the training data set includes dialogue samples of each round; a training module configured to iteratively train the to-be-trained dialogue state tracking model based on the dialogue samples of each round, and obtain, during each round of training, a confidence score corresponding to the dialogue sample of each round as a sample optimization coefficient corresponding to the dialogue sample of each round, wherein each sample optimization coefficient is inversely correlated with the confidence score of the corresponding dialogue sample of the round; a verification module, configured to verify the performance of the to-be-trained dialog state tracking model after each round of training based on the verification dataset, and obtain the accuracy of each slot on the verification dataset as a slot optimization coefficient corresponding to each slot; each slot optimization coefficient is inversely correlated with the accuracy of the corresponding slot on the verification dataset; A parameter adjustment module is used to determine an adaptive optimization loss function based on multiple sample optimization coefficients and multiple slot optimization coefficients, and adjust the parameters of the dialogue state tracking model to be trained in each round of training according to the adaptive optimization loss function.
15. An electronic device, characterized in that: include: one or more processors; A storage device, wherein the storage device is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors execute the dialog state tracking method according to any one of claims 1 to 10 or the dialog state tracking model training method according to any one of claims 11-12.
16. A computer-readable medium, characterized in that The computer-readable medium carries one or more programs, and when the one or more programs are executed by an electronic device, the electronic device implements the dialogue state tracking method according to any one of claims 1 to 10 or the dialogue state tracking model training method according to any one of claims 11-12.
17. A computer program product, characterized in that The computer program product comprises a computer program, which is suitable for being loaded by a processor and executing the dialog state tracking method according to any one of claims 1 to 10 or the dialog state tracking model training method according to any one of claims 11-12.
Citation Information
Patent Citations
Man-machine conversation method and device
CN110555095A
Semantic comprehension method in task type dialogue system
CN111104498A