Question and answer method and device, equipment and medium

By finding short-term and long-term data related to target problems in the agent's database and calling large language models to generate replies, the problem of limited storage space of the agent memory module is solved, and the accuracy and practicality of question-and-answer responses are improved.

CN119918669APending Publication Date: 2025-05-02新奥新智科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411979893.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

The memory module of the agent has limited storage space, which can only store recent historical data, lack of long-term awareness of users, resulting in low accuracy and poor practicality of Q&A reply.

Method used

By finding target short-term data and target long-term data similar to target problems in a pre-configured database, including key information for user preferences, invoking large language models to generate target responses corresponding to target problems.

Benefits of technology

It improves the accuracy and practicality of Q&A reply, and can handle user problems more accurately and personalized.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119918669A_ABST
    Figure CN119918669A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, in particular to a question and answer method and device, equipment and a medium. In order to make the question answering process more accurate and personalized, a database used for storing long-term data and short-term data is designed, in the question answering process, an electronic device can match target short-term data and target long-term data related to a target question from the database, and the question answering efficiency is improved. Therefore, the big language model can be scheduled to generate the target reply corresponding to the target question according to the target short-term data and the target long-term data, and the accuracy and practicability of the reply are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a question-answering method, device, equipment and medium. Background Art

[0002] An agent is a software or program that can run autonomously to some extent. It can operate under the guidance of the user or according to predetermined rules. With the emergence of large language models (LLM), the development of agents has received a new impetus. At present, the framework design and implementation of agents usually follow the structure of "Agent = LLM + memory + planning + tool". The LLM module is responsible for processing and understanding language; the memory module is used to save and retrieve historical data for planning and decision-making; the planning module is used to formulate effective action strategies based on the current situation and goals; the tool module is used to perform various tasks. The above four parts work together to enable the agent to perform tasks autonomously and intelligently.

[0003] However, the storage space of the agent's memory module is limited, so the memory module can only store recent historical data. When answering questions, due to the lack of long-term cognition of the user who asked the question, the reply text output by the agent has low accuracy and poor practicality. Summary of the invention

[0004] The present application provides a question-answering method, device, equipment and medium to solve the problem that the memory module can only store recent historical data. When solving some family needs, due to the lack of long-term cognition of the family, the reply text output by the intelligent agent has low accuracy and poor practicality.

[0005] In a first aspect, an embodiment of the present application provides a question-answering method, the method comprising:

[0006] Receiving a question-and-answer instruction carrying a target question;

[0007] Searching for target short-term data similar to the target problem in a pre-configured database, and searching for target long-term data matching the slot in the target problem in the database; wherein the target long-term data includes key information of user preferences;

[0008] The large language model is called so that the large language model generates a target response corresponding to the target question according to the target short-term data and the target long-term data.

[0009] In a second aspect, an embodiment of the present application further provides a question-answering device, the device comprising:

[0010] A processing module is used to receive a question-answering instruction carrying a target question; search for target short-term data similar to the target question in a pre-configured database, and search for target long-term data matching the slot in the target question in the database; wherein the target long-term data includes key information of user preferences;

[0011] The question-answering module is used to call the large language model so that the large language model generates a target response corresponding to the target question based on the target short-term data and the target long-term data.

[0012] In a third aspect, an embodiment of the present application further provides an electronic device, which includes at least a processor and a memory, and the processor is used to implement the steps of the question-and-answer method as described above when executing a computer program stored in the memory.

[0013] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, which implements the steps of the question-and-answer method as described above when the computer program is executed by a processor.

[0014] In order to make the question-answering process more accurate and personalized, the embodiment of the present application designs a database for storing long-term data and short-term data. During the question-answering process, the electronic device can match the target short-term data and target long-term data related to the target question from the database, so that the large language model can be scheduled to generate a target reply corresponding to the target question according to the target short-term data and target long-term data, thereby improving the accuracy and practicality of the reply. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0016] Figure 1 A schematic diagram of a question-and-answer process provided in an embodiment of the present application;

[0017] Figure 2 A schematic diagram of the structure of the family demand insight library provided in the embodiment of the present application;

[0018] Figure 3 A flowchart of database construction provided in the embodiment of the present application;

[0019] Figure 4 A schematic diagram of private model construction provided for an embodiment of the present application;

[0020] Figure 5A schematic diagram of the application of the database provided in the embodiment of the present application;

[0021] Figure 6 A schematic diagram of the structure of a question-and-answer device provided in an embodiment of the present application;

[0022] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the drawings in the embodiment of the present application. Obviously, the described embodiment is only a part of the embodiment of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be arbitrarily combined with each other. In addition, although the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that here.

[0024] The terms "first" and "second" in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any of their variations are intended to cover non-exclusive protection. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices. "Multiple" in the present application can mean at least two, for example, two, three or more, and the embodiments of the present application are not limited.

