Method, device and storage medium for selecting knowledge base

By obtaining the user's query intention and user portrait, building a knowledge base to select a big model, selecting a target knowledge base and extracting contextual knowledge, it solves the problem that the existing intelligent question-and-answer system cannot combine user needs and preferences, and achieves efficient and accurate question-and-answer responses, improving user experience.

CN119358657BActive Publication Date: 2025-03-28ZHONGKE YUNGU TECH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411934604.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-03-28
Estimated Expiration
2044-12-26

AI Technical Summary

Technical Problem

The existing intelligent question-and-answer system cannot combine users' demand preferences and cannot determine the database required by users in a timely and accurate manner, resulting in homogeneity of responses, unable to truly solve users' problems and reduce user experience.

Method used

By obtaining the user's current query intent and user portrait, a task scenario prompt word is generated based on the positive sample data set selected for the knowledge base, a knowledge base is built to select a big model, a target knowledge base is selected, and context knowledge is extracted from the target knowledge base to generate a reply.

Benefits of technology

It realizes the precise determination of the target knowledge base based on users' personalized needs, improves the answer efficiency and accuracy of the Q&A system, reduces the homogeneity of reply, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119358657B_ABST
    Figure CN119358657B_ABST
Patent Text Reader

Abstract

The present application relates to the field of artificial intelligence technology, and in particular to a method, device and storage medium for selecting a knowledge base. The method includes: obtaining the user's current query intent and current user portrait; obtaining a positive sample data set in a sample data set; generating task scenario prompt words based on the positive sample data set for the knowledge base selection large model; constructing a knowledge base selection large model based on the task scenario prompt words; inputting the current query intent and the current user portrait into the knowledge base selection large model to obtain the knowledge base selection score of each currently available knowledge base; selecting a target knowledge base for the user's current query intent from each currently available knowledge base according to the preset selection rules and the knowledge base selection score of each currently available knowledge base, taking into account the user's personalized needs, and being able to accurately determine the target knowledge base required by the user, thereby improving the efficiency and accuracy of subsequent answers to user questions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and specifically to a method, device and storage medium for selecting a knowledge base. Background Art

[0002] Intelligent question-answering systems are widely used in the customer service field of multiple industries. The system can recognize the semantics of customer questions and automatically retrieve relevant information from the knowledge base to generate responses to user questions. Existing intelligent question-answering systems generally implement jumps to specific scenarios and scripts based on keywords and rules, or collect relevant reference data from existing databases based on the semantics of user questions, and then input user questions and reference data into a large model to give corresponding responses through the large model. However, the existing methods all search directly from existing databases, without combining user needs and preferences, and without considering user feedback on texts provided by different databases, resulting in the inability to timely, accurately and targetedly determine the database required by the user. Instead, data is directly obtained from existing local databases. The repetitiveness of these data is high, resulting in serious homogeneity of subsequent responses, which cannot truly solve user problems and reduce the user's experience. Summary of the invention

[0003] The purpose of the embodiments of the present application is to provide a method, device and storage medium for selecting a knowledge base, so as to solve the problem in the prior art that there is a lack of user feedback and the database associated with the user query cannot be determined, resulting in the user problem not being truly solved.

[0004] In order to achieve the above-mentioned object, the first aspect of the present application provides a method for selecting a knowledge base, the method comprising:

[0005] Obtain the user's current query intent, which is obtained by parsing the query question entered by the user and its historical context;

[0006] Get the user's current user profile, which is a set of indicator parameters built based on the user's personal information and historical behavior data;

[0007] Obtain a positive sample data set from the sample data set, where the sample data set is constructed based on each user's historical query intent and historical user profile and their corresponding outputs;

[0008] Generate task scenario prompt words based on a positive sample data set for a knowledge base selection large model, where any positive sample data in the positive sample data set is a mapping of a set of historical data of an input structure to historical data of an output structure of a historical call to the knowledge base selection large model, wherein the input structure includes query intent and user portrait, and the output structure includes knowledge base selection scores of multiple knowledge bases;

[0009] Building a knowledge base selection large model based on task scenario prompt words, the task scenario prompt words are used to enable the knowledge base selection large model to obtain output data of the output structure based on the input data of the input structure;

[0010] Input the current query intent and the current user profile into the knowledge base selection model to obtain the knowledge base selection score of each currently available knowledge base;

[0011] According to the preset selection rules and the knowledge base selection score of each currently available knowledge base, a target knowledge base targeting the current query intention of the user is selected from each currently available knowledge base.

[0012] In an embodiment of the present application, the input structure also includes knowledge base descriptions of multiple knowledge bases, and generating task scenario prompt words based on the positive sample data set of the knowledge base selection large model includes: splicing the knowledge base selection task introduction text, the knowledge base description of the currently available knowledge base, the input structure, the output structure, and at least part of the positive sample data in the positive sample data set to obtain the task scenario prompt words.

[0013] In an embodiment of the present application, at least part of the positive sample data in the positive sample data set includes a preset number of positive sample data with the highest confidence count ranking in the positive sample data set.

