A dialogue processing method, device and computer readable storage medium

By defining topic boundaries and using dynamic weight filtering in the dialogue flow, the problem of information retention in long-term dialogues by large language models is solved, enabling the effective extraction of key information and the avoidance of redundant information, thus improving the user experience.

CN122287647APending Publication Date: 2026-06-26LENOVO (BEIJING) LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
LENOVO (BEIJING) LTD
Filing Date
2026-03-30
Publication Date
2026-06-26

Smart Images

  • Figure CN122287647A_ABST
    Figure CN122287647A_ABST
Patent Text Reader

Abstract

This invention provides a dialogue processing method, apparatus, and computer-readable storage medium, belonging to the field of natural language processing technology. The dialogue processing method includes acquiring multiple sets of dialogue streams; determining at least one topic boundary based on the semantics of the multiple sets of dialogue streams; segmenting all dialogue streams into at least two topic segments based on each topic boundary; assigning dynamic weights to memory items in each topic segment, wherein each memory item stores at least one piece of memory information; the dynamic weights are determined at least based on the timeliness of the memory item, its relevance to the current query, and its coherence with the current topic; and, in response to the current dialogue, acquiring multiple candidate memory items from all topic segments, and, based on the dynamic weight of each candidate memory item, filtering and outputting a set of memory items that meets a target length from the multiple candidate memory items.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of natural language technology, specifically relating to a dialogue processing method, apparatus, and computer-readable storage medium. Background Technology

[0002] With the widespread application of large language models in dialogue systems, existing large language models are unable to effectively maintain and utilize key information in long-term dialogues, resulting in the phenomenon of "dialogue forgetting" and affecting user experience. Summary of the Invention

[0003] In order to solve the above-mentioned technical problems, the present invention aims to provide a dialogue processing method, apparatus and computer-readable storage medium.

[0004] The specific technical solution adopted is as follows: A dialogue processing method, comprising: Acquire multiple dialogue streams; Determine at least one topic boundary based on the semantics of multiple dialogue streams, and divide all dialogue streams into at least two topic segments based on each of the topic boundaries; Dynamic weights are assigned to memory items in each topic fragment, each memory item storing at least one piece of memory information; the dynamic weights are determined based at least on the timeliness of the memory item, its relevance to the current query, and its coherence with the current topic. In response to the current dialogue, multiple candidate memory items are obtained from all topic fragments. Based on the dynamic weight of each candidate memory item, a set of memory items that meet the target length is selected and output from the multiple candidate memory items.

[0005] In some embodiments, determining at least one topic boundary based on the semantics of multiple sets of dialogue streams, and segmenting all dialogue streams into at least two topic segments based on each of the topic boundaries, includes: Obtain the semantic similarity between two adjacent dialogue streams; Based on the semantic similarity among all dialogue streams, the topic transition degree of the target location is determined, where the target location is any set of dialogue streams; Determine the topic conversion threshold based on the distribution of topic conversion degree; The topic boundary is determined by comparing the topic conversion degree of the target location with the topic conversion threshold.

[0006] In some embodiments, determining the topic shift degree of a target location includes: Obtain the average first semantic similarity among the n dialogue streams preceding the target position, and the average second semantic similarity among the n dialogue streams following the target position; Based on the first average semantic similarity and the second average semantic similarity, the center similarity of the target location is obtained; The topic shift degree of the target location is determined based on the first average semantic similarity, the second average semantic similarity, and the center similarity.

[0007] In some embodiments, a topic conversion threshold is determined based on the distribution of topic conversion degree; including: Obtain the mean and standard deviation of topic conversion rates for all target locations; The linear combination of the mean and the standard deviation is used as the topic switching threshold.

[0008] In some embodiments, the dynamic weights are determined by means of: The timeliness of the memory item is determined based on the time difference between the time the memory item was generated and the current query time, as well as the structured distance between the topic segment to which the memory item belongs and the current topic segment. The relevance of the memory item to the current query is determined based on the semantic similarity between the memory item and the current query, as well as the entity overlap between the memory item and the current query. The timeliness and coherence of the memory item with the current topic are determined based on the topic alignment between the memory item and the current topic, and the strength of the discourse relationship between the memory item and the current context.

[0009] In some embodiments, based on the dynamic weight of each candidate memory item, a set of memory items that meets the target length is selected and output from the plurality of candidate memory items, including: The attention score of each candidate memory item is obtained, and the target length to be output is dynamically determined based on the distribution of attention scores of all candidate memory items. The attention score is determined based on at least one of the following factors: the consistency between the topic to which the candidate memory item belongs and the current conversation topic, the information density of the candidate memory item, and the discourse coherence strength between the memory item and the current dialogue context. Sort all candidate memory items by attention score, and select a set of memory items that meet the target length from the candidate memory information.

[0010] In some embodiments, the target length to be output is dynamically determined based on the attention score distribution of all candidate memory items, including: Obtain the information entropy of attention scores for multiple candidate memory items; The target length is determined based on the information entropy and the preset minimum and maximum lengths.

[0011] In some embodiments, it also includes: Basic entity relationships are constructed from memory items stored in all topic fragments; wherein, the basic entity relationships include at least the entities, attributes, and relationship elements that appear in the dialogue; Conflict detection is performed based on the underlying entity relationships and the target entity relationships in the current session, and different resolution strategies are executed based on the detected conflict types.

[0012] A dialogue processing device, comprising: The first module is used to acquire multiple sets of dialogue streams; The second module determines at least one topic boundary based on the semantics of multiple dialogue streams, and divides all dialogue streams into at least two topic segments based on each of the topic boundaries. The third module assigns dynamic weights to memory items for each topic fragment, wherein each memory item stores at least one piece of memory information; the dynamic weights are determined based at least on the timeliness of the memory item, its relevance to the current query, and its coherence with the current topic. The fourth module, in response to the current dialogue, obtains multiple candidate memory items from all topic fragments, and based on the dynamic weight of each candidate memory item, filters and outputs a set of memory items that meet the target length from the multiple candidate memory items.

[0013] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any of the above embodiments.

[0014] The present invention has the following beneficial effects: The dialogue processing method in this embodiment divides multiple dialogue streams into topic boundaries, segmenting the dialogue content into multiple independent topic segments to avoid the chaotic accumulation of information in long dialogues. Then, dynamic weights are assigned to memory items in each topic segment, and a set of memory items that meet the target length is selected from multiple topic segments based on the dynamic weights. This ensures the effective extraction of key information and avoids the interference of redundant information on dialogue understanding, thereby significantly improving the ability to retain information in long dialogues, reducing the phenomenon of "dialogue forgetting", and improving the user experience. Attached Figure Description

[0015] To more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 This is a flowchart of a dialogue processing method provided in Embodiment 1 of the present invention; Figure 2 This is a flowchart of a dialogue processing method provided in Embodiment 2 of the present invention; Figure 3 This is a flowchart of a dialogue processing method provided in Embodiment 2 of the present invention; Figure 4 This is a flowchart of a dialogue processing method provided in Embodiment 2 of the present invention; Figure 5 This is a flowchart of a dialogue processing method provided in Embodiment 2 of the present invention; Figure 6 This is a flowchart of a dialogue processing method provided in Embodiment 3 of the present invention. Detailed Implementation

[0017] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following detailed description, in conjunction with the accompanying drawings and preferred embodiments, provides a detailed explanation of the specific implementation, structure, features, and effects of a dialogue processing method proposed according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.