[0025] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description. It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0026] At present, the framework design and implementation of Agent usually follows the structure of "Agent = LLM + memory + planning + tool". The LLM module is responsible for processing and understanding language; the memory module is used to save and retrieve historical data for planning and decision-making; the planning module is used to formulate effective action strategies based on the current situation and goals; the tool module is used to perform various tasks. The above four parts work together to enable the Agent to perform tasks autonomously and intelligently.

[0027] Among the four modules, the memory module is not just a simple information storage warehouse, but a complex system that plays a key role in information collection, processing, storage and retrieval in the interaction between the agent and the environment. The memory model allows the agent to effectively organize information, including classification, indexing, and prioritization of data, as well as updating and deleting outdated or irrelevant information, ensuring that the required data can be retrieved quickly and accurately, avoiding information overload, and keeping the decision-making process clear and efficient.

[0028] In practical applications, most intelligent agents do not distinguish between long-term and short-term memory, or do not precipitate long-term memory, such as AutoGPT. However, in some application scenarios, intelligent agents need to combine long-term memory to conduct question and answer. For example, in a family scenario, a personalized service experience means that a family assistant must be created that can understand and adapt to the personalized needs of each family member. It is necessary to learn and understand the interests and personality traits of each family member, and to achieve the ability to develop healthy diet plans, create schedules, and recommend products. Short-term memory alone cannot solve the above problems, and long-term memory is needed to continuously record information such as the user's physical condition, changes in interests and hobbies, etc.

[0029] Based on this, the embodiment of the present application provides a question-answering method, device, equipment and medium. In the embodiment of the present application, a question-answering instruction carrying a target question is received; target short-term data similar to the target question is searched in a pre-configured database, and target long-term data matching the slot in the target question is searched in the database; wherein the target long-term data includes key information of user preferences; a large language model is called so that the large language model generates a target response corresponding to the target question based on the target short-term data and the target long-term data.

[0030] Embodiment 1:

[0031] Figure 1 A schematic diagram of a question-and-answer process provided in an embodiment of the present application, the process includes:

[0032] S101: Receive a question-and-answer instruction carrying a target question; search a preconfigured database for target short-term data similar to the target question, and search the database for target long-term data matching a slot in the target question; wherein the target long-term data includes key information of user preferences.

[0033] A question-answering method provided in an embodiment of the present application is applied to an electronic device, which may be a PC, a server, etc., in which an intelligent agent runs.

[0034] In an embodiment of the present application, the electronic device stores long-term and short-term memory data in an external medium such as a database, and retrieves relevant data from the database when used.

[0035] Specifically, in the embodiment of the present application, the electronic device is pre-configured with a database for storing each user's long-term and short-term memory. Among them, the long-term memory is long-term data, including but not limited to key information of user preferences, or behavioral information of user preferences, etc.; the short-term memory is short-term data, including but not limited to the user's historical question and answer data.

[0036] During the application process, in various scenarios, users can input target questions into electronic devices through applications, web pages, etc., and then the application generates a question-and-answer instruction carrying the target question, so that the agent responds to the question-and-answer instruction. The target question is obtained from the question-and-answer instruction, and the long-term and short-term memory related to the target question is retrieved from the database, and the large language model is scheduled to generate the target response corresponding to the target question according to the long-term and short-term memory.

[0037] In a possible implementation, the electronic device may use retrieval augmented generation (RAG) technology to retrieve target short-term data related to the target problem from a database.

[0038] Among them, RAG combines knowledge retrieval and generation models to reduce the generation of "hallucinations", which is generally implemented with the help of vector databases. Vector databases are a type of database specifically used to store, index, and manage data vector embeddings generated by machine learning models. These vector embeddings are high-dimensional representations of data items (such as text, images, or sounds) that can capture certain aspects of their content or features so that computers can process them. Commonly used ones include Chroma, Redis, and Milvus. The complete RAG application process mainly includes two stages. The first stage is the data preparation stage. RAG vectorizes text data after slicing it, and then stores it in the form of vectors in the vector database; the second stage is the application stage. According to the user's questions, through efficient retrieval methods, the most relevant knowledge is recalled and integrated into the prompt, and finally the LLM generates the answer.

[0039] Based on this, if the electronic device uses RAG technology to retrieve from a database, the database stores a first vector corresponding to the short-term data. The electronic device determines the target short-term data and the target long-term question and answer data based on the target vector corresponding to the target question, and each first vector and each second vector stored in the database.

[0040] In the embodiment of the present application, the long-term data stored in the electronic device includes structured long-term data and unstructured long-term data. For the unstructured long-term data, the database also stores a second vector corresponding to the unstructured long-term data, and the electronic device can use the RAG technology to retrieve the unstructured target user data matching the target question from the database.