[0014] In an embodiment of the present application, the method also includes: extracting contextual knowledge for the current query intent from the target knowledge base; inputting the current query intent and the contextual knowledge into the big model to obtain a response to the current query intent.

[0015] In an embodiment of the present application, extracting contextual knowledge for the current query intent from the target knowledge base includes: when the target knowledge base is a vertical domain big model for generating text in a specific field, inputting the current query intent into the vertical domain big model to generate contextual knowledge for the current query intent; when the target knowledge base is a vertical domain database for storing text in a specific field, retrieving contextual knowledge associated with the current query intent from the vertical domain database.

[0016] In an embodiment of the present application, the method also includes: feeding back the reply to the user and obtaining the user's score for the reply; constructing current positive sample data based on the current query intent, the current user portrait, and the knowledge base selection score of each currently available knowledge base; when the score is greater than a first preset score, adding the current positive sample data constructed based on the current query intent, the current user portrait, and the knowledge base selection score of each currently available knowledge base to the positive sample data set.

[0017] In an embodiment of the present application, when the score is greater than a first preset score, the current positive sample data constructed based on the current query intent, the current user portrait, and the knowledge base selection score of each currently available knowledge base is added to the positive sample data set, including: searching the positive sample data set to see whether there is historical positive sample data in which the query intent in the input structure is similar to the current query intent and the user profile in the input structure is similar to the current user profile; when there is historical positive sample data and the score is greater than the first preset score, the confidence count of the historical positive sample data is increased; when there is historical positive sample data and the score is less than a second preset score, the confidence count of the historical positive sample data is reduced; when there is no historical positive sample data and the score is greater than the first preset score, the current positive sample data constructed based on the current query intent, the current user portrait, and the knowledge base selection score of each currently available knowledge base is added to the positive sample data set.

[0018] In an embodiment of the present application, the current query intent and contextual knowledge are input into the big model to obtain a response to the current query intent, including: when there are multiple target knowledge bases, determining the semantic similarity between a contextual knowledge extracted from each target knowledge base and the current query intent; arranging all the contextual knowledge in descending order based on the semantic similarity; and inputting all the arranged contextual knowledge and the current query intent into the big model to obtain a response.

[0019] In an embodiment of the present application, the current query intent and contextual knowledge are input into the big model to obtain a response to the current query intent, including: determining the contextual knowledge whose semantic similarity is greater than a preset value as the target contextual knowledge; inputting the target contextual knowledge and the current query intent into the big model to obtain a response.

[0020] In an embodiment of the present application, a target knowledge base for the user's current query intention is selected from each currently available knowledge base according to a preset selection rule and a knowledge base selection score of each currently available knowledge base, including: for each knowledge base selection score, when the knowledge base selection score is greater than a set threshold, the knowledge base corresponding to the knowledge base selection score is determined as the target knowledge base; or, all knowledge bases are arranged in descending order according to the size of the knowledge base selection score, and a preset number of knowledge bases with the highest rankings are determined as target knowledge bases.

[0021] In an embodiment of the present application, the knowledge base is trained through the following steps: determining multiple participants corresponding to the target vertical domain, and the multiple participants have local text data of the target vertical domain; distributing the initial large model of the target vertical domain to the multiple participants, so that the multiple participants iteratively train the initial large model based on the local text data of the target vertical domain they each own; obtaining the temporary large models returned by the multiple participants obtained by the iterative training, and aggregating the temporary large models that have been verified to be compliant to obtain the current latest aggregated large model; when the termination conditions of the iterative training are met, the current latest aggregated large model is determined as the knowledge base corresponding to the target vertical domain.

[0022] A second aspect of the present application provides a device for selecting a knowledge base, comprising:

[0023] a memory configured to store instructions;

[0024] The processor is configured to call instructions from the memory and implement the above method for selecting a knowledge base when executing the instructions.

[0025] A third aspect of the present application provides a machine-readable storage medium having instructions stored thereon, the instructions being used to enable a machine to execute the above-mentioned method for selecting a knowledge base.

[0026] Through the above technical scheme, it is possible to generate task scenario prompt words based on the positive sample data set for the knowledge base selection big model, and build a knowledge base selection big model based on the task scenario prompt words, so as to input the user's current query intention and the current user portrait into the knowledge base selection big model, and obtain the knowledge base selection score of each currently available knowledge base. Finally, according to the preset selection rules and the knowledge base selection score of each currently available knowledge base, the target knowledge base for the user's current query intention is selected from each currently available knowledge base, so as to build a knowledge base selection big model that can determine the knowledge base selection score based on the user's query intention and user portrait, taking into account the user's personalized needs, and can accurately determine the target knowledge base required by the user, thereby improving the efficiency and accuracy of subsequent answering of user questions.

[0027] Other features and advantages of the embodiments of the present application will be described in detail in the subsequent specific implementation section. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application. In the accompanying drawings:

[0029] Figure 1A schematic diagram of a process for selecting a knowledge base according to an embodiment of the present application is shown;