[0018] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0019] The specific solution of the dialogue processing method provided by the present invention will be described in detail below with reference to the accompanying drawings. To facilitate explanation, an example of a multi-turn dialogue between a user and AI is listed below: Topic 1 (Rounds 1-5): Determining Travel Dates User Round 1: I'm planning a trip to Japan with my family next spring. Any suggestions? AI Round 1: Spring is a great time to visit Japan, especially during cherry blossom season. Which month are you considering traveling to? User Round 2: I heard the cherry blossoms are beautiful, when is the best time to visit? AI Round 2: Cherry blossoms in the Kanto region (Tokyo) typically bloom from late March to early April.

[0020] User Round 3: How about we set it for April, around the 10th? AI Round 3: April 10th is a good choice, avoiding the crowds during the Qingming Festival holiday. How many days are you planning to spend? User rotation 4: Approximately 10 days, April 10-20.

[0021] AI Round 4: Okay, a 10-day itinerary allows for a more in-depth exploration of the Kanto region.

[0022] User Round 5: Okay, let's set it like this, April 10-20.

[0023] Topic 2 (Rounds 6-15): Budget Discussion Topic User Round 6: How much would such a trip cost? AI Round 6: The cost of a self-guided trip to Japan varies from person to person. What is your desired budget range? (Detailed discussion of budgets for airfare, hotels, food, etc. follows...) User Round 15: Let's set the total budget at around 50,000 yen.

[0024] AI Round 15: Okay, I will help you allocate the 50,000 yen budget reasonably.

[0025] Topic 3 (Rounds 16-25): Scenic Spot Selection User Round 16: What are some must-see attractions in Tokyo? AI Round 16: Tokyo Tower, Senso-ji Temple, and Disneyland are all popular choices. (Discussion of the unique features, ticket prices, and time allocation for each attraction...) User Round 25: Then focus on Asakusa Temple and Tokyo Tower, and check the schedule for Disneyland.

[0026] AI Round 25: Okay, your attraction preferences have been recorded.

[0027] Topic 4 (Rounds 26-35): Accommodation Arrangements User Round 26: Any recommendations for accommodations in Tokyo? AI Round 26: Based on your budget, we recommend business hotels in Shinjuku or Shibuya.

[0028] User Round 30: I'd like to stay somewhere nicer, are there any hotels with hot springs? AI Round 30: Hot spring hotels are usually more expensive, for example, XX Hot Spring Hotel costs about 30,000 yen per night.

[0029] User Round 35: 30,000 yen... a bit expensive, but my family likes hot springs. Let's book this one then.

[0030] AI Round 35: Okay, your selection of XX Hot Spring Hotel has been recorded, 30,000 yen / night.

[0031] Please see Figure 1 This illustrates a dialogue processing method provided by an embodiment of the present invention, the dialogue processing method comprising: Step S100: Obtain multiple sets of dialogue streams.

[0032] In step S100, each dialogue stream contains at least one set of user input text and received response text. For example, in round 1 dialogue, if the user inputs the text "I want to take my family to Japan next spring, do you have any suggestions?" and receives the response text "Spring is a great time to go to Japan, especially during cherry blossom season. Which month are you considering traveling?", then these two sentences can constitute a dialogue stream.

[0033] In practical applications, dialogue streams can be acquired in various ways. For example, user interaction data can be received in real time through instant messaging interfaces, or dialogue records can be extracted in batches from historical dialogue logs.

[0034] In step S100, when receiving dialogue records containing multiple sets of conversations, the dialogue records can be standardized to obtain multiple dialogue streams. For example, the input dialogue records D = {U1, C1, U2, C2, ..., U...} t C t}, where U i For the user to input text in the i-th round, C i This is the text of the reply in the i-th round.

[0035] Dialogue records D can be organized into dialogue pairs (DPs) in an alternating "user-model" order, and a structured dialogue pair sequence DP = {DP1, DP2, ..., DP} can be output. n}. Each dialogue pair is a DP. i = (U i C i It serves as a basic processing unit.

[0036] In step S100, the acquired dialogue stream may also undergo preprocessing, including text cleaning to remove irrelevant symbols, emoticons, and other interfering information, as well as format standardization to ensure the structural uniformity of each dialogue stream, facilitating subsequent semantic analysis and topic boundary determination. During preprocessing, basic natural language processing operations such as word segmentation and part-of-speech tagging can also be performed on the dialogue stream to provide a data foundation for subsequent steps.

[0037] Step S200: Determine at least one topic boundary based on the semantics of multiple dialogue streams, and divide all dialogue streams into at least two topic segments based on each topic boundary; each topic segment contains at least one dialogue stream. In step S200, topic boundaries can be determined based on semantic changes in multiple dialogue streams. For example, in rounds 1-10 of the dialogue above, it can be seen that the user and the model are discussing the topic of travel time, while in rounds 11-25, it can be seen that the user and the model are discussing the topic of planning budget.

[0038] Methods for determining topic boundaries can be based on calculating the semantic relevance between adjacent dialogue streams to determine whether a topic shift has occurred. Alternatively, features such as keyword changes and entity frequency in the dialogue stream can be used to assist in determining topic boundaries. For example, when core keywords change significantly in multiple consecutive dialogue streams, and newly appearing entities have low relevance to previous topics, these can also be used as a reference for determining topic boundaries.

[0039] In practical applications, appropriate methods for determining topic boundaries can be selected based on the characteristics of the dialogue scenario, or a combination of multiple methods can be used for comprehensive judgment to improve the accuracy of topic boundary identification.

[0040] In step S200, the final topic segments can be output: T = {T1, T2, ..., T} k}. Each topic segment T k = {DP_start, DP_end,}. For example, T1 = {DP_1, DP_5,}, T2 = {DP_6, DP_15,}, etc.

[0041] Step S300: Assign dynamic weights to memory items in each topic fragment, wherein each memory item stores at least one memory information; the dynamic weights are determined at least based on the memory item's Recency_Weight, Relevance_Weight, and Coherence_Bonus of the current topic.

[0042] Each topic segment can include multiple memory items, with each memory item containing at least one piece of information. This information can be content from the dialogue. For example, in topic 1, the memory items could store important information from rounds 1 through 5. This could include location information, such as Japan, time information, such as April 10-20, or other decision-making information, such as cherry blossoms typically bloom from late March to early April.

[0043] In this step, dynamic weights are values ​​that are dynamically adjusted based on the importance of the memory item in the dialogue, and are used to measure the priority of the memory item in the current dialogue scenario.

[0044] The Recency_Weight dimension can be quantified by calculating the difference between the time the memory item was generated and the current query time, combined with the structured distance between topic fragments (such as topic hierarchy and time span). The closer the time and the more closely related the memory item is to the current topic, the higher the timeliness weight.

[0045] The Relevance_Weight dimension calculates the text matching degree between the memory item and the current query using a semantic similarity model, and counts the amount and importance of overlap of entities (such as location, time, event, etc.) between the two. The more semantically similar the memory items and the higher the degree of entity overlap, the greater the relevance weight.

[0046] The coherence_Bonus dimension can be determined based on the alignment between the topic to which the memory item belongs and the current topic (such as whether they belong to the same parent topic or related sub-topics) and the strength of their discourse relationship with the current context (such as cause and effect, contrast, and sequence). Memory items with high topic alignment and close discourse relationship have a more prominent coherence weight.

[0047] By weighting and fusing the weights of these three dimensions, a comprehensive dynamic weight for each memory item can be obtained, providing a quantitative basis for subsequent memory item selection.

[0048] Step S400: In response to the current dialogue, obtain multiple candidate memory items from all topic fragments, and based on the dynamic weight of each candidate memory item, filter and output a set of memory items that meet the target length from the multiple candidate memory items.

[0049] In step S400, when a current dialogue request is received, all the divided topic segments can be traversed, and memory items related to the current dialogue can be extracted from each topic segment as candidate memory items.