[0041] Specifically, the short-term data stored in the database includes questions and answers. The electronic device can determine candidate questions similar to the target question in the database according to a preset similarity algorithm, and determine the short-term data containing the candidate question as the target short-term data. The electronic device can also use the similarity algorithm to determine target long-term data similar to the target question in the database.

[0042] However, since long-term data is the key information of user preferences, similarity algorithms may not be able to accurately filter out target long-term data. For example, if the target question is: what food do you recommend for lunch, the target long-term data that the electronic device should filter out is: I like to eat hot pot. However, since the semantic similarity between the target long-term data and the target question is not high, the electronic device cannot filter out the target long-term data based on the similarity algorithm.

[0043] Based on this, in an embodiment of the present application, when long-term data is stored in the database, it will also be stored in a structured manner, that is, key information and corresponding slot types are stored accordingly, and the electronic device can use slot matching to match the target long-term data from the database.

[0044] Specifically, the electronic device extracts the slot of the target problem, determines the target slot type contained in the target problem, and searches the database for target long-term data corresponding to the target slot type.

[0045] In a possible implementation, structured long-term data may be stored in a database in the form of a table, as shown in the following Table 1:

[0046] Food preference hot pot Preferred travel mode Public transportation Preferred travel time night

[0047] Table 1

[0048] Table 1 is a long-term memory storage table provided in an embodiment of the present application. As shown in Table 1, the preferred food is apple, the preferred mode of travel is public transportation, and the preferred travel time is evening. Based on this, if the target question is "what food is recommended for lunch", the electronic device can match the target long-term data "preferred food: hot pot" in the database according to the slot "food".

[0049] S102: calling a large language model so that the large language model generates a target response corresponding to the target question according to the target short-term data and the target long-term data.

[0050] In an embodiment of the present application, after the target short-term data and the target long-term data corresponding to the target question are determined, the large language model can be called so that the large language model generates a target response corresponding to the target question based on the target short-term data and the target long-term data.

[0051] In one possible implementation, the electronic device adds the target short-term data and the target long-term data to the prompt word, inputs the prompt word and the target question into the large language model together, and the large language model generates and outputs the target response corresponding to the target question based on the target short-term data and the target long-term data.

[0052] In addition to the target short-term data and the target long-term data, the prompt word at least includes the functional text for prompting the large language model and the information of the database table for generating the reply text.

[0053] In addition, in the embodiment of the present application, weights can be assigned to long-term data and short-term data, so that the large language model can generate target responses based on the weights. For example, when generating a breakfast recipe for a child, it can be seen from the long-term memory that the child's favorite foods are ham, cheese, and lettuce, and that they like spicy food. From the short-term memory, it can be found that the child has a sore throat, so it can be recommended to eat ham and lettuce wraps in the morning.

[0054] In order to make the question-answering process more accurate and personalized, the embodiment of the present application designs a database for storing long-term data and short-term data. During the question-answering process, the electronic device can match the target short-term data and target long-term data related to the target question from the database, so that the large language model can be scheduled to generate a target reply corresponding to the target question according to the target short-term data and target long-term data, thereby improving the accuracy and practicality of the reply.

[0055] Embodiment 2:

[0056] In order to improve the accuracy and practicality of the reply, based on the above embodiment, in the embodiment of the present application, the question and answer instruction also carries a target user identifier;

[0057] The step of searching a pre-configured database for target short-term data similar to the target problem includes:

[0058] Determine a target short-term data set corresponding to the target user identifier in the database;

[0059] In the target short-term data set, target short-term data similar to the target problem is searched.

[0060] In order to provide users with personalized questions and answers, in the embodiment of the present application, when the electronic device stores short-term data and long-term data in the database, it also stores the user ID of the user to whom the data belongs. When searching later, the target short-term data and target long-term data will be retrieved from the data corresponding to the user who input the target question.

[0061] Specifically, the question-and-answer instruction also carries a target user identifier corresponding to the user who inputs the target question, and the target user identifier may be an account name, account number, name, etc. After the agent receives the question-and-answer instruction, the agent obtains the target user identifier carried in the question-and-answer instruction, and searches for a target short-term data set corresponding to the target user identifier in a database. The agent searches for target short-term data sets similar to the target question carried in the question instruction from the target short-term data set.

[0062] In addition, in the embodiment of the present application, the database also stores the user identifier corresponding to each long-term data, and the intelligent agent uses a similar method to determine the target long-term data.

[0063] Specifically, the agent searches the database for a target long-term data set corresponding to the target user identifier carried in the question-answer instruction, and searches the target long-term data set for target long-term data matching the slot of the target question carried in the question instruction.

[0064] Embodiment 3:

[0065] In order to improve the accuracy and practicality of the reply, based on the above embodiments, in the embodiment of the present application, if the target short-term data and the target long-term data are not found, the method further includes:

[0066] Obtaining basic user information carried in the question-and-answer instruction, and determining the target group category corresponding to the target user based on the basic user information; wherein the basic user information includes the user's age, gender, and location;

[0067] In the database, searching for target group data corresponding to the target group category; wherein the group data is determined based on long-term data of each user belonging to the same group category;

[0068] The large language model is called so that the large language model generates a target response corresponding to the target question according to the target group data.

[0069] In the embodiment of the present application, if the agent has not retrieved the target long-term data or the target short-term data, it means that the user who asked the target question is a new user. At this time, the agent needs to "cold start", that is, how to guess the user's intention in a new scene or when the new user has no long or short-term memory. In the related art, when facing new scenes or new users, the agent can often only "discuss the matter at hand" and cannot provide personalized solutions based on the user's characteristics.

[0070] In order to solve the problem of guessing user intentions in a "cold start" scenario, in an embodiment of the present application, when constructing a database, a platform-level memory layer related to group portraits is constructed in the database. In a "cold start" scenario, the intelligent agent can use similar group data instead of the long- and short-term data of new users that have not been mined.

[0071] Among them, group data essentially plays a role in a vague understanding of new users. A simple example is to plan a memory of staple food preferences based on region, gender, age, height and weight. When a new user comes in, first classify them into groups, and then recall the group data corresponding to this group as instruction support information.

[0072] Specifically, in the embodiment of the present application, the database is divided into at least three memory layers, each memory layer corresponds to a storage area of ​​the database, and the three memory layers are respectively a long-term memory layer for storing long-term data, a short-term memory layer for storing short-term data, and a platform memory layer for storing group data. In different scenarios, the name of the database is different.

[0073] For example, in a family scenario, in order to create a home assistant that can understand and adapt to the personalized needs of each family member, a family demand insight library will be pre-built. The family demand insight library includes a short-term memory layer, a long-term memory layer, and a platform memory layer.

[0074] Figure 2 A schematic diagram of the structure of the family demand insight library provided in the embodiment of the present application, such as the Figure 2 As shown in the figure, the family demand insight library includes a short-term memory layer, a long-term memory layer, and a platform memory layer. The short-term memory layer is used to store the user's recent input and interaction data, with a high update frequency; the long-term memory layer is used to precipitate the user's long-term behavior patterns and preferences, with a low but continuous update frequency; the platform memory layer is specifically used to store crowd memory of characteristic scenes or events.

[0075] Based on this, in an embodiment of the present application, if the target short-term data and target long-term data related to the target question are not found, the basic user information carried in the question and answer instruction can be obtained, and the target group category corresponding to the target user can be determined based on the basic user information, so as to reply to the target question based on the target group data corresponding to the target group category.

[0076] Among them, user basic information includes but is not limited to the user's age, gender and location.

[0077] It should be noted that in the embodiments of the present application, the information used to classify users when determining group data is the same as the information used to determine the target group category. For example, when building a database, users are classified based on age, and each group category and corresponding group data are determined. Then, the agent will also determine the target group category based on the age carried in the question-and-answer instruction.

[0078] Specifically, in the embodiment of the present application, the agent obtains the basic user information carried in the question instruction, and determines the target group category to which the target user belongs based on the basic user information. The agent searches the database for the target group data corresponding to the target group category; wherein the group data is determined based on the long-term data of each user belonging to the same group category. The agent calls the large language model so that the large language model generates the target response corresponding to the target question based on the target group data.

[0079] Among them, the process in which the intelligent agent calls the large language model so that the large language model generates the target response corresponding to the target question based on the target group data is similar to the process in which the intelligent agent calls the large language model so that the large language model generates the target response corresponding to the target question based on the target short-term data and the target long-term data, and will not be repeated here.

[0080] Embodiment 4:

[0081] In order to improve the accuracy and practicality of the reply, based on the above embodiments, in the embodiment of the present application, the process of determining the group data includes:

[0082] Determining each user identification and corresponding long-term data stored in the database;

[0083] Classify the users of each user ID according to the stored basic user information corresponding to each user ID, and determine each group category; wherein the basic user information includes the user's age, gender and location;

[0084] For each group category, a large language model is called to summarize the long-term data corresponding to each user identifier contained in the group category to obtain summary data; the summary data is used as the group data corresponding to the group category, and the group data and the group category are correspondingly saved in the database.

[0085] In the embodiment of the present application, the group data is obtained based on the long-term data statistical analysis of each user belonging to the same group category.

[0086] Specifically, when determining group data, each user ID and corresponding long-term data stored in the database are determined; and according to the basic user information corresponding to each stored user ID, the user of each user ID is classified to determine each group category.

[0087] For each group category, the large language model is called to summarize the long-term data corresponding to each user identifier contained in the group category to obtain summary data; the summary data is used as the group data corresponding to the group category, and the group data and the group category are correspondingly saved in the database.

