Intelligent question and answer method and device and storage medium

By building a label vector database and personalized question-and-answer method, the problems of user preference tracking and context loss in the intelligent question-and-answer system are solved, and answer generation is achieved that is more in line with user needs, improving the question-and-answer experience.

CN120371983AActive Publication Date: 2025-07-25国家超级计算天津中心

Patent Information

Application Number
CN202510875489.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-27
Publication Date
2025-07-25
Estimated Expiration
2045-06-27

AI Technical Summary

Technical Problem

The existing intelligent question-and-answer system is difficult to achieve dynamic tracking and updates of users' long-term preferences, resulting in deviations from the user's actual needs. In multiple rounds of conversations, interactions are often interrupted due to context loss or logic faults.

Method used

By building a tag vector database, target memory fragments are determined based on user's historical session records, and combined with question-and-answer roles, task goals, basic instructions and reasoning guidance instructions, personalized answers are generated to realize tagged memory and long-term maintenance of the session.

Benefits of technology

It improves the fit between answers and user preferences, enhances the user's Q&A experience, ensures dynamic tracking and adaptability of user preferences in long-term interactions, and reduces information redundancy and context loss problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371983A_ABST
    Figure CN120371983A_ABST
Patent Text Reader

Abstract

The invention relates to the field of data processing, and discloses an intelligent question answering method and device and a storage medium, and the method comprises the steps: determining a target memory fragment according to a target question and a label vector database of a target user corresponding to the target question; determining a question and answer role and a task target according to the target question, and determining a basic instruction according to the question and answer role and the task target; determining a constraint condition and a reasoning guide instruction corresponding to the constraint condition according to the target memory fragment; and determining a target answer corresponding to the target question according to the basic instruction, the constraint condition and the reasoning guide instruction. According to the method, tagged memory of the session can be realized, long-term maintenance and historical memory extraction are facilitated, the fitness of answers and user preferences is improved, and the question and answer experience of the user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and particularly to an intelligent question-answering method, device, and storage medium. Background Art

[0002] With the rapid development of artificial intelligence technology, the intelligent agent question-answering system has become the core research direction in the field of human-computer interaction. The question-answering system based on large language models performs excellently in general scenarios, but still has significant defects in complex dialogue scenarios.

[0003] Currently, common intelligent question-answering systems generally rely on conversation history or short-term context management, and it is difficult to achieve dynamic tracking and updating of users' long-term preferences. Therefore, when users' interests or needs change dynamically, it is impossible to efficiently identify key events and update user information, resulting in the generated content deviating from the actual needs of users or failing to meet users' preferences. In addition, existing intelligent question-answering systems often suffer from context loss or logical discontinuity in multi-round conversations, leading to interaction interruption. For example, traditional methods rely on context caching with a fixed window length (such as only retaining the last 5 rounds of conversations), resulting in the loss of long-term memory, and some retained conversation histories often lack deep representation of users' personalized characteristics due to information redundancy or low relevance, so it is difficult to generate highly adapted responses in combination with the context.

[0004] In view of this, the present invention is specifically proposed. Summary of the Invention

[0005] To solve the above technical problems, the present invention provides an intelligent question-answering method, device, and storage medium, which realize the labeled memory of conversations, facilitate long-term maintenance and extraction of historical memories, improve the fit between the answers and users' preferences, and enhance the users' question-answering experience.

[0006] An embodiment of the present invention provides an intelligent question-answering method, which includes:

[0007] Determine a target memory segment according to the target question and the label vector database of the target user corresponding to the target question; wherein, the label vector database is a database constructed based on historical conversations and includes various user label groups, historical label information corresponding to each user label group, and factual semantic vectors;

[0008] Determine the question-answering role and task objective according to the target question, and determine the basic instruction according to the question-answering role and task objective;

[0009] Determine the constraint condition and the reasoning guidance instruction corresponding to the constraint condition according to the target memory segment;

[0010] Determine the target answer corresponding to the target question according to the basic instruction, the constraint condition, and the reasoning guidance instruction.

[0011] An embodiment of the present invention provides an electronic device, which includes:

[0012] a processor and a memory;

[0013] The processor is configured to execute the steps of the intelligent question - answering method of any embodiment by calling a program or instruction stored in the memory.

[0014] An embodiment of the present invention provides a computer - readable storage medium, which stores a program or instruction, and the program or instruction causes a computer to execute the steps of the intelligent question - answering method of any embodiment.

[0015] The embodiments of the present invention have the following technical effects:

[0016] By determining a target memory segment according to a target question and a label vector database of a target user corresponding to the target question, so as to store label information of the target user and fact semantic vectors through the label vector database, the purpose of long - term memory management is achieved. Furthermore, according to the target question, a question - answering role and a task target are determined. According to the question - answering role and the task target, a basic instruction is determined. According to the target memory segment, a constraint condition and an inference guidance instruction corresponding to the constraint condition are determined, so as to extract relevant content by combining long - term memory, increase the constraint condition of the target question, facilitate improving the adaptability of the subsequent answer to the target user. Finally, according to the basic instruction, the constraint condition and the inference guidance instruction, a target answer corresponding to the target question is determined, realizing labeled memory of the conversation, facilitating long - term maintenance and extraction of historical memory, improving the fitting degree of the answer to the user preference, and improving the user's question - answering experience. Description of the Drawings

