Generative dialogue system based on large language model
By introducing dialogue state tracking, thinking chain reasoning and large language model generation modules into the generative dialogue system, the problem of insufficient dialogue state tracking and reasoning capabilities in multiple rounds of dialogue is solved, and more natural, smooth and context-related dialogue replies are achieved, improving the user experience.
Patent Information
- Application Number
- CN202510279905.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2045-03-11
AI Technical Summary
Existing generative dialogue systems are difficult to accurately track conversation status in multiple rounds of conversations, lack effective reasoning capabilities, and perform poorly in cross-domain transfers and zero-sample learning.
A generative dialogue system based on a large language model is adopted, including a dialogue state tracking module, a thinking chain reasoning module and a dialogue generation module. The dialogue state tracking module fine-tunes the large language model through transfer learning to track dialogue state in real time; the thinking chain reasoning module dynamically retrieves and integrates information to ensure the consistency of reply; the dialogue generation module uses the Transformer architecture to capture long-distance context information and dynamically adjusts the generation strategy.
It significantly improves the ability to identify user intentions and systematic reasoning capabilities in multiple rounds of conversations, ensures that the generated responses are natural, fluent and context-sensitive, and improves the coherence of user experience and dialogue.
Smart Images

Figure CN119782490A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a generative dialogue system based on a large language model. Background Art
[0002] With the advancement of artificial intelligence technology, the demand for human-computer interaction systems in various application scenarios has gradually increased, such as intelligent customer service, voice assistants, and virtual agents. Natural Language Processing (NLP) is one of the key technologies for implementing these systems, which aims to enable machines to understand and generate human natural language. However, traditional dialogue systems usually rely on pre-designed rules and templates. These systems often adopt architectures based on finite state machines or decision trees. Although they can provide basic dialogue capabilities in specific tasks, they show great limitations in complex, open-domain multi-round dialogues.
[0003] The limitations of traditional dialogue systems are mainly reflected in the following aspects: 1. Limitations of fixed rules and templates: Early dialogue systems conducted conversations through a predefined "input-output" model. Although this method has certain application value in specific fields, the system lacks a deep understanding of the content of the conversation and is difficult to cope with unstructured or complex and changeable dialogue scenarios.
[0004] 2. Insufficient dialogue flexibility: Rule-based systems are usually difficult to adapt to the changes and diversity of users in natural language. Users may express the same intention in different ways, and traditional systems lack sufficient generalization capabilities, resulting in inaccurate capture and understanding of user intentions.
[0005] 3. Poor context processing capabilities in multi-round conversations: Traditional systems have difficulty accurately maintaining the context information of conversations when processing multi-round conversations. This results in the system often being unable to correctly track the state of the conversation when facing multiple consecutive rounds of conversations, thus affecting the accuracy of the system's response.
[0006] With the rapid development of deep learning technology, data-driven dialogue systems have gradually emerged. In particular, in recent years, neural network models have shown strong learning capabilities in natural language processing tasks, and can automatically learn language patterns and semantic features from large-scale data, thereby improving the performance of dialogue systems. Among them, generative dialogue systems have become a hot topic of research.
[0007] The advantage of a generative dialogue system is that it can dynamically generate natural language output based on input, rather than just relying on predefined templates. This system uses deep learning models such as recurrent neural networks (RNNs), long short-term memory networks (LSTMs), and Transformer architectures, which show greater flexibility and adaptability when generating text. However, despite the improvements of deep learning-based generative dialogue systems over traditional systems, there are still some challenges: a) Insufficient dialogue state tracking capability: Generative dialogue systems usually have difficulty accurately tracking dialogue states in multi-round dialogues, especially in dialogues involving multiple fields or complex tasks, where the system may not be able to correctly understand the changes in user intent.
[0008] b) Lack of effective reasoning ability: Although deep learning models can generate fluent natural language text, their reasoning ability is limited and it is difficult to make logical and coherent inferences in complex dialogue scenarios. This limits the application of the system in high-level dialogue understanding.
[0009] c) Difficulty in zero-shot learning and cross-domain transfer: When faced with new domains or zero-shot tasks, the performance of generative dialogue systems is often poor because the systems lack effective cross-domain transfer capabilities. This poses a challenge to their wide adaptability in practical application scenarios. Summary of the invention
[0010] In view of the limitations of existing generative dialogue systems in multi-round dialogues, the present invention provides a generative dialogue system based on a large language model, aiming to improve the ability to recognize user intentions and the system's reasoning ability in multi-round dialogues.
[0011] The present invention is a generative dialogue system based on a large language model, and the technical solution adopted to solve the above technical problems is as follows: A generative dialogue system based on a large language model, the structure of which includes: The dialogue interface module is responsible for receiving user input and displaying the corresponding output results generated by the system to the user; The dialogue state tracking module is used to encode and generate prompts using key dialogue information, transform prompts based on context, and use transfer learning to fine-tune the large language model to adapt to multi-domain dialogue state tracking tasks. It also builds a sample library containing dialogue examples from multiple fields to retrieve relevant examples in real time, so as to accurately and real-timely track the dialogue state in multiple rounds of dialogue. The thinking chain reasoning module is used to store and manage the intermediate state information generated during the dialogue process, and dynamically retrieve the previously stored intermediate state according to the current dialogue state to ensure the coherence of the generated reply with the previous dialogue content; it is also used to call multiple tools to perform complex tasks, integrate the obtained results into the dialogue, establish logical connections between multiple reasoning steps, analyze the key elements of the user input and reason step by step to understand the user's intention; The dialogue generation module adopts a large language model with a Transformer architecture based on a multi-layer self-attention mechanism and a feedforward network. It is used to pay attention to all parts of the input sequence while generating dialogue replies, effectively capture long-distance contextual information, and dynamically adjust the generation strategy according to the context of the current dialogue. It extracts language features from large-scale unlabeled text data and fine-tunes the large language model with a Transformer architecture on data in specified domains. It is used to retain and selectively activate important contextual information in multiple rounds of dialogues, flexibly adjust the generation strategy according to different user requests and interaction methods, analyze the user's emotional state in real time and adjust the tone and content of the reply accordingly, and automatically adjust the reply style and content according to the user's historical dialogues and preferences to achieve personalized replies.
[0012] Optionally, the dialog state tracking module involved specifically includes: The fine-tuning unit is used to fine-tune the pre-trained large language model using transfer learning to achieve multi-domain and zero-shot learning; The slot encoding unit is used to annotate and encode key information of the conversation into a unified format using natural language processing technology, and then generate targeted slot prompts with the help of the rich semantic understanding and knowledge reserve of the fine-tuned large language model. The fine-tuned large language model also identifies key features based on the encoded information and generates prompts that are more suitable for the conversation context, thereby guiding the system to accurately focus on the specified information; The prefix prompt unit is used to enhance the understanding of context based on the fine-tuned large language model. It converts slot prompts into key prefix prompts and value prefix prompts. During the conversion process, the fine-tuned large language model uses its understanding of the context to analyze the degree of relevance of each prompt to the context and dynamically adjusts the emphasis of the prompt, thereby enhancing the state tracking capability in combination with the context, allowing the system to more keenly capture key changes in the conversation; The example retrieval unit is used to build a sample library containing dialogue examples from various fields. Through the real-time retrieval mechanism, it uses the fine-tuned large language model to accurately understand the semantics of the current dialogue, and retrieves the dialogue examples most relevant to the current dialogue from the sample library in real time.
[0013] Further optionally, in the process of generating a dialogue response, the example retrieval unit uses a real-time retrieval mechanism and similarity calculation to retrieve the example most relevant to the current dialogue from the sample library to assist in generating accurate dialogue state information.
[0014] Optionally, the thought chain reasoning modules involved specifically include: The external memory encoding unit is used to store and manage the intermediate state information generated during the conversation, and dynamically retrieve the previously stored intermediate state according to the current conversation state through the information retrieval mechanism to ensure the coherence of the generated response with the previous conversation content; The tool integration unit is used to integrate multiple tools to support the execution of complex tasks. It also uses the feedback mechanism to integrate the results obtained by calling the tools into the dialogue to enhance the interactivity and practicality of the dialogue. A logic connection unit, which is used to establish logical connections between multiple reasoning steps through a thought chain reasoner when performing complex tasks; The step-by-step reasoning unit is used to adopt a step-by-step reasoning method through the thought chain reasoner when facing complex and long-sequence dialogues, continuously correct and optimize the dialogue state maintained by the dialogue state tracking module, accurately understand the user's intentions, and generate logically reasonable responses.
[0015] Preferably, the external memory encoding unit involved stores and manages intermediate state information generated during the conversation, including user input, generated replies, and important context information.
[0016] Further optionally, when the logic connection unit is performing a complex task, a thinking chain reasoner is used to establish a logical connection between multiple reasoning steps. This process includes: firstly, a deep analysis is performed on the key elements of the user input, where the key elements are important information that has been processed and identified by the dialogue state tracking module, and then a final reply is generated through a series of reasoning steps to ensure that the reply is consistent with the understanding and processing process of the dialogue state tracking module, so that the entire dialogue reasoning process is logically rigorous; When faced with complex and long-sequence dialogues, the step-by-step reasoning unit uses a step-by-step reasoning method through the thought chain reasoner to continuously correct and optimize the dialogue state maintained by the dialogue state tracking module, accurately understand the user's intentions, and generate logically reasonable responses. In this process, the thought chain reasoner sets the reasoning path to ensure that the reasoning results of each step are consistent with the previous content, thereby helping the dialogue state tracking module to accurately understand the user's intentions and generate logically reasonable responses.
[0017] Optionally, the dialogue generation module involved specifically includes: Training fine-tuning units are used to extract language features from large-scale unlabeled text data and use transfer learning techniques to fine-tune large language models based on the Transformer architecture on data in a specified domain; The capture adjustment unit is used to use a large language model based on the Transformer architecture to focus on different parts of the input sequence while generating dialogue responses, effectively capture long-range context information, and dynamically adjust the generation strategy according to the context of the current dialogue; The dialogue generation unit is used to use a large language model based on the Transformer architecture to retain and selectively activate important context information in multiple rounds of dialogue, and flexibly adjust the generation strategy according to different user requests and interaction methods; The personalized generation unit is used to analyze the user's emotional state in real time with the help of the emotion recognition module, and adjust the tone and content of the reply according to the user's emotional changes when generating dialogue replies. At the same time, it automatically adjusts the reply style and content according to the user's historical conversations and preferences, and generates natural, fluent, contextual, interactive, relevant and logical replies.
[0018] Optionally, the large language models in the dialogue state tracking module and the dialogue generation module all adopt a Transformer architecture based on a multi-layer self-attention mechanism and a feedforward network, and a time factor is introduced into the Transformer architecture to process the sequence and time correlation of the dialogue in the dialogue system; The introduced time factor is located between the word embedding layer and the feedforward neural network, including: A time embedding layer, used to encode the time information of the dialogue turns formed by the text, wherein the time embedding is a relative time embedding, used to represent the relative time interval between dialogue turns, or the time embedding is an absolute time embedding, used to represent the absolute timestamp of the dialogue turn; The time-aware self-attention mechanism is used to consider the semantic relationship between words in the multi-head self-attention mechanism and combine the time embedding vector to calculate the attention weight, so that the large language model pays more attention to the conversation content that is related or close in time, so as to better capture the coherence and contextual dependency of the conversation; The time decay mechanism is used to add a time decay factor to the weight calculation of the feedforward neural network part or the self-attention mechanism, so that the influence of the previous dialogue round on the current generated answer gradually weakens; Among them: the word embedding layer is used to convert the text of the input layer into a word embedding vector, and the feedforward neural network is used to further transform and process the hidden state after being processed by the self-attention mechanism.
[0019] Preferably, the dialogue interface module involved supports multiple input modes, including text input, voice input and image input, and can adapt to different device screen sizes and resolutions to provide a consistent and friendly user interaction experience.
[0020] Compared with the prior art, the generative dialogue system based on a large language model of the present invention has the following beneficial effects: 1. The present invention can accurately track state changes in complex conversations, handle complex multi-round conversations, and provide more coherent and intelligent conversation services in combination with tool operations, making the conversations generated by the system more natural and smooth, thus improving the user experience; 2. The present invention uses a dialogue state tracking module to enable the system to track and update the dialogue state in real time, thereby significantly improving the coherence and accuracy of the dialogue; through the thought chain reasoning module, a step-by-step reasoning method is adopted to gradually analyze user questions, and external memory is used to store intermediate results to ensure that the generated replies are logically coherent and meet the context requirements; the generative dialogue module is based on the pre-trained Transformer language model, which can make full use of large-scale language knowledge to generate natural, fluent and context-consistent dialogue replies, so as to be flexibly applied in new fields and zero-sample learning scenarios, ensuring that the generated dialogue content meets the needs of the specified field. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Attached Figure 1 It is a module connection block diagram of an embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to make the technical solution, the technical problem solved and the technical effect of the present invention more clearly understood, the technical solution of the present invention is clearly and completely described below in conjunction with specific embodiments.
[0023] Example: Refer to the attached Figure 1 This embodiment proposes a generative dialogue system based on a large language model, the structure of which includes: The dialogue interface module is responsible for receiving user input and displaying the corresponding output results generated by the system to the user; The dialogue state tracking module is used to encode and generate prompts using key dialogue information, transform prompts based on context, and use transfer learning to fine-tune the large language model to adapt to multi-domain dialogue state tracking tasks. It also builds a sample library containing dialogue examples from multiple fields to retrieve relevant examples in real time, so as to accurately and real-timely track the dialogue state in multiple rounds of dialogue. The thinking chain reasoning module is used to store and manage the intermediate state information generated during the dialogue process, and dynamically retrieve the previously stored intermediate state according to the current dialogue state to ensure the coherence of the generated reply with the previous dialogue content; it is also used to call multiple tools to perform complex tasks, integrate the obtained results into the dialogue, establish logical connections between multiple reasoning steps, analyze the key elements of the user input and reason step by step to understand the user's intention; The dialogue generation module adopts a large language model with a Transformer architecture based on a multi-layer self-attention mechanism and a feedforward network. It is used to pay attention to all parts of the input sequence while generating dialogue replies, effectively capture long-distance contextual information, and dynamically adjust the generation strategy according to the context of the current dialogue. It extracts language features from large-scale unlabeled text data and fine-tunes the large language model with a Transformer architecture on data in specified domains. It is used to retain and selectively activate important contextual information in multiple rounds of dialogues, flexibly adjust the generation strategy according to different user requests and interaction methods, analyze the user's emotional state in real time and adjust the tone and content of the reply accordingly, and automatically adjust the reply style and content according to the user's historical dialogues and preferences to achieve personalized replies.
[0024] In this embodiment, the dialogue interface module involved supports multiple input methods, including text input, voice input, and image input, and can adapt to different device screen sizes and resolutions to provide a consistent and friendly user interaction experience.
[0025] In this embodiment, the dialog state tracking module involved specifically includes: The fine-tuning unit is used to fine-tune the pre-trained large language model using transfer learning to achieve multi-domain and zero-shot learning; The slot encoding unit is used to annotate and encode key information of the conversation into a unified format using natural language processing technology, and then generate targeted slot prompts with the help of the rich semantic understanding and knowledge reserve of the fine-tuned large language model. The fine-tuned large language model also identifies key features based on the encoded information and generates prompts that are more suitable for the conversation context, thereby guiding the system to accurately focus on the specified information; The prefix prompt unit is used to enhance the understanding of context based on the fine-tuned large language model. It converts slot prompts into key prefix prompts and value prefix prompts. During the conversion process, the fine-tuned large language model uses its understanding of the context to analyze the degree of relevance of each prompt to the context and dynamically adjusts the emphasis of the prompt, thereby enhancing the state tracking capability in combination with the context, allowing the system to more keenly capture key changes in the conversation; The example retrieval unit is used to build a sample library containing dialogue examples from various fields. Through the real-time retrieval mechanism, it uses the fine-tuned large language model to accurately understand the semantics of the current dialogue, and retrieves the dialogue examples most relevant to the current dialogue from the sample library in real time, thereby assisting in generating accurate dialogue status information.
[0026] It should be added here that the fine-tuning unit in the dialogue state tracking module uses transfer learning to fine-tune the pre-trained large language model to achieve multi-domain and zero-shot learning. This process is specifically achieved in the following ways: i) Application of transfer learning technology. Transfer learning is a machine learning method that aims to apply knowledge learned from one or more source tasks to the target task. In the present invention, the fine-tuning unit uses transfer learning technology to transfer the language knowledge and patterns learned by the pre-trained large language model on a large-scale general dataset to the dialogue state tracking task in a specific domain. In this way, the model can quickly adapt and achieve good performance on limited specific domain data.
[0027] ii) Implementation of multi-domain learning. In order to adapt to multi-domain dialogue state tracking tasks, the fine-tuning unit adopts a variety of strategies: ① Domain adaptation: The fine-tuning unit enables the pre-trained large language model to adapt to the language style and dialogue mode of different fields by training on data from multiple fields. This includes pre-processing and labeling dialogue data from different fields to ensure that the model can accurately understand and generate dialogues that conform to the characteristics of the field. ② Domain-specific fine-tuning: During the fine-tuning process, the pre-trained large language model will be specifically optimized for the characteristics of each field. For example, in the field of tourism, the pre-trained large language model will focus on learning tourism-related vocabulary, attraction information, and user preferences; in the medical field, the pre-trained large language model will focus on medical terminology, disease information, and patient needs. In this way, the pre-trained large language model can achieve efficient dialogue state tracking in different fields.
[0028] iii) Implementation of zero-shot learning. Zero-shot learning means that the pre-trained large language model can track the dialogue state in a new domain by transferring and reasoning about the knowledge in the related domain in the absence of training data in a specific domain. The fine-tuning unit implements zero-shot learning in the following ways: ① Knowledge transfer: Using the knowledge learned by the pre-trained large language model on a large-scale general dataset, the fine-tuning unit can transfer this knowledge to the new domain. For example, the pre-trained large language model can infer the dialogue logic and user intention in the new domain by understanding the general dialogue mode and language structure. ② Enhanced reasoning ability: The fine-tuning unit enhances the reasoning ability of the pre-trained large language model, enabling it to generate reasonable dialogue responses through logical reasoning and knowledge association in the absence of specific domain data. For example, the pre-trained large language model can infer the user's potential needs and generate corresponding responses by analyzing the keywords and context input by the user.
[0029] It should also be noted that the fine-tuning unit uses a variety of fine-tuning algorithms to improve the adaptability and performance of the pre-trained large language model, such as: ① LoRA (Low-Rank Adaptation), which is an efficient fine-tuning method that simulates full parameter fine-tuning by adding low-rank matrices to the pre-trained large language model. This method significantly reduces the computing resources and time required for fine-tuning while maintaining performance comparable to full model fine-tuning. LoRA is suitable for situations where labeled data is insufficient, but the effect may not be as good as SFT when the labeled data set is large. ② Adapter Tuning: Adapter tuning achieves fine-tuning by adding small neural network modules (adapters) to each layer of the model. The adapter is independent of the main structure of the model, and only the parameters of the adapter are updated during the fine-tuning process, while the other pre-trained parameters of the model remain unchanged. This method improves the flexibility and adaptability of the model. ③ Prefix Tuning: Prefix tuning achieves fine-tuning by adding a trainable prefix to the input sequence of the pre-trained large language model. The prefix can be a fixed-length vector sequence, and the pre-trained large language model learns these prefixes during the training process to adapt to specific tasks. These are all prior art and will not be described in detail.
[0030] In this embodiment, the thought chain reasoning module involved specifically includes: The external memory encoding unit is used to store and manage the intermediate state information generated during the conversation process, and dynamically retrieve the previously stored intermediate state according to the current conversation state through the information retrieval mechanism to ensure the coherence of the generated reply with the previous conversation content; the intermediate state information includes user input, generated reply and important context information; Tool integration unit, which is used to integrate multiple tools (such as database query, API call, etc.) to support the execution of complex tasks, and integrate the results obtained by calling the tools into the dialogue with the help of feedback mechanism to enhance the interactivity and practicality of the dialogue; The logic connection unit is used to establish logical connections between multiple reasoning steps through the thought chain reasoner when performing complex tasks. This process includes: first, deeply analyzing the key elements of the user input, which are important information that has been processed and identified by the dialogue state tracking module, and then generating the final reply through a series of reasoning steps to ensure that the reply is consistent with the dialogue state tracking module's understanding and processing of the dialogue, so that the entire dialogue reasoning process is logically rigorous; The step-by-step reasoning unit is used to continuously correct and optimize the dialogue state maintained by the dialogue state tracking module through the step-by-step reasoning method through the thought chain reasoner when facing complex and long-sequence dialogues, accurately understand the user's intentions, and generate logically reasonable responses. In this process, the thought chain reasoner sets the reasoning path to ensure that the reasoning results of each step are consistent with the previous content, thereby helping the dialogue state tracking module to accurately understand the user's intentions and generate logically reasonable responses.
[0031] In this embodiment, the dialogue generation module involved specifically includes: Training fine-tuning units are used to extract language features from large-scale unlabeled text data and use transfer learning techniques to fine-tune large language models based on the Transformer architecture on data in a specified domain; The capture adjustment unit is used to use a large language model based on the Transformer architecture to focus on different parts of the input sequence while generating dialogue responses, effectively capture long-range context information, and dynamically adjust the generation strategy according to the context of the current dialogue; The dialogue generation unit is used to use a large language model based on the Transformer architecture to retain and selectively activate important context information in multiple rounds of dialogue, and flexibly adjust the generation strategy according to different user requests and interaction methods; The personalized generation unit is used to analyze the user's emotional state in real time with the help of the emotion recognition module, and adjust the tone and content of the reply according to the user's emotional changes when generating dialogue replies. At the same time, it automatically adjusts the reply style and content according to the user's historical conversations and preferences, and generates natural, fluent, contextual, interactive, relevant and logical replies.
[0032] It should be added that the execution operations of the training fine-tuning unit of the dialogue generation module involved are similar to those of the fine-tuning unit in the dialogue state tracking module, both of which are for fine-tuning the pre-trained large language model to make it meet current needs. The process of fine-tuning the large language model by the training fine-tuning unit is similar to the process of fine-tuning the large language model by the aforementioned fine-tuning unit, and will not be repeated here.
[0033] It should also be added that the large language model involved in the dialogue state tracking module or the dialogue generation module is a model based on the Transformer architecture, and specifically ChatGLM is selected (a language model developed by Zhipu AI, which has the characteristics of efficient parallel computing capabilities and good scalability. It can handle large-scale text data and complex language tasks. It can be used in the dialogue system to accurately track the dialogue state and generate high-quality dialogue responses).
[0034] Specifically, in conjunction with this embodiment, the large language model involved in the dialogue state tracking module or the dialogue generation module adopts a Transformer architecture based on a multi-layer self-attention mechanism and a feedforward network, and introduces a time factor on the Transformer architecture to process the sequence and time correlation of the dialogue in the dialogue system; The introduced time factor is located between the word embedding layer (used to convert the text of the input layer into a word embedding vector) and the feedforward neural network (used to further transform and process the hidden state after the self-attention mechanism), including: The time factors introduced specifically include: 1. The time embedding layer is used to encode the time information of the dialogue turn formed by the text. This time embedding layer can integrate the time information into the word embedding vector after the word embedding layer. Time embedding can be in two forms: Relative time embedding: This embedding represents the relative time interval between dialogue turns. For example, for two dialogue turns i and j, we calculate the relative time difference t between them. ij , and then through a learnable embedding matrix E rel This time difference is mapped into a vector space with a fixed dimension. In this way, the word embedding vector of each dialogue round will carry the relative time information.
[0035] Absolute time embedding: This embedding method represents the absolute timestamp of the dialogue turn. The timestamp of each dialogue turn is t i Through a learnable embedding matrix E abs Mapped into a vector space of fixed dimension. These time embedding vectors will be fused with word embedding vectors, for example by addition or concatenation, to provide temporal information to the subsequent self-attention mechanism.
[0036] 2. The time-aware self-attention mechanism is used to consider the semantic relationship between words in the multi-head self-attention mechanism, and combines the time embedding vector to calculate the attention weight, so that the large language model pays more attention to the conversation content that is related or close in time to better capture the coherence and contextual dependencies of the conversation. Specifically, the time-aware self-attention mechanism is introduced. When calculating the self-attention weight, in addition to the traditional word embedding vectors Q (query vector), K (key vector) and V (value vector), the influence of the time embedding vector is also considered. The time embedding vector can be concatenated or added to the Q and K vectors to form new query and key vectors containing time information. For example, the new query vector Q′ can be Q and the time embedding vector E t In this way, the big prediction model takes both semantic and temporal factors into consideration when calculating the attention score.
[0037] 3. Time decay mechanism, which is used to add a time decay factor in the weight calculation of the feedforward neural network part or the self-attention mechanism, so that the influence of the previous dialogue round on the currently generated answer gradually weakens.
[0038] In the feedforward neural network part, the hidden state of each position can be multiplied by a time decay factor α t , this factor is a value between 0 and 1 and decreases over time. For example, we can define α t =exp(−λt), where λ is a learnable parameter that controls the speed of time decay. In this way, the influence of earlier dialogue rounds on the currently generated answer will gradually weaken, but still retain a certain amount of historical information.
[0039] Of course, in the weight calculation of the self-attention mechanism, the attention score can also be multiplied by a decay coefficient based on the time difference before the softmax function. In this way, the attention weights between earlier rounds will decay faster, thus simulating the gradually weakening attention to past information in human conversations.
[0040] Based on the large language model described above, its operation process is as follows: ① Input: The user enters the dialogue text, and each dialogue round is identified and timestamped. ②2. Word embedding layer: Convert the input dialogue text into a word embedding vector, and each word is mapped to a high-dimensional vector space. ③ Time embedding layer: Encode the time information of each dialogue round, which can be relative time embedding or absolute time embedding: i) Relative time embedding: Calculate the relative time difference between each dialogue round and map it to a vector of fixed dimension. ii) Absolute time embedding: Directly map the absolute timestamp of each dialogue round to a vector of fixed dimension. The time embedding vector is fused (added or concatenated) with the word embedding vector. ④ Time-aware self-attention mechanism: In the multi-head self-attention mechanism, the attention weight is calculated in combination with the time embedding vector. The new query vector Q′ and key vector K′ are obtained by adding or concatenating the time embedding vector with the traditional word embedding vector. Calculate the attention score between Q′ and K′, taking into account semantic and time factors. ⑤ Time decay mechanism: Add the time decay factor α in the weight calculation of the feedforward neural network part or the self-attention mechanism. t , time decay factor α t Usually defined as exp(−λt), where λ controls the speed of time decay. The influence of earlier dialogue rounds on the currently generated answer gradually weakens, but still retains a certain amount of historical information. ⑥ Feedforward neural network: Processes hidden states, applies nonlinear transformations and time decay factors. ⑦ Decoder: Generates answers based on the aforementioned output and time information. ⑧ Output content: You can refer to the information of the dialogue state tracking module to ensure the accuracy and coherence of the answer.
[0041] Through the above process, the big oracle model can more effectively handle the time correlation and sequentiality in the dialogue system, improving the performance and user experience of the dialogue system.
[0042] The specific working process of the system described in this embodiment is as follows: 1. User input stage: The user inputs content through the dialogue interface module, and the input method can be text, voice or image, etc. The dialogue interface module receives the user input and passes it to the subsequent modules for processing.
[0043] Suppose the user inputs: "I want to travel to City A this weekend. Please recommend some interesting attractions to me. It would be best if you could know the ticket prices." 2. Dialogue status tracking stage: (2.1) Fine-tuning unit: Using transfer learning technology, based on the knowledge previously accumulated in the tourism field and related fields, the pre-trained large language model is fine-tuned to adapt to the multi-domain dialogue state tracking task.
[0044] It is assumed that the large language model described in this stage has previously learned a large amount of tourism-related text data, and through fine-tuning it can better handle the current dialogue state tracking task related to the recommendation of tourist attractions in City A.
[0045] (2.2) Slot encoding unit: The key information of the conversation input by the user is annotated and encoded into a unified format. Then, targeted slot prompts are generated with the help of the rich semantic understanding and knowledge reserve of the fine-tuned large language model. The fine-tuned large language model also identifies key features based on the encoded information and generates prompts that are more suitable for the conversation context, thereby guiding the system to focus on the specified information accurately.
[0046] Based on the above assumptions, key information such as "weekend" (time), "city A" (location), "tourism" (user request), "interesting attractions" (request content), and "ticket price" (request content) are encoded into a unified format according to the predefined slot types, and slot prompts are generated, such as "time-weekend", "location-city A", "user request-recommended tourist attractions and ticket prices", etc., to guide the system to pay attention to this information.
[0047] (2.3) Prefix prompt unit: Based on the enhanced understanding of context by the fine-tuned large language model, slot prompts are converted into key prefix prompts and value prefix prompts. During the conversion process, the fine-tuned large language model uses its understanding of the context to analyze the degree of relevance of each prompt to the context and dynamically adjusts the emphasis of the prompt, thereby enhancing the state tracking capability in combination with the context, allowing the system to more sensitively capture key changes in the conversation.
[0048] Based on the above assumptions, “user request - tourist attractions and ticket price recommendations” is converted into a key prefix prompt such as “travel request: attractions and ticket prices”, as well as corresponding more detailed value prefix prompts, to enhance the large language model’s ability to capture key changes in user needs.
[0049] (2.4) Example retrieval unit: In the constructed sample library containing dialogue examples from various fields, through the real-time retrieval mechanism, the fine-tuned large language model is used to accurately understand the semantics of the current dialogue, perform similarity calculations (such as cosine similarity), and retrieve the examples most relevant to the current dialogue.
[0050] Assume that there is a conversation example in the sample library similar to "I plan to travel to City B. What places are worth visiting and how much are the tickets?" Since the location and request type are similar, this example is retrieved to assist in generating accurate conversation status information, determining that the current conversation is in a state related to recommending tourist attractions, and involves location, time, and attention to ticket prices.
[0051] 3. Thinking chain reasoning stage: (3.1) External memory encoding unit: stores and manages the information processed by the dialogue state tracking module and the intermediate state information generated by the previous dialogue (user input, generated replies, and important contextual information), and dynamically retrieves the previously stored intermediate states based on the current dialogue state.
[0052] Based on the aforementioned assumptions, it was found that the user had previously expressed interest in historical and cultural attractions, and this information was retrieved for subsequent reasoning.
[0053] (3.2) Tool integration unit: If the user input involves complex tasks (such as the need to query database information, etc.), the integrated tool module (such as database query, API call, etc.) is called to perform the relevant tasks, and the obtained results are integrated into the dialogue through the feedback mechanism.
[0054] Based on the above assumptions, it is specifically identified that the user's needs involve the complex task of querying tourist attractions and ticket prices in City A. The database query tool module is called to connect to the relevant tourism information database. The database query tool module obtains the interesting attractions in City A and their ticket price information from the database and feeds the results back to the system.
[0055] (3.3) Logical connection unit: It conducts in-depth analysis on the key elements of user input (information processed by the dialogue state tracking module), establishes logical connections between multiple reasoning steps through the thought chain reasoner, and generates preliminary response logic through a series of reasoning steps.
[0056] Based on the aforementioned assumptions, this step specifically determines to filter out popular attractions that are open on weekends from the tourist attraction database, and then further links it to the acquisition of ticket price information.
[0057] (3.4) Step-by-step reasoning unit: When faced with complex and long-sequence dialogues, the mind chain reasoner uses a step-by-step reasoning method to continuously correct and optimize the dialogue state maintained by the dialogue state tracking module, accurately understand the user's intentions, and generate more logical response reasoning results.
[0058] Based on the above assumptions, this step specifically involves first selecting those attractions in City A that are open on weekends, then sorting them according to their popularity, and then combining them with ticket price information to generate a preliminary attraction recommendation logic, such as recommending from high to low popularity, while marking the ticket prices.
[0059] 4. Dialogue generation stage: (4.1) Training and fine-tuning unit: Extract language features from large-scale unlabeled text data, and use transfer learning technology to fine-tune the large language model based on the Transformer architecture on the specified domain data to provide a better language foundation for dialogue generation.
[0060] Based on the above assumptions, we extract expressions and common vocabulary related to tourist attraction recommendations, and fine-tune the large language model based on the Transformer architecture on tourism data, so that it can better generate responses that are in line with the tourist attraction recommendation scenario.
[0061] (4.2) Capture Adjustment Unit: Utilizes a large language model based on the Transformer architecture to simultaneously focus on all parts of the input sequence, effectively capture long-range contextual information, and dynamically adjust the generation strategy according to the context of the current conversation.
[0062] Based on the above assumptions, long-distance contextual information such as the user's attention to City A, weekends, tourist attractions and ticket prices is captured; the generation strategy is dynamically adjusted according to the current conversation context, and it is determined to reply in the form of a list of recommended attractions, which are sorted by popularity.
[0063] (4.3) Dialogue generation unit: retains and selectively activates important contextual information in multiple rounds of dialogue, flexibly adjusts the generation strategy according to different user requests and interaction methods, and combines the reasoning results of the thought chain reasoning module to generate preliminary dialogue response content.
[0064] Assuming that there have been similar travel-related conversations before, the previous contextual information related to travel preferences is retained, and the information related to the recommendation of tourist attractions in City A is selectively activated. According to the user's request method, the generation strategy is flexibly adjusted to generate preliminary response content, such as "Recommend you fun attractions in City A on weekends: attraction a, the ticket price is X yuan; attraction b, the ticket price is Y yuan..."
[0065] (4.4) Personalized generation unit: With the help of the emotion recognition module, the user's emotional state is analyzed in real time, and the tone and content of the reply are adjusted according to the user's emotional changes. At the same time, the reply style and content are automatically adjusted according to the user's historical conversations and preferences, generating a natural, fluent, contextual, interactive, relevant and logical final reply.
[0066] Assuming that the user was previously interested in historical and cultural attractions, focus on introducing historical and cultural attractions such as attraction A in the reply, and generate a natural, smooth, contextual, interactive, relevant and logical reply: "Wow, it's great to travel to city A on the weekend! I strongly recommend attraction A, which carries a profound historical and cultural heritage and the ticket price is X yuan. There is also attraction B, which is magnificent and the ticket price is Y yuan. These two attractions are very popular on weekends and are worth a visit!" 5. Results display stage: The final response generated is displayed to the user through the dialogue interface module. The user can see the output results generated by the system and complete a dialogue interaction.
[0067] Based on the above assumptions, the user can finally see the system-recommended weekend tourist attractions and ticket price information in City A, completing the dialogue interaction.
[0068] In summary, the generative dialogue system based on a large language model of the present invention can improve the recognition ability of user intentions and the reasoning ability of the system in multi-round dialogues, and solve the limitations of existing generative dialogue systems in multi-round dialogues.
[0069] The above specific examples are used to explain the principles and implementation methods of the present invention in detail. These examples are only used to help understand the core technical content of the present invention. Based on the above specific embodiments of the present invention, any improvements and modifications made by technicians in this technical field without departing from the principles of the present invention should fall within the scope of patent protection of the present invention.
Claims
1. A generative dialogue system based on a large language model, characterized in that: Its structure includes: The dialogue interface module is responsible for receiving user input and displaying the corresponding output results generated by the system to the user; The dialogue state tracking module is used to encode and generate prompts using key dialogue information, transform prompts based on context, and use transfer learning to fine-tune the large language model to adapt to multi-domain dialogue state tracking tasks. It also builds a sample library containing dialogue examples from multiple fields to retrieve relevant examples in real time, so as to accurately and real-timely track the dialogue state in multiple rounds of dialogue. The thinking chain reasoning module is used to store and manage the intermediate state information generated during the dialogue process, and dynamically retrieve the previously stored intermediate state according to the current dialogue state to ensure the coherence of the generated reply with the previous dialogue content; it is also used to call multiple tools to perform complex tasks, integrate the obtained results into the dialogue, establish logical connections between multiple reasoning steps, analyze the key elements of the user input and reason step by step to understand the user's intention; The dialogue generation module adopts a large language model with a Transformer architecture based on a multi-layer self-attention mechanism and a feedforward network. It is used to pay attention to all parts of the input sequence while generating dialogue replies, effectively capture long-distance contextual information, and dynamically adjust the generation strategy according to the context of the current dialogue. It extracts language features from large-scale unlabeled text data and fine-tunes the large language model with a Transformer architecture on data in specified domains. It is used to retain and selectively activate important contextual information in multiple rounds of dialogues, flexibly adjust the generation strategy according to different user requests and interaction methods, analyze the user's emotional state in real time and adjust the tone and content of the reply accordingly, and automatically adjust the reply style and content according to the user's historical dialogues and preferences to achieve personalized replies.
2. A generative dialogue system based on a large language model according to claim 1, characterized in that: The dialogue state tracking module specifically includes: The fine-tuning unit is used to fine-tune the pre-trained large language model using transfer learning to achieve multi-domain and zero-shot learning; The slot encoding unit is used to annotate and encode key information of the conversation into a unified format using natural language processing technology, and then generate targeted slot prompts with the help of the rich semantic understanding and knowledge reserve of the fine-tuned large language model. The fine-tuned large language model also identifies key features based on the encoded information and generates prompts that are more suitable for the conversation context, thereby guiding the system to accurately focus on the specified information; The prefix prompt unit is used to enhance the understanding of context based on the fine-tuned large language model. It converts slot prompts into key prefix prompts and value prefix prompts. During the conversion process, the fine-tuned large language model uses its understanding of the context to analyze the degree of relevance of each prompt to the context and dynamically adjusts the emphasis of the prompt, thereby enhancing the state tracking capability in combination with the context, allowing the system to more keenly capture key changes in the conversation; The example retrieval unit is used to build a sample library containing dialogue examples from various fields. Through the real-time retrieval mechanism, it uses the fine-tuned large language model to accurately understand the semantics of the current dialogue, and retrieves the dialogue examples most relevant to the current dialogue from the sample library in real time.
3. A generative dialogue system based on a large language model according to claim 2, characterized in that: In the process of generating a dialogue response, the example retrieval unit uses a real-time retrieval mechanism and similarity calculation to retrieve the example most relevant to the current dialogue from the sample library, thereby assisting in generating accurate dialogue status information.
4. A generative dialogue system based on a large language model according to claim 2, characterized in that: The thought chain reasoning module specifically includes: The external memory encoding unit is used to store and manage the intermediate state information generated during the conversation, and dynamically retrieve the previously stored intermediate state according to the current conversation state through the information retrieval mechanism to ensure the coherence of the generated response with the previous conversation content; The tool integration unit is used to integrate multiple tools to support the execution of complex tasks. It also uses the feedback mechanism to integrate the results obtained by calling the tools into the dialogue to enhance the interactivity and practicality of the dialogue. A logic connection unit, which is used to establish logical connections between multiple reasoning steps through a thought chain reasoner when performing complex tasks; The step-by-step reasoning unit is used to adopt a step-by-step reasoning method through the thought chain reasoner when facing complex and long-sequence dialogues, continuously correct and optimize the dialogue state maintained by the dialogue state tracking module, accurately understand the user's intentions, and generate logically reasonable responses.
5. A generative dialogue system based on a large language model according to claim 4, characterized in that: The external memory encoding unit stores and manages intermediate state information generated during the conversation, including user input, generated replies, and important context information.
6. A generative dialogue system based on a large language model according to claim 4, characterized in that: When executing complex tasks, the logic connection unit establishes logical connections between multiple reasoning steps through the thought chain reasoner. This process includes: firstly, deeply analyzing the key elements of the user input, which are important information that has been processed and identified by the dialogue state tracking module, and then generating the final reply through a series of reasoning steps to ensure that the reply is consistent with the dialogue state tracking module's understanding and processing of the dialogue, so that the entire dialogue reasoning process is logically rigorous; When faced with complex and long-sequence dialogues, the step-by-step reasoning unit uses a step-by-step reasoning method through the thought chain reasoner to continuously correct and optimize the dialogue state maintained by the dialogue state tracking module, accurately understand the user's intention, and generate logically reasonable responses. In this process, the thought chain reasoner sets the reasoning path to ensure that the reasoning result of each step is consistent with the previous content, thereby helping the dialogue state tracking module to accurately understand the user's intention and generate logically reasonable responses.
7. A generative dialogue system based on a large language model according to claim 4, characterized in that: The dialogue generation module specifically includes: Training fine-tuning units are used to extract language features from large-scale unlabeled text data and use transfer learning techniques to fine-tune large language models based on the Transformer architecture on data in a specified domain; The capture adjustment unit is used to use a large language model based on the Transformer architecture to focus on different parts of the input sequence while generating dialogue responses, effectively capture long-range context information, and dynamically adjust the generation strategy according to the context of the current dialogue; The dialogue generation unit is used to use a large language model based on the Transformer architecture to retain and selectively activate important context information in multiple rounds of dialogue, and flexibly adjust the generation strategy according to different user requests and interaction methods; The personalized generation unit is used to analyze the user's emotional state in real time with the help of the emotion recognition module, and adjust the tone and content of the reply according to the user's emotional changes when generating dialogue replies. At the same time, it automatically adjusts the reply style and content according to the user's historical conversations and preferences, and generates natural, fluent, contextual, interactive, relevant and logical replies.
8. A generative dialogue system based on a large language model according to claim 7, characterized in that: The large language models in the dialogue state tracking module and the dialogue generation module both adopt a Transformer architecture based on a multi-layer self-attention mechanism and a feedforward network, and introduce a time factor into the Transformer architecture to handle the sequentiality and time correlation of the dialogue in the dialogue system; The introduced time factor is located between the word embedding layer and the feedforward neural network, including: A time embedding layer, used to encode the time information of the dialogue turns formed by the text, wherein the time embedding is a relative time embedding, used to represent the relative time interval between dialogue turns, or the time embedding is an absolute time embedding, used to represent the absolute timestamp of the dialogue turn; The time-aware self-attention mechanism is used to consider the semantic relationship between words in the multi-head self-attention mechanism and combine the time embedding vector to calculate the attention weight, so that the large language model pays more attention to the conversation content that is related or close in time, so as to better capture the coherence and contextual dependency of the conversation; The time decay mechanism is used to add a time decay factor to the weight calculation of the feedforward neural network part or the self-attention mechanism, so that the influence of the previous dialogue round on the current generated answer gradually weakens; Among them: the word embedding layer is used to convert the text of the input layer into a word embedding vector, and the feedforward neural network is used to further transform and process the hidden state after being processed by the self-attention mechanism.
9. A generative dialogue system based on a large language model according to claim 1, characterized in that: The dialogue interface module supports multiple input methods, including text input, voice input and image input, and can adapt to different device screen sizes and resolutions to provide a consistent and friendly user interaction experience.
Citation Information
Patent Citations
Equipment residual life prediction model construction method based on deep learning
CN113051839A
Multi-modal sentiment analysis method based on multi-task learning and stacked cross-modal fusion
CN114694076A
Dialogue assisting method and device and electronic equipment
CN116483964A
Medical dialogue-oriented time perception enhanced reply generation method and device
CN117708301A
Intelligent customer service return visit system capable of continuously learning
CN118411990A
Cited By
Intelligent marketing verbal skill self-adaptive generation method based on multi-round interaction feedback
CN120277274A
Controllable dialogue case generation method based on large model
CN120353907A
Multi-round dialogue agent system based on deep learning and control method thereof
CN120874856A
Digital employee reply generation method, system and device and storage medium
CN121009181A
Interaction mode recommendation method fusing user preference and ergonomics
CN121118963A