Method, device and computer storage medium for reply generation based on multi-turn dialogue
By identifying and updating referential information in multi-turn dialogues and reconstructing citation relationships, the problem of inaccurate semantic understanding caused by pronouns in multi-turn dialogue scenarios is solved, improving the coherence of dialogues and the accuracy of responses.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG DAHUA TECH CO LTD
- Filing Date
- 2026-02-04
- Publication Date
- 2026-06-05
AI Technical Summary
Existing AI models struggle to accurately trace the referents of pronouns in multi-turn dialogue scenarios, resulting in insufficient dialogue coherence and response accuracy.
By identifying referential information and historical dialogue in the original input, an initial semantic representation is determined. When the referential information includes the result referential type, the initial semantic representation is updated. Combined with the reconstruction of reference relationships, a target semantic representation is generated to determine the response information.
It enables accurate tracing of pronouns, improving the coherence and responsiveness of multi-turn dialogues.
Smart Images

Figure CN122152983A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of natural language processing technology, and in particular to a response generation method, device, and computer storage medium based on multi-turn dialogue. Background Technology
[0002] With the rapid development of natural language processing technology, multi-turn dialogue interactions between users and artificial intelligence models have been widely applied in various fields such as intelligent customer service, office assistance, and intelligent terminal control. In actual multi-turn dialogue scenarios between users and artificial intelligence models, in order to improve communication efficiency, users often adopt concise expression strategies based on the preceding dialogue content. Specifically, they use pronouns such as "it," "this," "that," "the solution," and "the above operation" to refer to people, things, events, solutions, or operational steps mentioned earlier.
[0003] However, because the semantic information of multi-turn dialogues is scattered in the context of multi-turn interactions, existing artificial intelligence models often struggle to fully explore and establish strong connections between the content of each turn of dialogue. They also cannot accurately trace the referents of pronouns, resulting in insufficient coherence of the dialogue and accuracy of the response.
[0004] Therefore, how to solve the problem of inaccurate semantic understanding caused by users' use of pronouns in multi-turn dialogue scenarios, and improve the coherence of dialogue and the accuracy of response, has become a technical bottleneck that urgently needs to be overcome. Summary of the Invention
[0005] To address the aforementioned technical problems, this application provides a response generation method, apparatus, and computer storage medium based on multi-turn dialogue.
[0006] To address the aforementioned technical problems, this application provides a response generation method based on multi-turn dialogue, the method comprising: Based on the referential information in the original input and the historical dialogue, an initial semantic representation is determined; when the referential information includes referential words of the result referential type, the initial semantic representation is updated according to the initial semantic representation and the corresponding reference relationship to obtain the target semantic representation; the response information corresponding to the original input is determined based on the target semantic representation.
[0007] The process of determining the initial semantic representation based on the referential information and historical dialogue in the original input includes: performing semantic restoration on the original input based on the referential information and historical dialogue to obtain the target input; and performing semantic analysis on the target input to obtain the initial semantic representation.
[0008] The semantic restoration of the original input based on the referential information and the historical dialogue includes: when the referential information includes referential words of the question referential type, obtaining all historical questions within a preset window; determining the semantic similarity between the original input and each historical question, and filtering out target historical questions whose semantic similarity meets preset conditions; performing referential resolution on the original input based on the target historical questions to obtain referential resolution input; and performing semantic completion on the referential resolution to obtain the target input.
[0009] The step of resolving the referential inference of the original input based on the target historical question includes: obtaining a first semantic tag set corresponding to the target historical question; obtaining a second semantic tag set corresponding to the non-question referential content in the original input; determining a target semantic tag set based on the first semantic tag set and the second semantic tag set, wherein the target semantic tag set is a subset of the first semantic tag set, and the semantic tags in the target semantic tag set are not recorded in the second semantic tag set; obtaining the historical content of the target historical question corresponding to each semantic tag in the target semantic tag set; and performing referential word replacement on the original input based on the historical content.
[0010] The method further includes: when the referential information does not include referential words of the question referential type, performing semantic completion on the original input to obtain the target input.
[0011] The method further includes: when the preset window does not contain historical questions whose semantic similarity meets the preset conditions, obtaining persistently stored historical dialogue semantic summaries, wherein the timestamps corresponding to the historical dialogue semantic summaries are earlier than the preset window; recalling the N historical dialogue semantic summaries with the highest semantic similarity through an approximate nearest neighbor search of semantic vectors; and generating the target input based on the N historical dialogue semantic summaries and a large language model.
[0012] The initial semantic representation includes intent tags and slot value pairs corresponding to intent tags. Updating the initial semantic representation based on the initial semantic representation and the corresponding reference relationship to obtain the target semantic representation includes: obtaining reference information items that have a reference relationship with the reference of the result reference type; and fusing the reference information items into the slot structure of the initial semantic representation to obtain the target semantic representation.
[0013] Before determining the initial semantic representation based on the referential information in the original input and the historical dialogue, the method further includes: identifying all referential words in the original input; determining the referential type corresponding to each referential word, wherein the referential type includes result referential and question referential; and determining all referential words and the referential type corresponding to each referential word as the referential information.
[0014] To address the aforementioned technical problems, this application also provides a response generation device based on multi-turn dialogue, the response generation device based on multi-turn dialogue including a memory and a processor coupled to the memory; wherein, the memory is used to store program data, and the processor is used to execute the program data to implement the response generation method based on multi-turn dialogue as described above.
[0015] To address the aforementioned technical problems, this application also provides a computer storage medium storing a computer program, which, when executed by a processor, implements the steps in the multi-turn dialogue-based response generation method described above.
[0016] Compared with existing technologies, the beneficial effects of this application are as follows: An initial semantic representation is determined based on the referential information in the original input and historical dialogue; when the referential information includes referential words of the result referential type, the initial semantic representation is updated based on the initial semantic representation and the corresponding citation relationship to obtain the target semantic representation; the response information corresponding to the original input is determined based on the target semantic representation, realizing the tracing of the referential objects of the referential words in the original input, solving the problem of inaccurate semantic understanding caused by users using referential words in multi-turn dialogue scenarios, and improving dialogue coherence and response accuracy. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein: Figure 1 This is a flowchart illustrating an embodiment of the response generation method based on multi-turn dialogue provided in this application; Figure 2 This is a structural diagram of the semantic completion module provided in this application; Figure 3 This is a flowchart illustrating the semantic restoration process provided in this application; Figure 4 This is a schematic diagram of the citation relationship reconstruction module in this application; Figure 5 This is a schematic diagram of the response information generation process provided in this application; Figure 6 This is a schematic diagram of an embodiment of the response generation device based on multi-turn dialogue provided in this application; Figure 7 This is a schematic diagram of the structure of an embodiment of the computer storage medium provided in this application. Detailed Implementation
[0018] To make the above-mentioned objectives, features, and advantages of this application more apparent and understandable, the specific embodiments of this application will be described in detail below with reference to the accompanying drawings. It is to be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, it should be noted that, for ease of description, only the parts relevant to this application are shown in the accompanying drawings, not all structures. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0019] The terms “first,” “second,” etc. (if applicable) in this application are used to distinguish different objects, not to describe a particular order. Furthermore, the terms “comprising” and “featured,” and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus.
[0020] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0021] The response generation method based on multi-turn dialogue of this application is applied to a response generation device based on multi-turn dialogue. This response generation device can be a server, a terminal device, or a system in which the server and terminal device cooperate. Accordingly, the various parts of the response generation device based on multi-turn dialogue, such as units, sub-units, modules, and sub-modules, can all be located in the server, all in the terminal device, or separately in both the server and the terminal device.
[0022] Furthermore, the aforementioned server can be either hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When the server is software, it can be implemented as multiple software programs or software modules, such as software or software modules used to provide distributed server functionality, or as a single software program or software module; no specific limitations are made here.
[0023] Please see Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the response generation method based on multi-turn dialogue provided in this application.
[0024] Specifically, such as Figure 1 As shown, the specific steps are as follows: Step S11: Determine the initial semantic representation based on the referential information in the original input and the historical dialogue.
[0025] In this embodiment of the application, the original input is the natural language content that the user directly enters into the dialog box. After the user completes the input, the referential information in the original input is first identified.
[0026] The pronouns in the input are divided into two types: question pronouns and result pronouns. The pronoun information in the original input is used to indicate whether the original input includes pronouns and to indicate the type of each pronoun.
[0027] Before determining the initial semantic representation based on the referential information in the original input and the historical dialogue, the method further includes: identifying all referential words in the original input; determining the referential type corresponding to each referential word, wherein the referential type includes result referential and question referential; and determining all referential words and the referential type corresponding to each referential word as the referential information.
[0028] Among them, the referential expression in the original input is identified by the referential recognition and classification unit.
[0029] The pronoun identification and classification unit uses a lightweight deep learning model to extract pronouns and indicator words, such as "it" and "ne", from the original input, and classifies the identified pronouns by using rule templates to determine whether the pronouns in the original input belong to the question reference type or the result reference type.
[0030] Question referential pronouns are used to refer to the content of questions in the historical dialogue, while result referential pronouns are used to refer to the content of query results in the historical dialogue.
[0031] The referential identification and classification unit can also introduce a deep learning-based named entity recognition model to improve the detection accuracy of implicit referentials and pronoun boundaries in complex contexts. It can identify the special entity category of quoting pronouns and is used to label words with referential functions in the original input and their contextual boundaries, such as "it", "this", "the above", "the latter", "the XX mentioned above", etc.
[0032] The Named Entity Recognition model outputs a sequence of entities with labels. For example, if the original input is "What is its GDP?", the corresponding sequence of entities with labels is {"text": "it", "type": "result referencing type", "referencing identifier": 1}.
[0033] The named entity recognition model supports an online incremental learning mechanism, continuously optimizing its ability to recognize domain-specific references based on actual dialogue logs (such as the high frequency of "this indicator" and "this model" in data analysis scenarios). This significantly improves the accuracy and robustness of result reference detection, and enables automated recognition of diverse and non-standard references, providing high-quality pre-analysis support for subsequent response generation.
[0034] In an optional embodiment, determining the initial semantic representation based on the referential information in the original input and the historical dialogue includes: performing semantic restoration on the original input based on the referential information and the historical dialogue to obtain the target input; and performing semantic analysis on the target input to obtain the initial semantic representation.
[0035] Specifically, semantic restoration of the original input includes dereference resolution and semantic completion. Dereference resolution refers to replacing the pronouns in the original input with the actual content they refer to, while semantic completion is to complete the semantic content omitted in the original input.
[0036] The semantic restoration of the original input based on the referential information and the historical dialogue includes: when the referential information includes referential words of the question referential type, obtaining all historical questions within a preset window; determining the semantic similarity between the original input and each historical question, and filtering out target historical questions whose semantic similarity meets preset conditions; performing referential resolution on the original input based on the target historical questions to obtain referential resolution input; and performing semantic completion on the referential resolution to obtain the target input.
[0037] In this embodiment of the application, the dereference resolution mainly resolves the dereferences of the problem reference type. That is, the dereferences of the problem reference type are resolved only when the reference information includes the dereferences of the problem reference type. The dereferenced input is then semantically completed to obtain the target input.
[0038] Otherwise, if the referential information does not include referential words of the problem referential type, referential resolution is not performed, and semantic completion is directly performed on the original input to obtain the target input.
[0039] When the referential information includes referential words of the question referential type, referential resolution is required. Specifically, this includes: obtaining all historical questions in the preset window; finding the most relevant preceding question (i.e., the historical question) from the historical dialogue; and performing referential resolution on the original input based on the historical question.
[0040] Determine the semantic similarity between the original input and each historical question in the preset window, and filter out the target historical questions whose semantic similarity meets the preset conditions; perform referential resolution on the original input based on the target historical questions.
[0041] During pronoun resolution, a rule-based template replacement mechanism can be used to replace the pronouns in the original input with the most relevant entities in the historical questions. The most relevant entities are those in the target historical questions that meet the preset conditions.
[0042] The original input and all historical questions are encoded into vectors, and the cosine similarity is calculated to determine the semantic similarity between the original input and the historical questions. The historical questions with the highest semantic similarity and a semantic similarity higher than a preset threshold are identified as target historical questions whose semantic similarity meets the preset conditions.
[0043] The step of resolving the referential inference of the original input based on the target historical question includes: obtaining a first semantic tag set corresponding to the target historical question; obtaining a second semantic tag set corresponding to the non-question referential content in the original input; determining a target semantic tag set based on the first semantic tag set and the second semantic tag set, wherein the target semantic tag set is a subset of the first semantic tag set, and the semantic tags in the target semantic tag set are not recorded in the second semantic tag set; obtaining the historical content of the target historical question corresponding to each semantic tag in the target semantic tag set; and performing referential word replacement on the original input based on the historical content.
[0044] In this embodiment of the application, semantic tags corresponding to multiple text contents in the target historical question are identified, namely the first semantic tag set, and semantic tags corresponding to text contents in the target historical question other than pronouns referring to the question referencing type are identified, namely the second semantic tag set.
[0045] Obtain semantic tags that are not recorded in the second semantic tag set but are recorded in the first semantic tag set to form a target semantic tag set. Replace the pronouns in the original input with the historical content of each semantic tag in the target historical question to obtain the target input.
[0046] For example, if the original input is "What about location A in 2023?", the target historical question with the highest semantic similarity to the original input is "What is the population of location B in 2023?", and the target semantic tag set is {population query}, whose corresponding historical content is "What is the population?". Therefore, after replacing the pronouns of the question reference type in the original input, the target input is "What is the population of location A in 2023?".
[0047] The semantic completion module restores the semantic meaning of the original input. Please refer to [link / reference]. Figure 2 , Figure 2 This is a structural diagram of the semantic completion module provided in this application, as shown below. Figure 2 As shown, the semantic completion module includes a context management unit, a referential identification and classification unit, a semantic matching and retrieval unit, and a completion generation unit.
[0048] Please see Figure 3 , Figure 3 This is a flowchart illustrating the semantic restoration process provided in this application, such as... Figure 3 As shown, the semantic restoration process includes: Step S111: Receive the user's raw input.
[0049] Step S112: The context management unit uses a sliding window mechanism to select the most recent multi-turn dialogue.
[0050] The context management unit constructs a local context window, or preset window, for the current dialogue. For example, it uses the five most recent historical dialogues within the current dialogue as a preset window. For historical dialogues outside the preset window, a corresponding high-level semantic summary is generated by the summary generation model to form a searchable long-term memory index, which is then stored in a persistent database.
[0051] After each round of dialogue, the system stores user input and responses in a structured format in a local dialogue cache and simultaneously writes them to a persistent dialogue history database. For historical dialogues that have exceeded a preset window, a summary generation model is invoked to automatically generate a high-level semantic summary, including key entities, discussion topics, and important conclusions, and appends timestamps and topic tags to form indexable long-term memory entries. This effectively balances processing efficiency and contextual integrity, enabling the system to perceive the state of distant dialogues even under resource-constrained conditions.
[0052] Step S113: The pronoun identification and classification unit identifies the pronouns in the original input and determines whether the identified pronouns are problem pronoun types. If yes, proceed to step S114; otherwise, proceed to step S115.
[0053] Step S114: The semantic matching and retrieval unit performs semantic matching between the original input and the historical dialogue and retrieves the most relevant historical dialogue, and then executes step S115.
[0054] The semantic matching and retrieval unit acquires all historical questions within a preset window; determines the semantic similarity between the original input and each historical question within the preset window; and filters out target historical questions whose semantic similarity meets preset conditions. The target historical question is the most relevant historical dialogue.
[0055] When no target historical question is found that matches the semantic similarity to the preset conditions, the original input may contain distant references or cross-topic backtracking. A retrieval mechanism based on semantic vector approximate nearest neighbor search recalls the N semantic summaries of historical dialogues with the highest semantic similarity from the database. The completion generation unit generates the target input based on the N semantic summaries of historical dialogues and the large language model.
[0056] By combining local windows with long-term memory in hierarchical context management, the problem of information forgetting due to excessively long context or reference parsing failure caused by context truncation in multi-turn dialogues is solved. While ensuring processing efficiency, the accuracy of semantic restoration and system scalability are significantly improved.
[0057] Step S115: The completion generation unit outputs a semantically complete question, which is the target input.
[0058] The completion generation unit can be constructed using a large language model. The retrieval results (target historical question or the semantic summaries of the N historical dialogues with the highest semantic similarity) are input into the large language model. The large language model outputs a question with complete semantics, which is the target input. The large language model sets prompt words to guide the generation of output results. The output of the large language model is set with processing, verification, and editing mechanisms. For example, if the output of the large language model is abnormal, it will fall back to the original input.
[0059] Large language models guide the output of target input by constructing specific prompts. For example, a specific prompt template is: history dialogue is [×], the user's latest question is [×], please rewrite the user's latest question into a complete question that does not depend on the context.
[0060] The completion and generation unit can also add system instructions or multimodal information to specific prompts as contextual information. Multimodal information can be converted into natural language descriptions and aligned with the input at the text level, or converted into vectors and aligned with text vectors. The completion and generation unit can also impose format requirements on the output by adjusting the prompt words and increase post-processing validation to improve stability. For example, if the format of the generated target input does not conform to the requirements, the large language model output is considered incomplete or divergent, and a degradation strategy using the original input as the output result ensures that the system can execute normally.
[0061] Step S12: When the referential information includes a referential word of the result referential type, update the initial semantic representation according to the initial semantic representation and the corresponding reference relationship to obtain the target semantic representation.
[0062] In this embodiment, the pronouns of the question reference type in the original input are replaced, while the pronouns of the result reference type in the original input are not directly replaced, but the semantic representation of the input is updated based on the reconstruction of the reference relationship.
[0063] Semantic analysis is performed on the target input to obtain an initial semantic representation, including: identifying the intent of the target input to obtain an intent label; obtaining the value of the slot corresponding to the intent label in the target input to obtain a set of slot value pairs; and determining the structured representation of the target semantic representation based on the intent label and the set of slot value pairs.
[0064] The slot structure of the initial semantic representation includes intent tags and slot value pairs corresponding to the intent tags; The initial semantic representation is updated according to the initial semantic representation and the corresponding reference relationship to obtain the target semantic representation, including: obtaining reference information items that have a reference relationship with the reference of the result reference type; and merging the reference information items into the slot structure of the initial semantic representation to obtain the target semantic representation.
[0065] In this embodiment of the application, the referent of the result referencing type refers to the content in the previous system response result. When the referencing information includes the referent of the result referencing type, the reference relationship in the initial semantic representation is reconstructed through the reference relationship reconstruction module.
[0066] Please see Figure 4 , Figure 4 This is a schematic diagram of the reference relationship reconstruction module in this application. The reference relationship reconstruction module includes a reference index construction unit, a context alignment and binding unit, and a structure fusion unit.
[0067] The reference index building unit automatically builds and maintains a dynamically updated reference index table after the response information of each round of dialogue is generated. This table records all information items in the response information that may be referenced in the future. It retrieves all information units that may be referenced from the response results, including various attributes and their values. Each information unit corresponds to a reference information item, and each reference information item is assigned a unique reference identifier and attached with contextual metadata, such as the generation round, topic tags, and timeliness markers. The reference information items are written into the reference index table and persistently saved to the database.
[0068] When the context alignment and binding unit includes result referential terms (denoted as result referential terms), it semantically aligns the result referential terms with the referential information items in the historical dialogue, establishing a precise referential binding relationship between the result referential terms and the referential information items in the historical dialogue.
[0069] The context alignment and binding unit takes the target input, the detected result pronouns, and the historical dialogue as contextual information, organizes them into a preset prompt template, inputs it into the large language model, and then the large language model infers and outputs the most likely referent and its reference identifier.
[0070] For example, the prompt template includes a task description, dialogue history, current question, target word and candidate information items, and output target. The task description is specifically: "Based on the following dialogue history and current question, please analyze which specific referential information item the target word refers to and return its reference identifier. If the target word has no explicit referent or points to a historical question, please answer 'No match'."
[0071] The current problem is the target input, the target word is the result referent in the target input, the candidate information item is the referent information item in the reference index table, and the output target is the reference identifier of the referent information item referred to by the target word in the final input.
[0072] The structured fusion unit obtains referential information items that have a referential relationship with the referential words of the result referential type according to the reference identifier, and merges the referential information items into the slot structure of the initial semantic representation to realize the reconstruction of the reference relationship in the initial semantic representation.
[0073] The structured fusion unit also integrates the parsed reference binding relationships into the structured initial semantic representation, realizing the closed-loop transmission of context information. This allows the original data source to be accessed directly through the reference identifier when generating response information, avoiding information transmission distortion and improving the accuracy of task execution.
[0074] By combining explicit reference indexing with a structured fusion mechanism, not only is the coherence of the dialogue improved, but the burden on users' expression is also reduced, repeated questions are avoided, and the human-computer interaction experience is significantly optimized. Furthermore, since the referents of result reference types may refer to large sections of the system's output, the reconstruction of reference relationships avoids repeated semantic analysis of the same content, thus reducing the computational load of the system.
[0075] Step S13: Determine the response information corresponding to the original input based on the target semantic representation.
[0076] In this embodiment, the pronouns of the question reference type in the original input are resolved by reference, and the reference relationship of the pronouns of the result reference type in the original input is reconstructed to obtain the target semantic representation. Based on the target semantic representation and the large language model, the final response information expressed in natural language is obtained.
[0077] Through the above embodiments, an initial semantic representation is determined based on the referential information in the original input and the historical dialogue. When the referential information includes referential words of the result referential type, the initial semantic representation is updated based on the initial semantic representation and the corresponding reference relationship to obtain the target semantic representation. The response information corresponding to the original input is determined based on the target semantic representation, thereby realizing the tracing of the referential objects of the referential words in the original input. This solves the problem of inaccurate semantic understanding caused by users using referential words in multi-turn dialogue scenarios and improves the coherence of the dialogue and the accuracy of the response.
[0078] Please see Figure 5 , Figure 5 This is a schematic diagram of the response information generation process provided in this application, such as... Figure 5 As shown, the process includes: acquiring the user's original input and identifying pronouns and referential types in the original input; performing semantic restoration on the original input to obtain the target input, wherein semantic restoration includes completing omitted information in the original input and resolving referential types of pronouns in the question; performing natural language understanding on the target input to obtain an initial semantic representation, wherein natural language understanding includes intent recognition and slot filling; reconstructing reference relationships from the initial semantic representation to obtain the target semantic representation; determining the dialogue strategy based on the target semantic representation and generating response information; and outputting the response information by the system.
[0079] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0080] To implement the above-mentioned response generation method based on multi-turn dialogue, this application also proposes a response generation device based on multi-turn dialogue, which can be found in the details. Figure 6 , Figure 6 This is a schematic diagram of an embodiment of the response generation device based on multi-turn dialogue provided in this application.
[0081] The response generation device 400 based on multi-turn dialogue in this embodiment includes a processor 41, a memory 42, an input / output device 43, and a bus 44.
[0082] The processor 41, memory 42, and input / output device 43 are respectively connected to the bus 44. The memory 42 stores program data, and the processor 41 is used to execute the program data to implement the response generation method based on multi-turn dialogue described in the above embodiment.
[0083] In this embodiment, processor 41 can also be referred to as a CPU (Central Processing Unit). Processor 41 may be an integrated circuit chip with signal processing capabilities. Processor 41 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor, or processor 41 can be any conventional processor.
[0084] This application also provides a computer storage medium; please refer to the following: Figure 7 , Figure 7 This is a schematic diagram of a computer storage medium according to an embodiment of the present application. The computer storage medium 600 stores a computer program 61, which, when executed by a processor, is used to implement the response generation method based on multi-turn dialogue in the above embodiment.
[0085] When the embodiments of this application are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part 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.) or processor 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.
[0086] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A response generation method based on multi-turn dialogue, characterized in that, The response generation method based on multi-turn dialogue includes: Determine the initial semantic representation based on the referential information in the original input and the historical dialogue; When the referential information includes a referential word of the result referential type, the initial semantic representation is updated according to the initial semantic representation and the corresponding reference relationship to obtain the target semantic representation; The response information corresponding to the original input is determined based on the target semantic representation.
2. The response generation method based on multi-turn dialogue according to claim 1, characterized in that, Based on the referential information in the original input and the historical dialogue, determine the initial semantic representation, including: Based on the referential information and the historical dialogue, the original input is semantically restored to obtain the target input; The target input is subjected to semantic analysis to obtain the initial semantic representation.
3. The response generation method based on multi-turn dialogue according to claim 2, characterized in that, Based on the referential information and the historical dialogue, semantic restoration is performed on the original input, including: When the referential information includes referential words of the question referential type, retrieve all historical questions within the preset window; Determine the semantic similarity between the original input and each historical question, and filter out target historical questions whose semantic similarity meets preset conditions; Based on the target historical question, the original input is subjected to substitution resolution to obtain the substitution resolution input; The semantic completion of the referential resolution is performed to obtain the target input.
4. The response generation method based on multi-turn dialogue according to claim 3, characterized in that, The step of performing reference resolution on the original input based on the target historical question includes: Obtain the first semantic tag set corresponding to the target historical question; Obtain the second semantic tag set corresponding to the non-problem referents in the original input; A target semantic tag set is determined based on the first semantic tag set and the second semantic tag set, wherein the target semantic tag set is a subset of the first semantic tag set, and the semantic tags in the target semantic tag set are not recorded in the second semantic tag set; Obtain the historical content of the target historical question corresponding to each semantic tag in the target semantic tag set; The original input is replaced with pronouns based on the historical content.
5. The response generation method based on multi-turn dialogue according to claim 3, characterized in that, The method further includes: When the referential information does not include referential words of the problem referential type, semantic completion is performed on the original input to obtain the target input.
6. The response generation method based on multi-turn dialogue according to claim 3, characterized in that, The method further includes: When the preset window does not contain any historical questions whose semantic similarity meets the preset conditions, a persistently stored semantic summary of the historical dialogue is obtained, wherein the timestamp corresponding to the semantic summary of the historical dialogue is earlier than the preset window. Recall the N historical dialogue semantic summaries with the highest semantic similarity by using an approximate nearest neighbor search of semantic vectors; The target input is generated based on the semantic summaries of the N historical dialogues and the large language model.
7. The response generation method based on multi-turn dialogue according to claim 1, characterized in that, The initial semantic representation includes intent tags and slot value pairs corresponding to the intent tags; The initial semantic representation is updated based on the initial semantic representation and the corresponding reference relationship to obtain the target semantic representation, including: Obtain the reference information items that have a referential relationship with the reference type of the result; The referential information items are fused into the slot structure of the initial semantic representation to obtain the target semantic representation.
8. The response generation method based on multi-turn dialogue according to claim 1, characterized in that, Before determining the initial semantic representation based on the referential information in the original input and historical dialogue, the method further includes: Identify all pronouns in the original input; Determine the reference type corresponding to each pronoun, wherein the reference type includes result reference and question reference; All pronouns and the referential type corresponding to each pronoun are determined as the referential information.
9. A response generation device based on multi-turn dialogue, characterized in that, The response generation device based on multi-turn dialogue includes a memory and a processor, wherein the memory is coupled to the processor; The memory is used to store program data, and the processor is used to execute the program data to implement the response generation method based on multi-turn dialogue as described in any one of claims 1 to 8.
10. A computer storage medium, characterized in that, The computer storage medium stores a computer program, which, when executed by a processor, implements the steps in the response generation method based on multi-turn dialogue as described in any one of claims 1 to 8.