Model training and information query method and device, equipment, medium and product

By generating a knowledge base prediction model, using the feature vectors of the query statement to automatically predict the relevant knowledge base, the cumbersome problem of manually selecting the knowledge base in existing information queries is solved, and a fast and efficient information query experience is achieved.

CN119443192APending Publication Date: 2025-02-14GUANGZHOU FANGZHOU INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411507756.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

In the existing information query scenario based on knowledge base, users need to manually select the knowledge base, which makes the information query process time-consuming and cumbersome, affecting the user experience.

Method used

The knowledge base prediction model is generated by obtaining the eigenvectors of the sample query statement and using the model to be trained to determine the predictive correlation between these eigenvectors and each candidate knowledge base. This model can automatically predict the relevant target knowledge base based on the user's current query statement, thereby conducting information query.

Benefits of technology

The effect of automatically selecting relevant knowledge bases based on the query statement is realized, greatly saving the time required for information query and improving user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119443192A_ABST
    Figure CN119443192A_ABST
Patent Text Reader

Abstract

The invention discloses a model training and information query method and device, equipment, a medium and a product, and relates to the technical field of artificial intelligence, and the method comprises the steps: obtaining a sample feature vector corresponding to a sample inquiry statement, and inputting the sample feature vector into a to-be-trained model; determining the prediction correlation between the sample feature vector and each candidate knowledge base by using the to-be-trained model, and training the to-be-trained model according to the prediction correlation and the standard correlation between the sample feature vector and each candidate knowledge base to generate a knowledge base prediction model; wherein the knowledge base prediction model is used for predicting a related target knowledge base according to the current inquiry statement of the user, and the target knowledge base is used for carrying out information query according to the current inquiry statement. According to the invention, the effect of automatically selecting the related knowledge base according to the inquiry statement can be realized, the time required for information inquiry is greatly saved, and the user experience is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a model training and information query method, device, equipment, medium and product. Background Art

[0002] With the development of artificial intelligence technology, more and more business scenarios that originally required human participation can now be realized using artificial intelligence technology, which undoubtedly greatly saves labor costs and improves the efficiency of business execution. Among them, information query scenario is a typical business scenario that can be realized using artificial intelligence technology.

[0003] In existing knowledge base-based information query scenarios, users are usually required to manually select a knowledge base and then perform information query based on a query statement, which undoubtedly makes the information query process time-consuming and cumbersome, affecting the user experience. Summary of the invention

[0004] The present invention provides a model training and information query method, device, equipment, medium and product to solve the problem that in the existing knowledge base-based information query scenario, users are required to manually select a knowledge base, which makes the information query process time-consuming and cumbersome, affecting the user experience.

[0005] According to one aspect of the present invention, a model training method is provided, comprising:

[0006] Obtaining a sample feature vector corresponding to the sample query sentence, and inputting the sample feature vector into the model to be trained;

[0007] Determining the prediction correlation between the sample feature vector and each candidate knowledge base using the model to be trained, and training the model to be trained to generate a knowledge base prediction model based on the prediction correlation and the standard correlation between the sample feature vector and each candidate knowledge base;

[0008] The knowledge base prediction model is used to predict a related target knowledge base according to the user's current query statement, and the target knowledge base is used to perform information query according to the current query statement.

[0009] According to another aspect of the present invention, there is provided an information query method, comprising:

[0010] Obtaining a current feature vector corresponding to the user's current query statement, and inputting the current feature vector into a knowledge base prediction model; wherein the knowledge base prediction model is trained using any of the above-mentioned model training methods;

[0011] According to the actual correlation between the current feature vector output by the knowledge base prediction model and each candidate knowledge base, a target knowledge base related to the current query statement is determined, and information query is performed in the target knowledge base according to the current query statement.

[0012] According to another aspect of the present invention, there is provided a model training device, comprising:

[0013] A sample feature vector acquisition module is used to acquire a sample feature vector corresponding to a sample query sentence and input the sample feature vector into a model to be trained;

[0014] A model training module, used to determine the prediction correlation between the sample feature vector and each candidate knowledge base using the model to be trained, and train the model to be trained to generate a knowledge base prediction model based on the prediction correlation and the standard correlation between the sample feature vector and each candidate knowledge base;