[0088] Embodiment 5:

[0089] In order to improve the accuracy and practicality of the reply, based on the above embodiments, in the embodiment of the present application, the method further includes:

[0090] Obtain user data and historical question and answer data corresponding to the newly added user ID;

[0091] According to a preset information extraction algorithm, extract information from each sub-data in the user data to determine key information corresponding to each sub-data;

[0092] The key information corresponding to each sub-data is fused with the original long-term data corresponding to the candidate user identifier, the fused long-term data corresponding to the newly added user identifier is determined, and the fused long-term data is correspondingly saved in the database.

[0093] In an embodiment of the present application, when determining long-term data, user data and historical question and answer data corresponding to the newly added user identifier can be obtained; and according to a preset information extraction algorithm, information is extracted for each sub-data in the user data to determine the key information corresponding to each sub-data; the key information corresponding to each sub-data is fused with the original long-term data corresponding to the candidate user identifier to determine the fused long-term data corresponding to the newly added user identifier, and the fused long-term data is saved in the database.

[0094] In the embodiment of the present application, user data includes multiple sub-data, each of which includes but is not limited to user basic data, historical question and answer data, and device data corresponding to the user, and the user basic data includes but is not limited to age, gender, and location. The device data includes but is not limited to IoT data for health monitoring, positioning data, time series data for electricity use, and time series data for gas use.

[0095] In a possible implementation, user data may be input in a multimodal input manner, such as voice, text, image, and video. That is, in the embodiment of the present application, each sub-data in the user data corresponds to a different data type. Different information extraction algorithms may be used for user data of different data types, such as selecting a multimodal large model for video data extraction, selecting a BERT-type deep learning model or a large language model for text data, and selecting a business expert rule algorithm for IoT data for health monitoring.

[0096] Furthermore, in the embodiment of the present application, after determining the key information corresponding to each sub-data, the key information is determined as the short-term data of the user corresponding to the candidate user identifier. Since the extracted information may be inconsistent with the actual situation due to the quality of the original data, information extraction algorithm errors, etc., it is necessary to add a quality control link to confirm the rationality and validity of the information, and integrate multiple versions of reasonable values ​​to manage and improve the accuracy of the data. Quality control can also be performed on the key information corresponding to each sub-data, and the rules used in quality control can be controlled according to actual needs.

[0097] Figure 3 The database construction flow chart provided in the embodiment of the present application is as follows: Figure 3 As shown, the information extraction module extracts information from the family's multimodal input to obtain the family's short-term memory; the family's long-term memory is obtained by quality control, fusion and alignment of the family's short-term memory; and the platform's group memory is obtained by statistically analyzing the family's long-term memory of each group category.

[0098] Specifically, multimodal input includes traditional voice, text, images and videos, as well as IoT data for health monitoring, positioning data, time series data of electricity and gas use, etc. Multimodal information is input into the information extraction module, and different information extraction algorithms are selected according to the modality, data volume, etc. For example, multimodal large models are selected for video data extraction, BERT-type deep learning models or large language models are selected for text data, and business expert rule algorithms are selected for IoT data for health monitoring. The extracted short-term data is quality controlled and fused and aligned with long-term data. The extracted information may be inconsistent with the actual situation due to problems with the quality of the original data, errors in the information extraction algorithm, etc. Therefore, it is necessary to add a quality control link to confirm the rationality and validity of the information, and integrate and manage multiple versions of reasonable values. After quality control, fusion and alignment, short-term data is precipitated into long-term data, and long-term data is finally precipitated into platform-level group data after statistical analysis.

[0099] In a possible implementation, a private model may also be constructed based on the constructed database.

[0100] Figure 4 A private model construction schematic diagram provided for the embodiment of the present application, such as the Figure 4 As shown in FIG. 1 , the process includes data collection and data review from the database (memory bank) to obtain candidate data. Information extraction, information fusion and data alignment are performed on the candidate data to obtain sample data, and the sample data is used to fine-tune the privatization model.

[0101] In addition, to improve real-time performance and save costs, local information extraction models and multimodal information fusion models can be fine-tuned and trained based on sample data and deployed locally after training.

[0102] Embodiment 6:

[0103] In order to improve the accuracy and practicality of the reply, based on the above embodiments, in the embodiment of the present application, the method further includes:

[0104] Determine the latest short-term data corresponding to the target user identifier by using the target question and the target answer;

[0105] The latest short-term data is saved in the database.

[0106] In an embodiment of the present application, after determining and outputting the target response corresponding to the target question, the electronic device can also determine the latest short-term data corresponding to the target user identifier based on the target question and the target response, and save the latest short-term data into a database.