[0050] For example, if the current conversation involves adjustments to accommodation arrangements, the system will extract memory items such as hotel type, price, and user preferences from the "Accommodation Arrangement Topic" segment. It may also extract relevant memory items such as total budget from the "Budget Discussion Topic" segment to ensure that candidate memory items cover all potential relevant information.

[0051] After acquiring multiple candidate memory items, the system evaluates the timeliness, relevance, and coherence of each candidate memory item according to the preset dynamic weight calculation rules and assigns corresponding weight values. Then, the system obtains the comprehensive dynamic weight of each candidate memory item by weighted summation.

[0052] Next, all candidate memory items are sorted from high to low according to the comprehensive dynamic weight. Then, combined with the dynamically determined target length, memory items are selected sequentially from the sorted candidate memory items until the total length of the selected memory items reaches the target length, thus forming a set of memory items that meets the requirements and providing accurate information support for the response of the current dialogue.

[0053] The dialogue processing method in this embodiment divides multiple dialogue streams into topic boundaries, segmenting the dialogue content into multiple independent topic segments to avoid the chaotic accumulation of information in long dialogues. Then, dynamic weights are assigned to memory items in each topic segment, and a set of memory items that meet the target length is selected from multiple topic segments based on the dynamic weights. This ensures the effective extraction of key information and avoids the interference of redundant information on dialogue understanding, thereby significantly improving the ability to retain information in long dialogues, reducing the phenomenon of "dialogue forgetting", and improving the user experience.

[0054] In some embodiments, when acquiring multiple sets of dialogue streams, semantic encoding can be performed on each round of dialogue to obtain a semantic vector representation of the dialogue stream.

[0055] Specifically, pre-trained language models (such as BERT, RoBERTa, etc.) can be used to jointly encode the user input text and response text in each dialogue stream, transforming the text sequence into a fixed-dimensional semantic vector. For example, user turn 1's "I'd like to take my family to Japan next spring, any suggestions?" and AI turn 1's "Spring is a great time to go to Japan, especially during cherry blossom season. When are you considering traveling?" can be used as the overall input model of the dialogue stream, outputting the semantic vector of that dialogue stream. Through semantic encoding, the textual information of the dialogue stream can be transformed into a numerical form that can be processed by a computer, solving problems such as noise, omissions, and pronoun references in the original dialogue, establishing a unified semantic representation framework, and ensuring the consistency of subsequent algorithms. It also facilitates the extraction of key semantic and entity information from each round of dialogue, providing raw materials for topic analysis and memory management.

[0056] For example, Sentence-BERT can be used to encode each dialogue pair. Each dialogue pair can be encoded as a 768-dimensional semantic vector. For example: The semantic vector v1 of the first round of dialogue can be: [0.23, -0.45, 0.78, ...] (representing "Spring Japan travel information").

[0057] The semantic vector v2 of the round 2 dialogue can be: [0.25, -0.42, 0.81, ...] (representing "cherry blossom time inquiry").

[0058] The semantic vector v3 of a round 3 dialogue can be: [0.28, -0.38, 0.85, ...] (representing "discussion on a specific date").

[0059] By encoding each dialogue pair with Sentence-BERT, the semantic information contained in the dialogue stream can be effectively captured, providing a precise quantitative basis for subsequent topic boundary delineation.

[0060] For example, by calculating the cosine similarity of the semantic vectors of adjacent dialogue pairs, a topic boundary can be determined when the similarity is lower than a preset threshold. Taking the boundary between topic 1 and topic 2 as an example, the cosine similarity between the semantic vector of dialogue in round 5 ("Okay, let's set it like this, April 10-20.") and the semantic vector of dialogue in round 6 ("How much will this trip cost?") may be significantly lower than the similarity between the dialogues within topic 1. Thus, the boundary between round 5 and round 6 can be determined, achieving topic segmentation from "determining travel dates" to "budget discussion".

[0061] In addition, when acquiring multiple sets of dialogue streams, entity extraction and dialogue behavior annotation can be performed on each round of dialogue.

[0062] Among them, Entities(DP) are extracted. i ) = NER(U i ) ∪ NER(C i ) ∪ {coreference_resolution}, dialogue behavior is labeled as DA(DP) i ) = {type, polarity, certainty, commitment_level}.

[0063] φ(DP i ): Use a pre-trained language model to obtain the overall semantic representation of the dialogue pair.

[0064] NER(·): Named Entity Recognition, extracts key information units from a dialogue.

[0065] coreference_resolution: Referential resolution, handling referential issues such as "this" and "it".