[0015] The knowledge base prediction model is used to predict a related target knowledge base according to the user's current query statement, and the target knowledge base is used to perform information query according to the current query statement.

[0016] According to another aspect of the present invention, there is provided an information query device, comprising:

[0017] A current feature vector acquisition module is used to acquire a current feature vector corresponding to a current query statement of a user, and input the current feature vector into a knowledge base prediction model; wherein the knowledge base prediction model is trained using any of the above-mentioned model training methods;

[0018] The target knowledge base determination module is used to determine the target knowledge base related to the current query statement based on the actual correlation between the current feature vector output by the knowledge base prediction model and each candidate knowledge base, and perform information query in the target knowledge base based on the current query statement.

[0019] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0020] at least one processor; and

[0021] a memory communicatively connected to the at least one processor; wherein,

[0022] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the model training method and / or information query method described in any one of the present invention.

[0023] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the model training method and / or information query method described in any one of the present invention when executed.

[0024] According to another aspect of the present invention, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the model training method and / or information query method described in any one of the present invention.

[0025] The present invention obtains a sample feature vector corresponding to a sample query statement, and inputs the sample feature vector into a model to be trained; uses the model to be trained to determine the predicted correlation between the sample feature vector and each candidate knowledge base, and trains the model to be trained to generate a knowledge base prediction model based on the predicted correlation and the standard correlation between the sample feature vector and each candidate knowledge base, so that the trained knowledge base prediction model can predict the correlation between the query statement and each candidate knowledge base based on the feature vector of the query statement, thereby automatically selecting a knowledge base based on the correlation, thereby achieving the effect of automatically selecting a relevant knowledge base based on the query statement, greatly saving the time required for information query, and ensuring user experience.

[0026] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0028] Figure 1 A flowchart of a model training method provided in Embodiment 1 of the present invention;

[0029] Figure 2 A flowchart of a model training method provided in Embodiment 2 of the present invention;

[0030] Figure 3 A flowchart of an information query method provided in Embodiment 3 of the present invention;

[0031] Figure 4 A schematic diagram of the structure of a model training device provided in Embodiment 4 of the present invention;

[0032] Figure 5A schematic diagram of the structure of an information query device provided in Embodiment 5 of the present invention;

[0033] Figure 6 A schematic diagram of the structure of an electronic device that can be used to implement an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0034] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0035] It should be noted that the terms "sample", "current", "candidate", "target", "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0036] Embodiment 1

[0037] Figure 1 This is a flow chart of a model training method provided in the first embodiment of the present invention. This embodiment can be applied to training a knowledge base prediction model for predicting a related target knowledge base based on the user's current query statement, so as to perform information query in the target knowledge base. The method can be executed by a model training device, which can be implemented in the form of hardware and / or software, such as a server. Figure 1 As shown, the method includes:

[0038] S101. Obtain a sample feature vector corresponding to a sample query statement, and input the sample feature vector into a model to be trained.

[0039] The sample query sentence refers to the query sentence used as training data for model training. The query sentence refers to a question-type sentence containing query keywords, which is used to trigger information query operations, such as "what medicine to take for a cold" or "what are the symptoms of a cold", etc. The feature vector, also known as embedding, is a vector representation that can reflect the semantic information of the corresponding query sentence. It can be understood that the sample feature vector represents the feature vector corresponding to the sample query sentence. The model to be trained refers to a model that is in the training stage and has not yet been trained.

[0040] In one embodiment, a server for training a model to be trained (hereinafter referred to as the first server) extracts data from a training data set, obtains at least one sample query statement, and uses a feature vector generation technique to determine a sample feature vector corresponding to each sample query statement. Further, the first server inputs each sample feature vector into a model to be trained in the first server that is in the model training stage. The type of model to be trained includes, but is not limited to, a neural network model, etc.

[0041] S102, using the model to be trained to determine the prediction correlation between the sample feature vector and each candidate knowledge base, and based on the prediction correlation and the standard correlation between the sample feature vector and each candidate knowledge base, train the model to be trained to generate a knowledge base prediction model.