[0017] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for use in the description of the specific embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0018] Figure 1 is a flowchart of an intelligent question - answering method provided by an embodiment of the present invention;

[0019] Figure 2 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. Detailed Embodiments

[0020] To make the objectives, technical solutions, and advantages of the present invention clearer, the technical solutions of the present invention will be described clearly and completely below. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts belong to the scope protected by the present invention.

[0021] The intelligent question-answering method provided by the embodiments of the present invention is mainly applicable to the situation of tagging and memorizing the historical conversations of users and answering users' questions personalized based on the tags. The intelligent question-answering method provided by the embodiments of the present invention can be executed by an electronic device.

[0022] Embodiment 1

[0023] Figure 1 is a flowchart of an intelligent question-answering method provided by the embodiments of the present invention. Refer to Figure 1 and the intelligent question-answering method specifically includes:

[0024] S110. Determine a target memory segment according to a target question and a tag vector database of a target user corresponding to the target question.

[0025] Among them, the target question is a question proposed by the target user that needs to be answered. The target user is the user conducting the current conversation. The tag vector database is a database bound to different users, and the tag vector database is a database constructed based on historical conversations and containing each user's tag group, the historical tag information corresponding to each user's tag group, and the factual semantic vector. The historical conversation is each round of conversation of the target user before the current conversation. The user tag group is a combination of tags at all levels associated with the target user, for example: basic identity information - demographics - age, society and occupation - educational background - major, etc. The historical tag information is the information content stored corresponding to the user tag group. The factual semantic vector is the vector representation corresponding to the statements in the historical conversation when extracting the historical tag information. The target memory segment is the relevant historical memory extracted for the target question, that is, the user tag group related to the target question, the corresponding historical tag information, and the factual semantic vector.

[0026] Specifically, the target question can be analyzed based on a preset large language model to determine each user tag group involved, match the determined user tag groups in the tag vector database of the target user, and use each user tag group and the corresponding historical tag information and factual semantic vector obtained by the match as the target memory segment.

[0027] Based on the above example, the target memory segment can be determined according to the target question and the tag vector database of the target user corresponding to the target question in the following manner:

[0028] Determine at least one candidate tag group corresponding to the target problem according to the target problem;

[0029] According to each candidate tag group, in the tag vector database of the target user corresponding to the target problem, determine the candidate tag information and candidate fact vector corresponding to each candidate tag group respectively;

[0030] For each candidate tag group, determine the candidate relevance according to the candidate fact vector corresponding to the candidate tag group and the problem vector corresponding to the target problem;

[0031] Determine each target relevance according to each candidate relevance, the relevance threshold, and the preset memory quantity;

[0032] For each target relevance, determine the candidate tag group corresponding to the target relevance as the target tag group, and use the candidate tag information and candidate fact vector corresponding to the target tag group as the target memory segment.

[0033] Among them, the candidate tag group is the tag group involved in the target problem. The candidate tag information and candidate fact vector are the historical tag information and fact semantic vector that have a corresponding relationship with the candidate tag group. The problem vector is the vectorized representation of the target problem. The candidate relevance is the relevance between the candidate fact vector and the problem vector, such as cosine similarity, etc. The relevance threshold is the minimum requirement for relevance when answering the target problem preset. The preset memory quantity is the maximum quantity of the selected target memory segments preset. The target relevance is the candidate relevance that simultaneously meets the requirements of the relevance threshold and the preset memory quantity. The target tag group is the candidate tag group corresponding to each target relevance, that is, each user tag group relatively relevant to the target problem.

[0034] Specifically, based on a pre-set large language model, the target question can be analyzed to determine at least one user tag group related to the target question as a candidate tag group. Furthermore, by matching each candidate tag group in the tag vector database of the target user corresponding to the target question, the candidate tag information and candidate fact vector corresponding to each candidate tag group can be obtained. It can be understood that not every candidate tag group can find corresponding candidate tag information and candidate fact vector. If not recorded in the database, the corresponding candidate tag information and candidate fact vector can be considered empty. For each candidate tag group, the relevance calculation can be performed. Specifically, the relevance between the candidate fact vector corresponding to the candidate tag group and the question vector corresponding to the target question is calculated as the candidate relevance corresponding to the candidate tag group. Delete each candidate relevance less than the relevance threshold and determine the number of the remaining candidate relevances. If the number is greater than the pre-set memory number, then sort the remaining candidate relevances in descending order and retain the pre-set memory number of candidate relevances ranked at the front as the target relevance. If the number is less than or equal to the pre-set memory number, then regard all the remaining candidate relevances as the target relevance. Determine the candidate tag group corresponding to each target relevance as the target tag group. Integrate the candidate tag information and candidate fact vector corresponding to each target tag group respectively as the target memory segment.

[0035] Exemplarily, based on the storage architecture of the vector database, in the above manner, the structured memory tag information extracted from the historical conversation of the target user to represent user personalization is stored in the tag vector database in the form of semantic vectors of unstructured data. Therefore, when the target user initiates a new target question, based on the current conversation, the Top-K (pre-set memory number) relevant memory segments are recalled from the tag vector database. For example, when the target user asks "Recommend a breakfast suitable for me", the memories related to "dietary preferences", "allergy history", and "recent health goals" can be retrieved from the tag vector database.