[0107] In a possible implementation, if a data volume threshold of stored short-term data is predefined in the database, and the data volume of short-term data exceeds the data volume threshold after the latest short-term data is stored in the database, the short-term data with the earliest storage time can be deleted.

[0108] Embodiment 7:

[0109] In order to improve the accuracy and practicality of the reply, based on the above embodiments, in the embodiment of the present application, if the target short-term data or the target long-term data is not found, the method further includes:

[0110] The large language model is called so that the large language model generates a target response corresponding to the target question based on the found data.

[0111] In actual applications, the agent may only find the target long-term data or the target short-term data from the database.

[0112] In one possible implementation, if the agent only finds the target short-term data from the database but fails to find the target long-term data, the agent calls the large language model so that the large language model generates a target response corresponding to the target question based on the target short-term data.

[0113] In another possible implementation, if the agent only finds the target long-term data from the database but fails to find the target short-term data, the agent calls the large language model to obtain the large language model to generate a target response corresponding to the target question based on the target long-term data.

[0114] Figure 5 The application diagram of the database provided in the embodiment of the present application is as follows: Figure 5 As shown, the user issues instructions to the Agent, and the instructions here can be various, including but not limited to professional business Q&A, solution generation, chat Q&A, information retrieval, etc.; the Agent determines whether the user is a new user. If the user is an old user, the Agent retrieves and recalls the family short-term memory and family long-term memory; if the user is a new user, the Agent retrieves and recalls the family short-term memory and platform group memory; the retrieved information is given different weights according to different sources for fusion and alignment, and outputs according to the instructions.

[0115] In the embodiment of the present application, the database includes but is not limited to two states: development state and running state. The development state means that the database is being built or updated, and the running state means that the database is being applied. In the main process of the development state, it is necessary to extract and fuse information from multimodal inputs. Open source large models such as llama3, chatglm, etc. will be used during cold start. In the long-term plan, the local large model will be trained with accumulated data to complete. Whether using an open source large model or a large model trained after local fine-tuning, it can play a role in information extraction and information fusion, but the timeliness and accuracy of the domain adaptive large model trained and deployed locally will be higher. Replacing any large language model in this link will not affect the overall process operation, but will only affect the accuracy of the precipitated memory. In the running state, one of the technologies for recalling memories from the database according to instructions is text vectorization recall. The trained acge model can be used, and replacing it with other text vectorization models can also play a similar role, such as bge.

[0116] Embodiment 8:

[0117] Based on the above embodiments, the embodiment of the present application also provides a question-answering device. Figure 6 A schematic diagram of the structure of a question-and-answer device provided in an embodiment of the present application, the device comprises:

[0118] The processing module 601 is used to receive a question-answering instruction carrying a target question; search for target short-term data similar to the target question in a pre-configured database, and search for target long-term data matching the slot in the target question in the database; wherein the target long-term data includes key information of user preferences;

[0119] The question-answering module 602 is used to call the large language model so that the large language model generates a target response corresponding to the target question based on the target short-term data and the target long-term data.

[0120] In a possible implementation manner, the question-and-answer instruction further carries a target user identifier;

[0121] The processing module 601 is specifically configured to determine a target short-term data set corresponding to the target user identifier in the database; and search for target short-term data similar to the target problem in the target short-term data set.

[0122] In a possible implementation, the processing module 601 is further used to obtain the user basic information carried in the question-and-answer instruction if the target short-term data and the target long-term data are not found, and determine the target group category corresponding to the target user according to the user basic information; wherein the user basic information includes the user's age, gender and location; and search the database for target group data corresponding to the target group category; wherein the group data is determined based on the long-term data of each user belonging to the same group category;

[0123] The question-answering module 602 is further used to call a large language model so that the large language model generates a target response corresponding to the target question according to the target group data.

[0124] In a possible implementation, the processing module 601 is further used to determine each user identifier and the corresponding long-term data stored in the database; classify the users of each user identifier according to the stored user basic information corresponding to each user identifier, and determine each group category; wherein the user basic information includes the user's age, gender and location; for each group category, call the large language model to summarize the long-term data corresponding to each user identifier contained in the group category to obtain summary data; use the summary data as the group data corresponding to the group category, and save the group data and the group category in the database accordingly.

[0125] In a possible implementation, the processing module 601 is also used to obtain user data corresponding to a newly added user identifier; extract information from each sub-data in the user data according to a preset information extraction algorithm, and determine key information corresponding to each sub-data; fuse the key information corresponding to each sub-data with the original long-term data corresponding to the candidate user identifier, determine the fused long-term data corresponding to the newly added user identifier, and save the fused long-term data into the database.

[0126] In a possible implementation manner, the processing module 601 is further configured to determine the latest short-term data corresponding to the target user identifier based on the target question and the target reply; and save the latest short-term data into the database.

