Multi-round dialogue method and system
By combining intent recognition models and large language models, and dynamically managing dialogue states, the problem of inaccurate user intent recognition in multi-turn dialogue systems is solved, improving the flexibility and responsiveness of the dialogue system and providing an intelligent and personalized user interaction experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-17
- Publication Date
- 2026-04-03
AI Technical Summary
Existing multi-turn dialogue systems are unable to accurately identify the user's current intent when dealing with complex task-oriented dialogue scenarios, resulting in low dialogue efficiency and an inability to flexibly handle changes in user intent.
By combining a pre-defined intent recognition model and a large language model, the intent and slot information of the user's input statement are initially identified. When the confidence level is lower than the threshold, the large language model is invoked for deep recognition, and the dialogue task stack is updated to determine the target intent and slot information, thereby dynamically managing the dialogue state.
It significantly improves the flexibility and responsiveness of multi-turn dialogue systems, enabling them to better handle changes in user intent and supplement slot information, and provide an intelligent and personalized interactive experience.
Smart Images

Figure CN121786151A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a multi-turn dialogue method and system. Background Technology
[0002] With the continuous development of artificial intelligence technology, dialogue systems have been widely applied in various scenarios, providing users with a convenient interactive experience. In the application of intelligent assistants, dialogue systems are no longer limited to casual conversation with users, but are gradually expanding to meet various professional and segmented business needs. Specifically, for different business areas, intelligent assistants need to be endowed with different functions and capabilities to effectively solve users' practical problems. For example, in the application scenario of home automation, intelligent assistants typically need to establish connections with various home devices to help users achieve functions such as lighting control, air conditioning adjustment, and security monitoring, thereby improving the user's living experience. In e-commerce platforms, intelligent assistants need to have capabilities such as product recommendation, price inquiry, and order management to provide users with personalized shopping support. The realization of these functions not only relies on dialogue generation capabilities but also requires the combination of accurate intent parsing and slot extraction technologies to invoke relevant predefined tools or services to complete complex tasks.
[0003] In some complex task-oriented dialogue scenarios, user needs often require multiple rounds of interaction to be fully clarified. For example, a user may only state a preliminary need in the initial interaction, and the intelligent assistant needs to gradually collect key data through further questioning and information confirmation to ultimately arrive at a clear solution. This multi-turn interaction mode significantly improves the flexibility and responsiveness of the dialogue system.
[0004] In multi-turn dialogues, the system needs to understand and remember the contextual information during the conversation. Users may use incomplete expressions or ambiguous referents, so the system needs to have the ability to resolve referents. In task-oriented multi-turn dialogues, users may not provide all slots at once, so it is necessary to continuously track the dialogue state and update the state in each turn. Furthermore, the user's intent may change at any time during the dialogue, and accurately identifying the user's current intent is also a major challenge in multi-turn dialogues. Summary of the Invention
[0005] This application provides a multi-turn dialogue method and system to address the shortcomings of existing multi-turn dialogue tasks in accurately identifying the user's current intent.
[0006] This application provides a multi-turn dialogue method, including: Get the user's current input statement in the current dialogue round; The current input statement is initially identified by a preset intent recognition model to obtain preliminary intent results, slot information and corresponding confidence levels; Determine whether the confidence level is lower than a preset confidence threshold; if so, call the large language model to perform dialogue state recognition to determine the target intent and slot information of the current round; if not, use the preliminary intent result as the target intent of the current round. Update the dialogue task stack based on the determined target intent and slot information of the current round; Based on the updated dialogue task stack, determine the next action and response.
[0007] According to the multi-turn dialogue method provided in this application, a large language model is invoked to identify the dialogue state in order to determine the target intent and slot information of the current turn, specifically including: Integrate contextual information to construct prompt words; The prompt words are input into the large language model, and the structured dialogue state results output by the large language model are obtained. The dialogue state results include target intent and slot information.
[0008] According to the multi-turn dialogue method provided in this application, the context information includes at least: the currently input statement; The prompt words are input into the large language model, and the structured dialogue state results output by the large language model are obtained, specifically including: The prompt word is input into the large language model, and the large language model determines whether the current input statement has a semantic relationship with any unfinished task in the dialogue task stack; When semantic association exists, the decision inherits the unfinished task and parses the current input statement as a slot supplement or correction for the unfinished task.
[0009] According to the multi-turn dialogue method provided in this application, the context information further includes: historical dialogue records, a predefined task library, the current system time, and the current task status data of the dialogue task stack; The current system time is used to assist the large language model in performing time-related semantic understanding and slot filling. The task library is used to store system-executable tasks in a structured format. Each task definition includes a task identifier, a task description, and the slots required to execute the task and their definitions.
[0010] According to the multi-turn dialogue method provided in this application, the dialogue task stack is used to maintain one or more ongoing task status data in the current dialogue, and each task status data records its corresponding intent and the filled slot value. Based on the determined target intent and slot information for the current round, update the dialogue task stack, specifically including: Determine whether the target intent is in the dialogue task stack; If the target intent is not in the dialogue task stack, insert a new task status data, and delete the oldest task status data if the maximum number of intents in the dialogue task stack is satisfied. If the target intent is found to have a corresponding intent in the dialogue task stack, and the slot is updated based on the slot value of the target intent, the corresponding task status data in the dialogue task stack is deleted, and new task status data is inserted.
[0011] According to the multi-turn dialogue method provided in this application, based on the updated dialogue task stack, the next action is determined, specifically including: If it is detected that all the necessary slots for a certain task's status data in the updated dialogue task stack are filled, the next action is to execute that task.
[0012] According to the multi-turn dialogue method provided in this application, based on the updated dialogue task stack, the next response content is determined, specifically including: if it is detected that a necessary slot of a certain task status data in the updated dialogue task stack is not filled, the next action is determined to be to ask the user a follow-up question, and a response content is generated to fill in the unfilled slot.
[0013] This application also provides a multi-turn dialogue system, including: The statement acquisition module is used to acquire the user's current input statement in the current dialogue round; The intent recognition module is used to perform preliminary recognition of the current input statement through a preset intent recognition model to obtain preliminary intent results, slot information and corresponding confidence levels; The large language model processing module is used to determine whether the confidence level is lower than a preset confidence level threshold; if so, the large language model is called to perform dialogue state recognition to determine the target intent and slot information of the current round; if not, the preliminary intent result is used as the target intent of the current round. The task stack update module is used to update the dialogue task stack based on the determined target intent and slot information of the current round. The dialogue strategy selection module is used to determine the next action and response content based on the updated dialogue task stack.
[0014] This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the multi-turn dialogue method as described above.
[0015] This application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the multi-turn dialogue method as described above.
[0016] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the multi-turn dialogue method as described above.
[0017] The multi-turn dialogue method and system provided in this application acquire the user's input statement in the current dialogue turn, initially identify the intent and slot information through a preset intent recognition model, and then call a large language model to perform deep recognition of the dialogue state when the confidence level is below a threshold, thereby determining the target intent and slot information. Based on this information, the dialogue task stack is updated, and the next action and response content are determined according to the state of the task stack. The multi-turn dialogue method of this application can effectively solve the problem of inaccurate identification of the user's current intent in multi-turn dialogue tasks in existing technologies, especially in scenarios where user needs need to be gradually clarified through multiple rounds of interaction, significantly improving the flexibility and responsiveness of the dialogue system. By combining the capabilities of the intent recognition model and the large language model, the system can better handle changes in user intent and the supplementation of slot information, thereby providing a more intelligent and personalized interactive experience. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is one of the flowcharts of the multi-turn dialogue method provided in this application.
[0020] Figure 2 This is the second flowchart of the multi-turn dialogue method provided in this application.
[0021] Figure 3 This is the third flowchart of the multi-turn dialogue method provided in this application.
[0022] Figure 4 This is a schematic diagram illustrating a specific implementation of the multi-turn dialogue method provided in this application.
[0023] Figure 5 This is a flowchart illustrating the multi-turn dialogue method provided in this application.
[0024] Figure 6 This is a schematic diagram of the structure of the multi-turn dialogue system provided in this application.
[0025] Figure 7 This is a schematic diagram of the structure of the electronic device provided in this application. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0027] In modern multi-turn dialogue systems, user needs often require multiple rounds of interaction to be gradually clarified. Taking a smart home scenario as an example, a user might initially say, "Check the weather for me," and the smart assistant needs to follow up with, "Which city's weather do you need to check?" After the user answers "Shanghai," the assistant might continue by asking, "Do you need to check tomorrow's weather or the day after?" While this gradually clarifying interaction pattern is flexible, current technology has significant shortcomings in handling similar scenarios. For instance, when the user answers "Today is fine!" for the third time, the assistant might still be unable to complete the task in one go due to a failure to effectively track the dialogue state, resulting in low dialogue efficiency.
[0028] Furthermore, existing technologies exhibit significant limitations when user intent changes. For example, when a user suddenly shifts from checking the weather to other needs, such as "Please turn on the living room light for me," the system often fails to switch tasks flexibly and may even lose contextual information from the original task. These problems ultimately stem from the lack of precise management of contextual information and efficient processing of dynamic changes in intent during multi-turn interactions in existing dialogue systems.
[0029] The technical solution of this application is designed to solve the above problems, aiming to improve the intelligence level of multi-turn dialogue systems by combining the capabilities of intent recognition models and large language models.
[0030] This embodiment uses a typical smart home control system as the application hardware scenario. The system includes a smart terminal device (e.g., a smart speaker, smart TV, or in-vehicle infotainment screen) and a cloud server. The smart terminal device is responsible for collecting the user's voice input, converting it into text using Automatic Speech Recognition (ASR) technology, and sending the text to the cloud server. The cloud server deploys the multi-turn dialogue method proposed in this application, responsible for processing text, understanding intent, managing status, and distributing the generated response text and device control commands. The response text is played back to the user via the smart terminal device's text-to-speech (TTS) module, while the control commands drive the corresponding smart home devices to perform actions through the Internet of Things (IoT) platform.
[0031] Before introducing the multi-turn dialogue method of the embodiments of this application, the terminology involved in the embodiments of this application will be explained illustratively.
[0032] Intent recognition model: In multi-turn dialogue systems, it is used to analyze user input and identify the intent that the user wants to express, such as checking the weather or booking a restaurant. It is a key component of dialogue understanding.
[0033] Large Language Model: A large-scale language processing model built on deep learning technology, capable of understanding and generating natural language text, providing dialogue systems with richer and more flexible language processing capabilities, and helping to accurately understand user intent and generate appropriate responses.
[0034] Intent result: The conclusion drawn by the intent recognition model after analyzing the user's input statement, that is, determining what the user's current intent is, such as "check the weather" or "play music", which is the basis for the dialogue system to decide how to respond to the user.
[0035] Slot: In a dialogue system, a slot refers to the key information or parameters required for a specific task or intention, such as "date" and "location" when checking the weather, or "number of people" and "time" when booking a restaurant. It is an information point that must be filled in to complete the task.
[0036] Slot information: Specific data or descriptions related to slots, including the slot's name, type, and possible value range, used to guide the dialogue system on how to collect and process user-provided information.
[0037] Slot value: Specific information provided by the user for a specific slot in the conversation, such as "Beijing" as the value of the "Location" slot, and "tomorrow" as the value of the "Date" slot. It is the key data for filling the slot and completing the task.
[0038] Task Library: A database that stores various task-related information, including task names, descriptions, associated intents, required slots and their information, providing the dialogue system with the knowledge and guidance needed to execute tasks.
[0039] Dialogue Task Stack: A data structure that records the tasks currently in progress and their status in the current dialogue. It helps the dialogue system track the progress of multiple tasks, manage task priorities and switching, and ensure dialogue continuity and task completion.
[0040] Task status data: Information describing the current status of the task, including completed slots, incomplete slots, and the stage of task execution. The dialogue system uses this data to determine the next dialogue strategy and task execution action.
[0041] Figure 1 This is one of the flowcharts illustrating the multi-turn dialogue method provided in this application, such as... Figure 1 As shown, the method includes the following: Step 101: Obtain the user's current input statement in the current dialogue round.
[0042] In step 101, the execution entity is the input receiving module of the multi-turn dialogue system. As the front-end entry point of the entire dialogue system, this module is mainly responsible for obtaining the input statement of the current dialogue turn from the user side and performing a series of preprocessing operations on the input to ensure that subsequent modules can efficiently and accurately understand and respond to user needs.
[0043] Specifically, the input receiving module first captures the user's raw input signal through a user interface (such as a smart speaker's microphone, a voice input button in a mobile application, or a text input box). If the input is in speech form, the speech recognition subunit within the module converts the speech signal into text content, while simultaneously evaluating and optimizing the speech quality, such as removing background noise, adjusting volume, and recognizing the user's accent, to improve the accuracy of speech-to-text conversion. If the input is in text form, the text undergoes preliminary cleaning, such as removing extra spaces, punctuation marks, or special characters.
[0044] After receiving the user's input text, the input receiving module further performs semantic integrity checks. For example, by analyzing the sentence's grammatical structure and keyword distribution, it determines whether the user's input is a complete sentence or contains ambiguous expressions (such as missing key information or unclear referents). For incomplete input, the input receiving module attempts to complete the semantics based on the context or generates follow-up questions to guide the user to provide more specific information.
[0045] In addition, the input receiving module also associates the current input with historical dialogue records to supplement contextual information. For example, if the user mentioned "check today's weather" in the previous round of dialogue, but only inputs "Beijing" in the current round, the module will infer from the context that the user's complete intent might be "check today's weather in Beijing," and then pass the completed sentence to the subsequent large language model.
[0046] Finally, the preprocessed input statements and their context information are transformed into structured data formats (such as JSON or XML) and passed to the next processing module of the system to ensure the coherence and efficiency of the entire dialogue process. This module's design fully considers the diversity and complexity of user input, thus laying the foundation for accurate understanding and intelligent responses in subsequent modules.
[0047] Step 102: Perform preliminary recognition of the current input statement using a preset intent recognition model to obtain preliminary intent results, slot information, and corresponding confidence levels.
[0048] In step 102, the system performs preliminary recognition of the current input statement using a preset intent recognition model. This model is built on deep learning technology and typically employs architectures such as recurrent neural networks (RNNs) or their variants (such as LSTM or GRUs) combined with conditional random fields (CRFs) to extract semantic information from text and predict the user's intent and slots.
[0049] Intent recognition models are a core component of multi-turn dialogue systems, responsible for analyzing user input and determining the user's intent. By learning from large amounts of labeled data, they can identify the actions a user wants to perform, such as checking the weather, booking a restaurant, or playing music. The model's training data typically includes various intents and their corresponding sentence examples, helping the model understand multiple ways different sentences express the same intent.
[0050] Preliminary intent result refers to the user intent predicted by the intent recognition model after analyzing the user's input. For example, when a user enters "What will the weather be like in Beijing tomorrow?", the model will predict the intent result as "Check the weather".
[0051] Slot information refers to specific parameters or details related to an intent, which are crucial for fulfilling a user's request. In the example above, the slot information includes "Date = Tomorrow" and "Location = Beijing".
[0052] Confidence level is the degree to which a model is confident in its predictions, typically expressed as a value between 0 and 1. A higher confidence level (e.g., 0.95) indicates that the model is very confident in its predictions, while a lower confidence level (e.g., 0.6) indicates that the model is less certain about its predictions. Confidence level is usually calculated based on the model's output probability distribution.
[0053] Specifically, in one illustrative implementation, the steps for the intent recognition model to perform preliminary recognition of the current input statement include: 1) Text preprocessing: First, the input sentence is preprocessed, including word segmentation and removal of stop words, so that the model can better understand the sentence structure.
[0054] 2) Feature extraction: Convert the preprocessed text into numerical features that the model can process, usually achieved through word embedding techniques.
[0055] 3) Intent prediction: Input the feature vector into the trained intent recognition model, and the model will output the probability distribution of each possible intent.
[0056] 4) Slot identification: At the same time, the model will identify the slot information in the statement, which is usually achieved through Named Entity Recognition (NER) technology.
[0057] 5) Confidence calculation: From the probability distribution of intent prediction, take the intent corresponding to the highest probability as the preliminary intent result, and use this probability as the confidence level.
[0058] Assuming the user inputs "What will the weather be like in Beijing tomorrow?", after preprocessing and feature extraction, the model will output: Initial intention / result: To check the weather; Slot information: Date = Tomorrow, Location = Beijing; Confidence level: 0.95.
[0059] If the user input is vague, such as "How's the weather?", the model may output a lower confidence score, for example: Initial intention / result: To check the weather; Slot information: Date=Unknown, Location=Unknown; Confidence level: 0.6.
[0060] In this situation, the system may ask the user further questions to obtain more information, thereby increasing confidence and accurately meeting the user's needs.
[0061] Step 103: Determine whether the confidence level is lower than a preset confidence threshold; if yes, call the large language model to perform dialogue state recognition to determine the target intent and slot information of the current round; if no, use the preliminary intent result as the target intent of the current round.
[0062] When a single-turn intent is identified as a task-oriented intent with high confidence, its result is prioritized, and slot identification is performed based on the intent. However, since single-turn intent recognition does not incorporate contextual information, it suffers from low accuracy in multi-turn dialogues. Therefore, when a task-oriented intent with high confidence is not identified, a secondary judgment is made by entering the large language model dialogue state recognition process.
[0063] Specifically, the system in this embodiment pre-sets a confidence threshold, such as 0.7, which is optimized based on system performance and user experience requirements. The system compares the confidence score obtained in step 102 with this threshold. If the confidence score is lower than the threshold, it indicates that the reliability of the preliminary intent recognition result is insufficient. In this case, the system will call the large language model for deeper dialogue state recognition. For example, when a user inputs "I want to see the weather in Hangzhou tomorrow," the preliminary intent recognition model may give a low confidence score of 0.6 due to insufficient training data or sentence complexity. The system integrates user input, historical dialogues, task library information, and the current system time into prompt words, which are then input into the large language model. Through complex semantic analysis and contextual understanding, the model outputs a more accurate structured dialogue state result, such as the target intent "check the weather" and the slot information "date=2025-09-09, location=Hangzhou".
[0064] If the confidence level is higher than or equal to a preset threshold, for example, for the explicit user input "turn on the living room lights," and the initial intent recognition model gives a confidence level of 0.8, the system determines that the initial intent result is reliable enough. Without further invoking the large language model, the system directly determines the initial intent result as the target intent for the current round, thereby improving the efficiency of dialogue processing. This design ensures that the system maintains high accuracy while also considering the fluency and responsiveness of the dialogue.
[0065] Step 104: Update the dialogue task stack based on the determined target intent and slot information of the current round.
[0066] In step 104, the system updates the dialogue task stack based on the target intent and slot information determined in the current round. Specifically, if the target intent does not exist in the task stack, a new task status data entry is inserted, containing the intent and the already filled slot value. If the target intent already exists, the system updates the status data of the corresponding task according to the new slot information, ensuring that the information in the task stack is always up-to-date. This process not only maintains the continuity of the dialogue but also provides an accurate basis for the selection of subsequent dialogue strategies.
[0067] The dialogue task stack is a data structure used to maintain the status of all ongoing tasks in the current dialogue. Each task status record records the task's intent and the filled slot values. For example, the task stack may contain multiple tasks, each with its corresponding intent and slot information. When a user enters a new statement and determines the target intent and slot information, the system checks whether the intent already exists in the task stack. If it does not exist, a new task status record is added to the task stack; if it exists, the slot value of that task is updated. This update mechanism ensures that the dialogue task stack can reflect the latest state of the dialogue in real time, providing the dialogue system with accurate task information, thereby better supporting the management and execution of multi-turn dialogues.
[0068] For example, in a smart home control scenario, a user might first say, "Turn on the living room light." The system recognizes the intent "turn on the light" and the slot "location = living room," adding this information to the task stack. Then, the user might say, "Turn on the bedroom light." The system recognizes the same intent "turn on the light," but updates the slot to "location = bedroom." At this point, the system updates the corresponding task slot value in the task stack. This update mechanism allows the dialogue system to dynamically track changes in user commands, ensuring the continuity of the dialogue and the accuracy of task execution.
[0069] Step 105: Based on the updated dialogue task stack, determine the next action and response content.
[0070] Specifically, the system checks the completion status of each task in the dialogue task stack to decide whether to continue asking the user to fill in the missing slot information or to execute the already completed task.
[0071] If all the necessary slots for a task's status data are filled, the system will determine that the next action is to execute the task and generate a corresponding response to inform the user that the task is about to be executed. For example, if there is a "check the weather" task in the dialogue task stack, and the "date" and "location" slots are both filled, the system will call the weather query interface to obtain and return the query results to the user.
[0072] If there are still unfilled slots in the task status data, the system will determine the next step to ask the user a follow-up question to complete the required information. For example, if the "Check Weather" task is missing a "Location" slot, the system will generate a response asking the user: "Which city's weather would you like to check?" Furthermore, the system will rationally arrange the execution order of tasks and the logical structure of responses based on task priorities and context information in the dialogue task stack to ensure the coherence and naturalness of the dialogue. For example, when processing multiple parallel tasks, the system may prioritize urgent or critical tasks and reflect the priority and relevance of the tasks in the responses.
[0073] In this way, the system can flexibly manage multiple tasks in multi-turn dialogues, ensuring that each task is handled properly and providing accurate and timely feedback to the user, thereby improving the intelligence level of the dialogue system and the user experience.
[0074] The multi-turn dialogue method provided in this application obtains the user's input statement in the current dialogue turn, initially identifies the intent and slot information through a preset intent recognition model, and calls a large language model to perform deep recognition of the dialogue state when the confidence level is below a threshold, thereby determining the target intent and slot information. Based on this information, the dialogue task stack is updated, and the next action and response content are determined according to the state of the task stack. The multi-turn dialogue method of this application can effectively solve the problem of inaccurate identification of the user's current intent in multi-turn dialogue tasks in the prior art, especially in scenarios where user needs need to be gradually clarified through multiple rounds of interaction, significantly improving the flexibility and responsiveness of the dialogue system. By combining the capabilities of the intent recognition model and the large language model, the system can better handle changes in user intent and the supplementation of slot information, thereby providing a more intelligent and personalized interactive experience.
[0075] Furthermore, for step 103, as Figure 2 As shown, it specifically includes: Step 201: Integrate contextual information to construct prompt words.
[0076] The system first integrates various contextual information to construct prompt words, which specifically include: 1) Current input statement: This is the statement entered by the user in the current round, such as "I want to watch Jiu'an". This is the core content of the prompt, directly reflecting the user's immediate needs.
[0077] 2) Historical Dialogue Records: The system reviews and organizes the content of previous dialogues. For example, in a previous dialogue, the user mentioned "I want to see the surveillance footage," and when the system asked the user which camera they wanted to control, the user received a list of cameras. This historical information helps the large language model understand the context of the current input.
[0078] 3) Current task status data of the dialogue task stack: The task stack records the status data of all currently incomplete tasks, including the task intent and the filled slot values. For example, the current task stack may contain an incomplete "view camera" task, whose slot "index" has not yet been filled.
[0079] 4) Predefined Task Library: The task library stores the executable tasks of the system and their required slots in a structured format. For example, the "view camera" task requires an "index" slot to specify the camera number. The task library provides a reference framework for possible intents and slots for large language models.
[0080] 5) Current system time: Current time information (such as "2024-11-13 18:36:17") helps the model understand time-related queries, such as "today" or "tomorrow", and perform normalization processing of time slots.
[0081] Here is a sample prompt: You are an intelligent assistant responsible for determining whether to inherit a task and updating task parameters based on user input and context information. Your goal is to ensure accurate judgment and directly return the final result. Here is your task logic: 1. Inheritance determination Based on user input, the current task stack, and the user's historical dialogue, determine whether historical tasks need to be inherited, and which tasks need to be inherited (if there are multiple tasks, prioritize the task that is most relevant to the user input).
[0082] If inheritance is not required, immediately return {"inherit": 0} and end the task.
[0083] 2. Parameter determination If task inheritance is required, determine whether the user has provided complete or partial parameters: a. If the user provides parameters: Standardize the parameters.
[0084] Check if the historical parameters in the dialogue task stack need to be supplemented or updated.
[0085] Return {"inherit": 1, "task name": {"arguments": {updated parameters}}} and end the task.
[0086] b. If the user does not provide parameters: Return the result directly using the parameters in the dialogue task stack.
[0087] Returns {"inherit": 1, "task name": {"arguments": {history parameters}}} and ends the task.
[0088] 3. Output Format Ensure that the output is clearly and accurately structured, containing only direct results and avoiding any additional explanations or intermediate reasoning.
[0089] Input information: User's current input: I want to see the second camera. The task status data and parameters in the current dialogue task stack: [{'checkCameraLive': {'arguments': {'index': '2'}}}] Task status data and parameter description: {'checkCameraLive': {'type': 'function', 'function': {'name': 'checkCameraLive', 'description': 'Check Camera', 'parameter': {'type': 'object', 'properties': {'index': {'type': 'int', 'description': 'Camera number, must be within the given camera list, e.g., 1'}}, 'required':['index']}}}} User conversation history: round1: Q: I want to view the surveillance footage. A: Two cameras have been matched, namely Camera 1 and Camera 2. Which one would you like to control? Current system time: 2024-11-13 18:36:17.
[0090] Please return the final JSON result directly; no explanation or reasoning is required.
[0091] To improve the accuracy and efficiency of dialogue state recognition using large language models, fine-tuning and quantization of open-source large language models can be performed. While returning thought chain results from large language models improves the accuracy of inference, online efficiency requirements limit the ability to output excessively long texts. Therefore, it's advisable to first use closed-source large language models, such as GLM-4 and GPT-4, combined with thought chains for inference, using the inference results as training data. Locally, a smaller model, such as Qwen-14b, can be fine-tuned to improve accuracy.
[0092] Step 202: Input the prompt words into the large language model and obtain the structured dialogue state results output by the large language model. The dialogue state results include target intent and slot information.
[0093] After constructing the prompts, the system inputs them into the large language model. The model then uses the information in the prompts to determine whether the current input statement has a semantic connection with any incomplete task in the dialogue task stack. For example, if the task in the dialogue task stack is to check the camera ("checkCameraLive"), and the user currently inputs "I want to see A," the model needs to determine whether this is related to the incomplete camera-checking task.
[0094] If the large language model determines that there is a semantic association between the current input statement and an unfinished task, the system will decide to inherit the unfinished task and parse the current input statement as a slot supplement or correction to the unfinished task. In this example, the model will recognize that "Jiu An" is the name of the camera and parse it as supplementary information for the camera serial number slot, thereby updating the slot value in the task stack.
[0095] Finally, the large language model will output a structured dialogue state result, which includes the target intent and slot information. For example, the large language model may output the target intent "checkCameraLive" and the slot information "index: 2", indicating that the user wants to view the second camera (i.e., camera "A"). The system will use this information to update the dialogue task stack and determine the next action and response content.
[0096] Through the above steps 201~202, the system can flexibly handle semantic associations and slot supplements in multi-round dialogues, effectively improving the coherence of the dialogue and the accuracy of task completion.
[0097] Furthermore, referring to Figure 3 , for step 104, it specifically includes: 301. Determine whether the target intent is in the dialogue task stack.
[0098] The dialogue task stack is a data structure used to maintain the status of one or more ongoing tasks in the current dialogue. Each task status data records the intent of the task and the filled slot values. For example, the task stack may contain multiple tasks, and each task has its corresponding intent and slot information.
[0099] Among them, the data format of the task status data in the dialogue task stack is: {'TaskName': {'arguments': {'parameter1': value, 'parameter2': value}}}, TaskName is the task name, parameter and value correspond to the parameter name and parameter value, and the dialogue task stack may contain 0 to N pieces of data.
[0100] Based on the determined target intent and slot information of the current round, the system will determine whether the target intent is in the task stack. The system first checks whether the currently determined target intent already exists in the task stack. For example, if the target intent is "view the camera", the system will search whether this intent already exists in the task stack.
[0101] 302. If the target intent is not in the dialogue task stack, insert a new task status data, and under the condition of meeting the maximum intent number limit of the dialogue task stack, delete the earliest task status data.
[0102] If the target intent is not in the task stack, the system will insert a new task status record into the task stack, containing the intent and the already filled slot value. For example, if the user enters "I want to view the surveillance footage," the system will insert a new task status record with the intent "View camera" and an empty slot value. If the number of tasks in the task stack exceeds the preset maximum number of intents after insertion, the system will delete the oldest task status record.
[0103] 303. If the target intent is found in the dialogue task stack, and the slot is updated according to the slot value of the target intent, the corresponding task status data in the dialogue task stack is deleted and new task status data is inserted.
[0104] If the target intent is already in the task stack, the system will find the corresponding intent and update the task's status data based on the new slot information. For example, if the user further inputs "the one by the door," the system will update the slot value of the "view camera" task to "index: 2."
[0105] Based on the updated dialogue task stack, the system checks whether the required slots for each task's status data are filled. If all the required slots for a task's status data are filled, the system determines that the next action is to execute that task. For example, if the "index" slot for the "View Camera" task is filled with "2", the system will execute the task, turn on the second camera, and send a confirmation message to the user.
[0106] If a required slot for task status data is not filled, the system will determine the next step to ask the user a follow-up question to complete the information. For example, if the "index" slot for the "View Camera" task is not yet filled, the system will generate a response asking the user: "Which camera would you like to view?" Through the steps described above, the system can dynamically manage the dialogue task stack, ensuring that the status of each task is updated in a timely manner, and determining the next action and response content based on the task completion status. This mechanism not only improves the coherence of the dialogue but also enhances the system's responsiveness and user experience.
[0107] The following example, a task-oriented multi-turn dialogue in a family setting, illustrates a specific implementation method of the proposed solution. Figure 4 As shown.
[0108] Suppose a user says "I want to view the surveillance footage." The intent recognition module identifies the intent as viewing the camera (checkCameraLive). Since the user hasn't specified which camera they want to view, the slot is empty. The dialogue strategy selection module first checks in the background whether the user has configured any cameras. If multiple cameras are configured, it provides a list of camera names for the user to choose from, such as "A total of 4 cameras were matched: Smart Camera-1, Doorway, Bar Counter, and LeOrange G67P-1. Which one would you like to control?". Simultaneously, the task stack module updates the task stack based on the intent and the available slots. The current task stack is updated to: [{'checkCameraLive': {'arguments': {'index': ''}}].
[0109] In the second round of dialogue, assuming the user says "the one by the door," the intent recognition module fails to identify a high-confidence task-oriented intent, therefore the fallback intent is casual conversation. At this point, the large language model processing module is invoked. The large language model, based on the context and information in the task stack, identifies the task to be inherited in the dialogue task stack: opening the camera. It extracts the corresponding camera index as the second one, normalizes it to 2, and returns {'checkCameraLive': {'arguments': {'index': '2'}}}. Based on the recognition result, the dialogue task stack is updated to: [{'checkCameraLive': {'arguments': {'index': '2'}}]. Since the current intent and slot are complete, the dialogue strategy selection module executes the corresponding function, opens the second camera, and replies to the user: "Okay, the camera is now open for you."
[0110] In the third round of dialogue, suppose the user says they want to check another camera, and says "turn on the first one." Since the intent recognition module did not identify a task-oriented intent with high confidence, it will also enter the large language model processing module. At this time, the recognition result is [{'checkCameraLive': {'arguments': {'index': '1'}}}]. Based on the recognition result, the dialogue task stack will also be updated to: [{'checkCameraLive': {'arguments': {'index': '1'}}]. Since the current intent and slot are complete, the dialogue strategy selection module will execute the corresponding function, turn on the first camera, and reply to the user: "Okay, the camera is turned on for you."
[0111] In the fourth round of dialogue, the user's intent changes. Suppose the user says, "What's the weather like in Hangzhou today?" The single-round intent recognition module identifies the intent as a weather query, obtains the location slot as Hangzhou based on the user's geographic location, extracts the date slot as today, and converts it into a standard time format. Since the current intent and slots are complete, the dialogue strategy selection module executes the corresponding function and provides the user's response. Simultaneously, the dialogue task stack is updated to: [{'checkCameraLive': {'arguments': {'index': '1'}, {'checkWeather': {'date': '2024-12-13', 'location':'hangzhou'}}].
[0112] To further understand the solutions of the embodiments of this application, please refer to... Figure 5 The overall flow of the multi-turn dialogue method in this application embodiment is as follows: 1) Start: The process begins when the user initiates a conversation or the system starts a conversation.
[0113] 2) Single sentence intent recognition: The system first uses a preset intent recognition model to perform preliminary recognition of the user's current input sentence, and obtains preliminary intent results and their confidence levels.
[0114] 3) Determine if it is a task-oriented intent: If the preliminary intent recognition results indicate that the user's intent is task-oriented, proceed to the "single sentence slot recognition" step; if the user's intent is non-task-oriented, proceed to the dialogue state recognition process based on the large model.
[0115] 4) Single-sentence slot recognition: For task-oriented intents, the system further recognizes slot information and extracts key parameters from user input.
[0116] 5) Dialogue State Recognition Based on Large Model: For non-task-oriented intents or when the confidence level of single-sentence intent recognition is low, the system calls a large language model for deeper dialogue state recognition. This includes steps such as inheritance judgment, inheritance selection, and slot extraction and normalization to determine the complete state of the current dialogue.
[0117] 6) Determining whether to inherit historical state: The system determines whether to inherit the historical dialogue state. If inheritance is required, the current dialogue state is updated; otherwise, the system enters the casual conversation module.
[0118] 7) Status Update: If the historical status is inherited, the system will update the dialogue task stack to maintain the latest status of each task in the current dialogue.
[0119] 8) Dialogue strategy selection: Based on the updated dialogue task stack, the system selects an appropriate dialogue strategy and decides on the next action.
[0120] 9) Generate a reply: The system generates a reply to the user and sends it to the user.
[0121] 10) End: The dialogue process ends, and the system awaits the user's next input.
[0122] The technical effects that can be achieved by the technical solution of this application include: 1. The embodiments of this application do not have a preset round limit. They are based solely on historical dialogues, task library descriptions, and large model dialogue state recognition, which can avoid manual configuration of fixed business templates and is superior in terms of flexibility and efficiency.
[0123] 2. The embodiments of this application can cache multiple historical states and combine them with a large model to identify the current intent and slot, and can handle various scenarios such as intent change and interruption recovery.
[0124] 3. The embodiments of this application are based on a large model for dialogue state recognition. It can rely on the zero-shot or few-shot capability of the large model, or it can be fine-tuned to maintain good generalization ability on unknown data.
[0125] 4. The embodiments of this application use a large and small model collaboration approach, only calling the large language model for state recognition when the confidence of a single-round intent recognition is low, which can meet the needs of online applications for computing power, load and latency.
[0126] The multi-turn dialogue system provided in the embodiments of this application is described below. The multi-turn dialogue system described below can be referred to in correspondence with the multi-turn dialogue method described above.
[0127] This application provides a multi-turn dialogue system, see [link to relevant documentation] Figure 6 ,include: The statement acquisition module 610 is used to acquire the user's current input statement in the current dialogue round; The intent recognition module 620 is used to perform preliminary recognition of the current input statement through a preset intent recognition model to obtain preliminary intent results, slot information and corresponding confidence levels; The large language model processing module 630 is used to determine whether the confidence level is lower than a preset confidence level threshold; if so, the large language model is called to perform dialogue state recognition to determine the target intent and slot information of the current round; if not, the preliminary intent result is used as the target intent of the current round. The task stack update module 640 is used to update the dialogue task stack based on the determined target intent and slot information of the current round. The dialogue strategy selection module 650 is used to determine the next action and response content based on the updated dialogue task stack.
[0128] Figure 7 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 7 As shown, the electronic device may include a processor 710, a communications interface 720, a memory 730, and a communication bus 740, wherein the processor 710, communications interface 720, and memory 730 communicate with each other via the communication bus 740. The processor 710 can call logical instructions in the memory 730 to execute a multi-turn dialogue method. This method includes: obtaining the user's current input statement in the current dialogue turn; performing preliminary recognition of the current input statement using a preset intent recognition model to obtain a preliminary intent result, slot information, and corresponding confidence level; determining whether the confidence level is lower than a preset confidence threshold; if so, calling a large language model to perform dialogue state recognition to determine the target intent and slot information of the current turn; if not, using the preliminary intent result as the target intent of the current turn; updating the dialogue task stack based on the determined target intent and slot information of the current turn; and determining the next action and response content based on the updated dialogue task stack.
[0129] Furthermore, the logical instructions in the aforementioned memory 730 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0130] On the other hand, this application also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the multi-turn dialogue method provided by the above methods. The method includes: obtaining the user's current input statement in the current dialogue turn; performing preliminary recognition on the current input statement through a preset intent recognition model to obtain a preliminary intent result, slot information, and corresponding confidence level; determining whether the confidence level is lower than a preset confidence level threshold; if so, calling a large language model to perform dialogue state recognition to determine the target intent and slot information of the current turn; if not, using the preliminary intent result as the target intent of the current turn; updating the dialogue task stack based on the determined target intent and slot information of the current turn; and determining the next action and response content based on the updated dialogue task stack.
[0131] Furthermore, this application also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the multi-turn dialogue method provided by the above methods. The method includes: obtaining the user's current input statement in the current dialogue turn; performing preliminary recognition on the current input statement using a preset intent recognition model to obtain a preliminary intent result, slot information, and corresponding confidence level; determining whether the confidence level is lower than a preset confidence level threshold; if so, calling a large language model to perform dialogue state recognition to determine the target intent and slot information of the current turn; if not, using the preliminary intent result as the target intent of the current turn; updating the dialogue task stack based on the determined target intent and slot information of the current turn; and determining the next action and response content based on the updated dialogue task stack.
[0132] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0133] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0134] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A multi-turn dialogue method, characterized in that, include: Get the user's current input statement in the current dialogue round; The current input statement is initially identified by a preset intent recognition model to obtain preliminary intent results, slot information and corresponding confidence levels; Determine whether the confidence level is lower than a preset confidence threshold; if so, call the large language model to perform dialogue state recognition to determine the target intent and slot information of the current round; if not, use the preliminary intent result as the target intent of the current round. Update the dialogue task stack based on the determined target intent and slot information of the current round; Based on the updated dialogue task stack, determine the next action and response.
2. The multi-turn dialogue method according to claim 1, characterized in that, The large language model is invoked to perform dialogue state recognition in order to determine the target intent and slot information for the current round, specifically including: Integrate contextual information to construct prompt words; The prompt words are input into the large language model, and the structured dialogue state results output by the large language model are obtained. The dialogue state results include target intent and slot information.
3. The multi-turn dialogue method according to claim 2, characterized in that, The context information includes at least: the currently input statement; The prompt words are input into the large language model, and the structured dialogue state results output by the large language model are obtained, specifically including: The prompt word is input into the large language model, and the large language model determines whether the current input statement has a semantic relationship with any unfinished task in the dialogue task stack; When semantic association exists, the decision inherits the unfinished task and parses the current input statement as a slot supplement or correction for the unfinished task.
4. The multi-turn dialogue method according to claim 2, characterized in that, The context information also includes: historical dialogue records, a predefined task library, the current system time, and the current task status data of the dialogue task stack; The current system time is used to assist the large language model in performing time-related semantic understanding and slot filling. The task library is used to store system-executable tasks in a structured format. Each task definition includes a task identifier, a task description, and the slots required to execute the task and their definitions.
5. The multi-turn dialogue method according to claim 1, characterized in that, The dialogue task stack is used to maintain the status data of one or more ongoing tasks in the current dialogue. Each task status data records its corresponding intent and the filled slot value. Based on the determined target intent and slot information for the current round, update the dialogue task stack, specifically including: Determine whether the target intent is in the dialogue task stack; If the target intent is not in the dialogue task stack, insert a new task status data, and delete the oldest task status data if the maximum number of intents in the dialogue task stack is satisfied. If the target intent is found to have a corresponding intent in the dialogue task stack, and the slot is updated based on the slot value of the target intent, the corresponding task status data in the dialogue task stack is deleted, and new task status data is inserted.
6. The multi-turn dialogue method according to claim 5, characterized in that, Based on the updated dialogue task stack, the next action is determined, specifically including: If it is detected that all the necessary slots for a certain task's status data in the updated dialogue task stack are filled, the next action is to execute that task.
7. The multi-turn dialogue method according to claim 5, characterized in that, Based on the updated dialogue task stack, the next response is determined, specifically including: If it is detected that a required slot for a certain task status data in the updated dialogue task stack is not filled, the next action is to ask the user a follow-up question and generate a response to fill in the unfilled slot.
8. A multi-turn dialogue system, characterized in that, include: The statement acquisition module is used to acquire the user's current input statement in the current dialogue round; The intent recognition module is used to perform preliminary recognition of the current input statement through a preset intent recognition model to obtain preliminary intent results, slot information and corresponding confidence levels; The large language model processing module is used to determine whether the confidence level is lower than a preset confidence level threshold; if so, the large language model is called to perform dialogue state recognition to determine the target intent and slot information of the current round; if not, the preliminary intent result is used as the target intent of the current round. The task stack update module is used to update the dialogue task stack based on the determined target intent and slot information of the current round. The dialogue strategy selection module is used to determine the next action and response content based on the updated dialogue task stack.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the multi-turn dialogue method as described in any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the multi-turn dialogue method as described in any one of claims 1 to 7.
11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the multi-turn dialogue method as described in any one of claims 1 to 7.