[0030] Figure 2 Another flowchart of a method for selecting a knowledge base according to an embodiment of the present application is schematically shown;

[0031] Figure 3 The internal structure diagram of a computer device according to an embodiment of the present application is schematically shown. DETAILED DESCRIPTION

[0032] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the specific implementation methods described herein are only used to illustrate and explain the embodiments of the present application, and are not used to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0033] It should be noted that if the embodiments of the present application involve directional indications (such as up, down, left, right, front, back...), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0034] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0035] Figure 1 A schematic diagram of a process for selecting a knowledge base according to an embodiment of the present application is shown. Figure 1 As shown, an embodiment of the present application provides a method for selecting a knowledge base, which may include the following steps.

[0036] Step 101: Obtain the user's current query intention, which is obtained by parsing the query question input by the user and its historical context.

[0037] Step 102: Obtain the current user portrait of the user, which is a set of indicator parameters constructed based on the user's personal information and historical behavior data.

[0038] Step 103: Obtain a positive sample data set in the sample data set, wherein the sample data set is constructed based on each user's historical query intention and historical user profile and their corresponding outputs.

[0039] Step 104: Generate task scenario prompt words based on the positive sample data set for the knowledge base selection large model, where any positive sample data in the positive sample data set is a mapping of a set of historical data of the input structure to the historical data of the output structure of the historical call to the knowledge base selection large model, wherein the input structure includes query intent and user portrait, and the output structure includes knowledge base selection scores of multiple knowledge bases.

[0040] The processor can obtain the user's current query intention, which can be obtained by parsing the query question entered by the user and the historical context of the query question. The processor can obtain the user's current user portrait, which is an indicator parameter set constructed based on the user's personal information and historical behavior data. Personal information can include the user's age, gender, region, etc., historical behavior data can include the user's purchase record, browsing history, interactive feedback, etc., and the indicator parameter set can include the user's object of interest, the degree of interest in different objects, preferences, and needs, etc. In an optional embodiment, the processor can input the query question entered by the user and the historical context of the query context into the intention parsing model to obtain the user's current query intention. The processor can input the user's personal information and historical behavior data into a machine learning model or a deep learning model to obtain the user's current user portrait. The processor can obtain a positive sample data set in a sample data set, wherein the sample data set is constructed based on each user's historical query intention and historical user portrait and its corresponding output. The positive sample data set can refer to the output of each user's likes and its corresponding historical query intention and historical user portrait of each user. After obtaining the positive sample data set, the processor can generate task scenario prompt words based on the positive sample data set for the knowledge base selection large model. Any positive sample data in the positive sample data set is a mapping of a set of historical data of the input structure to the historical data of the output structure of the historical call to the knowledge base selection large model, wherein the input structure includes query intent and user portrait, and the output structure includes knowledge base selection scores of multiple knowledge bases.

[0041] In an embodiment of the present application, the input structure also includes knowledge base descriptions of multiple knowledge bases, and generating task scenario prompt words based on the positive sample data set of the knowledge base selection large model includes: splicing the knowledge base selection task introduction text, the knowledge base description of the currently available knowledge base, the input structure, the output structure, and at least part of the positive sample data in the positive sample data set to obtain the task scenario prompt words.

[0042] The input structure also includes knowledge base descriptions of multiple knowledge bases, and the processor can generate task scenario prompt words based on the positive sample data set for the knowledge base selection large model. Specifically, the processor can splice the knowledge base selection task introduction text, the knowledge base description of the currently available knowledge base, the input structure, the output structure, and at least part of the positive sample data in the positive sample data set to obtain the task scenario prompt words. In an embodiment of the present application, at least part of the positive sample data in the positive sample data set can include a preset number of positive sample data with the highest confidence count ranking in the positive sample data set. The preset number can be determined based on the needs of the user. Among them, the knowledge base description can refer to the scope of the data contained in the knowledge base, the problems that the contained data can solve, etc. The currently available knowledge base and the multiple knowledge bases of the positive sample data set can be completed or partially the same in quantity and content, or they can be completely different. The multiple knowledge bases in the positive sample data set provide implicit knowledge of how the learning knowledge base description affects the knowledge base selection score, so that even if the knowledge base description of the currently available knowledge base is different from the knowledge base description of the historical knowledge base, the knowledge base selection large model constructed based on the task scenario prompt words generated by the positive sample data set also has a common knowledge base selection capability.

[0043] Step 105: construct a knowledge base selection large model based on the task scenario prompt words, and the task scenario prompt words are used to enable the knowledge base selection large model to obtain output data of the output structure based on the input data of the input structure.

[0044] Step 106: Input the current query intent and the current user portrait into the knowledge base selection model to obtain the knowledge base selection score of each currently available knowledge base.

[0045] Step 107: According to the preset selection rule and the knowledge base selection score of each currently available knowledge base, a target knowledge base for the current query intention of the user is selected from each currently available knowledge base.