[0127] In a possible implementation, the question-and-answer module 602 is also used to call the large language model if the target short-term data or the target long-term data is not found, so that the large language model generates a target response corresponding to the target question based on the found data.

[0128] Embodiment 8:

[0129] Based on the above embodiments, the present application also provides an electronic device, Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, it includes: a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other through the communication bus 704;

[0130] The memory 703 stores a computer program. When the program is executed by the processor 701, the processor 701 performs the following steps:

[0131] Receiving a question-and-answer instruction carrying a target question;

[0132] Searching for target short-term data similar to the target problem in a pre-configured database, and searching for target long-term data matching the slot in the target problem in the database; wherein the target long-term data includes key information of user preferences;

[0133] The large language model is called so that the large language model generates a target response corresponding to the target question according to the target short-term data and the target long-term data.

[0134] In a possible implementation manner, the question-and-answer instruction further carries a target user identifier;

[0135] The step of searching a pre-configured database for target short-term data similar to the target problem includes:

[0136] Determine a target short-term data set corresponding to the target user identifier in the database;

[0137] In the target short-term data set, target short-term data similar to the target problem is searched.

[0138] In a possible implementation manner, if the target short-term data and the target long-term data are not found, the method further includes:

[0139] Obtaining basic user information carried in the question-and-answer instruction, and determining the target group category corresponding to the target user based on the basic user information; wherein the basic user information includes the user's age, gender, and location;

[0140] In the database, searching for target group data corresponding to the target group category; wherein the group data is determined based on long-term data of each user belonging to the same group category;

[0141] The large language model is called so that the large language model generates a target response corresponding to the target question according to the target group data.

[0142] In a possible implementation, the process of determining the group data includes:

[0143] Determining each user identification and corresponding long-term data stored in the database;

[0144] Classify the users of each user ID according to the stored basic user information corresponding to each user ID, and determine each group category; wherein the basic user information includes the user's age, gender and location;

[0145] For each group category, a large language model is called to summarize the long-term data corresponding to each user identifier contained in the group category to obtain summary data; the summary data is used as the group data corresponding to the group category, and the group data and the group category are correspondingly saved in the database.

[0146] In a possible implementation, the method further includes:

[0147] Get the user data corresponding to the newly added user ID;

[0148] According to a preset information extraction algorithm, extract information from each sub-data in the user data to determine key information corresponding to each sub-data;

[0149] The key information corresponding to each sub-data is fused with the original long-term data corresponding to the candidate user identifier, the fused long-term data corresponding to the newly added user identifier is determined, and the fused long-term data is correspondingly saved in the database.

[0150] In a possible implementation, the method further includes:

[0151] Determine the latest short-term data corresponding to the target user identifier by using the target question and the target answer;

[0152] The latest short-term data is saved in the database.

[0153] In a possible implementation manner, if the target short-term data or the target long-term data is not found, the method further includes:

[0154] The large language model is called so that the large language model generates a target response corresponding to the target question based on the found data.

[0155] Since the principle of solving the problem by the above electronic device is similar to the question-answering method, the implementation of the above electronic device can refer to the embodiment of the method, and the repeated parts will not be repeated.

[0156] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface 702 is used for communication between the above electronic device and other devices. The memory may include a random access memory (RAM) and may also include a non-volatile memory (NVM), such as at least one disk storage. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0157] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (Network Processor, NP), etc.; it can also be a digital signal processing processor (Digital Signal Processing, DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.

[0158] Embodiment 9:

[0159] On the basis of the above embodiments, an embodiment of the present invention further provides a computer-readable storage medium, in which a computer program executable by a processor is stored. When the program runs on the processor, the processor implements the following steps when executing:

[0160] Receiving a question-and-answer instruction carrying a target question;

[0161] Searching for target short-term data similar to the target problem in a pre-configured database, and searching for target long-term data matching the slot in the target problem in the database; wherein the target long-term data includes key information of user preferences;

[0162] The large language model is called so that the large language model generates a target response corresponding to the target question according to the target short-term data and the target long-term data.

[0163] In a possible implementation manner, the question-and-answer instruction further carries a target user identifier;

[0164] The step of searching a pre-configured database for target short-term data similar to the target problem includes:

[0165] Determine a target short-term data set corresponding to the target user identifier in the database;

[0166] In the target short-term data set, target short-term data similar to the target problem is searched.

[0167] In a possible implementation manner, if the target short-term data and the target long-term data are not found, the method further includes:

[0168] Obtaining basic user information carried in the question-and-answer instruction, and determining the target group category corresponding to the target user based on the basic user information; wherein the basic user information includes the user's age, gender, and location;

[0169] In the database, searching for target group data corresponding to the target group category; wherein the group data is determined based on long-term data of each user belonging to the same group category;

[0170] The large language model is called so that the large language model generates a target response corresponding to the target question according to the target group data.

[0171] In a possible implementation, the process of determining the group data includes:

[0172] Determining each user identification and corresponding long-term data stored in the database;

[0173] Classify the users of each user ID according to the stored basic user information corresponding to each user ID, and determine each group category; wherein the basic user information includes the user's age, gender and location;

[0174] For each group category, a large language model is called to summarize the long-term data corresponding to each user identifier contained in the group category to obtain summary data; the summary data is used as the group data corresponding to the group category, and the group data and the group category are correspondingly saved in the database.

[0175] In a possible implementation, the method further includes:

[0176] Get the user data corresponding to the newly added user ID;

[0177] According to a preset information extraction algorithm, extract information from each sub-data in the user data to determine key information corresponding to each sub-data;

[0178] The key information corresponding to each sub-data is fused with the original long-term data corresponding to the candidate user identifier, the fused long-term data corresponding to the newly added user identifier is determined, and the fused long-term data is correspondingly saved in the database.

[0179] In a possible implementation, the method further includes:

[0180] Determine the latest short-term data corresponding to the target user identifier by using the target question and the target answer;

[0181] The latest short-term data is saved in the database.

[0182] In a possible implementation manner, if the target short-term data or the target long-term data is not found, the method further includes:

[0183] The large language model is called so that the large language model generates a target response corresponding to the target question based on the found data.

[0184] Since the principle of solving the problem by the above-mentioned computer program product is similar to that of the question-and-answer method, the implementation of the above-mentioned computer program product can refer to the implementation of the method, and the repeated parts will not be repeated.

[0185] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0186] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1A device that provides the functions specified in a block or multiple blocks.