[0042] Among them, the candidate knowledge base is a structured, easy-to-operate, easy-to-use, and fully organized knowledge cluster in knowledge engineering. It is a collection of interconnected knowledge pieces that are stored, organized, managed, and used in a memory using a certain (or several) knowledge representation method to solve problems in a certain (or certain) field. These knowledge pieces include theoretical knowledge and factual data related to the field, heuristic knowledge obtained from expert experience, such as definitions, theorems, and operation rules related to a certain field, as well as common sense knowledge. It is understandable that the content of knowledge pieces contained in different candidate knowledge bases is not the same.

[0043] The knowledge base prediction model refers to a trained model to be trained, which can be put into production in the model use stage. In the model use stage, the knowledge base prediction model is used to predict the relevant target knowledge base based on the user's current query statement, and the target knowledge base is used to query information based on the current query statement.

[0044] Prediction correlation refers to the correlation between each sample feature vector predicted by the training model and each candidate knowledge base. Standard correlation refers to the correlation between each sample feature vector manually calibrated and each candidate knowledge base. It can be understood that the greater the standard correlation between any sample feature vector and any candidate knowledge base, the higher the correlation between the sample feature vector and the candidate knowledge base, that is, the higher the correlation between the sample query statement corresponding to the sample feature vector and the candidate knowledge base, that is, the use of the candidate knowledge base can ensure that information with a high degree of correlation with the sample query statement can be queried, ensuring the accuracy and reliability of information query.

[0045] In one embodiment, the first server processes each sample feature vector using the model to be trained, and the model to be trained predicts the correlation between each sample feature vector and each candidate knowledge base as the predicted correlation. For example, assuming that candidate knowledge base 1, candidate knowledge base 2, and candidate knowledge base 3 are included, the first server inputs the sample feature vector A into the model to be trained, and the model to be trained predicts that the predicted correlation between the sample feature vector A and candidate knowledge base 1 is 35%, the predicted correlation between the sample feature vector A and candidate knowledge base 2 is 40%, and the predicted correlation between the sample feature vector A and candidate knowledge base 3 is 25%. It can be understood that the model to be trained predicts that the correlation between the sample feature vector A and candidate knowledge base 2 is the highest, followed by candidate knowledge base 1, and finally candidate knowledge base 3.

[0046] Furthermore, the first server compares the predicted correlation and standard correlation between each sample feature vector and each candidate knowledge base to calculate the target loss value, and further calculates the target gradient value based on the target loss value. Finally, the model parameters of the to-be-trained model are back-propagated based on the target gradient value to update the model parameters so that the predicted correlations predicted by the to-be-trained model can be closer to the manually calibrated standard correlations.

[0047] The embodiment of the present invention obtains a sample feature vector corresponding to a sample query statement and inputs the sample feature vector into a model to be trained; the model to be trained is used to determine the predicted correlation between the sample feature vector and each candidate knowledge base, and according to the predicted correlation and the standard correlation between the sample feature vector and each candidate knowledge base, the model to be trained is trained to generate a knowledge base prediction model, so that the trained knowledge base prediction model can predict the correlation between the query statement and each candidate knowledge base according to the feature vector of the query statement, thereby automatically selecting a knowledge base according to the correlation, thereby achieving the effect of automatically selecting a relevant knowledge base according to the query statement, greatly saving the time required for information query, and ensuring user experience.

[0048] Embodiment 2

[0049] Figure 2This is a flow chart of a model training method provided in the second embodiment of the present invention. This embodiment further expands and optimizes the above embodiment and can be combined with the above optional implementation modes. Figure 2 As shown, the method includes:

[0050] S201. Obtain a sample feature vector corresponding to a sample query statement, and input the sample feature vector into a model to be trained.

[0051] S202: Determine a knowledge base feature vector corresponding to any candidate knowledge base using the model to be trained.

[0052] The knowledge base feature vector refers to the vector representation of the semantic information that can represent the candidate knowledge base information.

[0053] Optionally, the knowledge base feature vector corresponding to any candidate knowledge base is determined using the model to be trained, including:

[0054] A knowledge document is extracted from the candidate knowledge base using the model to be trained, and a knowledge base feature vector corresponding to the candidate knowledge base is determined based on a document feature vector corresponding to the knowledge document.