[0036] S120. According to the target question, determine the Q&A role and task objective, and according to the Q&A role and task objective, determine the basic instruction.

[0037] Among them, the Q&A role is the role assumed when answering the target question, making the answering process more professional. The task objective is a brief summary of the target question, that is, the problem that the Q&A role needs to solve. The basic instruction is the instruction obtained by substituting the Q&A role and task objective using a pre-set format, that is, the instruction to execute the task objective in the target role, that is, the content that the pre-set large language model needs to execute.

[0038] Specifically, analyze the target question according to a pre-set large language model to determine the Q&A role and the task objective when answering the target question. Furthermore, combine the Q&A role and the task objective in a pre-set format to obtain a basic instruction.

[0039] S130. Determine the constraint conditions and the corresponding reasoning guidance instructions according to the target memory segment.

[0040] Among them, the constraint condition is the brief content in the target memory segment. The reasoning guidance instruction is to add a Chain-of-Thought instruction, requiring the pre-set large language model to explicitly associate the content of the constraint condition.

[0041] Specifically, convert the content of the target memory segment into natural language according to a pre-set template, and then the constraint conditions can be extracted. Based on the constraint conditions, the requirement of Chain-of-Thought is added to obtain the reasoning guidance instruction.

[0042] Exemplarily, first convert the retrieved memory information (target memory segment) into a natural language description according to a pre-set template, and then construct a prompt word by means of hierarchical injection of prompt words to guide the generation of the pre-set large language model. The hierarchical injection of prompt words includes: a. Basic instruction (defining the target role and task objective, such as "As a nutrition consultant, provide breakfast suggestions"); b. Memory context: Insert the formatted memory information to clarify the generation constraint conditions; c. Reasoning guidance: Add a Chain-of-Thought instruction, requiring the model to explicitly associate the memory with the generated content. By means of structured memory extraction and reasoning guidance, noise interference can be reduced, and different scenarios and user portraits can be adapted by dynamically generating prompt words.

[0043] For example: Example of natural language description of memory:

[0044] [User Memory]

[0045] - Dietary preference: Strict vegetarian

[0046] - Health goal: Lose 5 kg within three months (confidence level 80%)

[0047] - Allergy history: Peanut allergy

[0048] Example of prompt word:

[0049] You are a nutrition consultant. Recommend a breakfast plan according to the user memory:

[0050] <User Memory>

[0051] {Formatted memory content}

[0052] < / User Memory>

[0053] Please think step by step:

[0054] 1. What are the core needs and constraints of the user?

[0055] 2. Select appropriate ingredients by combining dietary preferences and health goals in memory;

[0056] 3. Ensure to avoid allergens and meet the fat loss requirements.

[0057] The final reply shall include specific recipes and nutritional analysis.

[0058] S140. Determine the target answer corresponding to the target question according to the basic instruction, constraint condition, and reasoning guidance instruction.

[0059] Among them, the target answer is the answer to the target question in combination with the historical conversation of the target user.

[0060] Specifically, integrate the basic instruction, constraint condition, and reasoning guidance instruction to obtain the prompt word input to the preset large language model. The preset large language model analyzes based on the prompt word and outputs the target answer corresponding to the target question.

[0061] Based on the above example, the target answer corresponding to the target question can be determined according to the basic instruction, constraint condition, and reasoning guidance instruction in the following way:

[0062] Determine the target prompt word according to the basic instruction, constraint condition, and reasoning guidance instruction;

[0063] Input the target prompt word into the preset large language model to obtain the candidate answer corresponding to the target question;

[0064] Based on the preset large language model, judge whether the candidate answer meets the constraint condition;

[0065] If so, use the candidate answer as the target answer corresponding to the target question;

[0066] If not, generate a modification suggestion corresponding to the candidate answer based on the preset large language model. According to the candidate answer and the modification suggestion, update the target prompt word, and return to execute the step of inputting the target prompt word into the preset large language model to obtain the candidate answer corresponding to the target question.

[0067] Among them, the target prompt word is the content that prompts the preset large language model to perform analysis. The candidate answer is the output result of the preset large language model for the target prompt word. The modification suggestion is a prompt for modifying the part of the candidate answer that conflicts with the constraint condition.

[0068] Specifically, the basic instructions, constraint conditions, and reasoning guidance instructions are integrated to obtain the target prompt. The target prompt is input into a preset large language model to obtain candidate answers corresponding to the target question. The candidate answers and constraint conditions are input into the preset large language model to determine whether the candidate answers meet the constraint conditions, that is, to determine whether the candidate answers conform to the personalized tags of the target user. If so, it means that there is no conflict with the personalized tags of the target user, and the candidate answers can be directly used as the target answers corresponding to the target question. If not, based on the preset large language model, the content where the candidate answers conflict with the constraint conditions is analyzed to obtain modification suggestions corresponding to the candidate answers. Furthermore, the candidate answers and modification suggestions are added to the target prompt to obtain a new target prompt, and the step of inputting the target prompt into the preset large language model to obtain candidate answers corresponding to the target question is returned for re-inference and answering.