[0187] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0188] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0189] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A question-answering method, characterized in that: The method comprises: Receiving a question-and-answer instruction carrying a target question; Searching for target short-term data similar to the target problem in a pre-configured database, and searching for target long-term data matching the slot in the target problem in the database; wherein the target long-term data includes key information of user preferences; The large language model is called so that the large language model generates a target response corresponding to the target question according to the target short-term data and the target long-term data.

2. The method according to claim 1, characterized in that The question-and-answer instruction also carries a target user identifier; The step of searching a pre-configured database for target short-term data similar to the target problem includes: Determine a target short-term data set corresponding to the target user identifier in the database; In the target short-term data set, target short-term data similar to the target problem is searched.

3. The method according to claim 1, characterized in that If the target short-term data and the target long-term data are not found, the method further includes: Obtaining basic user information carried in the question-and-answer instruction, and determining the target group category corresponding to the target user based on the basic user information; wherein the basic user information includes the user's age, gender, and location; In the database, searching for target group data corresponding to the target group category; wherein the group data is determined based on long-term data of each user belonging to the same group category; The large language model is called so that the large language model generates a target response corresponding to the target question according to the target group data.

4. The method according to claim 1, characterized in that: The process of determining population data includes: Determining each user identification and corresponding long-term data stored in the database; Classify the users of each user ID according to the stored basic user information corresponding to each user ID, and determine each group category; wherein the basic user information includes the user's age, gender and location; For each group category, a large language model is called to summarize the long-term data corresponding to each user identifier contained in the group category to obtain summary data; the summary data is used as the group data corresponding to the group category, and the group data and the group category are correspondingly saved in the database.

5. The method according to claim 1, characterized in that The method further comprises: Obtain user data corresponding to the candidate user identifier; According to a preset information extraction algorithm, extract information from each sub-data in the user data to determine key information corresponding to each sub-data; The key information corresponding to each sub-data is fused with the original long-term data corresponding to the candidate user identifier, the fused long-term data corresponding to the newly added user identifier is determined, and the fused long-term data is correspondingly saved in the database.

6. The method according to claim 1, characterized in that The method further comprises: Determine the latest short-term data corresponding to the target user identifier by using the target question and the target answer; The latest short-term data is saved in the database.

7. The method according to claim 1, characterized in that If the target short-term data or the target long-term data is not found, the method further includes: The large language model is called so that the large language model generates a target response corresponding to the target question based on the found data.

8. A question-answering device, characterized in that: The device comprises: A processing module is used to receive a question-answering instruction carrying a target question; search for target short-term data similar to the target question in a pre-configured database, and search for target long-term data matching the slot in the target question in the database; wherein the target long-term data includes key information of user preferences; The question-answering module is used to call the large language model so that the large language model generates a target response corresponding to the target question based on the target short-term data and the target long-term data.

9. An electronic device, characterized in that: The electronic device comprises at least a processor and a memory, and the processor is used to implement the steps of the question-answering method according to any one of claims 1 to 6 when executing a computer program stored in the memory.

10. A computer-readable storage medium, characterized in that: It stores a computer program, which, when executed by a processor, implements the steps of the question-answering method as claimed in any one of claims 1 to 6.