A server and a topic memory-based dialogue generation method
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- V NETHERLANDS PRIVATE LLC
- Filing Date
- 2026-04-23
- Publication Date
- 2026-08-07
AI Technical Summary
[0005]本申请提供一种服务器及基于话题记忆的对话生成方法,以解决大语言模型在词元数量受限的情况下遗漏部分历史对话,导致不同轮次对话存在信息割裂的问题
[0007]以上技术方案具有以下有益效果或优点:通过判断提示词信息是否为新轮次对话的起点,并在起点处计算其与对话数据库各话题之间的第一相关度,服务器能够精准筛选出与当前提示词高度相关的目标话题,将目标话题的历史对话记录输入大语言模型,在不超过词元数量限制的前提下最大化利用历史信息,从而有效消除不同轮次对话之间的信息割裂,显著提升对话生成的个性化体验。
Smart Images

Figure CN122529063A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of display device technology, and in particular to a server and a dialogue generation method based on topic memory. Background Technology
[0002] Large Language Models (LLMs) are deep learning models trained on massive amounts of text data. They predict the next word in a text sequence through autoregression, demonstrating powerful language understanding and generation capabilities. With the continuous expansion of model scale and the continuous enrichment of training data, LLMs have gradually become an important technical path for achieving general artificial intelligence and are widely used in various scenarios such as intelligent dialogue, content generation, and knowledge question answering.
[0003] In the field of intelligent agent applications, large language models serve as the core engine driving natural interaction, capable of reasoning from user-input prompts to generate dialogues that conform to context and user intent. To ensure that each round of dialogue updates with user interaction, large language models can use user-input prompts and historical dialogues as lexical units for the new round of dialogue, allowing the new round of dialogue to retain the characteristics of the previous dialogue.
[0004] However, since large language models can only receive a limited number of lexical units in each inference process, when they combine historical dialogues to generate a new round of dialogue, they may miss some historical dialogues, resulting in information gaps between different rounds of dialogue and reducing the personalized experience of dialogue generation. Summary of the Invention
[0005] This application provides a server and a topic-based dialogue generation method to address the problem that large language models, when limited by the number of lexical units, may miss some historical dialogues, leading to information fragmentation in different rounds of dialogue.
[0006] In a first aspect, some embodiments of this application provide a server, including: The memory is configured to store the large language model and the dialogue database. The dialogue database stores the historical dialogue records output by the large language model during each interaction. The historical dialogue records are stored in the dialogue database in the form of multiple topics. A communicator, configured to establish a communication connection with a display device; The processor is configured as follows: In response to the prompt message information uploaded by the display device, determine whether the prompt message information is the starting point of a new round of dialogue; wherein, the prompt message information is generated by the display device in response to the target command input by the user; When the prompt word information serves as the starting point for a new round of dialogue, calculate the first relevance between the prompt word information and each topic in the dialogue database; Based on the first relevance, at least one target topic is determined, and the target topic is a topic whose first relevance is greater than or equal to the first relevance threshold; Input the prompt words and the historical dialogue records corresponding to the target topic into the large language model, so as to generate the first target content that corresponds to the prompt words and is related to the target topic.
[0007] The above technical solution has the following beneficial effects or advantages: By determining whether the prompt word information is the starting point of a new round of dialogue, and calculating its first relevance with each topic in the dialogue database at the starting point, the server can accurately filter out target topics that are highly related to the current prompt word, input the historical dialogue records of the target topic into the large language model, and maximize the use of historical information without exceeding the limit of the number of lexical units, thereby effectively eliminating the information gap between different rounds of dialogue and significantly improving the personalized experience of dialogue generation.
[0008] In some embodiments, the memory is further configured to store a semantic model and a binary classification model, and the processor executes a response to prompt word information uploaded by the display device to determine whether the prompt word information is the starting point of a new round of dialogue, specifically configured as follows: In response to the prompt word information uploaded by the display device, the second relevance between the prompt word information and the historical dialogue record corresponding to the current round of dialogue is calculated through a semantic model; The binary classification model outputs the first predicted probability of the prompt word information as the starting point of the new round of dialogue based on the second relevance. If the first predicted probability is greater than or equal to the probability threshold, the prompt word information is marked as the starting point of the new round of dialogue.
[0009] The above technical solution has the following beneficial effects or advantages: by using a semantic model to calculate the semantic relevance between the prompt word information and the current round of historical dialogue records, and then using a binary classification model to map this relevance into the probability output of the starting point of the new round of dialogue, it can accurately capture the user's topic switching intention and reduce the server's misjudgment rate of topics.
[0010] In some embodiments, the processor executes a response to prompt information uploaded by the display device, determining whether the prompt information marks the start point of a new round of dialogue. The processor is further configured to: In response to the prompt word information uploaded by the display device, calculate the time interval between the first time point corresponding to the prompt word information and the second time point corresponding to the previous historical dialogue record, obtain the total number of word elements in the historical dialogue records corresponding to the current round of dialogue, and detect the logical identifier type corresponding to the prompt word information. Encode the time interval, the total number of tokens, and the logical identifier type respectively to obtain the time interval code, the number of tokens code, and the logical code; By combining semantic model with time interval encoding, word number encoding and logical encoding, the third relevance between prompt word information and historical dialogue records corresponding to the current round of dialogue is calculated; The second predicted probability of the dialogue starting point for a new round of dialogue is output by a binary classification model based on the third relevance information of the prompt words. If the second predicted probability is greater than or equal to the probability threshold, the prompt word information is marked as the starting point of the new round of dialogue.
[0011] The above technical solutions have the following beneficial effects or advantages: Based on semantic relevance, multiple dimensions of contextual features such as time interval, number of lexical units and logical identifiers are further integrated and encoded before being input into the semantic model. This enables the semantic model to combine multiple dimensions of information such as time, dialogue length and user intent during the relevance calculation process, making the calculation of the third relevance more accurate and further improving the accuracy of judging the starting point of the new round of dialogue.
[0012] In some embodiments, a memory fine-tuning module is also included, which establishes a communication connection with the large language model; when the prompt word information is the starting point of a new round of dialogue, the processor is further configured to: Get the number of topics in the dialogue database; If the number of topics exceeds a preset threshold, a first preset number of sample topics are selected in order of their creation time from earliest to latest. The first preset number is less than or equal to the number of topics and is not zero. Based on the historical dialogue records corresponding to the sample topics, a training dataset is generated, which includes multiple response contents related to the sample topics. Based on the training dataset, the memory fine-tuning module is trained to obtain the parameters of the first module. In response to the new round of prompt word information uploaded by the display device, the large language model generates second target content related to the sample topic and the new round of prompt word information based on its own model parameters, the parameters of the first module, and the new round of prompt word information.
[0013] The above technical solution has the following beneficial effects or advantages: When the number of topics accumulated in the dialogue database exceeds a preset threshold, the server selects early topics as sample topics, uses the historical dialogue records of the sample topics to generate a training dataset, and then trains the memory fine-tuning module. This allows the historical dialogue data to be parameterized and solidified into the memory fine-tuning module. In this way, even if early topics are deleted from the dialogue database, the large language model can still access this part of the memory through the parameters of the first module, achieving lightweight storage and efficient utilization of long-term memory.
[0014] In some embodiments, a cue word database is also included, which stores pre-generated general cue word information; the processor executes historical dialogue records corresponding to the sample topic to generate a training dataset related to the sample topic, specifically configured as follows: The large language model generates third target content corresponding to the sample topic and the general prompt word information based on the historical dialogue records corresponding to the sample topic and the second preset number of general prompt words. Delete the historical dialogue records corresponding to the sample topic in the third target content to obtain the training dataset related to the sample topic.
[0015] The above technical solution has the following beneficial effects or advantages: by using pre-prepared general prompt words, the large language model is instructed to generate third target content based on the historical dialogue records of the sample topic, and then the historical dialogue records are deleted, leaving the pure response content as training samples, thereby increasing the quantity and diversity of the training dataset.
[0016] In some embodiments, the processor executes a response to prompt information uploaded by the display device, determining whether the prompt information is the starting point for a new round of dialogue, specifically configured as follows: In response to the prompt word information uploaded by the display device, calculate the time interval between the first time point of the prompt word information and the second time point corresponding to the previous historical dialogue record; If the time interval is greater than the time interval threshold, the prompt word information will be marked as the starting point of the new round of dialogue.
[0017] The above technical solution has the following beneficial effects or advantages: the server determines the starting point of a new round of dialogue by calculating the time interval between two interactions, which is suitable for scenarios where users restart the dialogue after a period of inactivity, and can accurately capture topic switching caused by time intervals in a simple and efficient way.
[0018] In some embodiments, the processor executes a response to prompt information uploaded by the display device, determining whether the prompt information is the starting point for a new round of dialogue, specifically configured as follows: In response to the prompt word information uploaded by the display device, obtain the total number of lexical units in the historical dialogue records corresponding to the current round of dialogue; If the total number of lexical units is greater than or equal to the lexical unit count threshold, the prompt word information will be marked as the starting point of the new round of dialogue.
[0019] The above technical solution has the following beneficial effects or advantages: using the total number of lexical units accumulated in the current round of dialogue as the basis for topic segmentation, when a single round of dialogue is too long and exceeds the context limit of the large language model, the server automatically defines the prompt word information as the starting point of the new round of dialogue, preventing a single round of dialogue from occupying too many lexical units and affecting the retrieval efficiency of historical memory.
[0020] In some embodiments, the processor performs a response to the display device uploading prompt information, determining whether the prompt information is the starting point for a new round of dialogue, specifically configured as follows: In response to the prompt word information uploaded by the display device, detect the logical identifier type corresponding to the prompt word information; When the logical identifier type is the first logical identifier, in response to the first logical identifier, the prompt word information is marked as the starting point of the new round of dialogue. The first logical identifier is an identifier generated by the display device in response to the user's new topic operation.
[0021] The above technical solution has the following beneficial effects or advantages: By identifying the first logical identifier carried by the user-initiated new topic operation on the display device, the server can directly respond to the user's dialogue intent and mark the corresponding prompt word information as the starting point of the new round. No additional semantic or time judgment is required, which ensures zero-delay response to the user's active topic switching behavior and takes into account both the smoothness of the user experience and the certainty of the system judgment.
[0022] In some embodiments, after training the memory fine-tuning module based on the training dataset to obtain the parameters of the first module, the processor is further configured to: Delete the historical dialogue records corresponding to the sample topic from the dialogue database.
[0023] The above technical solution has the following beneficial effects or advantages: After completing the training of the memory fine-tuning module and obtaining the parameters of the first module, the corresponding sample topic historical dialogue records in the dialogue database are deleted, releasing the storage space of the dialogue database, avoiding the accumulation of historical dialogue records occupying too much storage space, and improving the space utilization of the dialogue database.
[0024] Secondly, some embodiments of this application provide a topic-memory-based dialogue generation method, applied to the server provided in the first aspect, including: In response to the prompt message information uploaded by the display device, determine whether the prompt message information is the starting point of a new round of dialogue; wherein, the prompt message information is generated by the display device in response to the target command input by the user; When the prompt word information serves as the starting point for a new round of dialogue, calculate the first relevance between the prompt word information and each topic in the dialogue database; Based on the first relevance, at least one target topic is determined, and the target topic is a topic whose first relevance is greater than or equal to the first relevance threshold; Input the prompt words and the historical dialogue records corresponding to the target topic into the large language model, so as to generate the first target content that corresponds to the prompt words and is related to the target topic.
[0025] As can be seen from the above technical solutions, this application provides a server and a dialogue generation method based on topic memory. This method, in response to prompt information uploaded by a display device, determines whether the prompt information is the starting point for a new round of dialogue. Based on the first relevance of the prompt information to each topic in the dialogue database, it determines the target topic. Then, it inputs the historical dialogue records corresponding to the prompt information and the target topic into a large language model to generate first target content that corresponds to the prompt information and is related to the target topic. This application, through topic segmentation, retrieves target topics related to the prompt information from the dialogue database as intermediate memory for generating the first target content, given that the prompt information leads to a new round of dialogue. This enables the large language model to generate the first target content with the response style of the target topic, significantly improving the coherence and consistency of multi-turn dialogues. Attached Figure Description
[0026] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 This is a schematic diagram illustrating an operational scenario between a display device and a control device provided in some embodiments of this application; Figure 2 This is a schematic diagram of the hardware configuration of a display device provided in some embodiments of this application; Figure 3 This is a schematic diagram of the software configuration of a display device provided in some embodiments of this application; Figure 4 A flowchart illustrating a topic-memory-based dialogue generation method performed by a server according to some embodiments of this application; Figure 5 A timing diagram showing the execution of a topic-memory-based dialogue generation method by a server in some embodiments of this application; Figure 6 A flowchart of a first embodiment of a server determining the starting point of a new round of dialogue, provided in some embodiments of this application; Figure 7 A flowchart of a second embodiment of the server determining the starting point of a new round of dialogue, provided for some embodiments of this application; Figure 8 A flowchart illustrating how a server generates response content based on a long-term memory response strategy, as provided in some embodiments of this application; Figure 9 A flowchart illustrating the server-generated training dataset provided in some embodiments of this application; Figure 10 A flowchart of a third embodiment of a server determining the start point of a new round of dialogue, provided for some embodiments of this application; Figure 11 A flowchart of a fourth embodiment of a server determining the start point of a new round of dialogue, provided for some embodiments of this application; Figure 12 A flowchart of a fifth embodiment of the server determining the starting point of a new round of dialogue, provided for some embodiments of this application. Detailed Implementation
[0028] The embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described below do not represent all embodiments consistent with this application. They are merely examples of systems and methods consistent with some aspects of this application as detailed in the claims.
[0029] It should be noted that the brief descriptions of terms in this application are only for the convenience of understanding the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise stated, these terms should be understood in their ordinary and common meaning.
[0030] The terms "first," "second," "third," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar or related objects or entities, and do not necessarily imply a specific order or sequence, unless otherwise specified. It should be understood that such terms are interchangeable where appropriate.
[0031] The terms “comprising” and “having”, and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device that includes a range of components is not necessarily limited to all of the components that are clearly listed, but may include other components that are not clearly listed or that are inherent to such product or device.
[0032] The term "module" refers to any known or subsequently developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.
[0033] In this embodiment, the display device 200 generally refers to a device with screen display and data processing capabilities. For example, the display device 200 includes, but is not limited to, smart TVs, mobile terminals, computers, monitors, advertising screens, wearable devices, virtual reality devices, augmented reality devices, etc.
[0034] Figure 1 This is a schematic diagram illustrating an operational scenario between a display device and a control device provided in some embodiments of this application. For example... Figure 1 As shown, a user can operate the display device 200 via touch operation, a mobile terminal 300, and a control device 100. The control device 100 receives user input commands and converts them into control commands that the display device 200 can recognize and respond to. For example, the control device 100 can be a remote control, a stylus, a gamepad, etc.
[0035] The mobile terminal 300 can function as a control device for human-computer interaction between the user and the display device 200. It can also function as a communication device for establishing a communication connection with the display device 200 and exchanging data. In some embodiments, the mobile terminal 300 can have software applications installed on it and communicate with the display device 200 via network communication protocols to achieve one-to-one control and data communication. Furthermore, it can transmit audio and video content displayed on the mobile terminal 300 to the display device 200 for synchronized display.
[0036] In some embodiments, the mobile terminal 300 or other electronic devices may also simulate the functions of the control device 100 by running an application that controls the display device 200.
[0037] like Figure 1 The diagram also shows that the display device 200 communicates with the server 400 via various communication methods. This allows the display device 200 to communicate via a local area network (LAN), a wireless local area network (WLAN), and other networks.
[0038] Display device 200 can provide broadcast television reception function, and can also be equipped with intelligent network television function that provides computer support function, including but not limited to network television, smart television, Internet Protocol television (IPTV), etc.
[0039] Figure 2 Provided for some embodiments of this application Figure 1 Hardware configuration block diagram of display device 200.
[0040] In some embodiments, the display device 200 may include at least one of a tuner 210, a communication device 220, a detector 230, a device interface 240, a controller 250, a display 260, an audio output device 270, a memory, a power supply, and a user input interface 280.
[0041] In some embodiments, detector 230 is used to acquire signals from the external environment or to interact with the outside world. For example, detector 230 includes a light receiver, a sensor for acquiring ambient light intensity; or, detector 230 includes an image acquisition device, such as a camera, which can be used to acquire external environmental scenes, user attributes, or user interaction gestures; or, detector 230 includes a sound acquisition device, such as a microphone, for receiving external sounds.
[0042] In some embodiments, the display 260 includes display function components for presenting images and driving components for driving image display. The display 260 is used to receive and display image signals output from the controller 250. For example, the display 260 can be used to display video content, image content, menu control interface components, and user control UI interfaces, etc.
[0043] In some embodiments, the communication device 220 is a component used to communicate with external devices or the server 400 according to various communication protocol types. The display device 200 may have multiple communication devices 220 depending on the supported communication methods. For example, when the display device 200 supports wireless network communication, it may have a communication device 220 with WiFi functionality. When the display device 200 supports Bluetooth connectivity, it needs to have a communication device 220 with Bluetooth functionality.
[0044] The communication device 220 enables the display device 200 to communicate with external devices or the server 400 via wireless or wired connections. Wired connections utilize data cables, interfaces, or other components to connect the display device 200 to external devices. Wireless connections utilize wireless signals or wireless networks. The display device 200 can directly establish a connection with external devices or indirectly through gateways, routers, or other connection devices.
[0045] In some embodiments, the controller 250 may include at least one of a central processing unit, a video processor, an audio processor, a graphics processor, and a power processor, and a first to an nth interface for input / output. The controller 250 controls the operation of the display device and responds to user operations through various software control programs stored in memory. The controller 250 controls the overall operation of the display device 200.
[0046] In some embodiments, the controller 250 and the tuner 210 may be located in different separate devices, that is, the tuner 210 may also be located in an external device of the main device where the controller 250 is located, such as an external set-top box.
[0047] In some embodiments, a user can input user commands through a graphical user interface (GUI) displayed on a display 260, and the user input interface 280 receives the user input commands through the graphical user interface (GUI).
[0048] In some embodiments, the audio output device 270 can be a built-in speaker of the display device 200 or an external audio output device connected to the display device 200. For the external audio output device connected to the display device 200, the display device 200 may also be provided with an external audio output terminal, through which the audio output device can be connected to the display device 200 to output sound from the display device 200.
[0049] In some embodiments, the user input interface 280 can be used to receive instructions from user input.
[0050] To enable user interaction, in some embodiments, the display device 200 may run an operating system. The operating system is a computer program used to manage and control the hardware and software resources of the display device 200. The operating system can control the display device to provide a user interface; for example, the operating system can directly control the display device to provide a user interface, or it can provide a user interface by running an application. The operating system also allows users to interact with the display device 200.
[0051] It should be noted that the operating system can be a native operating system based on a specific operating platform, a third-party operating system that is deeply customized based on a specific operating platform, or an independent operating system specifically developed for display devices.
[0052] An operating system can be divided into different modules or levels based on the functions it implements, for example... Figure 3As shown, in some embodiments, the system is divided into four layers, from top to bottom: the Applications layer (referred to as the "Application Layer"), the Application Framework layer (referred to as the "Framework Layer"), the System Library layer, and the Kernel layer.
[0053] In some embodiments, the application layer provides services and interfaces for applications, enabling the display device 200 to run applications and interact with the user based on the applications. The application layer may contain at least one application, which may be a built-in Windows program, system settings program, or clock program of the operating system; or it may be an application developed by a third-party developer. In specific implementations, the application packages in the application layer are not limited to the examples above.
[0054] The framework layer provides application programming interfaces (APIs) and a programming framework for applications. The application framework layer includes predefined functions. It acts as a central processing unit, determining the actions taken by applications within the application layer. Through the API, applications can access system resources and obtain system services during execution.
[0055] like Figure 3 As shown, Figure 3 The diagram below illustrates the software configuration of a display device according to some embodiments of this application. In some embodiments, the system of the display device 200 can be divided into three layers, from top to bottom: the application layer, the middleware layer, and the hardware layer.
[0056] The application layer mainly includes TV applications and application frameworks. The applications are mainly browser-based applications, such as HTML5 apps, and native apps. An application framework is a complete program model that has all the basic functions required by standard application software, such as file access, data exchange, and the user interface for these functions (toolbar, status bar, menu, dialog box).
[0057] Native apps can support online or offline access, push notifications, or access to local resources.
[0058] The middleware layer includes various television protocols, multimedia protocols, and system components. Middleware can use the basic services (functions) provided by system software to connect different parts of application systems or different applications on the network, achieving resource sharing and function sharing.
[0059] The hardware layer mainly includes the HAL interface, hardware, and drivers. The HAL interface is a unified interface for all TV chips, with the specific logic implemented by each chip. The drivers mainly include: audio drivers, display drivers, Bluetooth drivers, camera drivers, Wi-Fi drivers, USB drivers, HDMI drivers, sensor drivers (such as fingerprint sensors, temperature sensors, pressure sensors, etc.), and power drivers.
[0060] It should be noted that the above examples are merely a simple division of operating system functions and do not limit the specific form of the operating system of the display device 200 in this application embodiment. Depending on the function of the display device, the type of operating system, and other factors, the number of levels and the specific level type of the operating system may be expressed in other forms.
[0061] In some embodiments, the display device 200 can generate corresponding dialogue content based on prompt words input by the user and display the dialogue content on the display 260. The prompt words can be text, voice commands, or image information input by the user via a remote control, voice input device, or touch panel. The AI processing module built into the display device 200 performs semantic analysis on the prompt words, identifies the user's intent and needs, and then calls the corresponding algorithm model to generate targeted response content.
[0062] In some embodiments, to save computational resources for generating dialogue content, the display device 200 can establish a communication connection with the server 400 via the communication device 220. Upon receiving prompt information, the display device 200 uploads the prompt information to the server 400 via the communication connection. The server 400 may be equipped with a large language model, which can infer from the prompt information input by the user, generate dialogue content that conforms to the context and the user's intent, and return the dialogue content to the display device 200 for display. To ensure that each round of dialogue can be updated with user interaction, the large language model can use the prompts input by the user and historical dialogues as lexical units for the new round of dialogue, allowing the new round of dialogue to retain the characteristics of the historical dialogue.
[0063] However, since large language models can only receive a limited number of lexical units in each inference process, they may miss some historical dialogues when generating a new round of dialogue by combining them with historical dialogues. This results in information gaps between different rounds of dialogue and reduces the personalized experience of dialogue generation.
[0064] To address the above technical issues, some embodiments of this application provide a server 400, which may include a memory, a communicator 410, and a processor 420. The communicator 410 is configured to establish a communication connection with a display device 200 to facilitate data transmission between the server 400 and the display device 200. The memory stores a large language model and a dialogue database.
[0065] It should be noted that the dialogue database is a structured database stored in the server 400's memory, used to store historical dialogue records output by the large language model in each interaction. Historical dialogue records are stored in the dialogue database in the form of multiple topics, each topic corresponding to a continuous dialogue sequence with inherent topical consistency. The dialogue database supports topic-based retrieval operations, enabling the server 400 to quickly locate relevant topics and retrieve corresponding historical dialogue records when receiving new prompts. The basic unit used in the dialogue database for organizing and classifying historical dialogue records is a topic. A topic corresponds to all interaction content from the start to the end of a new round of dialogue. The server 400 delineates topic boundaries by detecting the starting point of a new round of dialogue, allowing historical dialogue records to be stored in segments according to the topic dimension.
[0066] It should be noted that topics are the basic units used in the dialogue database to organize and categorize historical dialogue records. A topic corresponds to all the dialogue content from the start to the end of a new round of dialogue. Server 400 delineates topic boundaries by detecting the starting point of a new round of dialogue, thus segmenting and storing historical dialogue records according to the topic dimension.
[0067] Figure 4 A flowchart illustrating a topic-memory-based dialogue generation method performed by a server according to some embodiments of this application. Figure 5 A timing diagram showing the execution of a topic-memory-based dialogue generation method by a server according to some embodiments of this application.
[0068] See Figure 4 and Figure 5 The processor 420 is configured to perform the following steps: S100: In response to the prompt message information uploaded by the display device, determine whether the prompt message information is the starting point of a new round of dialogue.
[0069] In some embodiments, the prompt information is generated by the display device 200 in response to a target instruction input by the user. The target instruction may include various input methods, such as voice input, text input, and image input; this embodiment does not limit the input method used by the user to input the target instruction. The display device 200 can convert the target instruction into text format to obtain the prompt information.
[0070] In some embodiments, for target instructions obtained through text input, no text format conversion is required; the display device 200 can directly extract prompt information from the target instruction. For target instructions obtained through voice input and image input, text format conversion is required. For example, for target instructions obtained through voice input, the display device 200 can use speech-to-text technology to convert the voice-formatted target instruction into a text-formatted target instruction, thereby extracting prompt information from the target instruction. For target instructions obtained through image input, the display device 200 can use text recognition technology to identify the corresponding text content in the image and extract prompt information from the text content.
[0071] In some embodiments, after receiving a prompt message from the display device 200, the processor 420 first needs to determine the location of the prompt message in the dialogue history. If the prompt message is determined to be the starting point of a new round of dialogue, it means that the user's interaction intent has changed to a different topic. If the prompt message is determined to be a continuation of the current round of dialogue, it is included in the existing topic to continue the current round of dialogue interaction.
[0072] S200: When the prompt word information is the starting point of a new round of dialogue, calculate the first relevance between the prompt word information and each topic in the dialogue database.
[0073] When the prompt word information serves as the starting point for a new round of dialogue, the processor 420 can employ a mid-term memory management strategy. For example, the processor 420 can calculate the first relevance between the prompt word information and each historical topic stored in the dialogue database. The first relevance reflects the strength of the association between the prompt word information and the historical topic at a first level; a higher first relevance indicates a stronger association between the prompt word information and the historical topic.
[0074] For example, if the user's current prompt is "I finished watching the movie you recommended last time, and I thought the visuals were great," and the dialogue database stores historical topics with "movie recommendations" as the theme, then the processor 420 will calculate that the first relevance between the two is relatively high; while historical topics such as "weather query" and "recipe recommendation" have relatively low first relevance with the current prompt.
[0075] S300: Based on the first relevance, identify at least one target topic.
[0076] In some embodiments, the target topic is a topic with a first relevance greater than or equal to a first relevance threshold, that is, a historical topic that is semantically highly related to the prompt word information. It should be noted that the first relevance threshold is a parameter pre-configured by the server 400 and can be flexibly adjusted according to the business scenario. This embodiment does not impose specific restrictions on the value corresponding to the first relevance threshold.
[0077] In some implementations, the number of target topics meeting the threshold conditions in the dialogue database can be zero, one, or more. The processor 420 can filter out all target topics that meet the conditions and include them in subsequent processes. When the number of target topics is zero, the server 400 can send a prompt message to the display device 200. The display device 200 can then display the prompt message to inform the user that the server 400's dialogue database does not store any target topics related to the prompt word information.
[0078] S400: Input the prompt word information and the historical dialogue records corresponding to the target topic into the large language model, so as to generate the first target content corresponding to the prompt word information through the large language model.
[0079] After determining the target topic, server 400 extracts the historical dialogue records corresponding to each target topic from the dialogue database and integrates the prompt word information with these historical dialogue records to form a complete contextual input. Processor 420 inputs the integrated information into a large language model. Based on the semantic understanding of the prompt word information and the interaction background in the historical dialogue records, the large language model generates the first target content corresponding to the prompt word information. Since the large language model incorporates the historical dialogue records of the target topic, it also considers the response style of the historical dialogue records of the target topic when generating the first target content. This ensures that the language style of the first target content is the same as or similar to the response style of the historical dialogue records of the target topic, improving the coherence and consistency of the first target content, thereby providing users with a more personalized response experience that fits their historical interaction habits.
[0080] In some embodiments, the historical dialogue record includes all multi-turn dialogue content under the target topic, covering historical prompt word information uploaded by the display device 200, historical responses from the server 400, and related contextual information. The large language model generates more targeted and coherent response content by analyzing dialogue features such as interaction patterns and user preferences in the historical dialogue record.
[0081] In some embodiments, the processor 420 may preprocess the historical dialogue records before inputting the prompt word information and historical dialogue records into the large language model. Preprocessing operations include removing redundant information, extracting key dialogue nodes, and compressing long text content to reduce the number of tokens input to the large language model, reduce the computational resources required to generate the target content, and improve response efficiency. The specific preprocessing strategy can be dynamically adjusted based on the length, timeliness, and relevance of the historical dialogue records to the prompt word information.
[0082] In some embodiments, when the prompt information is not the starting point of a new round of dialogue, i.e., the prompt information is a continuation of the current round of dialogue, the processor 420 can employ a short-term memory management strategy. Under the short-term memory management strategy, the processor 420 can obtain existing historical dialogue records of the current round of dialogue and integrate the prompt information with the existing historical dialogue records of the current round of dialogue to form a complete contextual input. The integrated information can include the response style of the existing historical dialogue records of the current round of dialogue. After the integrated information is input into the large language model, the large language model will combine the response style of the existing historical dialogue records of the current round of dialogue to generate the first target content.
[0083] In some embodiments, while generating the first target content, the server 400 can also update relevant information in the dialogue database. Specifically, the processor 420 stores the current prompt word information and the generated first target content as a new dialogue record in the dialogue database under the corresponding topic, so as to enrich the historical dialogue data of that topic.
[0084] As can be seen from the above technical solutions, the embodiments of this application determine whether the prompt word information is the starting point of a new round of dialogue, and calculate the first relevance between it and each topic in the dialogue database at the starting point. The server can accurately filter out the target topic that is highly related to the current prompt word, input the historical dialogue records of the target topic into the large language model, and maximize the use of historical information without exceeding the limit of the number of word units, thereby effectively eliminating the information gap between different rounds of dialogue and significantly improving the personalized experience of dialogue generation.
[0085] Figure 6 A flowchart of a first embodiment of a server determining the starting point of a new round of dialogue, provided for some embodiments of this application.
[0086] See Figure 6 In some embodiments, the memory of server 400 also stores a semantic model and a binary classification model. Processor 420 executes step S100, which determines whether the prompt word information is the starting point of a new round of dialogue, specifically including steps S110 to S130.
[0087] S110: In response to the prompt word information uploaded by the display device, calculate the second relevance between the prompt word information and the historical dialogue record corresponding to the current round of dialogue through a semantic model.
[0088] In some embodiments, the semantic model can be a text semantic embedding model. The processor 420 inputs the current prompt word information and the existing historical dialogue records of the current round of dialogue into the semantic model to obtain the corresponding semantic vector representations. Then, by calculating the cosine similarity of the semantic vectors, a second relevance between the prompt word information and the historical dialogue records corresponding to the current round of dialogue is obtained. The second relevance reflects the degree of semantic association between the prompt word information and the current round of dialogue.
[0089] For example, if the second relevance is high, it indicates that the prompt word information belongs to the topic corresponding to the current round of dialogue; if the second relevance is low, it indicates that the topic corresponding to the prompt word information is different from the topic corresponding to the current round of dialogue, and a topic switch may have occurred.
[0090] In some embodiments, a specific separator, such as a SEP Token, can be set between the existing historical dialogue records and the prompt word information in the current round of dialogue to separate them.
[0091] S120: The first predicted probability of the dialogue starting point for the new round of dialogue is output by the prompt word information based on the second relevance of the binary classification model.
[0092] In some embodiments, the output of the semantic model is fed into the binary classification model. Therefore, after the semantic model calculates the second relevance, the binary classification model uses the second relevance output by the semantic model as the input feature, and outputs the prompt word information as the first predicted probability of the dialogue starting point of the new round of dialogue based on the second relevance through the sigmoid function.
[0093] In some embodiments, the binary classification model can employ structures such as logistic regression and lightweight neural networks to perform non-linear transformations on the second relevance, thereby more accurately determining whether the prompt word information is the starting point for a new round of dialogue. Logistic regression models are simple in structure and computationally efficient, making them suitable for scenarios with high real-time requirements; lightweight neural networks, on the other hand, can capture more complex feature relationships, improving classification accuracy.
[0094] In some embodiments, the training process of the binary classification model can use a labeled dialogue dataset, where positive samples are cue words that explicitly identify the starting point of a new round of dialogue, and negative samples are cue words that belong to the continuation of the current round of dialogue. By minimizing the cross-entropy loss function and optimizing the model parameters, the binary classification model can learn the mapping relationship between the second relevance and the dialogue starting point, thereby possessing a first prediction probability that the cue words output based on the second relevance are the starting point of a new round of dialogue.
[0095] S130: If the first predicted probability is greater than or equal to the probability threshold, mark the prompt word information as the starting point of the new round of dialogue.
[0096] In some embodiments, the processor 420 compares a first predicted probability with a preset probability threshold. If the first predicted probability is greater than or equal to the probability threshold, the prompt word information is marked as the starting point of a new round of dialogue, triggering the topic retrieval and content generation process described in subsequent steps S200 to S400. If the first predicted probability is less than the probability threshold, the prompt word information is included in the current round of dialogue to generate target content through a short-term memory management strategy.
[0097] As can be seen from the above technical solutions, this embodiment calculates the semantic relevance between the prompt word information and the current round of historical dialogue records through a semantic model, and then maps the relevance to the probability output of the starting point of the new round of dialogue through a binary classification model. This can accurately capture the user's intention to switch topics and reduce the server's misjudgment rate of topics.
[0098] Figure 7 A flowchart of a second embodiment of the server determining the starting point of a new round of dialogue, provided for some embodiments of this application.
[0099] See Figure 7 In some embodiments, when the processor 420 executes step S100, it can also integrate multi-dimensional features such as time interval, number of lexical units and logical identifiers for comprehensive judgment based on the semantic model and binary classification model, specifically including steps S140-S180.
[0100] S140: In response to the prompt word information uploaded by the display device, calculate the time interval between the first time point corresponding to the prompt word information and the second time point corresponding to the previous historical dialogue record, obtain the total number of word elements in the historical dialogue records corresponding to the current round of dialogue, and detect the logical identifier type corresponding to the prompt word information.
[0101] In some embodiments, upon receiving the prompt word information, the processor 420 can record the current timestamp as a first time point and obtain the generation timestamp of the previous historical dialogue record from the current round of dialogue as a second time point. Then, it calculates the difference between the first and second time points to obtain the time interval, which can determine the coherence of the dialogue. When the time interval is short, it indicates that the user may continue the same topic by continuously inputting prompt word information; when the time interval is long, it may mean that the user has started a new dialogue topic or needs to rebuild contextual understanding.
[0102] In some embodiments, the total number of lexical units reflects the accumulated information in the current dialogue round. The processor 420 can iterate through all historical dialogue records in the current round, count the number of lexical units in each record for prompt words and corresponding responses, and then sum them up. When the total number of lexical units exceeds a preset threshold, it indicates that the total number of lexical units has reached the upper limit of the number of lexical units in the current round. At this time, a new round of dialogue needs to be created.
[0103] In some embodiments, the processor 420 can identify additional fields in the prompt word information, identify whether they carry a specific logical identifier, and identify the type of logical identifier. For example, the logical identifier is an identifier generated by the user based on the triggering of functions such as "create a new topic" or "restart voice interaction" in the user interface of the display device 200, used to indicate the user's intention to actively request to start a new round of conversation.
[0104] S150: Encode the time interval, the total number of tokens, and the logical identifier type respectively to obtain the time interval code, the number of tokens code, and the logical code.
[0105] In some embodiments, the processor 420 can perform encoding operations on the time interval, the total number of tokens, and the logical identifier type respectively, converting the time interval, the total number of tokens, and the logical identifier type into vector representations suitable for semantic model processing, thereby obtaining time interval encoding, token number encoding, and logical encoding.
[0106] In some embodiments, the time interval and the sum of the number of terms can be encoded using the tanh function to map continuous numerical values to a finite interval. Encoding the time interval using the tanh function is illustrated as an example; the tanh function can be expressed as follows: ; Where t is the time interval, M is the maximum encoding length, and N is the normalization parameter. The processor 420 can perform binary encoding on the output of the tanh function to obtain the time interval code.
[0107] In some embodiments, for logical identifier types, binary encoding can be used directly. For example, the logical identifier type can be encoded using 0 and 1 to obtain the logical encoding.
[0108] It should be noted that the above is only an exemplary encoding method, and this embodiment does not limit the use of other encoding methods that can incorporate time intervals, total number of tokens, and logical identifier types.
[0109] S160: By combining semantic model with time interval encoding, word number encoding and logical encoding, calculate the third relevance between prompt word information and the historical dialogue record corresponding to the current round of dialogue.
[0110] In some embodiments, the processor 420 can integrate time interval encoding, word count encoding, logical encoding, prompt word information, and historical dialogue records corresponding to the current round of dialogue. The time interval encoding, word count encoding, and logical encoding are located between the prompt word information and the historical dialogue records corresponding to the current round of dialogue, and are separated by two separator words. For example, the integrated information structure is "historical dialogue records corresponding to the current round of dialogue / separator word / time interval encoding, word count encoding, logical encoding / separator word / prompt word information".
[0111] The processor 420 inputs the integrated information into the semantic model. By combining the semantic model with time interval encoding, word number encoding and logical encoding, it calculates the comprehensive relevance score between the prompt word information and the historical dialogue record corresponding to the current round of dialogue, and obtains the third relevance score.
[0112] S170: The second predicted probability of the dialogue starting point for a new round of dialogue is output by a binary classification model based on the third relevance information of the prompt word.
[0113] In some embodiments, the binary classification model uses the third relevance calculated by the semantic model as input to calculate the second predicted probability that the prompt word information is the starting point of the dialogue in a new round. The implementation process can be found in S120 and will not be repeated here. Since the features input in step S160 include time interval encoding, lexical quantity encoding, and logical encoding, the second predicted probability calculated by the binary classification model based on the third relevance can be combined with multi-dimensional predictions based on interval duration, lexical quantity limitations, and the logical identifier of topic creation, thereby making the second predicted probability more accurate.
[0114] S180: If the second predicted probability is greater than or equal to the probability threshold, mark the prompt word information as the starting point of the new round of dialogue.
[0115] In some embodiments, the processor 420 compares the second predicted probability with a probability threshold, and if the second predicted probability is greater than or equal to the probability threshold, marks the prompt word information as the starting point of the new round of dialogue. The judgment logic is the same as that in step S130, and the relevant implementation process in step S130 can be referred to, which will not be repeated here.
[0116] As can be seen from the above technical solutions, based on semantic relevance, multiple dimensions of contextual features such as time interval, number of lexical units, and logical identifiers are further integrated and encoded before being input into the semantic model. This allows the semantic model to combine multiple dimensions of information such as time, dialogue length, and user intent during the relevance calculation process, making the calculation of the third relevance more accurate and further improving the accuracy of judging the starting point of a new round of dialogue.
[0117] Figure 8 This is a flowchart illustrating how a server generates response content based on a long-term memory response strategy, as provided in some embodiments of this application.
[0118] See Figure 8 In some embodiments, server 400 may further include a memory fine-tuning module, and after step S200, processor 420 is further configured as follows: S500: Get the number of topics in the dialogue database.
[0119] When the prompt message is the starting point of a new round of dialogue, the processor 420 can create a new round of dialogue and create a topic for the current round in the dialogue database, thereby storing all dialogue records corresponding to the current round under the topic of the current round in the dialogue database.
[0120] After the topic for the current round is created in the dialogue database, the processor 420 can iterate through all topics in the dialogue database to obtain the number of topics in the dialogue database.
[0121] S600: When the number of topics exceeds the preset threshold, select the first preset number of sample topics in order of their creation time.
[0122] When the number of topics exceeds a preset threshold, it indicates that the dialogue database has accumulated a large number of historical topics. At this point, server 400 can switch to a long-term memory management strategy. Under the long-term memory management strategy, processor 420 can select a first preset number of sample topics in chronological order of their creation time, i.e., create the earliest generated batch of topics in the time dimension, and use them as training data to train the memory fine-tuning module to perform parameterized compression on these sample topics, thereby saving storage space in the dialogue database. The first preset number is less than or equal to the number of topics in the dialogue database, and the first preset number is not zero.
[0123] S700: Generate a training dataset based on historical dialogue records corresponding to sample topics.
[0124] The training set includes response content related to multiple sample topics. The processor 420 can extract response records, user intent tags, key entity information, and contextual features from the historical dialogue records corresponding to the sample topics to construct structured training samples.
[0125] In some embodiments, for each sample topic, the processor 420 pairs user questions and system responses in the dialogue record to form input-output sample pairs, and labels the domain category, sentiment tendency and information completeness score of the topic, thereby generating a training dataset containing multi-dimensional features.
[0126] S800: Based on the training dataset, the memory fine-tuning module is trained to obtain the parameters of the first module.
[0127] After obtaining the training dataset, the training dataset can be input into the memory fine-tuning module, thereby training the memory fine-tuning module with the training dataset, so that the memory features of the sample topics are retained in the parameters of the memory fine-tuning module, and the parameters of the first module are saved after training.
[0128] S900: In response to a new round of prompt word information uploaded by the display device, the large language model generates second target content related to the sample topic and the new round of prompt word information based on its own model parameters, the first module parameters and the new round of prompt word information.
[0129] In some embodiments, the memory tuning module can be a pluggable low-rank adaptation module (Lora) or an adapter module, or variations such as Scalable Low-Rank Adaptation (S-LoRA), LoRA eXchange (LoRAX), etc. Therefore, the server 400 can adaptively select whether to activate the memory tuning module.
[0130] With the memory fine-tuning module activated, when the server 400 subsequently receives a new round of prompt words, the large language model can combine its inherent model parameters with the first module parameters of the memory fine-tuning module to participate in the reasoning process. This allows the large language model to utilize the long-term memory information of the sample topic through the memory fine-tuning module to generate second target content related to the sample topic and the new round of prompt words. Even if the sample topic has been deleted from the dialogue database, the large language model can still maintain dialogue coherence with earlier historical topics.
[0131] As can be seen from the above technical solution, when the number of topics accumulated in the dialogue database exceeds a preset threshold, the server selects early topics as sample topics and uses the historical dialogue records of the sample topics to generate a training dataset, thereby training the memory fine-tuning module. This allows the historical dialogue data to be parameterized and solidified into the memory fine-tuning module. In this way, even if early topics are deleted from the dialogue database, the large language model can still access this part of the memory through the parameters of the first module, achieving lightweight storage and efficient utilization of long-term memory.
[0132] Figure 9 A flowchart illustrating the server-generated training dataset provided in some embodiments of this application.
[0133] See Figure 9In some embodiments, the server 400 further includes a prompt word database for storing pre-generated general prompt word information. Based on this, step S700 may include steps S710-S720.
[0134] S710: Generate third target content corresponding to the sample topic and general prompt words by using a large language model based on the historical dialogue records corresponding to the sample topic and a second preset number of general prompt words.
[0135] In some embodiments, the processor 420 may select a subset of general prompts from a prompt database. General prompts may be common questions related to daily life, entertainment, knowledge retrieval, etc., such as "Who are you?", "What can you do?", "How to learn programming?", "Recommend some good books", etc.
[0136] The processor 420 concatenates the historical dialogue records of the sample topic with each general cue word, using this as input to the large language model. The large language model generates corresponding third target content based on the historical dialogue records corresponding to the sample topic and a second preset number of general cue words. This allows the large language model to generate diverse responses to various general cue words within the context of the historical topic, thereby expanding the size and coverage of the training dataset.
[0137] S720: Delete the historical dialogue records corresponding to the sample topic in the third target content to obtain the training dataset related to the sample topic.
[0138] In some embodiments, since the third target content is generated in conjunction with historical dialogue records, it may contain direct references to or duplicate content from historical dialogue records. To reduce the interference of this redundant content on the training process, the processor 420 can perform data cleaning on the third target content to remove the parts belonging to the historical dialogue records of the sample topic, retaining the clean response content generated by the large language model based on the historical dialogue records corresponding to the sample topic and a second preset number of general prompt words, to obtain a training dataset related to the sample topic for subsequent training of the memory fine-tuning module.
[0139] As can be seen from the above technical solutions, by using pre-prepared general prompt words, the large language model is instructed to generate third target content based on the historical dialogue records of the sample topic, and then the historical dialogue records are deleted, leaving the pure response content as training samples, thereby increasing the quantity and diversity of the training dataset.
[0140] In some embodiments, after the processor 420 executes step S800, it may also include step S1000.
[0141] S1000: Delete the historical dialogue record corresponding to the sample topic in the dialogue database.
[0142] In some embodiments, since the historical dialogue records of the sample topic have been parameterized and solidified through the training of the memory fine-tuning module, the relevant memories can be retrieved subsequently through the parameters of the first module, and the original historical dialogue records no longer need to be retained in the dialogue database. After confirming that the memory fine-tuning module has been successfully trained and the parameters of the first module have been saved, the processor 420 deletes the historical dialogue records corresponding to the sample topic from the dialogue database, thereby freeing up storage space.
[0143] It should be noted that the processor 420 can retain the corresponding topic (only clearing the historical dialogue record) or delete the entire topic entry, depending on the actual system design. Before performing the deletion operation, the processor 420 needs to confirm that the parameters of the first module have been successfully persisted to prevent loss of memory data due to unexpected interruptions.
[0144] As can be seen from the above technical solutions, after completing the training of the memory fine-tuning module and obtaining the parameters of the first module, this embodiment deletes the corresponding sample topic historical dialogue records in the dialogue database, releases the dialogue database storage space, avoids the accumulation of historical dialogue records occupying too much storage space, and improves the space utilization of the dialogue database.
[0145] In some embodiments, the processor 420 can perform online or offline training on the memory fine-tuning module. Offline training requires the processor 420 to monitor the number of topics in the dialogue database in real time. When the number of topics exceeds a preset threshold, offline training is triggered, i.e., the training process described in the aforementioned embodiments. Online training is a training method that combines inference and training simultaneously. When the number of topics exceeds a preset threshold, the memory fine-tuning module is trained using historical dialogue records corresponding to all topics, and a second preset number of topics are deleted from the dialogue database in chronological order of their creation time.
[0146] It should be noted that during online training, the memory fine-tuning module needs to be substituted into the large language model for training. While keeping the model weight parameters of the large language model unchanged, the module weight parameters of the memory fine-tuning module are trained and adjusted to achieve online training.
[0147] In some embodiments, the processor 420 may use one of the following features—time interval, total number of lexical units, and logical identifier type—as the basis for determining whether the prompt word information is the starting point of a new round of dialogue.
[0148] Figure 10 A flowchart of a third embodiment of a server determining the starting point of a new round of dialogue, provided for some embodiments of this application.
[0149] See Figure 10 In some embodiments, step S100 may include: S190: In response to the prompt word information uploaded by the display device, calculate the time interval between the first time point of the prompt word information and the second time point corresponding to the previous historical dialogue record.
[0150] The implementation method of step S190 can be found in step S140, which calculates the time interval between the first time point corresponding to the prompt word information and the second time point corresponding to the previous historical dialogue record. It will not be repeated here.
[0151] S191: If the time interval is greater than the time interval threshold, mark the prompt word information as the starting point of the new round of dialogue.
[0152] In some embodiments, the processor 420 compares the calculated time interval with a preset time interval threshold. The time interval threshold can be flexibly configured according to specific application scenarios. For example, for a smart TV scenario, the time interval threshold can be set to 30 minutes or 1 hour. If the time interval is greater than the time interval threshold, the prompt word information is considered to be marked as the starting point of a new round of dialogue; otherwise, if the time interval is less than or equal to the time interval threshold, the prompt word information is summarized as the current round of dialogue, and processing continues.
[0153] As can be seen from the above technical solutions, the server 400 determines the starting point of a new round of dialogue by calculating the time interval between two interactions. This is suitable for scenarios where users restart a dialogue after a period of inactivity, and can accurately capture topic switching caused by time intervals in a simple and efficient manner.
[0154] Figure 11 A flowchart of a fourth embodiment of the server determining the starting point of a new round of dialogue, provided for some embodiments of this application.
[0155] See Figure 11 In some embodiments, step S100 may include: S192: In response to the prompt word information uploaded by the display device, obtain the total number of word units in the historical dialogue records corresponding to the current round of dialogue.
[0156] The implementation method of step S190 can be found in step S140, which is used to obtain the total number of lexical units in the historical dialogue records corresponding to the current round of dialogue. It will not be repeated here.
[0157] S193: If the total number of lexical units is greater than or equal to the lexical unit number threshold, mark the prompt word information as the starting point of the new round of dialogue.
[0158] In some embodiments, the processor 420 compares the total number of lexical units with a preset lexical unit count threshold. The lexical unit count threshold can be set according to the input window size of the large language model, typically set as a certain percentage of the maximum input window of the large language model, such as 50% to 80%, or 100%. If the total number of lexical units reaches or exceeds the threshold, the current round of dialogue is considered long enough. To prevent excessive historical dialogue records from occupying the input window and squeezing the available topic memory space, the processor 420 marks the subsequently received prompt word information as the starting point of a new round of dialogue to create a new topic and generate response content. Conversely, if the total number of lexical units is less than the lexical unit count threshold, the prompt word information is included in the current round of dialogue, and processing continues.
[0159] As can be seen from the above technical solutions, the total number of words accumulated in the current round of dialogue is used as the basis for topic segmentation. When a single round of dialogue is too long and exceeds the context limit of the large language model, the server 400 automatically defines the prompt word information as the starting point of the new round of dialogue, so as to prevent a single round of dialogue from occupying too many words and affecting the retrieval efficiency of historical memory.
[0160] Figure 12 A flowchart of a fifth embodiment of the server determining the starting point of a new round of dialogue, provided for some embodiments of this application.
[0161] See Figure 12 In some embodiments, step S100 may include: S194: In response to the prompt word information uploaded by the display device, detect the logical identifier type corresponding to the prompt word information.
[0162] The implementation method of step S190 can be found in the implementation method of detecting the logical identifier type corresponding to the prompt word information in step S140, and will not be repeated here.
[0163] S195: When the logical identifier type is the first logical identifier, in response to the first logical identifier, mark the prompt word information as the starting point of the new round of dialogue.
[0164] In some embodiments, the first logical identifier is an identifier generated by the display device 200 in response to the user's operation of creating a new topic. When the logical identifier type is the first logical identifier, it indicates that the prompt word information is input by the user based on the "create a new topic" or "restart voice interaction" function in the user interface of the display device 200, which can indicate that the user wants to create a new topic to continue the dialogue interaction. At this time, the server 400 can directly mark the prompt word information as the starting point of the new round of dialogue.
[0165] As can be seen from the above technical solutions, by recognizing the first logical identifier carried by the user-initiated new topic creation operation on the display device side, the server can directly respond to the user's dialogue intent and mark the corresponding prompt information as the starting point of the new round without additional semantic or time judgment, ensuring zero-delay response to the user's initiative to switch topics, and taking into account both the smoothness of the user experience and the certainty of the system's judgment.
[0166] Some embodiments of this application also provide a dialogue generation method based on topic memory. This method is applied to server 400 and includes steps S100-S400 provided in the foregoing embodiments. The implementation and beneficial effects of this method can be found in the foregoing embodiments, and will not be repeated here.
[0167] As can be seen from the above technical solutions, this application provides a server and a dialogue generation method based on topic memory. This method, in response to prompt word information uploaded by a display device, determines whether the prompt word information is the starting point of a new round of dialogue. Based on the first relevance of the prompt word information to each topic in the dialogue database, it determines the target topic. Then, it inputs the historical dialogue records corresponding to the prompt word information and the target topic into a large language model to generate first target content that corresponds to the prompt word information and is related to the target topic. This application, through topic segmentation, retrieves target topics related to the prompt word information from the dialogue database as intermediate memory for generating the first target content when it is determined that the prompt word information leads to a new round of dialogue. This enables the large language model to generate the first target content with the response style of the target topic, significantly improving the coherence and consistency of multi-turn dialogues. Similar or identical parts between the various embodiments in this specification can be referred to mutually, and will not be repeated here.
[0168] Those skilled in the art will clearly understand that the techniques in the embodiments of the present invention can be implemented using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solutions in the embodiments of the present invention, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or certain parts of the embodiments of the present invention.
[0169] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
[0170] For ease of explanation, the above description has been provided in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or to limit the embodiments to the specific forms disclosed above. Various modifications and variations can be obtained based on the above teachings. The selection and description of the above embodiments are for the purpose of better explaining the principles and practical applications, thereby enabling those skilled in the art to better utilize the described embodiments and various different variations of embodiments suitable for specific use considerations.
Claims
1. A server, characterized in that, include: The memory stores a large language model and a dialogue database. The dialogue database stores historical dialogue records output by the large language model during each interaction. The historical dialogue records are stored in the dialogue database in the form of multiple topics. The communicator is configured to establish a communication connection with the display device; The processor is configured as follows: In response to the prompt word information uploaded by the display device, it is determined whether the prompt word information is the starting point of a new round of dialogue; wherein, the prompt word information is generated by the display device in response to the target command input by the user; If the prompt word information is the starting point of a new round of dialogue, calculate the first relevance of the prompt word information to each topic in the dialogue database; Based on the first relevance, at least one target topic is determined, wherein the target topic is a topic whose first relevance is greater than or equal to the first relevance threshold; The prompt word information and the historical dialogue records corresponding to the target topic are input into the large language model to generate first target content that corresponds to the prompt word information and is related to the target topic.
2. The server according to claim 1, characterized in that, The memory is also configured to store a semantic model and a binary classification model. The processor executes a response to the prompt word information uploaded by the display device, determining whether the prompt word information is the starting point of a new round of dialogue. Specifically, it is configured as follows: In response to the prompt word information uploaded by the display device, a second relevance between the prompt word information and the historical dialogue record corresponding to the current round of dialogue is calculated through the semantic model; The binary classification model outputs a first predicted probability that the prompt word information is the starting point of the new round of dialogue based on the second relevance. If the first predicted probability is greater than or equal to the probability threshold, the prompt word information is marked as the starting point of the new round of dialogue.
3. The server according to claim 2, characterized in that, The processor executes a response to the prompt message information uploaded by the display device, determines whether the prompt message information is the starting point of a new round of dialogue, and the processor is further configured to: In response to the prompt word information uploaded by the display device, the time interval between the first time point corresponding to the prompt word information and the second time point corresponding to the previous historical dialogue record is calculated, and the total number of word elements in the historical dialogue records corresponding to the current round of dialogue is obtained, and the logical identifier type corresponding to the prompt word information is detected. Encode the time interval, the total number of tokens, and the logical identifier type respectively to obtain the time interval code, the number of tokens code, and the logical code; By combining the semantic model with the time interval encoding, the word number encoding, and the logical encoding, the third relevance between the prompt word information and the historical dialogue record corresponding to the current round of dialogue is calculated; The binary classification model outputs a second predicted probability that the prompt word information is the starting point of the new round of dialogue based on the third relevance. If the second predicted probability is greater than or equal to the probability threshold, the prompt word information is marked as the starting point of the new round of dialogue.
4. The server according to claim 1, characterized in that, It also includes a memory fine-tuning module, which establishes a communication connection with the large language model; when the prompt word information is the starting point of a new round of dialogue, the processor is further configured to: Obtain the number of topics in the dialogue database; If the number of topics exceeds a preset threshold, a first preset number of sample topics are selected in order of their creation time from earliest to latest. The first preset number is less than or equal to the number of topics and is not zero. Based on the historical dialogue records corresponding to the sample topic, a training dataset is generated, which includes multiple response contents related to the sample topic; Based on the training dataset, the memory fine-tuning module is trained to obtain the parameters of the first module. In response to a new round of prompt word information uploaded by the display device, the large language model generates second target content related to the sample topic and the new round of prompt word information based on its own model parameters, the parameters of the first module, and the new round of prompt word information.
5. The server according to claim 4, characterized in that, It also includes a prompt word database, which stores pre-generated general prompt word information; the processor executes a training dataset related to the sample topic based on historical dialogue records corresponding to the sample topic, specifically configured as follows: The large language model generates third target content corresponding to the sample topic and the general prompt word information based on the historical dialogue records corresponding to the sample topic and a second preset number of general prompt word information. Delete the historical dialogue records corresponding to the sample topic in the third target content to obtain the training dataset related to the sample topic.
6. The server according to claim 1, characterized in that, The processor executes a response to the prompt message information uploaded by the display device, and determines whether the prompt message information is the starting point of a new round of dialogue, specifically configured as follows: In response to the prompt word information uploaded by the display device, the time interval between the first time point of the prompt word information and the second time point corresponding to the previous historical dialogue record is calculated; If the time interval is greater than the time interval threshold, the prompt word information is marked as the starting point of a new round of dialogue.
7. The server according to claim 1, characterized in that, The processor executes a response to the prompt message information uploaded by the display device, and determines whether the prompt message information is the starting point of a new round of dialogue, specifically configured as follows: In response to the prompt word information uploaded by the display device, the total number of word elements in the historical dialogue records corresponding to the current round of dialogue is obtained; If the total number of lexical units is greater than or equal to the lexical unit number threshold, the prompt word information is marked as the starting point of a new round of dialogue.
8. The server according to claim 1, characterized in that, The processor executes a response to the display device uploading prompt information, determining whether the prompt information is the starting point for a new round of dialogue, specifically configured as follows: In response to the prompt word information uploaded by the display device, the logical identifier type corresponding to the prompt word information is detected; When the logical identifier type is the first logical identifier, in response to the first logical identifier, the prompt word information is marked as the starting point of a new round of dialogue. The first logical identifier is an identifier generated by the display device in response to the user's new topic operation.
9. The server according to claim 5, characterized in that, The execution, based on the training dataset, trains the memory fine-tuning module to obtain the parameters of the first module. The processor is further configured to: Delete the historical dialogue record corresponding to the sample topic from the dialogue database.
10. A dialogue generation method based on topic memory, characterized in that, Applied to servers, including: In response to the prompt word information uploaded by the display device, it is determined whether the prompt word information is the starting point of a new round of dialogue; wherein, the prompt word information is generated by the display device in response to the target command input by the user; If the prompt word information is the starting point of a new round of dialogue, calculate the first relevance of the prompt word information to each topic in the dialogue database; Based on the first relevance, at least one target topic is determined, wherein the target topic is a topic whose first relevance is greater than or equal to the first relevance threshold; The prompt word information and the historical dialogue records corresponding to the target topic are input into the large language model to generate first target content that corresponds to the prompt word information and is related to the target topic.