[0069] Exemplarily, in the model inference stage, the attention correction technology is adopted, that is, the attention mechanism is adjusted through external memory information (constraint conditions) to strengthen the semantic regions related to user preferences. For example, when generating "breakfast recommendations", the model automatically focuses on the activation patterns of neurons related to "vegetarian" and "fat loss". After the inference is completed, the generation verification technology is adopted to automatically verify the consistency between the candidate answers generated by the model and the constraint conditions. If a conflict is detected (such as recommending foods containing peanuts), regeneration is triggered until the consistency verification passes.

[0070] Based on the above example, after determining the target answers corresponding to the target question, the label vector database of the target user can also be updated based on the current conversation. Specifically, it can be:

[0071] Obtain the current conversation, and based on the preset large language model, determine each factual information in the current conversation. For each factual information, determine each current label group corresponding to the factual information and the current label information corresponding to each current label group;

[0072] Update the label vector database of the target user according to each current label group, the current label information corresponding to each current label group, and the current factual vector corresponding to the factual information.

[0073] Among them, the current conversation is the conversation to which the target question and the target answer belong. The current label group is the label group extracted from the factual information in the current conversation. The current label information is the brief information of the factual information in the current label group. The current factual vector is the vectorized representation of the factual information in the current conversation.

[0074] Specifically, obtain the current session, and based on a preset large language model, analyze and obtain various factual information in the current session. Based on the preset large language model, for each factual information, perform tag group analysis and brief summarization on the factual information to obtain corresponding current tag groups and current tag information corresponding to each current tag group. Furthermore, use each current tag group, the current tag information corresponding to each current tag group, and the current fact vector corresponding to the factual information to adjust the existing tag vector database of the target user for updating.

[0075] Based on the above example, the tag vector database of the target user can be updated in the following manner according to each current tag group, the current tag information corresponding to each current tag group, and the current fact vector corresponding to the factual information:

[0076] Determine the tag processing strategy corresponding to the current tag group according to each current tag group, each current tag information, and the tag vector database of the target user;

[0077] For each current tag group, determine the corresponding current fact vector according to the factual information corresponding to the current tag group;

[0078] Based on the tag processing strategy corresponding to the current tag group, process the tag vector database of the target user according to the current tag information corresponding to the current tag group and the current fact vector.

[0079] Among them, the tag processing strategy is the strategy when integrating the current tag group and the corresponding current tag information with the tag vector database of the target user. The tag processing strategy includes addition, update, deletion, and no change.

[0080] Specifically, for each current tag group, match the current tag group and the corresponding current tag information in the tag vector database of the target user to obtain a matching result, and determine the tag processing strategy corresponding to the current tag group according to different matching results. Further, for each current tag group, vectorize the factual information corresponding to the current tag group to obtain the corresponding current fact vector, and according to the tag processing strategy corresponding to the current tag group, organize the current tag information corresponding to the current tag group and the current fact vector into the tag vector database of the target user to process the tag vector database of the target user.

[0081] Based on the above example, the tag processing strategy corresponding to the current tag group can be determined in the following manner according to each current tag group, each current tag information, and the tag vector database of the target user:

[0082] For each current tag group, determine whether there is historical tag information corresponding to the current tag group in the tag vector database of the target user;

[0083] If there is historical tag information corresponding to the current tag group, it is determined whether there is a semantic conflict between the historical tag information and the current tag information corresponding to the current tag group;

[0084] If there is a semantic conflict, it is determined whether the historical tag information and the current tag information are semantically opposite;

[0085] If they are semantically opposite, it is determined that the tag processing strategy corresponding to the current tag group is deletion;

[0086] If they are not semantically opposite, it is determined that the tag processing strategy corresponding to the current tag group is update;

[0087] If there is no semantic conflict, it is determined that the tag processing strategy corresponding to the current tag group is unchanged;

[0088] If there is no historical tag information corresponding to the current tag group, it is determined that the tag processing strategy corresponding to the current tag group is addition.

[0089] Specifically, for each current tag group, first, it is determined whether there is historical tag information corresponding to the current tag group in the tag vector database of the target user. If there is no historical tag information corresponding to the current tag group, it means that there is no relevant information in the tag vector database. Therefore, it can be directly added, that is, it is determined that the tag processing strategy corresponding to the current tag group is addition. If there is historical tag information corresponding to the current tag group, it means that there is already relevant information in the tag vector database of the target user. Therefore, it is necessary to further determine whether there is a semantic conflict between the historical tag information and the current tag information corresponding to the current tag group. If there is no semantic conflict, it means that the current tag information is consistent with the historical tag information, and thus it can be determined that the tag processing strategy corresponding to the current tag group is unchanged. If there is a semantic conflict, it means that the historical tag information needs to be adjusted. Furthermore, it is necessary to determine whether the historical tag information and the current tag information are semantically opposite. If they are semantically opposite, it means that the current tag information and the historical tag information cannot exist simultaneously. Therefore, it is determined that the tag processing strategy corresponding to the current tag group is deletion; if they are not semantically opposite, it means that the current tag information and the historical tag information can exist simultaneously, and the current tag information can be added to the historical tag information. Therefore, it is determined that the tag processing strategy corresponding to the current tag group is update.

[0090] Based on the above example, the tag vector database of the target user can be processed by the following method according to the tag processing strategy corresponding to the current tag group, the current tag information corresponding to the current tag group, and the current fact vector:

[0091] Based on the label processing strategy corresponding to the current label group, generate label adjustment information corresponding to the current session according to the label vector database of the target user, the current label information corresponding to the current label group, and the current fact vector, and display the label adjustment information;

[0092] In response to receiving the secondary adjustment information corresponding to the label adjustment information, process the label vector database of the target user according to the secondary adjustment information;

[0093] In response to receiving the confirmation information corresponding to the label adjustment information or not receiving feedback information within the preset time, process the label vector database of the target user according to the label adjustment information.

[0094] Among them, the label adjustment information is the part for adjusting the content in the label vector database of the target user determined by analyzing the current session, including the content before and after the adjustment. The secondary adjustment information is the information actively modified by the target user for the label adjustment information. The preset time is the time for waiting for the target user to confirm the label adjustment information. The feedback information includes the secondary adjustment information and the confirmation information.

[0095] Specifically, in the label vector database of the target user, by combining the current label information corresponding to each current label group and the current fact vector, simulating the execution of the label processing strategy corresponding to each current label group, the information before and after the execution can be determined. If the information is different, the information before and after the execution can be used as the label adjustment information corresponding to the current session and displayed for the user to view. If the secondary adjustment information corresponding to the label adjustment information is received, it means that the target user is not satisfied with the current adjustment and provides the secondary adjustment information. Therefore, directly use the secondary adjustment information provided by the target user to process the label vector database of the target user. In response to receiving the confirmation information corresponding to the label adjustment information or not receiving feedback information within the preset time, it means that the target user is affirmative about the label adjustment information or times out without processing. Therefore, still use the label adjustment information to process the label vector database of the target user.

[0096] Exemplarily, the above example can be memory update based on event-driven, specifically referring to that when the target user interacts with the intelligent agent system and meets any of the following conditions, the memory re-encoding process is automatically activated: a. New information, such as when the target user first mentions a certain type of fact (such as "I'm allergic to peanuts"), b. Information conflict: The current statement of the target user conflicts with the historical record (such as the user is "teacher" in the historical record and "programmer" is mentioned in the current conversation). Optionally, context association can be considered, such as implicit long-term preference changes in the conversation (such as the target user repeatedly refuses sweet food recommendations, triggering the update of the "diet preference" label).

[0097] By presetting a large language model to deeply analyze the current conversation record of the target user and the intelligent agent system, personalized structured memory tag information (the current tag information corresponding to each current tag group) characterizing the target user can be extracted from the current conversation and stored in the vector database in the form of semantic vectors (current fact vectors) of unstructured data. For example, basic identity information, society and occupation, personality and psychological characteristics, interests and lifestyle, interpersonal relationships and family, values and beliefs, abilities and skills, health and medical, environment and geography, digital characteristics, and some other dynamic tags. Some tag types are listed in Table 1.

[0098] Table 1 Each tag group and tag information

[0099]

[0100] Conflict detection and logical reasoning refer to obtaining the tag information of the target user mentioned in the current conversation through memory query in the tag vector database of the target user, and then analyzing it through a preset large language model to compare the correlation between the current factual tag information and historical memories (the historical tag information corresponding to the current tag group and the current tag information corresponding to the current tag group), and giving a memory disposal strategy (tag processing strategy). The main basis for the decision of the preset large language model is: a. Semantic conflict detection: Judging whether the new and old tags are contradictory (such as "Occupation: Student" and "Occupation: Engineer"); b. Logical relevance analysis: Identifying the dependency relationship between tags (such as "Diet habit: Vegetarian" needs to be associated with "Health goal: Losing weight"), which can be a pre-bound dependency relationship. Through the logical reasoning of the preset large language model, if the current tag group does not exist in the tag vector database (such as adding "Pet: Keeping a cat"), an ADD disposal strategy is given; if the tag information conflicts or needs to be supplemented (such as "Interest: Photography" becomes "Photography + Mountaineering"), an UPDATE strategy is given; if the historical tag information is contrary to the current tag information (such as deleting the expired "Residence: Beijing"), a DELETE strategy is given; if the historical tag information is the same as the current tag information (such as "Blood type: A" remains unchanged), a NONE disposal strategy is given.

[0101] Dynamic update and feedback verification are to execute corresponding operations according to the strategy after generating the memory disposal strategy in the previous round. For example, if it is an addition, the new tag is written into the tag vector database (such as "Digital feature: Frequently using the iOS system"); if it is an update, the old tag is merged or replaced (such as "Interest: Basketball" is extended to "Basketball, e-sports"); if it is a deletion, the expired tag is marked as invalid (such as removing "Marital status: Unmarried"). After the strategy is executed, the update effect can be verified by feedback.

[0102] Through a three - layer architecture of event triggering - semantic reasoning - policy closed - loop, it solves the problems of staticity, coarse - grainedness, and high maintenance cost in traditional memory management. By binding memory updates to the dialogue flow in real - time, it avoids the problem of information lag. Based on the deep reasoning of a preset large - language model, it realizes fine - grained management at the tag level. Through conflict detection and feedback verification, it can autonomously evolve the memory quality. The tag system and disposal strategies support custom expansion to adapt to the needs of multiple domains. This mechanism endows the agent system with "human - like" memory evolution ability, enabling it to continuously adapt to user changes in long - term interactions and become a truly personalized digital assistant.