[0055] The knowledge document refers to the document containing knowledge information stored in the candidate knowledge base.

[0056] In one embodiment, the first server uses the model to be trained to randomly extract a knowledge document from the candidate knowledge base, and uses feature vector generation technology to determine the document feature vector corresponding to the knowledge document, and further uses the document feature vector corresponding to the knowledge document as the knowledge base feature vector corresponding to the candidate knowledge base.

[0057] By using the model to be trained to extract any knowledge document from the candidate knowledge base, and determining the knowledge base feature vector corresponding to the candidate knowledge base based on the document feature vector corresponding to the knowledge document, the convenience of determining the knowledge base feature vector is further improved under the premise that the knowledge base feature vector can be determined.

[0058] Optionally, the knowledge base feature vector corresponding to any candidate knowledge base is determined using the model to be trained, including:

[0059] The model to be trained is used to determine each knowledge document included in the candidate knowledge base, and the knowledge base feature vector corresponding to the candidate knowledge base is determined according to the document feature mean vector corresponding to each knowledge document.

[0060] In one embodiment, the first server uses the model to be trained to extract all knowledge documents from the candidate knowledge base, and uses feature vector generation technology to determine the document feature vectors corresponding to each knowledge document, and further calculates the document feature mean vector based on the document feature vectors corresponding to each knowledge document, and finally uses the document feature mean vector as the knowledge base feature vector corresponding to the candidate knowledge base.

[0061] By using the model to be trained to determine the knowledge documents included in the candidate knowledge base, and determining the knowledge base feature vector corresponding to the candidate knowledge base according to the document feature mean vector corresponding to each knowledge document, the accuracy and reliability of the knowledge base feature vector determination is guaranteed.

[0062] S203: Determine the feature vector correlation between the sample feature vector and the knowledge base feature vector using the model to be trained, and predict the predicted correlation between the sample feature vector and the candidate knowledge base based on the feature vector correlation.

[0063] In one embodiment, the first server uses the model to be trained to adopt the MMD (Maximum Mean Discrepancy) method to determine the feature vector correlation between each sample feature vector and the feature vector of the knowledge base, and further predicts the predicted correlation between each sample feature vector and the candidate knowledge base based on the feature vector correlation between each sample feature vector and the feature vector of the knowledge base.

[0064] The knowledge base feature vector corresponding to any candidate knowledge base is determined by using the model to be trained; the feature vector correlation between the sample feature vector and the knowledge base feature vector is determined by using the model to be trained, and the predicted correlation between the sample feature vector and the candidate knowledge base is predicted based on the feature vector correlation, thereby indirectly determining the predicted correlation between the sample feature vector and the candidate knowledge base using the correlation between the feature vectors, thereby ensuring the rationality and accuracy of the predicted correlation determination.

[0065] S204: taking the predicted correlation between the sample feature vector and any candidate knowledge base as the first correlation, and taking the standard correlation between the sample feature vector and the candidate knowledge base as the second correlation.

[0066] S205. Determine a target loss value according to the first correlation and the second correlation using the target loss function, and determine a target gradient value of the target loss function with respect to a model parameter of the model to be trained according to the target loss value.

[0067] Among them, the objective loss function can be set and adjusted according to actual business needs.

[0068] In one embodiment, the first server uses the first correlation and the second correlation as input values ​​of the target loss function, and uses the target loss function to calculate the loss value to determine the target loss value. Further, the first server uses a gradient calculation method to determine the target gradient value of the target loss function with respect to the model parameters of the model to be trained according to the target loss value.

[0069] S206: Update the model parameters according to the target gradient value to generate a knowledge base prediction model.

[0070] In one embodiment, the first server performs back-propagation to update model parameters of the model to be trained according to the target gradient value, so that each predicted correlation predicted by the model to be trained can be closer to the manually calibrated standard correlation.