[0066] DA(DP i Dialogue behavior analysis identifies dialogue types such as question-and-answer, confirmation, and commitment.

[0067] For example, in the conversation of user round 1, "I want to take my family to Japan next spring, do you have any suggestions?", entity extraction yields entities such as "Japan", "family" and "next spring", and the conversation behavior is labeled as "requesting advice"; the AI ​​round 1 reply, "Spring is a great time to go to Japan, especially during cherry blossom season. When are you considering traveling?" includes entities such as "Japan" and "cherry blossom season", and the conversation behavior is labeled as "providing information + asking".

[0068] This entity extraction and dialogue behavior annotation allows for more accurate capture of core information and interactive intent in dialogues, providing richer feature support for subsequent topic boundary determination and memory item extraction.

[0069] like Figure 2 As shown, in some embodiments, at least one topic boundary is determined based on the semantics of multiple sets of dialogue streams, and all dialogue streams are segmented into at least two topic segments based on each of the topic boundaries, including: Step S201: Obtain the semantic similarity between two adjacent dialogue streams.

[0070] In step S201, following step 100, a structured dialogue pair sequence DP = {DP1, DP2, ..., DP} is obtained. n After that, each DP i Corresponding to a semantic vector v i Adjacent dialogue streams DP1 and DP i+1 semantic similarity sim ( =cos(v) i , v i+1 This value ranges from 0 to 1, with values ​​closer to 1 indicating more coherent semantics.

[0071] Alternatively, semantic similarity between two adjacent dialogue streams can be obtained by calculating auxiliary features such as entity co-occurrence frequency and core keyword overlap in the dialogue stream, and constructing a multi-dimensional similarity scoring model.

[0072] Step S202: Based on the semantic similarity between all dialogue streams, determine the topic transition degree of the target location, where the target location is any set of dialogue streams.

[0073] In step 202, the topic transition degree can be a quantitative indicator reflecting the likelihood that the location is a topic boundary. A higher value indicates a greater semantic difference before and after the transition, making it more likely to be a topic transition point. The topic transition degree can be determined through all semantic similarities.

[0074] Step S203: Determine the topic conversion threshold based on the distribution of topic conversion degree.

[0075] In step 203, the topic conversion threshold is determined by obtaining the set of topic conversion degrees for the target locations and by obtaining the variance and standard deviation of the topic conversion degrees for all target locations. Then, the topic conversion degree for each target location is compared with the topic conversion threshold.

[0076] Step S204: Determine the topic boundary based on the comparison between the topic conversion degree of the target location and the topic conversion threshold.

[0077] In step 204, if the topic conversion degree at a target position is greater than the topic conversion threshold, it can be confirmed that a topic conversion exists at that target position. That is, the topics preceding that target position belong to the same topic. For example, when the topic conversion degree at round 5 is greater than the topic conversion threshold, rounds 1 to 5 belong to one topic. Then, when the topic conversion degree at round 15 is greater than the topic conversion threshold, rounds 6 to 15 belong to another topic.

[0078] If the topic conversion rate of a target location is less than the topic conversion threshold, it can be confirmed that there is no topic conversion at that target location.

[0079] By determining at least one topic boundary from the semantics of multiple dialogue streams, the problems of information overload and topic drift in long dialogues can be solved, providing a natural topic organization structure for memory management, improving the model's ability to understand the dialogue context, and reducing interference from irrelevant information.

[0080] In some embodiments, determining the topic shift degree of a target location may include: Step S2021: Obtain the average first semantic similarity among the n dialogue streams preceding the target position, and the average second semantic similarity among the n dialogue streams following the target position.

[0081] Step S2022: Obtain the center similarity of the target location.

[0082] Step S2023: Determine the topic conversion degree of the target location based on the first average semantic similarity, the second average semantic similarity, and the center similarity.

[0083] In this embodiment, the topic transition degree can be determined by the semantic similarity calculation result based on adjacent dialogue streams, through sliding window or local region analysis.

[0084] In this embodiment, the topic shift degree of the target position can be a depth score depth(i). The depth score can be depth(i) = [α·left_avg + β·right_avg] / (α+β) - γ·center_sim.

[0085] in: - left_avg = avg{sim(DP i- w, DP i- w +1 ), ..., sim(DP i-1 DP i )};.

[0086] - right_avg = avg{sim(DP i+1DP i+2 ), ..., sim(DP i+ w -1 DP i+ w)} .

[0087] - center_sim = sim(DP i DP i+1 ).

[0088] - α=1.2, β=0.8: Asymmetric window weights, reflecting the temporal characteristics of the dialogue.

[0089] - γ=0.2 Center similarity correction coefficient.

[0090] - It is a Sentence-BERT encoder that generates sentence-level semantic vectors.

[0091] In this formula, left_avg and right_avg are used to represent the semantic coherence of the front and back windows, reflecting the stability of the topic; center_sim is used to represent the semantic similarity of key turning points, detecting topic changes; α>β: based on the characteristics of dialogue sequence, subsequent content is more indicative of topic transitions.

[0092] For example, taking the dialogue between rounds 5 and 6 as an example, it can be seen that the actual dialogue will begin in round 6 regarding the "budget discussion topic." At this point, round 5 can be selected as the target position, the sliding window size can be set to 2, and the semantic similarity average of the two dialogue streams before and after the target position can be calculated. That is, the semantic similarity between rounds 3 and 4 and between rounds 4 and 5 is used to calculate left_avg, and the semantic similarity between rounds 6 and 7 and between rounds 7 and 8 is used to calculate right_avg. The center_sim center similarity is the semantic similarity between rounds 5 and 6.

[0093] Finally, based on the obtained left_avg, right_avg, and center_sim, the depth score depth(5) at round 5 is calculated, which is the topic transition degree of the target position. If depth(5) is greater than the topic transition threshold, round 5 can be determined as the topic boundary.

[0094] In some embodiments, a topic conversion threshold is determined based on the distribution of topic conversion degree; including: Step S2031: Obtain the mean and standard deviation of topic conversion rates for all target locations; Step S2032: Use the linear combination of the mean and the standard deviation as the topic switching threshold.

[0095] Specifically, the topic switching threshold T_adaptive = μ_depth + λ·σ_depth.

[0096] If depth(i) > T_adaptive then topic_boundary, then the target position i is the topic boundary.

[0097] in: μ_depth = mean({depth(j) for j in conversation}) is the mean of the depth scores.

[0098] σ_depth = std({depth(j) for j in conversation}) is the standard deviation of the depth score.

[0099] λ = 1.5 (sensitivity adjustment factor).

[0100] In some embodiments, after segmenting all dialogue streams into at least two topic fragments, a memory system can be constructed based on all topic fragments. This memory system includes at least a working memory layer, a topic memory layer, and a session memory layer. The memory system can be represented as M = {M_work, M_topic, M_session}, where M_work is the working memory layer, M_topic is the topic memory layer, and M_session is the session memory layer.

[0101] The working memory layer M_work stores the content of the most recent N rounds of dialogue and updates it using a first-in, first-out (FIFO) strategy, where N is a preset positive integer. The FIFO strategy means that when the working memory layer's storage capacity reaches the limit of N rounds of dialogue, if new dialogue content is input, the system automatically removes the oldest dialogue content that entered the working memory layer and adds the new dialogue content, thus ensuring that the working memory layer always retains the latest N rounds of dialogue information.

[0102] For example, if N is preset to 5, when the working memory layer has already stored the first 5 rounds of dialogue, after the 6th round of dialogue is input, the system will delete the first round of dialogue and use the second to sixth rounds of dialogue as new working memory content. This mechanism allows the working memory layer to focus on the recent context of the current dialogue, providing fast and accessible information support for real-time dialogue understanding and response, and avoiding information processing delays caused by storing too many historical dialogues.

[0103] The topic memory layer M_topic is used to store the divided topic segments. Each topic segment contains all the dialogue streams under that topic and the corresponding memory items. A unique identifier, such as a topic ID or topic keywords, is assigned to each topic segment to facilitate quick location and retrieval of relevant information for a specific topic when needed. In this embodiment, the topic memory layer has multiple memory units, each of which can store one topic segment.

[0104] For example, for the "Accommodation Arrangement" topic segment, its memory unit stores the accommodation needs mentioned by the user in rounds 26-35 of the conversation, including preferred hotel location (e.g., near a subway station or tourist attractions), room type requirements (twin room or family suite), expected price range (no more than 1500 yuan per night), and special requests (e.g., breakfast included, pick-up and drop-off service). This information is associated with the topic segment's identifier "Accommodation Arrangement_Topic4". When subsequent conversations involve accommodation adjustments, the system can quickly retrieve the complete memory item for that segment from the topic memory layer using the topic ID.

[0105] The session memory layer M_session, as a long-term storage structure, saves all topic fragments and historical update records of the working memory layer throughout the entire conversation. Even if the conversation is interrupted or resumed after it ends, the session memory layer can provide the system with a complete historical context of the conversation, supporting information continuity across sessions.

[0106] For example, the conversation memory layer is used to store all topic fragments generated throughout the entire conversation, including complete dialogue flows, semantic vector representations, topic boundary delineation criteria, and memory item sets for each topic fragment, such as topics like "determining travel time," "budget discussion," "attraction selection," and "accommodation arrangements."

[0107] When a user initiates another inquiry about traveling to Japan after a period of time following the end of a previous conversation, the system can retrieve historical conversation data from the conversation memory layer. This eliminates the need for the user to repeatedly provide previously discussed travel dates, budget ranges, etc., allowing for a continuation of the conversation based on existing topic fragments. For example, the user could ask, "Do we need to adjust the accommodation arrangements for our previously confirmed trip from April 10th to 20th?" This enables information reuse across conversations, improving the coherence of the dialogue and the user experience. Simultaneously, the conversation memory layer regularly organizes and optimizes the stored information, improving long-term storage efficiency and information retrieval accuracy by deleting redundant data and merging similar topic fragments.

[0108] In this embodiment, dynamic weights can be assigned to each memory item in the memory system, and the memory items can be retained, eliminated, and retrieved based on the dynamic weights.

[0109] For example, when a user mentions "Does the hotel price include taxes?" in a conversation, the system will first retrieve the discussions about accommodation budgets from the last three rounds of conversation from the working memory layer. If the dynamic weight of this memory item is higher than 0.6 (preset threshold), it will be given priority as a reference for the current reply. If no relevant information is found in the working memory layer, the system will retrieve the memory unit "Accommodation Arrangement_Topic4" in the topic memory layer by topic ID, calculate the real-time weight based on the historical access frequency and time decay coefficient of this memory item, and load it from the topic memory layer to the working memory layer to participate in the current conversation processing when the weight value is greater than the corresponding threshold.

[0110] For memory items in the session memory layer that have not been accessed for more than 90 days and whose weight is lower than the corresponding threshold, the system will automatically trigger an eviction mechanism to release storage space and optimize the operating efficiency of the memory system.

[0111] like Figure 3 As shown, in some embodiments, the determination of dynamic weights may include: The timeliness of a memory item is determined based on the time difference between the time the memory item was generated and the current query time, as well as the structured distance between the topic segment to which the memory item belongs and the current topic segment.

[0112] Among them, the timeliness of the memory item Recency_Weight = exp(-λ1·Δt - λ2·topic_distance).

[0113] Δt: The time difference between the current query time and the time the memory item was generated (in terms of the number of dialogue rounds).

[0114] topic_distance: The distance between the current topic and the topic to which the memory item belongs; within the same topic: topic_distance = 0; adjacent topics: topic_distance = 1; distance from n topics: topic_distance = n.

[0115] λ1: Absolute time decay coefficient (usually 0.1-0.3).

[0116] λ2: Topic distance decay coefficient (usually 0.2-0.5).

[0117] For example, if the current conversation is about "accommodation arrangements" (topic 4), and the user just mentioned in the 30th round of the conversation that "the hotel can provide free airport pick-up service", then the generation time Δt of this memory item is 0 (current round), and the distance between the topic and the current topic is also 0. At this time, Recency_Weight = exp(-λ1·0 - λ2·0) = exp(0) = 1, the weight reaches the highest, and the system will prioritize retaining and retrieving this memory item.

[0118] If the user mentions "airport pickup service" again in the subsequent 35th round of dialogue, at this time Δt=5 (5 rounds have passed since the memory item was generated), assuming λ1=0.2, λ2=0.3, and still within the same topic (topic_distance=0), then Recency_Weight = exp(-0.2×5 - 0.3×0) = exp(-1) ≈ 0.368. Although the weight has decreased, it is still higher than the memory item across topics.

[0119] If the conversation enters a new topic "Restaurant Recommendations" (Topic 5), the distance between the current topic and the "Accommodation Arrangements" topic is topic_distance=1. Even if Δt=0 (the topic has just been switched), Recency_Weight = exp(-0.2×0 - 0.3×1)= exp(-0.3) ≈ 0.741. The weight decreases due to the increase in topic distance, and the system will adjust the priority of this memory item during retrieval based on this weight.

[0120] The relevance of a memory item to the current query is determined based on the semantic similarity between the memory item and the current query, as well as the entity overlap between the memory item and the current query. Wherein, the relevance of the memory item is Relevance_Weight = α·semantic_sim + β·entity_overlap semantic_sim=cosine_similarity(φ(memory), φ(current_query)); entity_overlap=|Entities(memory) ∩ Entities(current_query)| / |Entities(memory) ∪ Entities(current_query)|; α and β are equilibrium parameters (usually α=0.7, β=0.3).

[0121] For example, if the current query is "Does the hotel include breakfast?", and the memory item stores the information "User requests accommodation including breakfast", then the semantic similarity is high, say 0.85. Entities(memory) contains "hotel" and "breakfast", and Entities(current_query) also contains "hotel" and "breakfast", so the entity overlap is 1.0. If α=0.7 and β=0.3, then Relevance_Weight = 0.7×0.85 + 0.3×1.0 = 0.595 + 0.3 = 0.895, indicating that the memory item is highly relevant to the current query and has a high weight value.

[0122] If the current query is "What attractions are nearby?", and the memory item is "Accommodation budget not exceeding 1500 yuan per night", then the semantic_sim is low (let's say 0.2). Entities(memory) are "Accommodation", "Budget", and "1500 yuan", while Entities(current_query) is "Attractions". The entity overlap is 0, and the Relevance_Weight = 0.7 × 0.2 + 0.3 × 0 = 0.14. The relevance weight is low, and the system will reduce the priority of this memory item during retrieval.

[0123] The timeliness of a memory item and its coherence with the current topic are determined based on the topic alignment between the memory item and the current topic, as well as the strength of the discourse relationship between the memory item and the current context.

[0124] Wherein, the timeliness of the memory item Coherence_Bonus = θ·topic_alignment + (1-θ)·discourse_relatio topic_alignment: The alignment of the memory item with the current topic.

[0125] Same topic: topic_alignment = 1.0.

[0126] Related topic: topic_alignment = 0.3-0.7.

[0127] Irrelevant topics: topic_alignment = 0.0.

[0128] discourse_relation: The strength of the discourse relation between a memory item and the current context.

[0129] θ: Equilibrium parameter (usually 0.6).

[0130] δ is the coefficient of Coherence_Bonus, which represents the importance of coherence rewards in the overall weight (usually 0.2).

[0131] For example, if the current conversation is about "accommodation arrangements" and the memory item is "user prefers twin rooms", the alignment of this memory item with the current topic (topic_alignment) is 1.0. Assuming its discourse relation strength with the current context (discourse_relation) is 0.8 (e.g., the current context is discussing room type selection), and θ=0.6, then Coherence_Bonus=0.6×1.0 + (1-0.6)×0.8=0.6 + 0.32=0.92. When δ=0.2, this coherence reward will have a positive impact on the dynamic weight of the memory item, further improving its retrieval priority in the current topic processing.

[0132] However, if the memory item belongs to the "budget discussion topic" (which is related to the current "accommodation arrangement topic"), with topic_alignment=0.5 and a weak relationship with the current context (discourse_relation=0.2), then Coherence_Bonus=0.6×0.5 + 0.4×0.2=0.3 + 0.08=0.38. The coherence reward is low, and its effect on improving the weight is limited. In this way, the system can more accurately evaluate the suitability of the memory item with the current dialogue scenario, ensuring that the most valuable memory information is efficiently accessed during dialogue processing.

[0133] Ultimately, the dynamic weight of each candidate memory item can be calculated based on a weighted combination of rewards for timeliness, relevance, and coherence.

[0134] That is, Memory_Weight = γ·Recency_Weight + (1-γ)·Relevance_Weight + δ·Coherence_Bonus.

[0135] γ: Dynamic balance factor (0.3-0.7, adjusted according to topic coherence); - δ: Consistency reward coefficient (usually 0.2); Dynamic equilibrium factor γ: γ = γ_min + (γ_max - γ_min)·topic_coherence topic_coherence: a factor for topic coherence, which relies more on semantic relevance when coherent. γ_min, γ_max: The minimum and maximum values ​​of γ (usually γ_min=0.3, γ_max=0.7). like Figure 4 As shown, based on the dynamic weight of each candidate memory item, a set of memory items that meet the target length is selected and output from the plurality of candidate memory items, including: Step 401: Obtain the attention score for each candidate memory item, and dynamically determine the target length to be output based on the distribution of attention scores for all candidate memory items.

[0136] The attention score is determined based on at least one of the following factors: the consistency between the topic of the candidate memory item and the current conversation topic, the information density of the candidate memory item, and the discourse coherence between the memory item and the current dialogue context. In step 401, the attention score for each candidate memory item is calculated.

[0137] attention(m) = base_weight × topic_bonus × density_factor × coherence_score Wherein, base_weight is the base weight for each memory item; topic_bonus is the topic bonus, which is the degree of consistency between the candidate memory item's topic and the current conversation topic; density_factor is the density factor, which is the information density of the candidate memory item; and coherence_score is the coherence score, which is the strength of the coherence between the memory item and the current conversation context.

[0138] In this embodiment, the topic reward is topic_bonus = 1 + α · [topic(m) = current_topic].

[0139] Where: [condition] is an indicator function (1 if the condition is true, 0 otherwise).

[0140] α is the reward coefficient (usually 0.2-0.5).

[0141] topic(m) is the topic to which the memory item belongs.

[0142] current_topic is the current topic of the conversation.

[0143] For example, if the current conversation topic is "accommodation arrangement", and the topic of a memory item is also "accommodation arrangement", then [topic(m) = current_topic] is 1, and topic_bonus = 1 + α×1 = 1+α; if the topic of the memory item is "attraction selection", then [topic(m) = current_topic] is 0, and topic_bonus = 1+ α×0 = 1, indicating that memory items with the same topic will receive additional topic rewards, thereby increasing their attention score.

[0144] The density factor is density_factor = β + (1-β)·(entity_count(m) / token_count(m)).

[0145] Where: entity_count(m) is the number of entities identified in memory item m; token_count(m) is the number of tokens in the memory item m; β is a smoothing parameter (usually 0.3).

[0146] For example, if a memory item contains three entities: "hotel", "twin room", and "free airport pick-up", and the total number of tokens is 15, then entity_count(m) / token_count(m) = 3 / 15 = 0.2. When β = 0.3, density_factor = 0.3 + (1-0.3)×0.2 = 0.3 + 0.14 = 0.44, indicating that memory items with higher entity density will obtain a higher density factor, thereby improving the attention score.

[0147] The coherence score is given by coherence_score = γ + (1-γ)·discourse_relation_strength(m, context).

[0148] Where: discourse_relation_strength(m, context) represents the discourse relation strength between memory item m and the current context. γ is a smoothing parameter (usually 0.4).

[0149] For example, if the current context is discussing "hotel room type selection," and the memory item is "user preference for twin rooms," its discourse relation strength with the context is 0.8. When γ=0.4, the coherence score is 0.4 + (1-0.4)×0.8 = 0.4 + 0.48 = 0.88, indicating high coherence and a corresponding increase in attention score. However, if the memory item is "attraction ticket price," and its discourse relation strength with the current "accommodation arrangement" context is 0.1, then the coherence score is 0.4 + 0.6×0.1 = 0.46, indicating a lower coherence score and a corresponding decrease in attention score.

[0150] Therefore, by comprehensively calculating base_weight, topic_bonus, density_factor, and coherence_score, the system can generate a reasonable attention score for each candidate memory item, and then dynamically determine the target length based on the score distribution.

[0151] For example, when the attention scores of most candidate memories are concentrated in the higher range, the target length can be appropriately increased to include more valuable memory information; if the attention scores are generally low or scattered, the target length can be shortened to avoid introducing redundant content.

[0152] Step 402: Sort all candidate memory items according to their attention scores, and select a set of memory items that meet the target length from the candidate memory information.

[0153] For example, suppose there are 5 candidate memory items in the current dialogue, with attention scores of 0.92, 0.85, 0.78, 0.45, and 0.30 respectively. After normalization, the scores of the first three memory items account for more than 70%, and the system determines the target length to be 3. In this case, the system will select the first 3 memory items in descending order of scores to form a memory item set. These memory items may contain core accommodation needs information such as "twin room near subway station", "breakfast included", and "no more than 1500 yuan per night", providing accurate data support for subsequent hotel recommendations or accommodation adjustments.

[0154] In some embodiments, the target length to be output is dynamically determined based on the attention score distribution of all candidate memory items, including: Step 4021: Obtain the information entropy of the attention scores of multiple candidate memory items.

[0155] In step 4021, the information entropy can be obtained by normalizing the attention scores of all multiple candidate memory items, i.e., softmax(attention(m_i)).

[0156] For example, if there are 5 candidate memory items with attention scores of 0.92, 0.85, 0.78, 0.45 and 0.30 respectively, after normalization, the proportion of each score is obtained, and then the variance or standard deviation and other dispersion indicators are calculated.

[0157] If the score distribution is relatively concentrated (e.g., the first three scores account for a significantly higher percentage than the last two) and the dispersion is low, it indicates the presence of obvious core memory items. In this case, the target length can be determined based on the number of high-scoring memory items. If the score distribution is relatively dispersed and the dispersion is high, it may be necessary to dynamically adjust the target length by accumulating the percentage of scores (e.g., accumulating to 80%) to avoid missing important information.

[0158] Step 4022: Determine the target length based on the information entropy and the preset minimum and maximum lengths. The target length is L_context = L_min + (L_max - L_min) · information_entropy(attention_scores).

[0159] L_min, L_max: Context length range, dynamic length range 500-2000 tokens, adaptively adjusted.

[0160] information_entropy: Information entropy of the attention score.

[0161] High entropy: Multiple memory items are important, requiring a longer context.

[0162] Low entropy: A few memory items dominate, which can shorten the context.

[0163] This dynamic length adjustment mechanism based on information entropy ensures that key memory items related to each topic are included, increasing the effective information density from 45% to 68%.

[0164] like Figure 5 As shown, in some embodiments, after dividing the topic into multiple segmentations, the dialogue processing method of this embodiment may further include: Step 500: Construct basic entity relationships from the memory items stored in all topic fragments; wherein the basic entity relationships include at least the entities, attributes and relationship elements that appear in the dialogue.

[0165] In step 500, all entities in the dialogue in the stored memory items can be extracted using named entity recognition technology. For example, in the topic of accommodation arrangements, entities such as "hotel name", "room type", "price range" and "check-in date" may be involved. At the same time, the attribute relationships between entities can be identified, such as "hotel name-price range" and "room type-check-in date".

[0166] Alternatively, if the dialogue includes the statement "I want to book a sea view room on April 12th, priced around 800 yuan", then the entities "April 12th" (check-in date), "sea view room" (room type), and "800 yuan" (price range) can be extracted, and basic entity relationships of "room type - check-in date" and "room type - price range" can be established.

[0167] The construction of these basic entity relationships can transform unstructured dialogue text into structured knowledge representations, providing structured data support for subsequent memory retrieval, topic understanding, and response generation, thus helping to improve the accuracy and efficiency of dialogue processing.

[0168] The basic entity relationships can be represented by an entity relationship graph, which uses entities as nodes and relationships as edges to intuitively present the logical connections between entities. For example, in the topic of accommodation arrangements, "sea view room" is the central entity, and its surrounding nodes may include "April 12th" (check-in date), "800 yuan" (price range), "breakfast included" (additional service), etc. The nodes are connected by relationship edges such as "booking date," "price range," and "services included." This structured representation can not only quickly locate relevant information for specific entities, but also discover hidden relationships through path analysis of the graph. For example, when a user asks "Are there any mountain view rooms nearby with similar prices?", the system can find the "800 yuan" node through the "price range" entity relationship, and then retrieve "mountain view room" information in the same price range along the "room type" relationship, realizing cross-entity information integration and reasoning.

[0169] Step 501: Detect conflicts based on the basic entity relationships and the target entity relationships in the current session, and execute different resolution strategies based on the detected conflict types.

[0170] In step 501, executing different resolution strategies based on the detected conflict type may further include: Step 5010: Automatically extract the entity relationships to be verified from the current dialogue information, and compare the entity relationships to be verified with the basic entity relationships constructed in the topic fragment, and simultaneously detect at least one type of conflict; In this embodiment, the conflict types can include attribute conflicts, relationship conflicts, and timing conflicts. Among them, attribute conflicts refer to the contradiction caused by the same entity having inconsistent values ​​for the same attribute. For example, if a user mentions "booking a sea view room for April 12th" in the topic of accommodation arrangements, and later says "I want to change the check-in date to April 15th," then the attribute value of the entity "check-in date" changes from "April 12th" to "April 15th," which constitutes an attribute conflict.

[0171] Relationship conflict refers to a contradiction arising from inconsistencies in the type or direction of the relationship between the same pair of entities. For example, if the statement first says "The selected hotel is a 10-minute walk from attraction A," and then later says "The hotel is a 30-minute drive from attraction A," the inconsistent description of the distance relationship between "hotel and attraction A" constitutes a relationship conflict.

[0172] A temporal conflict refers to a contradiction in the order of events or entities whose state changes violate the logical sequence of time. For example, when discussing accommodation, if it is initially agreed that "stay for 3 nights", but later it is proposed that "stay for only 2 nights", a temporal conflict will occur in the arrangement of the length of stay.

[0173] Step 5011: Based on the severity of the detected conflict, implement a graded resolution strategy; wherein, for conflicts exceeding a preset high threshold, proactively generate a clarification inquiry and suspend the update of the current dialogue information to the basic entity relationship until user feedback is obtained.

[0174] In step 5011, the methods for judging the severity of different conflict types are different.

[0175] The severity of attribute conflicts can be determined based on the degree of difference between different values ​​of the same attribute for the same entity, the confidence level of each value, and the reliability of the evidence.

[0176] For example, attribute conflict Conflict_attr = Σ w_a · |value1(a) - value2(a)| ·confidence(a).

[0177] The severity of relational conflicts can be determined based on the semantic distance between different relation types and the degree of certainty of each relation.

[0178] For example, the relationship conflict Conflict_rel = Σ w_r · semantic_distance(type(r1),type(r2)) · strength(r).

[0179] The severity of timing conflicts can be determined based on whether the order in which events occur is consistent with the evolution logic of the event states.

[0180] For example, a timing conflict `Conflict_time = Σ w_e · [time(e1)>time(e2)] · [state(e1)]` <state(e2)]。

[0181] In the above expression: |value1(a) - value2(a)|: Attribute value difference measure, supports both numeric and categorical attributes.

[0182] confidence(a): Confidence factor, representing the credibility of the source of the attribute value.

[0183] semantic_distance: Calculation of the semantic distance of the relationship type.

[0184] strength(r): Relationship strength, representing the certainty of the relationship.

[0185] [condition]: [time(e1)>time(e2)]: Temporal condition indicator function to check if event e1 occurs after e2; [state(e1)<state(e2)] is the state regression indicator function; the value is 1 when the condition holds and 0 when it does not.

[0186] w_*: Weight coefficient based on the reliability of evidence, value range: 0.0 - 1.0.

[0187] Specifically, for attribute conflicts, for example, in the price range attribute, if the price in the basic entity relationship is "around 800 yuan" and the price in the current target entity relationship is "below 600 yuan", then the difference measure of the attribute value is the numerical difference between the two (800 - 600 = 200). Combining the confidence factor of this attribute (such as the confidence of the user's current price preference being 0.9), the attribute conflict value Conflict_attr = 0.8 (price attribute weight) × 200 × 0.9 = 144 can be calculated.

[0188] When the attribute conflict value exceeds the preset threshold (such as 100), the system determines that it is an attribute conflict that needs to be prioritized. At this time, it will first confirm the reasonableness of the price adjustment with the user. For example, it will ask "Do you want to adjust the budget from around 800 yuan to below 600 yuan due to changes in the itinerary or other reasons?" After obtaining the user's feedback, it will then combine the room type price database to filter out the room types that meet the new price range and synchronously update the price attribute in the basic entity relationship.

[0189] For relationship conflicts, for example, in the basic entity relationship, "hotel name - price range" is a direct association relationship, while in the current target entity relationship, "hotel name - price range" is replaced by an indirect association relationship of "hotel name - promotion activity". At this time, the semantic distance between the two relationship types needs to be calculated. Suppose the semantic distance between "direct association" and "indirect association" is 0.6, the relationship strength is 0.7 (indicating the clarity of this relationship in the conversation), and the relationship weight coefficient is 0.6. Then the relationship conflict value Conflict_rel = 0.6 × 0.6 × 0.7 = 0.252.

[0190] For temporal conflicts, for example, in the basic entity relationship, the "reservation confirmation" event occurs after the "payment completed" event, while in the current target entity relationship, the user requests "confirm the room type before payment", that is, the "payment completed" event is adjusted to after the "reservation confirmation". At this time, it is necessary to detect whether the temporal logic is contradictory. Assume that the timestamp of the "reservation confirmation" event e1 is t1, and the timestamp of the "payment completed" event e2 is t2. The original temporal order is t1 < t2, and the current target temporal order is t1 > t2. Also, the status of "reservation confirmation" (such as "pending confirmation") is lower than the status of "payment completed" (such as "paid"). Then the value of the temporal conflict indication function is 1. Combining with the event weight coefficient of 0.5, the temporal conflict value Conflict_time = 0.5 × 1 × 1 = 0.5.

[0191] In step 5011, the hierarchical resolution strategy may include: For severe contradictions where the conflict degree exceeds the first threshold, execute the active clarification strategy, generate targeted clarification questions, and place the current conversation information in a pending state before obtaining user confirmation; for medium contradictions where the conflict degree is between the first threshold and the second threshold, make a ruling based on the confidence level of the information source, and retain the information with a higher confidence level; for minor contradictions where the conflict degree is lower than the second threshold, make a ruling based on the chronological order of information generation, and overwrite the old information with the information with an updated timestamp.

[0192] For example, when the detected conflict value is 144 (exceeding the first threshold of 100), the system triggers the active clarification strategy and sends a query to the user: "You mentioned that the price has been adjusted from around 800 yuan to below 600 yuan. Do you need to give priority to price factors and appropriately adjust the room type standard?"; if the conflict value is 80 (between the first threshold of 100 and the second threshold of 50), and the current information source is the user's direct input (confidence level 0.8) which is higher than the historical default setting (confidence level 0.6), then directly update the basic entity relationship with the current price information of below 600 yuan; if the conflict value is 30 (lower than the second threshold of 50), then directly overwrite the original record of "April 12th" with the latest input check-in date of "April 15th" without additional user interaction. This hierarchical resolution mechanism can ensure the coherence of the conversation while minimizing unnecessary clarification operations to improve the fluency and efficiency of conversation processing.

[0193] Through the above construction of the basic entity relationship and the conflict hierarchical resolution mechanism, the accuracy rate of understanding user needs can be increased to 92%. At the same time, it is expected that in 1000 rounds of conversation tests, the contradiction incidence rate will drop from 35% to 8%.

[0194] The embodiment of the present application also provides a conversation processing device, which includes: A first module for obtaining multiple groups of conversation flows; The first module corresponds to Figure 6 The preprocessing stage in the process can be used to preprocess dialogue records containing multiple sets of sessions to obtain multiple dialogue streams. For example, the input dialogue records D={U1, C1, U2, C2, ..., U... t C t}, where U i For the user to input text in the i-th round, C i This is the text of the reply in the i-th round.

[0195] Dialogue records D can be organized into dialogue pairs (DPs) in an alternating "user-model" order, and a structured dialogue pair sequence DP = {DP1, DP2, ..., DP} can be output. n}. Each dialogue pair is a DP. i = (U i C i It serves as a basic processing unit.

[0196] The first module can also be used to semantically encode each round of dialogue when acquiring multiple sets of dialogue streams, thereby obtaining a semantic vector representation of the dialogue stream.

[0197] Specifically, pre-trained language models (such as BERT, RoBERTa, etc.) can be used to jointly encode the user input text and response text in each dialogue stream, transforming the text sequence into a fixed-dimensional semantic vector. For example, user turn 1's "I'd like to take my family to Japan next spring, any suggestions?" and AI turn 1's "Spring is a great time to go to Japan, especially during cherry blossom season. When are you considering traveling?" can be used as the overall input model of the dialogue stream, outputting the semantic vector of that dialogue stream. Through semantic encoding, the textual information of the dialogue stream can be transformed into a numerical form that can be processed by a computer, solving problems such as noise, omissions, and pronoun references in the original dialogue, establishing a unified semantic representation framework, and ensuring the consistency of subsequent algorithms. It also facilitates the extraction of key semantic and entity information from each round of dialogue, providing raw materials for topic analysis and memory management.

[0198] The second module determines at least one topic boundary based on the semantics of multiple dialogue streams, and divides all dialogue streams into at least two topic segments based on each of the topic boundaries.

[0199] The second module corresponds to Figure 6 In the analysis phase, it can determine topic boundaries based on semantic changes in multiple dialogue streams. For example, in rounds 1-10 of the dialogue above, it can be seen that the user and the model are discussing the topic of travel time, while in rounds 11-25, it can be seen that the user and the model are discussing the topic of planning budget.

[0200] Methods for determining topic boundaries can be based on calculating the semantic relevance between adjacent dialogue streams to determine whether a topic shift has occurred. Alternatively, features such as keyword changes and entity frequency in the dialogue stream can be used to assist in determining topic boundaries. For example, when core keywords change significantly in multiple consecutive dialogue streams, and newly appearing entities have low relevance to previous topics, these can also be used as a reference for determining topic boundaries.

[0201] The third module assigns dynamic weights to memory items for each topic fragment, wherein each memory item stores at least one piece of memory information; the dynamic weights are determined based on at least the timeliness of the memory item, its relevance to the current query, and its coherence with the current topic.

[0202] The second module corresponds to Figure 6 In the management phase, after dividing all dialogue flows into at least two topic segments, a memory system can be constructed based on all topic segments. This memory system includes at least a working memory layer, a topic memory layer, and a session memory layer. The memory system can be represented as M = {M_work, M_topic, M_session}, where M_work is the working memory layer, M_topic is the topic memory layer, and M_session is the session memory layer. Dynamic weights can be assigned to each memory item in this memory system.

[0203] The fourth module, in response to the current dialogue, obtains multiple candidate memory items from all topic fragments, and based on the dynamic weight of each candidate memory item, filters and outputs a set of memory items that meet the target length from the multiple candidate memory items.

[0204] The fourth module corresponds to Figure 6 In the output phase, when the current dialogue request is received, all the divided topic segments can be traversed, and memory items related to the current dialogue can be extracted from each topic segment as candidate memory items.

[0205] After acquiring multiple candidate memory items, the system evaluates the timeliness, relevance, and coherence of each candidate memory item according to the preset dynamic weight calculation rules and assigns corresponding weight values. Then, the system obtains the comprehensive dynamic weight of each candidate memory item by weighted summation.

[0206] Next, all candidate memory items are sorted from high to low according to the comprehensive dynamic weight. Then, combined with the dynamically determined target length, memory items are selected sequentially from the sorted candidate memory items until the total length of the selected memory items reaches the target length, thus forming a set of memory items that meets the requirements and providing accurate information support for the response of the current dialogue.

[0207] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements a dialogue processing method as described in any of the above embodiments.

[0208] The processor may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed through integrated logic circuits in the processor's hardware or through software instructions. The processor can 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.

[0209] The various methods, steps, and logic diagrams disclosed in the embodiments of this application can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory, and the processor 403 reads information from memory 402 and, in conjunction with its hardware, completes the steps of the above methods.

[0210] It is understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described herein, or combinations thereof.

[0211] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0212] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.

Claims

1. A dialogue processing method, comprising: Acquire multiple dialogue streams; Determine at least one topic boundary based on the semantics of multiple dialogue streams, and divide all dialogue streams into at least two topic segments based on each of the topic boundaries; Dynamic weights are assigned to memory items in each topic segment, and each memory item stores at least one piece of memory information. The dynamic weights are determined at least based on the timeliness of the memory item, its relevance to the current query, and its coherence with the current topic. In response to the current dialogue, multiple candidate memory items are obtained from all topic fragments. Based on the dynamic weight of each candidate memory item, a set of memory items that meet the target length is selected and output from the multiple candidate memory items.

2. The dialogue processing method as described in claim 1, wherein at least one topic boundary is determined based on the semantics of multiple dialogue streams, and all dialogue streams are segmented into at least two topic segments based on each of the topic boundaries, comprising: Obtain the semantic similarity between two adjacent dialogue streams; Based on the semantic similarity among all dialogue streams, the topic transition degree of the target location is determined, where the target location is any set of dialogue streams; Determine the topic conversion threshold based on the distribution of topic conversion degree; The topic boundary is determined by comparing the topic conversion degree of the target location with the topic conversion threshold.

3. The dialogue processing method as described in claim 2, determining the topic transition degree of the target location, includes: Obtain the average first semantic similarity among the n dialogue streams preceding the target position, and the average second semantic similarity among the n dialogue streams following the target position; Based on the first average semantic similarity and the second average semantic similarity, the center similarity of the target location is obtained; The topic shift degree of the target location is determined based on the first average semantic similarity, the second average semantic similarity, and the center similarity.

4. The dialogue processing method as described in claim 2, wherein a topic transition threshold is determined based on the distribution of topic transition degree; comprising: Obtain the mean and standard deviation of topic conversion rates for all target locations; The linear combination of the mean and the standard deviation is used as the topic switching threshold.

5. The dialogue processing method as described in claim 1, wherein the determination of the dynamic weights includes: The timeliness of the memory item is determined based on the time difference between the time the memory item was generated and the current query time, as well as the structured distance between the topic segment to which the memory item belongs and the current topic segment. The relevance of the memory item to the current query is determined based on the semantic similarity between the memory item and the current query, as well as the entity overlap between the memory item and the current query. The timeliness and coherence of the memory item with the current topic are determined based on the topic alignment between the memory item and the current topic, and the strength of the discourse relationship between the memory item and the current context.

6. The dialogue processing method as described in claim 1, wherein, based on the dynamic weight of each candidate memory item, a set of memory items satisfying a target length is selected and output from the plurality of candidate memory items, comprising: Obtain the attention score for each candidate memory item, and dynamically determine the target length to be output based on the distribution of attention scores for all candidate memory items; The attention score is determined based on at least one of the following factors: the degree of consistency between the topic to which the candidate memory item belongs and the current conversation topic, the information density of the candidate memory item, and the discourse coherence strength of the memory item with the current dialogue context. Sort all candidate memory items by attention score, and select a set of memory items that meet the target length from the candidate memory information.

7. The dialogue processing method as described in claim 6, dynamically determining the target length to be output based on the attention score distribution of all candidate memory items, includes: Obtain the information entropy of attention scores for multiple candidate memory items; The target length is determined based on the information entropy and the preset minimum and maximum lengths.

8. The dialogue processing method as described in claim 1, further comprising: Basic entity relationships are constructed from memory items stored in all topic fragments; wherein, the basic entity relationships include at least the entities, attributes, and relationship elements that appear in the dialogue; Conflict detection is performed based on the underlying entity relationships and the target entity relationships in the current session, and different resolution strategies are executed based on the detected conflict types.

9. A dialogue processing apparatus, comprising: The first module is used to acquire multiple sets of dialogue streams; The second module determines at least one topic boundary based on the semantics of multiple dialogue streams, and divides all dialogue streams into at least two topic segments based on each of the topic boundaries. The third module assigns dynamic weights to memory items for each topic fragment, and each memory item stores at least one piece of memory information. The dynamic weights are determined at least based on the timeliness of the memory item, its relevance to the current query, and its coherence with the current topic. The fourth module, in response to the current dialogue, obtains multiple candidate memory items from all topic fragments, and based on the dynamic weight of each candidate memory item, filters and outputs a set of memory items that meet the target length from the multiple candidate memory items.

10. A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method of any one of claims 1 to 9.