[0046] After generating the task scenario prompt words, the processor can construct a knowledge base selection large model based on the task scenario prompt words, and the task scenario prompt words are used to enable the knowledge base selection large model to obtain output data of the output structure based on the input data of the input structure. After constructing the knowledge base selection large model, the processor can input the current query intent and the current user portrait into the knowledge base selection large model to obtain the knowledge base selection score of each currently available knowledge base. After obtaining the knowledge base selection score of each currently available knowledge base, the processor can select a target knowledge base for the user's current query intent from each currently available knowledge base according to the preset selection rules and the knowledge base selection score of each currently available knowledge base. The preset selection rules can be the output format of the knowledge base selection model defined based on actual conditions.

[0047] In an embodiment of the present application, a target knowledge base for the user's current query intention is selected from each currently available knowledge base according to a preset selection rule and a knowledge base selection score of each currently available knowledge base, including: for each knowledge base selection score, when the knowledge base selection score is greater than a set threshold, the knowledge base corresponding to the knowledge base selection score is determined as the target knowledge base; or, all knowledge bases are arranged in descending order according to the size of the knowledge base selection score, and a preset number of knowledge bases with the highest rankings are determined as target knowledge bases.

[0048] The processor can select a target knowledge base for the user's current query intention from the currently available knowledge bases according to the preset selection rules and the knowledge base selection score of each currently available knowledge base. Specifically, for each knowledge base selection score, the processor can determine whether the knowledge base selection score is greater than a set threshold. The set threshold can be determined based on the needs of the user. In the case where the knowledge base selection score is greater than the set threshold, the processor can determine the knowledge base corresponding to the knowledge base selection score as the target knowledge base. Alternatively, the processor can arrange all the knowledge bases in descending order according to the size of the selection score, and determine a preset number of knowledge bases with the highest ranking as the target knowledge base. The preset number can be determined based on the needs of the user.

[0049] In an embodiment of the present application, the method also includes: extracting contextual knowledge for the current query intent from the target knowledge base; inputting the current query intent and the contextual knowledge into the big model to obtain a response to the current query intent.

[0050] After determining the target knowledge base for the user's current query intent, the processor can extract contextual knowledge for the current query from the target knowledge base. After obtaining the contextual knowledge for the current query intent, the processor can input the current query intent and the contextual knowledge into the big model to obtain a response for the current query intent.

[0051] In an embodiment of the present application, extracting contextual knowledge for the current query intent from the target knowledge base includes: when the target knowledge base is a vertical domain big model for generating text in a specific field, inputting the current query intent into the vertical domain big model to generate contextual knowledge for the current query intent; when the target knowledge base is a vertical domain database for storing text in a specific field, retrieving contextual knowledge associated with the current query intent from the vertical domain database.

[0052] The processor can extract contextual knowledge for the current query intent from the target knowledge base. Specifically, the processor can determine whether the target knowledge base is a vertical domain large model for generating text in a specific field. For example, text in a specific field may refer to text in the fields of engineering machinery, financial services, medical consulting, etc. In the case where it is determined that the target knowledge base is a vertical domain large model for generating text in a specific field, the processor can input the current query intent into the vertical domain large model to generate contextual knowledge for the current query intent. The processor can determine whether the target knowledge base is a vertical domain database for storing text in a specific field. In the case where it is determined that the target knowledge base is a vertical domain database for storing text in a specific field, the processor can retrieve contextual knowledge associated with the current query intent from the vertical domain database. The above-mentioned contextual knowledge is the text that best answers the user's query intent, which improves the accuracy of subsequent large model replies.

[0053] In an embodiment of the present application, the method also includes: feeding back the reply to the user and obtaining the user's score for the reply; constructing current positive sample data based on the current query intent, the current user portrait, and the knowledge base selection score of each currently available knowledge base; when the score is greater than a first preset score, adding the current positive sample data constructed based on the current query intent, the current user portrait, and the knowledge base selection score of each currently available knowledge base to the positive sample data set.

[0054] After obtaining the reply of the large model to the current query intent, the processor can feed back the reply to the user and obtain the user's score for the reply. The processor can construct the current positive sample data set based on the current query intent, the current user portrait, and the knowledge base selection score of each currently available knowledge base. The processor can determine whether the score of the reply is greater than the first preset score. The first preset score is determined based on the actual situation. In the case where the score of the reply is greater than the first preset score, the processor can add the current positive sample data constructed based on the current query intent, the current user portrait, and the knowledge base selection score of each currently available knowledge base to the positive sample data set to achieve real-time update and optimization of the positive sample data set.

[0055] In an embodiment of the present application, when the score is greater than a first preset score, the current positive sample data constructed based on the current query intent, the current user portrait, and the knowledge base selection score of each currently available knowledge base is added to the positive sample data set, including: searching the positive sample data set to see whether there is historical positive sample data in which the query intent in the input structure is similar to the current query intent and the user profile in the input structure is similar to the current user profile; when there is historical positive sample data and the score is greater than the first preset score, the confidence count of the historical positive sample data is increased; when there is historical positive sample data and the score is less than a second preset score, the confidence count of the historical positive sample data is reduced; when there is no historical positive sample data and the score is greater than the first preset score, the current positive sample data constructed based on the current query intent, the current user portrait, and the knowledge base selection score of each currently available knowledge base is added to the positive sample data set.