[0071] The predicted correlation between the sample feature vector and any candidate knowledge base is taken as the first correlation, and the standard correlation between the sample feature vector and the candidate knowledge base is taken as the second correlation; the target loss value is determined according to the first correlation and the second correlation using the target loss function, and the target gradient value of the target loss function with respect to the model parameters of the model to be trained is determined according to the target loss value; the model parameters are updated according to the target gradient value, so that the model to be trained tends to aggregate the contents of the same knowledge base, that is, to reduce the intra-class distance, and at the same time push the contents of different knowledge bases away from each other, that is, to increase the inter-class distance, thereby ensuring the effectiveness of model training.

[0072] Embodiment 3

[0073] Figure 3 This is a flowchart of an information query method provided in the third embodiment of the present invention. This embodiment can be applied to the case where the trained knowledge base prediction model is used to determine the target knowledge base related to the current query statement for information query. The method can be executed by an information query device, which can be implemented in the form of hardware and / or software, such as a server. Figure 3 As shown, the method includes:

[0074] S301. Obtain a current feature vector corresponding to the user's current query statement, and input the current feature vector into a knowledge base prediction model.

[0075] The knowledge base prediction model is trained using the model training method as described above.

[0076] In one embodiment, the server for information query (hereinafter referred to as the second server) obtains the current query statement issued by the user, and uses the feature vector generation technology to determine the current feature vector corresponding to the current query statement. The second server further inputs the current feature vector into the deployed knowledge base prediction model.

[0077] S302: Determine a target knowledge base related to the current query statement based on the current feature vector output by the knowledge base prediction model and the actual correlation between each candidate knowledge base, and perform information query in the target knowledge base based on the current query statement.

[0078] In one embodiment, the knowledge base prediction model processes the current feature vector and outputs the actual correlation between the current feature vector and each candidate knowledge base. The second server obtains the actual correlation between the current feature vector and each candidate knowledge base output by the knowledge base prediction model, and sorts the actual correlation between the current feature vector and each candidate knowledge base, and selects the candidate knowledge base with the largest actual correlation with the current feature vector as the target knowledge base according to the sorting result. The second server uses the target knowledge base as a data source, uses a method including rule matching according to the current query statement to query information in the target knowledge base, and feeds back the queried information to the user.

[0079] The embodiment of the present invention obtains the current feature vector corresponding to the user's current query statement and inputs the current feature vector into the knowledge base prediction model; wherein the knowledge base prediction model is trained using any of the above model training methods; according to the actual correlation between the current feature vector output by the knowledge base prediction model and each candidate knowledge base, the target knowledge base related to the current query statement is determined, and information query is performed in the target knowledge base according to the current query statement, thereby using the trained knowledge base prediction model to predict the correlation between the current query statement and each candidate knowledge base, and automatically selecting the knowledge base according to the correlation, thereby achieving the effect of automatically selecting the relevant knowledge base according to the current query statement, greatly saving the time required for information query, and ensuring user experience.

[0080] Optionally, according to the actual correlation between the current feature vector output by the knowledge base prediction model and each candidate knowledge base, a target knowledge base related to the current query statement is determined, including:

[0081] Determine a first actual correlation between the current feature vector and the first candidate knowledge base, and a second actual correlation between the current feature vector and the second candidate knowledge base; if the correlation difference between the first actual correlation and the second actual correlation is greater than or equal to the correlation threshold, use the first candidate knowledge base as the target knowledge base.

[0082] The first candidate knowledge base is at least one candidate knowledge base having the greatest actual correlation with the current feature vector, and the second candidate knowledge base is any candidate knowledge base except the first candidate knowledge base.

[0083] Exemplarily, assuming that the correlation threshold is 15%, and a total of candidate knowledge base 1, candidate knowledge base 2 and candidate knowledge base 3 are included, assuming that the actual correlation between the current feature vector and candidate knowledge base 1 is 50%, the actual correlation between the current feature vector and candidate knowledge base 2 is 30%, and the actual correlation between the current feature vector and candidate knowledge base 3 is 20%, then candidate knowledge base 1 is taken as the first candidate knowledge base, and no matter whether the second candidate knowledge base is candidate knowledge base 2 or candidate knowledge base 3, the correlation difference between the second actual correlation (20% / 30%) and the first actual correlation (50%) is greater than 15%, and therefore candidate knowledge base 1 is taken as the target knowledge base.