[0103] By combining event triggering and semantic reasoning, it realizes the intelligent dynamic management of user memory. Based on the deep analysis ability of a preset large - language model, it extracts multi - dimensional tag groups such as user identity, health, and interests from multi - turn conversations, and conducts conflict detection and logical relevance judgment with the memory of historical conversations, automatically generating tag disposal strategies of ADD, UPDATE, DELETE, or NONE. Compared with traditional static memory management, its innovation lies in: capturing explicit and implicit user characteristics through a fine - grained tag system, using the semantic understanding ability of a preset large - language model to solve information conflict problems, and constructing an event - driven closed - loop update link to achieve real - time and accurate adjustment of memory. This mechanism not only supports the dynamic tracking of user preferences (such as changing from "fitness" to "meditation"), but also can adaptively handle complex scenarios (such as updated medical taboos), and at the same time ensures uninterrupted operation of the system through hot - update technology, significantly improving the memory accuracy and scenario adaptation ability of the agent in long - term interactions.

[0104] On the basis of the above example, before determining the target memory segment according to the target question and the tag vector database of the target user corresponding to the target question, it is also necessary to perform content security inspection on the target question. Specifically, it can be:

[0105] Receive the initial question of the target user, and judge whether the initial question touches the sensitive range according to the preset static rule library and the preset large - language model;

[0106] If so, generate a risk prompt message and display the risk prompt message;

[0107] If not, take the initial question as the target question.

[0108] Among them, the initial question is the question input by the target user. Correspondingly, the target question is the initial question that has passed the security verification. The preset static rule library is a rule library for fixed risk investigation, such as a preset sensitive word list, regular expressions, etc. The preset static rule library and the preset large language model are updated according to the security case library established regularly. The security case library includes case questions, case answers, case risk types, and case handling methods. In the security case library, it is manually marked whether the handling is correct, as well as the questions and answers corresponding to the correct handling methods. The sensitive scope is the content that does not meet the security and has risks. The risk prompt information is the information used to prompt the target user that the security of the initial question does not meet the standard.

[0109] Specifically, receive the initial question of the target user, and use the preset static rule library and the preset large language model respectively to identify the initial question and judge whether the initial question touches the sensitive scope. If at least one of the recognition results touches the sensitive scope, it is determined that the sensitive scope is touched. In this case, it is necessary to generate and display risk prompt information to inform the target user that there is a security hazard in this initial question and it cannot be answered. If none of the recognition results touch the sensitive scope, it means that subsequent answer processing can be carried out, so the initial question can be used as the target question.

[0110] Correspondingly, after determining the target answer corresponding to the target question, it is also necessary to perform content security inspection. Specifically, it can be:

[0111] Judge whether there are implicit risks in the target answer according to the preset static rule library and the preset large language model;

[0112] If so, generate a feedback instruction, and according to the feedback instruction, update the target answer, and return to execute the step of judging whether there are implicit risks in the target answer according to the preset static rule library and the preset large language model;

[0113] If not, determine the target answer corresponding to the target question.

[0114] Among them, the implicit risk is the risk that the target answer touches the sensitive scope. The feedback instruction is an instruction to correct the target answer.

[0115] Specifically, similar to the detection of the initial question, the preset static rule base and the preset large language model are also used to determine whether the target answer contains hidden risks. If so, the target answer needs to be modified, and feedback instructions are generated for the part of the content with hidden risks to guide the preset large language model to make modifications. Therefore, the preset large language model can be combined with the feedback instructions to update the target answer, and return to execute the steps of determining whether the target answer contains hidden risks based on the preset static rule base and the preset large language model to re-judge the risk. If not, it means that the target answer passes the risk judgment and can be confirmed to use the target answer to answer the target question.