[0056] In the case where the score is greater than the first preset score, the processor can add the current positive sample data constructed based on the current query intent, the current user portrait and the knowledge base selection score of each currently available knowledge base to the positive sample data set. Specifically, the processor can retrieve whether there is historical positive sample data in the positive sample data set whose query intent in the input structure is similar to the current query intent and whose user portrait in the input structure is similar to the current user portrait. In the case where there is historical positive sample data in the positive sample data set and the score is greater than the first preset score, the processor can increase the confidence count of the historical positive sample data. That is, there is historical positive sample data in the positive sample data set that is similar to the current positive sample data constructed based on the current query intent, the current user portrait and the knowledge base selection score of each currently available knowledge base, and the user's score for this reply is greater than the first preset score, that is, the user is more recognized of this reply. In the case where there is historical positive sample data and the score is less than the second preset score, the processor can reduce the confidence count of the historical positive sample data. The second preset score is determined based on the actual situation, and the second preset score is less than the first preset score. When there is no historical positive example data and the score is greater than a first preset score, the processor can add the current positive example data constructed by selecting the score based on the current query intent, the current user profile and the knowledge base description of each currently available knowledge base to the positive example data set, so as to update each positive example data in the positive example data set and add new positive example data to the positive example data set, so that the positive example data set can be synchronized with the user's current query.

[0057] In an embodiment of the present application, the current query intent and contextual knowledge are input into the big model to obtain a response to the current query intent, including: when there are multiple target knowledge bases, determining the semantic similarity between a contextual knowledge extracted from each target knowledge base and the current query intent; arranging all the contextual knowledge in descending order based on the semantic similarity; and inputting all the arranged contextual knowledge and the current query intent into the big model to obtain a response.

[0058] The processor can input the current query intent and contextual knowledge into the big model to obtain a response to the current query intent. Specifically, the processor can determine whether the number of target knowledge bases is multiple. In the case where the number of target knowledge bases is multiple, the processor can determine the semantic similarity between a contextual knowledge extracted from each target knowledge base and the current query intent. After obtaining the semantic similarity between a contextual knowledge extracted from each target knowledge base and the current query intent, the processor can arrange all the contextual knowledge in descending order based on the semantic similarity. After obtaining all the contextual knowledge in descending order, the processor can input all the arranged contextual knowledge and the current query intent into the big model to obtain a response to the current query intent and improve the accuracy of the response.

[0059] In an embodiment of the present application, the current query intent and contextual knowledge are input into the big model to obtain a response to the current query intent, including: determining the contextual knowledge whose semantic similarity is greater than a preset value as the target contextual knowledge; inputting the target contextual knowledge and the current query intent into the big model to obtain a response.

[0060] The processor may determine the context knowledge with a semantic similarity greater than a preset value as the target context knowledge. The preset value may be determined based on the needs of the user. After obtaining the target context knowledge, the processor may input the target context knowledge and the current query intent into the big model to obtain a reply for the current query intent and improve the accuracy of the reply.

[0061] In an embodiment of the present application, the knowledge base is trained through the following steps: determining multiple participants corresponding to the target vertical domain, and the multiple participants have local text data of the target vertical domain; distributing the initial large model of the target vertical domain to the multiple participants, so that the multiple participants iteratively train the initial large model based on the local text data of the target vertical domain they each own; obtaining the temporary large models returned by the multiple participants obtained by the iterative training, and aggregating the temporary large models that have been verified to be compliant to obtain the current latest aggregated large model; when the termination conditions of the iterative training are met, the current latest aggregated large model is determined as the knowledge base corresponding to the target vertical domain.

[0062] The knowledge base in the embodiment of the present application can be obtained by training through the following steps. The processor can determine multiple participants corresponding to the target vertical domain, and the multiple participants have local text data of the target vertical domain. The processor can distribute the initial large model of the target vertical domain to multiple participants, so that the multiple participants can iteratively train the initial large model based on the local text data of the target vertical domain they each own. The processor can obtain the temporary large models obtained by the iterative training returned by each of the multiple participants, and aggregate the temporary large models that have been verified to be compliant to obtain the current latest aggregated large model. After obtaining the current latest aggregated large model, the processor can determine whether the termination condition of the iterative training is met. The termination condition may be that the number of iterations reaches a preset number or the model performance reaches the optimal level. The preset number may be determined based on the user's demand for the model. When the termination condition of the iterative training is met, the processor may determine the current latest aggregated large model as the knowledge base corresponding to the target vertical domain.