[0084] By determining the first actual correlation between the current feature vector and the first candidate knowledge base, and the second actual correlation between the current feature vector and the second candidate knowledge base; if the correlation difference between the first actual correlation and the second actual correlation is greater than or equal to the correlation threshold, the first candidate knowledge base is used as the target knowledge base to ensure that the target knowledge base is more relevant to the current query statement than other candidate knowledge bases.

[0085] Optionally, after determining a first actual correlation between the current feature vector and the first candidate knowledge base, and a second actual correlation between the current feature vector and the second candidate knowledge base, the method further includes:

[0086] If the correlation difference between the first actual correlation and the second actual correlation is less than the correlation threshold, the first candidate knowledge base and the second candidate knowledge base are used as target knowledge bases.

[0087] Exemplarily, assuming that the correlation threshold is 20%, and a total of candidate knowledge base 1, candidate knowledge base 2 and candidate knowledge base 3 are included, assuming that the actual correlation between the current feature vector and candidate knowledge base 1 is 35%, the actual correlation between the current feature vector and candidate knowledge base 2 is 40%, and the actual correlation between the current feature vector and candidate knowledge base 3 is 25%, then candidate knowledge base 2 is taken as the first candidate knowledge base, and no matter whether the second candidate knowledge base is candidate knowledge base 1 or candidate knowledge base 3, the correlation difference between the second actual correlation (35% / 25%) and the first actual correlation (40%) is less than 20%, and therefore candidate knowledge base 1, candidate knowledge base 2 and candidate knowledge base 3 are collectively taken as target knowledge bases.

[0088] If the correlation difference between the first actual correlation and the second actual correlation is less than the correlation threshold, the first candidate knowledge base and the second candidate knowledge base are used as target knowledge bases. When the actual correlation between each candidate knowledge base and the current feature vector is close, each candidate knowledge base is used as the target knowledge base together to ensure the comprehensiveness of the target knowledge base determination.

[0089] Embodiment 4

[0090] Figure 4 This is a schematic diagram of the structure of a model training device provided in Embodiment 4 of the present invention. Figure 4 As shown, the device comprises:

[0091] A sample feature vector acquisition module 41 is used to acquire a sample feature vector corresponding to a sample query sentence and input the sample feature vector into a model to be trained;

[0092] A model training module 42 is used to determine the prediction correlation between the sample feature vector and each candidate knowledge base using the model to be trained, and train the model to be trained to generate a knowledge base prediction model based on the prediction correlation and the standard correlation between the sample feature vector and each candidate knowledge base;

[0093] The knowledge base prediction model is used to predict a related target knowledge base according to the user's current query statement, and the target knowledge base is used to perform information query according to the current query statement.

[0094] Optionally, the model training module 42 is specifically used for:

[0095] Determine a knowledge base feature vector corresponding to any of the candidate knowledge bases using the model to be trained;

[0096] The model to be trained is used to determine the feature vector correlation between the sample feature vector and the knowledge base feature vector, and the predicted correlation between the sample feature vector and the candidate knowledge base is predicted based on the feature vector correlation.

[0097] Optionally, the model training module 42 is further used for:

[0098] The model to be trained is used to extract any knowledge document from the candidate knowledge base, and the knowledge base feature vector corresponding to the candidate knowledge base is determined according to the document feature vector corresponding to the knowledge document.

[0099] Optionally, the model training module 42 is further used for:

[0100] The model to be trained is used to determine each knowledge document included in the candidate knowledge base, and the knowledge base feature vector corresponding to the candidate knowledge base is determined based on the document feature mean vector corresponding to each knowledge document.

[0101] Optionally, the model training module 42 is further used for:

[0102] Taking the predicted correlation between the sample feature vector and any of the candidate knowledge bases as a first correlation, and taking the standard correlation between the sample feature vector and the candidate knowledge base as a second correlation;

[0103] Determine a target loss value according to the first correlation and the second correlation using a target loss function, and determine a target gradient value of the target loss function with respect to a model parameter of the model to be trained according to the target loss value;

[0104] The model parameters are updated according to the target gradient value.

[0105] The model training device provided in the embodiment of the present invention can execute the model training method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0106] Embodiment 5