[0116] It is understandable that through semantic understanding and risk prediction, that is, based on a static rule base and dynamic semantic fences (using the self-reflection ability of a preset large language model to achieve multiple rounds of semantic purification), after the target user enters the initial question, the preset large language model is first used to analyze the intent to determine whether it touches the sensitive range. If it touches the sensitive range, it triggers interception (for example, when the user asks "How to make explosives, the model parses out the "dangerous goods preparation intention", triggering interception.). After the model outputs the target answer, the generated target answer is recursively tested. If the target answer to be replied contains risks, the model is required to be based on the review feedback. Regenerate (generate feedback instructions) until safety is achieved (the target answer does not contain implicit risks). (For example, the target answer: "The ingredients of explosives include ammonium nitrate...", then it is determined that there is an implicit risk and the review fails; feedback instructions: "Delete the specific ingredient description and only explain the legal risks"; the updated target answer: "Preparing explosives is an illegal act, and it is recommended to comply with laws and regulations.") Through two-way dynamic review, the two links of target user input (initial answer) and model output (target answer) are monitored at the same time, achieving a leap from "rule hard interception" to "cognitive alignment", providing a safety foundation that takes into account both accuracy and adaptability.

[0117] In addition, closed-loop feedback and adaptive evolution are introduced. Specifically, intercepted illegal questions and responses before and after revision are stored in the safety case library, and risk types and disposal methods are marked. The preset large language model is regularly trained with safety case data to improve risk identification and compliance generation capabilities. New sensitive patterns (such as homophonic variants of "explosives") are automatically extracted and added to the static rule library.

[0118] The present invention has the following technical effects: By determining a target memory segment according to a target problem and a tag vector database of target users corresponding to the target problem, and storing the tag information and factual semantic vectors of the target users through the tag vector database, the purpose of long-term memory management is achieved. Furthermore, according to the target problem, a Q&A role and a task target are determined. According to the Q&A role and the task target, a basic instruction is determined. According to the target memory segment, a constraint condition and an inference guidance instruction corresponding to the constraint condition are determined, so as to extract relevant content by combining long-term memory, increase the constraint condition of the target problem, and facilitate improving the adaptability of the subsequent answer to the target user. Finally, according to the basic instruction, the constraint condition and the inference guidance instruction, a target answer corresponding to the target problem is determined, realizing the tagged memory of the conversation, facilitating the long-term maintenance and extraction of historical memories, improving the conformity of the answer to the user's preference, and improving the user's Q&A experience.

[0119] Embodiment 2

[0120] Figure 2 It is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. As Figure 2 shown, the electronic device 200 includes one or more processors 201 and a memory 202.

[0121] The processor 201 may be a central processing unit (CPU) or other forms of processing units with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 200 to perform desired functions.

[0122] The memory 202 may include one or more computer program products, and the computer program products may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory, etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage media, and the processor 201 may run the program instructions to implement the intelligent Q&A method of any embodiment of the present invention described above and / or other desired functions. Various contents such as initial external parameters and thresholds may also be stored in the computer-readable storage media.

[0123] In one example, the electronic device 200 may further include: an input device 203 and an output device 204, and these components are interconnected through a bus system and / or other forms of connection mechanisms (not shown). The input device 203 may include, for example, a keyboard, a mouse, and so on. The output device 204 may output various information to the outside, including warning prompt information, braking force, and so on. The output device 204 may include, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, and so on.

[0124] Of course, for simplicity, Figure 2 only some of the components related to the present invention in the electronic device 200 are shown, and components such as a bus, an input / output interface, and so on are omitted. In addition, according to specific application scenarios, the electronic device 200 may further include any other appropriate components.

[0125] Embodiment III

[0126] In addition to the above methods and devices, an embodiment of the present invention may also be a computer program product, which includes computer program instructions, and when the computer program instructions are run by a processor, the processor is caused to execute the steps of the intelligent question-answering method provided in any embodiment of the present invention.

[0127] The computer program product may be written in any combination of one or more programming languages for programming code to perform the operations of the embodiments of the present invention. The programming languages include object-oriented programming languages, such as Java, C++, etc., and also include conventional procedural programming languages, such as the "C" language or similar programming languages. The programming code may be executed entirely on a user computing device, partially on the user device, executed as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0128] In addition, an embodiment of the present invention may also be a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are run by a processor, the processor is caused to execute the steps of the intelligent question-answering method provided in any embodiment of the present invention.

[0129] The computer-readable storage medium may adopt any combination of one or more readable media. The readable media may be a readable signal medium or a readable storage medium. The readable storage medium may include, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the readable storage medium include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0130] It should be noted that the terms used in the present invention are only for describing specific embodiments and do not limit the scope of the present application. As shown in the specification of the present invention, unless the context clearly indicates otherwise, words such as "a", "an", "one", and / or "the" do not specifically refer to the singular and may also include the plural. The term "comprising", "including", or any other variant thereof is intended to cover a non-exclusive inclusion, such that a process, method, or device including a series of elements not only includes those elements but also includes other elements not explicitly listed, or further includes elements inherent to such a process, method, or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, or device including the said element.

[0131] It should also be noted that the orientation or positional relationship indicated by terms such as "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation to the present invention. Unless otherwise clearly specified and defined, terms such as "installed", "connected", "coupled" should be understood in a broad sense. For example, it may be a fixed connection, a detachable connection, or an integral connection; it may be a mechanical connection or an electrical connection; it may be directly connected or indirectly connected through an intermediate medium, and it may be the internal communication of two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the technical solutions of the embodiments of the present invention.

Claims

1. An intelligent question-answering method, characterized in that Including: Determine a target memory segment according to a target question and a tag vector database of the target user corresponding to the target question; wherein, the tag vector database is a database containing each user tag group, historical tag information corresponding to each user tag group, and a factual semantic vector, constructed based on historical conversations; Determine a Q&A role and a task target according to the target question, and determine a basic instruction according to the Q&A role and the task target; Determine a constraint condition and an inference guidance instruction corresponding to the constraint condition according to the target memory segment; Determine a target answer corresponding to the target question according to the basic instruction, the constraint condition, and the inference guidance instruction.

2. The method according to claim 1, wherein After determining the target answer corresponding to the target question, it further includes: Obtain the current conversation, determine each factual information in the current conversation based on a preset large language model, and for each factual information, determine each current tag group corresponding to the factual information and current tag information corresponding to each current tag group; Update the tag vector database of the target user according to each current tag group, current tag information corresponding to each current tag group, and a current factual vector corresponding to the factual information.