[0063] In one embodiment, Figure 2As shown in the figure, taking the user's need to purchase equipment as an example, the processor can use LLM (Large Language Model) to process user queries to identify query intent. The processor can obtain the knowledge base weight based on the positive sample case data set, user portrait and query intent, and convert the knowledge base weight into a selection vector. Among them, the user portrait (label) can refer to the relevant descriptive information of the user, such as a person from a certain place, occupation, whether it is an old user, etc. The query information includes whether there is a purchase intention, and whether certain models have been considered in historical conversations. Specifically, the processor can generate task scenario prompt words based on the positive sample case data set. After generating the task scenario prompt words, the processor can build a knowledge base selection model based on the task scenario prompt words. After the obtained knowledge base selection model is selected, the processor can input the query intent and user portrait into the knowledge base selection model to obtain the knowledge base weight that represents the probability of each knowledge base being selected. The knowledge base can include a database knowledge base and a generative knowledge base. The database knowledge base can include a business unit product introduction and administrative policies and regulations. The generative knowledge base can include a business unit product maintenance guide, regional product preferences, and a cross-domain comprehensive knowledge base. After determining the weight of the knowledge base, the processor can activate the knowledge base, including product comparisons of the corresponding business unit, regional product purchasing preferences and product usage precautions (such as regional soil and temperature characteristics), current industry policies and regulations (such as regional or company-level promotion subsidies), and some comprehensive knowledge. The processor can obtain reference contexts from the activated knowledge base and re-arrange the obtained reference contexts. The processor can construct prompt words based on the re-arranged reference contexts and the original user query. And input the prompt words into the LLM to get a reply. The processor can feed back the reply to the user and update the user portrait based on the user feedback to optimize the user's query intent in combination with the current chat context, and continuously update the positive sample case library to continuously optimize the agent assistance system.

[0064] Through the above technical solution, a large knowledge base selection model is constructed, which can determine the knowledge base selection score based on the user's query intention and user portrait. It takes into account the user's personalized needs, can accurately determine the target knowledge base required by the user, and improve the efficiency and accuracy of subsequent answers to user questions.

[0065] Figure 1 and Figure 2 FIG. 1 is a flow chart of a method for selecting a knowledge base in one embodiment. It should be understood that although Figure 1 and Figure 2 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 and Figure 2 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0066] The present application also provides a device for selecting a knowledge base, including:

[0067] a memory configured to store instructions;

[0068] The processor is configured to call instructions from the memory and implement the above method for selecting a knowledge base when executing the instructions.

[0069] An embodiment of the present application also provides a machine-readable storage medium, on which instructions are stored, and the instructions are used to enable a machine to execute the above-mentioned method for selecting a knowledge base.

[0070] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor A01, a network interface A02, a memory (not shown in the figure) and a database (not shown in the figure) connected through a system bus. Among them, the processor A01 of the computer device is used to provide computing and control capabilities. The memory of the computer device includes an internal memory A03 and a non-volatile storage medium A04. The non-volatile storage medium A04 stores an operating system B01, a computer program B02 and a database (not shown in the figure). The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 in the non-volatile storage medium A04. The database of the computer device is used to store data such as the current query intention, query question, current user portrait, positive sample data set, task scenario prompt words, knowledge base selection score, etc. The network interface A02 of the computer device is used to communicate with an external terminal through a network connection. When the computer program B02 is executed by the processor A01, a method for selecting a knowledge base is implemented.

[0071] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0072] The embodiment of the present application provides a device, the device includes a processor, a memory, and a program stored in the memory and executable on the processor, and the processor implements the following steps when executing the program: obtaining the current query intent of the user, the current query intent is obtained by parsing the query question input by the user and its historical context; obtaining the current user portrait of the user, the current user portrait is a set of indicator parameters constructed based on the user's personal information and historical behavior data; obtaining a positive sample data set in the sample data set, wherein the sample data set is constructed based on the historical query intent and historical user portrait of each user and their corresponding outputs; generating task scenario prompt words based on the positive sample data set of the large model selected for the knowledge base, and any positive sample data in the positive sample data set is A mapping of a set of historical data of an input structure of a historical call knowledge base selection big model to historical data of an output structure, wherein the input structure includes query intent and user portrait, and the output structure includes knowledge base selection scores of multiple knowledge bases; constructing a knowledge base selection big model based on task scenario prompt words, and the task scenario prompt words are used to enable the knowledge base selection big model to obtain output data of the output structure based on the input data of the input structure; inputting the current query intent and the current user portrait into the knowledge base selection big model to obtain the knowledge base selection score of each currently available knowledge base; selecting a target knowledge base for the user's current query intent from each currently available knowledge base according to preset selection rules and the knowledge base selection score of each currently available knowledge base.

[0073] In one embodiment, the input structure also includes knowledge base descriptions of multiple knowledge bases, and generating task scenario prompt words based on the positive sample data set for the knowledge base selection large model includes: splicing the knowledge base selection task introduction text, the knowledge base description of the currently available knowledge base, the input structure, the output structure, and at least part of the positive sample data in the positive sample data set to obtain the task scenario prompt words.

[0074] In one embodiment, at least part of the positive sample data in the positive sample data set includes a preset number of positive sample data with the highest confidence count ranking in the positive sample data set.