[0107] Figure 5 This is a schematic diagram of the structure of an information query device provided by Embodiment 5 of the present invention. Figure 5 As shown, the device comprises:

[0108] The current feature vector acquisition module 51 is used to acquire the current feature vector corresponding to the user's current query statement, and input the current feature vector into the knowledge base prediction model; wherein the knowledge base prediction model is trained using the model training method as described above;

[0109] The target knowledge base determination module 52 is used to determine the target knowledge base related to the current query statement according to the actual correlation between the current feature vector output by the knowledge base prediction model and each candidate knowledge base, and perform information query in the target knowledge base according to the current query statement.

[0110] Optionally, the target knowledge base determination module 52 is specifically configured to:

[0111] determining a first actual correlation between the current feature vector and a first candidate knowledge base, and a second actual correlation between the current feature vector and a second candidate knowledge base;

[0112] If the correlation difference between the first actual correlation and the second actual correlation is greater than or equal to a correlation threshold, taking the first candidate knowledge base as the target knowledge base;

[0113] The first candidate knowledge base is at least one candidate knowledge base having the greatest actual correlation with the current feature vector, and the second candidate knowledge base is any candidate knowledge base except the first candidate knowledge base.

[0114] Optionally, the device further includes a correlation comparison module, which is specifically used to:

[0115] If the correlation difference between the first actual correlation and the second actual correlation is smaller than the correlation threshold, the first candidate knowledge base and the second candidate knowledge base are used as the target knowledge base.

[0116] The information query device provided by the embodiment of the present invention can execute the information query method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0117] Embodiment 6

[0118] Figure 6 A schematic diagram of the structure of an electronic device 60 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0119] like Figure 6 As shown, the electronic device 60 includes at least one processor 61, and a memory connected to the at least one processor 61, such as a read-only memory (ROM) 62, a random access memory (RAM) 63, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 61 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 62 or the computer program loaded from the storage unit 68 to the random access memory (RAM) 63. In the RAM 63, various programs and data required for the operation of the electronic device 60 can also be stored. The processor 61, the ROM 62, and the RAM 63 are connected to each other via a bus 64. An input / output (I / O) interface 65 is also connected to the bus 64.

[0120] A number of components in the electronic device 60 are connected to the I / O interface 65, including: an input unit 66, such as a keyboard, a mouse, etc.; an output unit 67, such as various types of displays, speakers, etc.; a storage unit 68, such as a disk, an optical disk, etc.; and a communication unit 69, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 69 allows the electronic device 60 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0121] The processor 61 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 61 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 61 performs the various methods and processes described above, such as a model training method and / or an information query method.

[0122] In some embodiments, the model training method and / or the information query method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 68. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 60 via the ROM 62 and / or the communication unit 69. When the computer program is loaded into the RAM 63 and executed by the processor 61, one or more steps of the model training method and / or the information query method described above may be performed. Alternatively, in other embodiments, the processor 61 may be configured to execute the model training method and / or the information query method in any other appropriate manner (e.g., by means of firmware).

[0123] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0124] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0125] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer 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 foregoing.

[0126] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0127] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0128] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0129] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0130] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A model training method, characterized in that: include: Obtaining a sample feature vector corresponding to the sample query sentence, and inputting the sample feature vector into the model to be trained; Determining the prediction correlation between the sample feature vector and each candidate knowledge base using the model to be trained, and training the model to be trained to generate a knowledge base prediction model based on the prediction correlation and the standard correlation between the sample feature vector and each candidate knowledge base; The knowledge base prediction model is used to predict a related target knowledge base according to the user's current query statement, and the target knowledge base is used to perform information query according to the current query statement.

2. The method according to claim 1, characterized in that The step of using the model to be trained to determine the prediction correlation between the sample feature vector and each candidate knowledge base includes: Determine a knowledge base feature vector corresponding to any of the candidate knowledge bases using the model to be trained; The model to be trained is used to determine the feature vector correlation between the sample feature vector and the knowledge base feature vector, and the predicted correlation between the sample feature vector and the candidate knowledge base is predicted based on the feature vector correlation.