3. The method according to claim 2, wherein The updating the tag vector database of the target user according to each current tag group, current tag information corresponding to each current tag group, and a current factual vector corresponding to the factual information includes: Determine a tag processing strategy corresponding to the current tag group according to each current tag group, each current tag information, and the tag vector database of the target user; wherein, the tag processing strategy includes addition, update, deletion, and no change; For each current tag group, determine a corresponding current factual vector according to the factual information corresponding to the current tag group; Based on the tag processing strategy corresponding to the current tag group, process the tag vector database of the target user according to the current tag information and the current factual vector corresponding to the current tag group.

4. The method according to claim 3, characterized in that, The determining a tag processing strategy corresponding to the current tag group according to each current tag group, each current tag information, and the tag vector database of the target user includes: For each current tag group, determine whether there is historical tag information corresponding to the current tag group in the tag vector database of the target user; If there is historical tag information corresponding to the current tag group, determine whether there is a semantic conflict between the historical tag information and the current tag information corresponding to the current tag group; If there is a semantic conflict, determine whether the historical tag information and the current tag information are semantically opposite; If they are semantically opposite, determine that the tag processing strategy corresponding to the current tag group is deletion; If they are not semantically opposite, determine that the tag processing strategy corresponding to the current tag group is update; If there is no semantic conflict, determine that the tag processing strategy corresponding to the current tag group is no change; If there is no historical tag information corresponding to the current tag group, determine that the tag processing strategy corresponding to the current tag group is addition.

5. The method according to claim 3, characterized in that, Based on the tag processing strategy corresponding to the current tag group, process the tag vector database of the target user according to the current tag information and the current fact vector corresponding to the current tag group, including: Based on the tag processing strategy corresponding to the current tag group, generate tag adjustment information corresponding to the current session according to the tag vector database of the target user, the current tag information corresponding to the current tag group, and the current fact vector, and display the tag adjustment information; In response to receiving the secondary adjustment information corresponding to the tag adjustment information, process the tag vector database of the target user according to the secondary adjustment information; In response to receiving the confirmation information corresponding to the tag adjustment information or not receiving feedback information within the preset time, process the tag vector database of the target user according to the tag adjustment information; Wherein, the feedback information includes secondary adjustment information and the confirmation information.

6. The method according to claim 1, wherein The determining the target answer corresponding to the target question according to the basic instruction, the constraint condition, and the reasoning guidance instruction includes: Determine a target prompt word according to the basic instruction, the constraint condition, and the reasoning guidance instruction; Input the target prompt word into a preset large language model to obtain a candidate answer corresponding to the target question; Based on the preset large language model, determine whether the candidate answer meets the constraint condition; If so, use the candidate answer as the target answer corresponding to the target question; If not, based on the preset large language model, generate a modification suggestion corresponding to the candidate answer, update the target prompt word according to the candidate answer and the modification suggestion, and return to execute the step of inputting the target prompt word into the preset large language model to obtain a candidate answer corresponding to the target question.

7. The method according to claim 1, wherein Before determining the target memory segment according to the target question and the tag vector database of the target user corresponding to the target question, further include: Receive an initial question from the target user, and determine whether the initial question touches on a sensitive range according to a preset static rule library and a preset large language model; If so, generate a risk prompt message and display the risk prompt message; If not, use the initial question as the target question; After determining the target answer corresponding to the target question, further include: Determine whether the target answer has an implicit risk according to the preset static rule library and the preset large language model; If so, generate a feedback instruction, update the target answer according to the feedback instruction, and return to execute the step of determining whether the target answer has an implicit risk according to the preset static rule library and the preset large language model; If not, determine the target answer corresponding to the target question; Wherein, the preset static rule library and the preset large language model are updated according to a regularly established security case library, and the security case library includes case questions, case answers, case risk types, and case handling methods.

8. The method according to claim 1, wherein Determining a target memory segment according to the target question and the tag vector database of the target user corresponding to the target question includes: Determining at least one candidate tag group corresponding to the target question according to the target question; Determining candidate tag information and candidate fact vectors respectively corresponding to each candidate tag group in the tag vector database of the target user corresponding to the target question according to each candidate tag group; For each candidate tag group, determining a candidate relevance according to the candidate fact vector corresponding to the candidate tag group and the question vector corresponding to the target question; Determining each target relevance according to each candidate relevance, a relevance threshold, and a preset memory quantity; For each target relevance, determining the candidate tag group corresponding to the target relevance as a target tag group, and using the candidate tag information and the candidate fact vector corresponding to the target tag group as a target memory segment.

9. An electronic device, characterized in that, The electronic device includes: A processor and a memory; The processor is configured to execute the steps of the intelligent question-answering method according to any one of claims 1 to 8 by calling a program or an instruction stored in the memory.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program or an instruction, and the program or the instruction causes a computer to execute the steps of the intelligent question-answering method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Intention recognition method and device, electronic equipment and storage medium

    CN116861926A

  • Multi-intention dialogue method and device based on dialogue graph, equipment and storage medium

    CN117609455A

  • Human-computer interaction method and device and computer readable storage medium

    CN118838998A

  • Intention recognition intelligent dialogue method and system based on large model

    CN119226486A

  • Electronic device and control method therefor

    US20220059088A1

Cited By

  • Conversation processing method and computer equipment

    CN121212379A