[0075] In one embodiment, the method further includes: extracting contextual knowledge for the current query intent from the target knowledge base; and inputting the current query intent and the contextual knowledge into the big model to obtain a response for the current query intent.

[0076] In one embodiment, extracting contextual knowledge for the current query intent from the target knowledge base includes: when the target knowledge base is a vertical domain big model for generating text in a specific field, inputting the current query intent into the vertical domain big model to generate contextual knowledge for the current query intent; when the target knowledge base is a vertical domain database for storing text in a specific field, retrieving contextual knowledge associated with the current query intent from the vertical domain database.

[0077] In one embodiment, the method also includes: feeding back the reply to the user and obtaining the user's score for the reply; constructing current positive sample data based on the current query intent, the current user portrait and the knowledge base selection score of each currently available knowledge base; when the score is greater than a first preset score, adding the current positive sample data constructed based on the current query intent, the current user portrait and the knowledge base selection score of each currently available knowledge base to the positive sample data set.

[0078] In one embodiment, when the score is greater than a first preset score, the current positive sample data constructed based on the current query intent, the current user profile and the knowledge base selection score of each currently available knowledge base is added to the positive sample data set, including: searching the positive sample data set to see whether there is historical positive sample data in which the query intent in the input structure is similar to the current query intent and the user profile in the input structure is similar to the current user profile; when historical positive sample data exists and the score is greater than the first preset score, the confidence count of the historical positive sample data is increased; when historical positive sample data exists and the score is less than the second preset score, the confidence count of the historical positive sample data is reduced; when there is no historical positive sample data and the score is greater than the first preset score, the current positive sample data constructed based on the current query intent, the current user profile and the knowledge base selection score of each currently available knowledge base is added to the positive sample data set.

[0079] In one embodiment, the current query intent and contextual knowledge are input into a large model to obtain a response to the current query intent, including: when there are multiple target knowledge bases, determining the semantic similarity between a contextual knowledge extracted from each target knowledge base and the current query intent; arranging all contextual knowledge in descending order based on the semantic similarity; and inputting all the arranged contextual knowledge and the current query intent into the large model to obtain a response.

[0080] In one embodiment, the current query intent and contextual knowledge are input into the big model to obtain a response to the current query intent, including: determining contextual knowledge with a semantic similarity greater than a preset value as target contextual knowledge; inputting the target contextual knowledge and the current query intent into the big model to obtain a response.

[0081] In one embodiment, according to preset selection rules and the knowledge base selection score of each currently available knowledge base, a target knowledge base for the user's current query intention is selected from each currently available knowledge base, including: for each knowledge base selection score, when the knowledge base selection score is greater than a set threshold, the knowledge base corresponding to the knowledge base selection score is determined as the target knowledge base; or, all knowledge bases are arranged in descending order according to the size of the knowledge base selection score, and a preset number of knowledge bases with the highest rankings are determined as target knowledge bases.

[0082] In one embodiment, the knowledge base is trained through the following steps: determining multiple participants corresponding to the target vertical domain, and the multiple participants have local text data of the target vertical domain; distributing the initial large model of the target vertical domain to the multiple participants, so that the multiple participants iteratively train the initial large model based on the local text data of the target vertical domain they each own; obtaining the temporary large models returned by the multiple participants obtained by the iterative training, and aggregating the temporary large models that have been verified to be compliant to obtain the current latest aggregated large model; when the termination conditions of the iterative training are met, the current latest aggregated large model is determined as the knowledge base corresponding to the target vertical domain.

[0083] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program for initializing the method steps for selecting a knowledge base.

[0084] 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 take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0085] 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 embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks 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 generate 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 1 A device that provides the functions specified in a block or multiple blocks.

[0086] 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.

[0087] 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.

[0088] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0089] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0090] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0091] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0092] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.

Claims

1. A method for selecting a knowledge base, characterized in that: The method comprises: Obtaining the user's current query intent, where the current query intent is obtained by parsing the query question input by the user and its historical context; Obtaining a current user profile of the user, where the current user profile is a set of indicator parameters constructed based on the user's personal information and historical behavior data; Obtaining a positive sample data set from the sample data set, wherein the sample data set is constructed based on each user's historical query intention and historical user profile and their corresponding outputs; Generate task scenario prompt words based on the positive sample data set for the knowledge base selection large model, where any positive sample data in the positive sample data set is a mapping of a set of historical data of an input structure to historical data of an output structure for historically calling the knowledge base selection large model, wherein the input structure includes query intent and user portrait, and the output structure includes knowledge base selection scores of multiple knowledge bases; Building a knowledge base selection large model based on the task scenario prompt words, wherein the task scenario prompt words are used to enable the knowledge base selection large model to obtain output data of the output structure based on the input data of the input structure; Inputting the current query intent and the current user portrait into the knowledge base selection model to obtain a knowledge base selection score for each currently available knowledge base; Selecting a target knowledge base for the current query intention of the user from each of the currently available knowledge bases according to a preset selection rule and a knowledge base selection score of each of the currently available knowledge bases; The method further comprises: Extracting contextual knowledge for the current query intention from the target knowledge base; Inputting the current query intention and the context knowledge into the big model to obtain a response to the current query intention; The method further comprises: Feedback the reply to the user, and obtain the user's rating for the reply; Current positive sample data constructed based on the current query intent, the current user portrait, and the knowledge base selection score of each currently available knowledge base; When the score is greater than a first preset score, current positive sample data constructed based on the current query intent, the current user portrait and the knowledge base selection score of each currently available knowledge base is added to the positive sample data set.