3. The method according to claim 2, characterized in that The step of using the model to be trained to determine a knowledge base feature vector corresponding to any of the candidate knowledge bases includes: The model to be trained is used to extract any knowledge document from the candidate knowledge base, and the knowledge base feature vector corresponding to the candidate knowledge base is determined according to the document feature vector corresponding to the knowledge document.

4. The method according to claim 2, characterized in that: The step of using the model to be trained to determine a knowledge base feature vector corresponding to any of the candidate knowledge bases includes: The model to be trained is used to determine each knowledge document included in the candidate knowledge base, and the knowledge base feature vector corresponding to the candidate knowledge base is determined based on the document feature mean vector corresponding to each knowledge document.

5. The method according to claim 1, characterized in that The step of training the model to be trained to generate a knowledge base prediction model based on the prediction correlation and the standard correlation between the sample feature vector and each candidate knowledge base includes: Taking the predicted correlation between the sample feature vector and any of the candidate knowledge bases as a first correlation, and taking the standard correlation between the sample feature vector and the candidate knowledge base as a second correlation; Determine a target loss value according to the first correlation and the second correlation using a target loss function, and determine a target gradient value of the target loss function with respect to a model parameter of the model to be trained according to the target loss value; The model parameters are updated according to the target gradient value.

6. An information query method, characterized in that: include: Obtaining a current feature vector corresponding to a current query statement of a user, and inputting the current feature vector into a knowledge base prediction model; wherein the knowledge base prediction model is trained using the model training method as described in any one of claims 1 to 5; According to the actual correlation between the current feature vector output by the knowledge base prediction model and each candidate knowledge base, a target knowledge base related to the current query statement is determined, and information query is performed in the target knowledge base according to the current query statement.

7. The method according to claim 6, characterized in that The step of determining a target knowledge base related to the current query statement according to the actual correlation between the current feature vector output by the knowledge base prediction model and each candidate knowledge base comprises: determining a first actual correlation between the current feature vector and a first candidate knowledge base, and a second actual correlation between the current feature vector and a second candidate knowledge base; If the correlation difference between the first actual correlation and the second actual correlation is greater than or equal to a correlation threshold, taking the first candidate knowledge base as the target knowledge base; The first candidate knowledge base is at least one candidate knowledge base having the greatest actual correlation with the current feature vector, and the second candidate knowledge base is any candidate knowledge base except the first candidate knowledge base.

8. The method according to claim 7, after determining a first actual correlation between the current feature vector and the first candidate knowledge base, and a second actual correlation between the current feature vector and the second candidate knowledge base, further comprising: If the correlation difference between the first actual correlation and the second actual correlation is smaller than the correlation threshold, the first candidate knowledge base and the second candidate knowledge base are used as the target knowledge base.

9. A model training device, characterized in that: include: A sample feature vector acquisition module is used to acquire a sample feature vector corresponding to a sample query sentence and input the sample feature vector into a model to be trained; A model training module, used to determine the prediction correlation between the sample feature vector and each candidate knowledge base using the model to be trained, and train the model to be trained to generate a knowledge base prediction model based on the prediction correlation and the standard correlation between the sample feature vector and each candidate knowledge base; The knowledge base prediction model is used to predict a related target knowledge base according to the user's current query statement, and the target knowledge base is used to perform information query according to the current query statement.

10. An information query device, characterized in that: include: A current feature vector acquisition module, used to acquire a current feature vector corresponding to a current query statement of a user, and input the current feature vector into a knowledge base prediction model; wherein the knowledge base prediction model is trained using the model training method as described in any one of claims 1 to 5; The target knowledge base determination module is used to determine the target knowledge base related to the current query statement based on the actual correlation between the current feature vector output by the knowledge base prediction model and each candidate knowledge base, and perform information query in the target knowledge base based on the current query statement.

11. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the model training method according to any one of claims 1-5, and / or implement the information query method according to any one of claims 6-8.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to execute the model training method according to any one of claims 1-5, and / or to implement the information query method according to any one of claims 6-8.

13. A computer program product, comprising a computer program, which, when executed by a processor, implements the model training method according to any one of claims 1-5, and / or implements the information query method according to any one of claims 6-8.