2. The method for selecting a knowledge base according to claim 1, characterized in that: The input structure also includes knowledge base descriptions of the multiple knowledge bases, and the generating of task scenario prompt words based on the positive sample data set selecting a large model for the knowledge base includes: The task scenario prompt words are obtained by splicing the knowledge base selection task introduction text, the knowledge base description of the currently available knowledge base, the input structure, the output structure and at least part of the positive sample data in the positive sample data set.

3. The method for selecting a knowledge base according to claim 2, characterized in that: At least part of the positive sample data in the positive sample data set includes a preset number of positive sample data with the highest confidence count rankings in the positive sample data set.

4. The method for selecting a knowledge base according to claim 1, characterized in that: The extracting contextual knowledge for the current query intention from the target knowledge base includes: In the case where the target knowledge base is a vertical domain big model for generating text in a specific field, the current query intention is input into the vertical domain big model to generate contextual knowledge for the current query intention, wherein the specific field includes the engineering machinery field, the financial service field, and the medical consultation field; In the case where the target knowledge base is a vertical domain database for storing texts in a specific field, the contextual knowledge associated with the current query intention is retrieved from the vertical domain database.

5. The method for selecting a knowledge base according to claim 1, characterized in that: When the score is greater than the first preset score, adding the current positive sample data constructed based on the current query intent, the current user portrait and the knowledge base selection score of each currently available knowledge base to the positive sample data set includes: Searching the positive sample data set for historical positive sample data in which the query intent in the input structure is similar to the current query intent and the user profile in the input structure is similar to the current user profile; In the case where the historical positive sample data exists and the score is greater than a first preset score, increasing the confidence count of the historical positive sample data; In the case where the historical positive sample data exists and the score is less than a second preset score, reducing the confidence count of the historical positive sample data; When the historical positive sample data does not exist and the score is greater than the first preset score, the current positive sample data constructed based on the current query intent, the current user portrait and the knowledge base selection score of each currently available knowledge base is added to the positive sample data set.

6. The method for selecting a knowledge base according to claim 1, characterized in that: Inputting the current query intent and the context knowledge into the big model to obtain a response to the current query intent, including: In the case where there are multiple target knowledge bases, determining the semantic similarity between a piece of context knowledge extracted from each target knowledge base and the current query intention; Arrange all contextual knowledge in descending order based on the semantic similarity; All the arranged contextual knowledge and the current query intention are input into the big model to obtain the response.

7. The method for selecting a knowledge base according to claim 6, characterized in that: Inputting the current query intent and the context knowledge into the big model to obtain a response to the current query intent, including: Determine the context knowledge whose semantic similarity is greater than a preset value as the target context knowledge; The target context knowledge and the current query intention are input into the big model to obtain the reply.

8. The method for selecting a knowledge base according to claim 1, characterized in that: The step of selecting a target knowledge base for the current query intention of the user from each of the currently available knowledge bases according to a preset selection rule and a knowledge base selection score of each of the currently available knowledge bases includes: For each knowledge base selection score, when the knowledge base selection score is greater than a set threshold, determining the knowledge base corresponding to the knowledge base selection score as the target knowledge base; Alternatively, all knowledge bases are arranged in descending order according to the knowledge base selection scores, and a preset number of knowledge bases with the highest rankings are determined as the target knowledge bases.

9. The method for selecting a knowledge base according to claim 1, characterized in that: The knowledge base is trained by the following steps: Determine multiple participants corresponding to the target vertical domain, wherein the multiple participants have local text data of the target vertical domain; Distributing the initial large model of the target vertical domain to the multiple participants, so that the multiple participants iteratively train the initial large model based on the local text data of the target vertical domain owned by each of them; Obtaining the temporary large models returned by the multiple participants through iterative training, and aggregating the temporary large models that have been verified to be compliant to obtain the latest aggregated large model; When the termination condition of the iterative training is met, the current latest aggregated large model is determined as the knowledge base corresponding to the target vertical domain.

10. A device for selecting a knowledge base, characterized in that: include: a memory configured to store instructions; A processor is configured to call the instructions from the memory and implement the method for selecting a knowledge base according to any one of claims 1 to 9 when executing the instructions.

11. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores instructions for causing a machine to execute the method for selecting a knowledge base according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Interactive knowledge interaction system based on knowledge base and large language model

    CN118013001A

  • Domain large model multi-modal knowledge base construction method based on feature representation

    CN118779469A

  • Product recommendation method, device, equipment, system and program product

    CN119168729A