Data query method and device and electronic equipment

By establishing graph models and databases outside the external knowledge base, we update knowledge in real time to assist big models in answering questions, solving the search problems caused by untimely update of external knowledge bases in RAG technology, and improving the quality of answers to unpopular topics and brand new questions .

CN119248969APending Publication Date: 2025-01-03LENOVO (BEIJING) LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411205308.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

When using search-enhanced generation (RAG) technology, the timely update of external knowledge bases results in unsatisfactory search results for unpopular topics or new questions, and it is difficult for big models to provide accurate answers.

Method used

By establishing a graph model and a database corresponding to the graph model outside the external knowledge base, updating the knowledge in real time, and determining the relevant knowledge of the information to be queried based on the latest graph model, and sending it to the big model to assist in answering questions.

Benefits of technology

It improves the quality of answers to unpopular topics and new questions by the big model, improves the user experience, and ensures supplement and accuracy of unupdated knowledge.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248969A_ABST
    Figure CN119248969A_ABST
Patent Text Reader

Abstract

The invention discloses a data query method and device and electronic equipment. The method comprises the steps that to-be-queried information input by a user is acquired; identifying a target entity in the to-be-queried information; determining the importance degree of the target entity in each entity category in the first graph model at the t-th moment; wherein the first graph model at the t moment is obtained by updating the first graph model at the (t-1) moment according to a second graph model, and the second graph model is constructed according to knowledge not included in a database corresponding to the first graph model at the (t-1) moment; based on the importance degree, obtaining first knowledge corresponding to the target entity from a database corresponding to the first graph model at the t-th moment; and sending the to-be-queried information and the first knowledge to the large model, so that the large model determines reply information corresponding to the to-be-queried information based on the first knowledge.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of knowledge retrieval technology, and in particular to a data query method, device and electronic equipment. Background Art

[0002] At present, when searching based on Retrieval-Augmented Generation (RAG) technology, external knowledge bases can be referenced. However, for searches of unpopular topics or new questions, external knowledge bases may not have relevant knowledge or the relevant knowledge may be scarce due to untimely updates, resulting in unsatisfactory search results. Summary of the invention

[0003] In view of this, embodiments of the present application provide a data query method, device, and electronic device.

[0004] According to the first aspect of the present application, an embodiment of the present application provides a data query method, including:

[0005] Get the information to be queried input by the user;

[0006] Identify the target entity in the information to be queried;

[0007] Determine the importance of the target entity in each entity category in the first graph model at time t; wherein the first graph model at time t is obtained by updating the first graph model at time t-1 according to the second graph model, and the second graph model is constructed according to the knowledge not included in the database corresponding to the first graph model at time t-1;

[0008] Based on the importance, obtain the first knowledge corresponding to the target entity from the database corresponding to the first graph model at time t;

[0009] The information to be queried and the first knowledge are sent to the big model, so that the big model determines the reply information corresponding to the information to be queried based on the first knowledge.

[0010] Optionally, determining the importance of the target entity in each entity category in the first graph model at time t includes:

[0011] Determine each target entity category corresponding to the target entity in the first graph model at time t;

[0012] Based on the correspondence between the entity, entity category and importance at the tth moment, the importance of the target entity in each target entity category is determined.

[0013] Optionally, the steps of constructing the corresponding relationship between the entity, entity category, and importance at the t-th moment include:

[0014] Get training data;

[0015] Identify training entities in training data;

[0016] Based on the entropy change of each entity under each entity category when the first graph model at time t-1 is updated to the first graph model at time t, and the retrieval weight of each entity in the first graph model at time t, determine the entropy change and retrieval weight of each entity category of the training entity in the first graph model at time t;

[0017] Based on the training entity, obtaining a first preset amount of training knowledge from a database corresponding to the first graph model at time t;

[0018] Based on the training data, the entropy change amount and retrieval weight of each entity category in the first graph model of the training entity at the t moment, as well as the training knowledge, the large model is trained to determine the optimization function, and the optimization function includes the importance of each entity under each entity category in the first graph model at the t moment;

[0019] Based on the optimization function, the corresponding relationship between entities, entity categories and importance at the tth moment is determined.

[0020] Optionally, based on the importance, obtaining first knowledge corresponding to the target entity from a database corresponding to the first graph model at the t-th moment includes:

[0021] Based on the importance, determine the knowledge acquisition ratio of each entity category corresponding to the first graph model of the target entity at time t;

[0022] According to the knowledge acquisition ratio, a second preset amount of first knowledge corresponding to the target entity is acquired from the database corresponding to the first graph model at the tth moment.

[0023] Optionally, the steps of constructing the second graph model include:

[0024] Acquire the knowledge not included in the database corresponding to the first graph model at time t-1;

[0025] Determine each entity in the excluded knowledge and the entity category to which each entity corresponds;

[0026] Based on each entity in the excluded knowledge and the entity category corresponding to each entity, graph models corresponding to different entity categories are constructed respectively to obtain a second graph model.

[0027] Optionally, the step of constructing the first graph model at time t-1 includes:

[0028] Acquire the second knowledge in the knowledge base;

[0029] Determine a plurality of entities in the second knowledge and corresponding entity categories;

[0030] Based on multiple entities and corresponding entity categories, a first graph model at time t-1 is constructed.

[0031] Optionally, the step of constructing the first graph model at time t includes:

[0032] Determine entities under each entity category in the second graph model;

[0033] The entities under each entity category are merged into the corresponding entity category in the first graph model at time t-1 to obtain the first graph model at time t.

[0034] Optionally, the data query method further includes:

[0035] Determine the entropy of each entity under each entity category in the first graph model at time t-1 based on the association relationship between each entity and the entity category in the first graph model at time t-1;

[0036] Determine the entropy and retrieval weight of each entity under each entity category in the first graph model at time t based on the association relationship between each entity and the entity category in the first graph model at time t;

[0037] Based on the entropy of each entity under each entity category in the first graph model at time t-1 and the entropy of each entity under each entity category in the first graph model at time t, the entropy change of each entity under each entity category in the first graph model at time t is determined.

[0038] According to the second aspect of the present application, an embodiment of the present application provides a data query device, including:

[0039] The first acquisition module is used to acquire the information to be queried input by the user;

[0040] An identification module, used to identify the target entity in the information to be queried;

[0041] A determination module, used to determine the importance of the target entity in each entity category in the first graph model at time t; wherein the first graph model at time t is obtained by updating the first graph model at time t-1 according to the second graph model, and the second graph model is constructed according to the knowledge not included in the database corresponding to the first graph model at time t-1;

[0042] A second acquisition module is used to acquire first knowledge corresponding to the target entity from a database corresponding to the first graph model at time t based on the importance;

[0043] The sending module is used to send the information to be queried and the first knowledge to the big model, so that the big model determines the reply information corresponding to the information to be queried based on the first knowledge.

[0044] According to a third aspect of the present application, an embodiment of the present application provides an electronic device, including:

[0045] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the data query method as in the first aspect or any embodiment of the first aspect.

[0046] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 A flowchart of a data query method in an embodiment of the present application;

[0048] Figure 2 This is a flow chart of another data query method in an embodiment of the present application;

[0049] Figure 3 A schematic diagram of a construction process of a correspondence between entities, entity categories, and importance levels at time t in an embodiment of the present application;

[0050] Figure 4 This is a structural diagram of a data query device in an embodiment of the present application;

[0051] Figure 5 This is a schematic diagram of the hardware structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0052] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution 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. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of this application.

[0053] At present, due to the problems of sensitive content security, difficulty in memorizing long-tail questions, high training and computing costs, and low update frequency in large models, the industry has proposed a large model technology combined with text retrieval technology, namely RAG technology. When generating reply information with RAG technology, the large model can refer to the knowledge of the external knowledge base. In this way, even if the large model does not have certain information during training, it can generate more accurate and rich answers through the knowledge of the external knowledge base when generating reply information, while maintaining flexibility, configurability and security.

[0054] Although the quality of the big model's responses to relevant search content can be improved through external knowledge bases, when encountering new questions or questions on unpopular topics, the external knowledge base may not be updated in a timely manner, resulting in the fact that the truly directly relevant external knowledge does not exist in the external knowledge base or is relatively scarce, resulting in most of the content retrieved from the external knowledge base being irrelevant to the question or containing a lot of confusing information. After synchronizing it to the big model as additional context, it is likely to increase the difficulty of the big model in responding to the question or make it completely unable to answer the question.

[0055] To this end, the embodiment of the present application performs graph modeling on the knowledge that has not been updated into the external knowledge base, extracts the relationships in the knowledge, forms a graph model, and stores the knowledge in the database corresponding to the graph model. Thus, when encountering new questions or questions on unpopular topics, the large model can use the knowledge in the database corresponding to the graph model in addition to the knowledge in the external knowledge base.

[0056] The present application embodiment provides a data query method, such as Figure 1 As shown, including:

[0057] S101, obtaining the information to be queried input by the user.

[0058] In this embodiment, the user can obtain reply information corresponding to the information to be queried by inputting the information to be queried.

[0059] S102, identifying the target entity in the information to be queried.

[0060] In this embodiment, after the information to be queried input by the user is obtained, the target entity in the information to be queried can be identified through the corpus segmentation model.

[0061] In some embodiments, each entity in the information to be queried may be identified to obtain a target entity in the information to be queried.

[0062] In some embodiments, some entities in the information to be queried may be identified to obtain target entities in the information to be queried.

[0063] In this embodiment, the entity may be an object specifically included in the information to be queried, and the object may have the meaning of essence, specific thing, individual subject, supporter of phenomenon, etc. For example, the information to be queried is: how is the weather today; the entity may include: today, weather.

[0064] It should be noted that the corpus segmentation model can be a currently common corpus segmentation model, or it can be obtained by training a deep neural network based on training data of actual application scenarios.

[0065] S103, determining the importance of the target entity in each entity category in the first graph model at time t; wherein the first graph model at time t is obtained by updating the first graph model at time t-1 according to the second graph model, and the second graph model is constructed according to the knowledge not included in the database corresponding to the first graph model at time t-1.

[0066] In this embodiment, the entity category represents the attribute of the entity. For example, the entity category corresponding to the entity "today" is "date"; the entity category corresponding to the entity "weather" may include "environment", "atmosphere" and so on.

[0067] In this embodiment, the first graph model and the database corresponding to the first graph model are updated in real time. The knowledge not included in the database corresponding to the first graph model at time t-1 is new knowledge, which has not yet been updated to the database corresponding to the first graph model at time t-1, nor has it been updated to the external knowledge base. When the first graph model at time t-1 is updated according to the second graph model, it is also necessary to update the database corresponding to the first graph model at time t-1 according to the new knowledge corresponding to the second graph model, so as to obtain the database corresponding to the first graph model at time t.

[0068] In this embodiment, the first graph model may include multiple entity categories, entities corresponding to each entity category, and weights of edges between entities and between entities and entity categories. The weight representation of the edge between entities includes the number of times the knowledge of the two entities appears in all the knowledge of the database corresponding to the first graph model, and the weight representation of the edge between an entity and an entity category includes the number of times the knowledge of the entity and the entity category appears in all the knowledge of the database corresponding to the first graph model.

[0069] In this embodiment, the importance of the target entity in each entity category in the first graph model at time t is used to characterize the retrieval weight of the target entity under each entity category in the first graph model at time t, or the weight of the edge between the entity and the entity category, or the entropy change of the target entity under each entity category when the first graph model at time t-1 is updated to the first graph model at time t, or the importance score of a combination thereof.

[0070] Among them, the search weight can be calculated based on the following formula:

[0071]

[0072] DI n is the retrieval weight of entity n, W j is the total weight of the edge of entity j, M is the total number of entities, W n is the total weight of the edges of entity n.

[0073] The entropy change of the target entity under each entity category when the first graph model at time t-1 is updated to the first graph model at time t can be calculated based on the following formula:

[0074]

[0075] ΔH(n) is the entropy change of entity n under a certain entity category; H(n new ) is the entropy of entity n under a certain entity category in the first graph model at time t; H(n) is the entropy of entity n under a certain entity category in the first graph model at time t-1; w i is the weight of the edge between entity n and its i-th node; C is the degree of the node; W n is the total weight of the edges of entity n. If entity n appears for the first time in the first graph model at time t, then ΔH(n) is 1.

[0076] In this embodiment, based on the first graph model at time t, the importance of the target entity in each entity category in the first graph model at time t can be determined. For example, by determining the weight between the target entity and each entity category in the first graph model at time t, the importance of the target entity in each entity category in the first graph model at time t is determined.

[0077] In this embodiment, the first graph model at time t represents the latest graph model, that is, the graph model at the current time. The first graph model at time t-1 represents the graph model before the graph model at the current time is updated.

[0078] In this embodiment, between time t-1 and time t, new knowledge, that is, knowledge not included in the database corresponding to the first graph model at time t-1, will appear on the network, so that a second graph model can be constructed based on the knowledge not included in the database corresponding to the first graph model at time t-1, and then the first graph model at time t-1 is updated based on the second graph model to obtain the first graph model at time t; and the knowledge not included in the database corresponding to the first graph model at time t-1 is incorporated into the database corresponding to the first graph model at time t-1 to obtain the database corresponding to the first graph model at time t.

[0079] In some embodiments, each time new knowledge is acquired, that is, each time knowledge not included in the database corresponding to the first graph model at time t-1 is acquired, the first graph model at time t-1 is updated to obtain the first graph model at time t.

[0080] In some embodiments, when multiple new knowledge is acquired or according to a preset time period, the first graph model at time t-1 can be updated to obtain the first graph model at time t.

[0081] S104: Based on the importance, obtain the first knowledge corresponding to the target entity from the database corresponding to the first graph model at the tth moment.

[0082] In this embodiment, after determining the importance of the target entity in each entity category in the first graph model at the t moment, the acquisition ratio or the amount of knowledge acquisition of the target entity-related knowledge under each entity category can be determined according to the importance, or the entity categories under which the relevant knowledge of the target entity is acquired can be determined according to the importance, and then accordingly, the first knowledge corresponding to the target entity is acquired from the database corresponding to the first graph model at the t moment.

[0083] S105, sending the information to be queried and the first knowledge to the big model, so that the big model determines the reply information corresponding to the information to be queried based on the first knowledge.

[0084] In this embodiment, after obtaining the first knowledge, the information to be queried and the first knowledge can be sent to the big model. Of course, the knowledge corresponding to the information to be queried can also be obtained from the external knowledge base, and the big model can determine the answer information corresponding to the information to be queried based on the first knowledge and the knowledge obtained from the external knowledge base.

[0085] By implementing the solution of the embodiment of the present application, high-quality reply information can be obtained. For example:

[0086] Question 1: What is the configuration of the 2026 model of Brand A’s A series?

[0087] The identified target entities include: brand A, a series, 2026 models, and configuration. Through the identified target entities, the first knowledge obtained from the database corresponding to the first graph model at time t includes: brand A is divided into a series and b series according to different processors; brand A is classified into mainstream positioning products and high-end positioning products according to product level; products of the same level are further divided into gaming notebooks, office notebooks, and thin and light notebooks according to product types.

[0088] After inputting the first knowledge into the big model, the high-quality reply information 1 obtained is: Sorry, I can't provide exact information about the configuration of the 2026 model of the A series of brand A, because the specific configuration information of this product has not been announced yet. But based on past product lines, we can expect that the A series of brand A will continue to attract users with excellent performance and balanced overall configuration. In addition, the A series of brand A can be divided into A series and B series according to different processors, and they are all classified as mainstream positioning products and high-end positioning products according to product levels. Products of the same level are further divided into gaming notebooks, office notebooks, and thin and light notebooks according to product types. Therefore, we may see the 2026 models of the A series of brand A continue these traditions, but the final details will depend on the company's future release plans.

[0089] Question 2: Brand A's notebooks in 2026 support the 16th generation smart processor. The 2026 model of Brand A's A series is in the same series as the 2023 model of Brand A's A series and the 2024 model of Brand A's A series. What is the configuration of the 2026 model of Brand A's A series?

[0090] The identified target entities include: brand A, a series, 2026 model, notebook, processor, configuration, 2023 model, 2024 model. Through the identified target entities, the first knowledge obtained from the database corresponding to the first graph model at the tth time includes: the 2026 model of the a series of brand A is equipped with the 16th generation intelligent processor; the 2026 model of the a series of brand A is equipped with a large-capacity solid-state drive; the 2026 model of the a series of brand A uses a new forged carbon fiber A surface, which not only makes the body thinner, but also enhances durability; compared with the 2023 model of the a series of brand A, the core advantage of the 2026 model of the a series of brand A lies in more efficient power consumption management and stronger performance output.

[0091] After inputting the first knowledge into the big model, the high-quality answer information 2 obtained is: Your information is basically correct. The following is the specific configuration of the 2026 model of the A series of brand A:

[0092] It is equipped with the 16th generation intelligent processor; in order to ensure sufficient storage space and fast data reading and writing, the notebook is equipped with a large-capacity solid-state drive; in addition, the new brand A's a series continues to optimize product design, such as the new forged carbon fiber A-side, which not only makes the body thinner and lighter, but also enhances durability. At the same time, the entire series of brand A supports direct connection to independent graphics cards, and can switch between independent graphics card direct connection / hybrid mode / pure integrated graphics mode without restarting. Although the new configuration is very powerful, compared with the 2023 model of brand A's a series, its core advantage lies in more efficient power consumption management and stronger performance output.

[0093] The data query method provided in the embodiment of the present application establishes a graph model and a database corresponding to the graph model outside the external knowledge base, and updates the graph model and the corresponding database in real time based on the real-time updated knowledge, and determines the first knowledge corresponding to the information to be queried based on the latest graph model, and sends it to the big model. It can supplement the knowledge that has not been retrieved from the external knowledge base and the knowledge that has not been updated, so as to make full use of the existing knowledge to assist the big model in answering questions, thereby improving the quality of the big model's answers to questions and enhancing the user experience.

[0094] In an optional embodiment, step S103 determines the importance of the target entity in each entity category in the first graph model at time t, such as Figure 2 As shown, including:

[0095] S1031, determining each target entity category corresponding to the target entity in the first graph model at time t.

[0096] S1032, determining the importance of the target entity in each target entity category based on the correspondence between the entity, entity category and importance at the tth moment.

[0097] Regarding S1031, in this embodiment, since the first graph model at the tth moment includes multiple entity categories, the entities corresponding to each entity category, and the weights of the edges between entities and between entities and entity categories, based on the weights of the edges between entities and entity categories in the first graph model at the tth moment, the target entity categories corresponding to each target entity can be determined from the first graph model at the tth moment.

[0098] For S1032, after the first graph model at the tth moment is formed, the corresponding relationship between the entity, entity category and importance at the tth moment can be constructed based on the first graph model at the tth moment. Then, based on the corresponding relationship between the entity, entity category and importance at the tth moment, the importance of the target entity under each target entity category is determined.

[0099] In this embodiment, by constructing the correspondence between entities, entity categories and importance at the tth moment, it is possible to quickly find the importance of the target entity in each entity category in the first graph model at the tth moment by determining the target entity categories corresponding to the target entity in the first graph model at the tth moment.

[0100] In an optional embodiment, in step S1032, the step of constructing the corresponding relationship between the entity, entity category, and importance at the tth moment includes:

[0101] Acquire training data; identify training entities in the training data; determine the entropy change and retrieval weight of each entity category of the training entity in the first graph model at time t based on the entropy change of each entity under each entity category when the first graph model at time t-1 is updated to the first graph model at time t, and the retrieval weight of each entity in the first graph model at time t; based on the training entity, acquire a first preset amount of training knowledge from a database corresponding to the first graph model at time t; based on the training data, the entropy change and retrieval weight of each entity category of the training entity in the first graph model at time t, and the training knowledge, train the large model, and determine the optimization function, the optimization function including the importance of each entity under each entity category in the first graph model at time t; based on the optimization function, determine the correspondence between the entity, entity category and importance at time t.

[0102] In this embodiment, the optimization function f(X)=WX T +b; where the row vector of the nth row of the X matrix Entity is the entity, Class is the entity category, DI n is the retrieval weight corresponding to the entity, ΔH(n) is the entropy change of the entity; b is the bias term related to the result of combining the external knowledge base retrieval and the large model; W is The importance score corresponding to each dimension, that is, the degree of importance. After determining the first graph model at time t, the large model is trained based on the training data to optimize the optimization function and obtain the optimized matrix W, so that the corresponding relationship between the entity, entity category and importance at time t can be obtained.

[0103] In this embodiment, the entropy of each entity under each entity category in the first graph model at time t-1 and the first graph model at time t, as well as the retrieval weight can be calculated respectively; then, based on the entropy of each entity under each entity category in the first graph model at time t-1 and the first graph model at time t, the entropy change of each entity under each entity category when the first graph model at time t-1 is updated to the first graph model at time t is calculated.

[0104] Then prepare some training data, set the number of retrieval related items to K, and optimize the function f(X) = WX T+b, and then process the training data through the corpus segmentation model to identify the training entities in the training data. Combined with the first graph model at time t, the entropy change and retrieval weight of the training entity under each entity category in the first graph model at time t can be determined. Then, the training knowledge related to the training entity and the number K can be retrieved from the database corresponding to the first graph model at time t. Then the knowledge related to the training entity is retrieved through the external knowledge base. The training data, the entropy change and retrieval weight of each entity category in the first graph model of the training entity at time t, and the training knowledge are processed by the large model to determine the reply information corresponding to the training data. Then mark whether the training knowledge and the externally retrieved knowledge meet the answer requirements. Through continuous training, the optimization function is optimized and solved to obtain the optimized matrix W, so that the corresponding relationship between the entity, entity category and importance at time t can be obtained.

[0105] In the specific implementation, the first graph model at time t-1 is constructed based on the second knowledge of the external knowledge base, and time t is the time when the latest document that has not been updated to the external knowledge base is obtained as an example. Figure 3 As shown, based on the second knowledge of the external knowledge base, entity recognition and entity category recognition can be performed through the corpus segmentation model to obtain the first graph model at time t-1, where the entropy of entities under each entity category is calculated as: Among them, n is the entity node, C is the degree of the node, and w i is the weight of the edge between n and its i-th node, W n is the total weight of the edge of n. The retrieval weight of entity n is: Among them, j represents any entity in the graph, W j is the total weight of the edge of entity j, and M is the total number of entities. Then the entity and the cut corpus are associated, and the cut corpus is vectorized and stored in the database.

[0106] When there is new corpus, such as the latest document input, the same corpus segmentation model can be used to perform entity recognition and entity category recognition, and build second graph models of different entity categories. Then merge them into the existing categories of the first graph model at time t-1 to obtain the first graph model at time t. Then calculate the new entity entropy H(n new ), and calculate the change in entropy of entity n At the same time, the retrieval weight DI of each entity is updated and calculated.

[0107] Then prepare some training data, set the number of retrieval related items to K, and optimize the function f(X) = WX T+b, and combine the training data with the first graph model at time t to obtain similar segmented corpus, and then through relevant knowledge base retrieval and large model verification, judge whether it meets the answer requirements. Optimize the optimization function to obtain the optimized matrix W, so that the corresponding relationship between entities, entity categories and importance at time t can be obtained.

[0108] In this embodiment, by optimizing the optimization function in real time, the optimal correspondence between entities, entity categories and importance can be obtained in real time; and the importance is related to the change in entropy of the entity and the retrieval weight of the entity, so when the first knowledge is acquired based on the importance, the accuracy of new knowledge retrieval can be improved.

[0109] In an optional embodiment, step S104, based on the importance, obtaining first knowledge corresponding to the target entity from a database corresponding to the first graph model at the tth moment includes:

[0110] Based on the importance, determine the knowledge acquisition ratio of the target entity under each entity category corresponding to the first graph model at the t moment; according to the knowledge acquisition ratio, obtain a second preset amount of first knowledge corresponding to the target entity from the database corresponding to the first graph model at the t moment.

[0111] In specific implementation, after determining the importance of each entity category in the first graph model at time t, the knowledge acquisition ratio of each entity category corresponding to the first graph model of the target entity at time t can be calculated. The calculation formula can be: w ei is the importance of an entity under this entity category, The sum of the importance of all entities under this entity category. Then, the corpus associated with the corresponding entity is obtained according to the corresponding knowledge acquisition ratio, that is, the first knowledge. The number of associated corpora is the second preset number.

[0112] In this embodiment, based on the importance, the knowledge acquisition ratio under each entity category corresponding to the first graph model of the target entity at the t moment is determined, and then according to the knowledge acquisition ratio, a second preset amount of first knowledge corresponding to the target entity is obtained from the database corresponding to the first graph model at the t moment, so that more important knowledge, such as new knowledge and unpopular knowledge, can be obtained, thereby increasing the probability of unpopular knowledge and new knowledge appearing in the retrieval results, and improving the accuracy and richness of the large model's answers to new or unpopular questions.

[0113] In an optional embodiment, the step of constructing the second graph model includes:

[0114] Obtain the knowledge not included in the database corresponding to the first graph model at time t-1; determine each entity in the excluded knowledge and the entity category corresponding to each entity; based on each entity in the excluded knowledge and the entity category corresponding to each entity, respectively construct graph models corresponding to different entity categories to obtain a second graph model.

[0115] In this embodiment, when knowledge not included in the database corresponding to the first graph model at time t-1 is obtained, for example, when new corpus is input, the corpus segmentation model can be used to perform entity recognition and entity category recognition on the knowledge not included in the database corresponding to the first graph model at time t-1, and then respectively construct graph models of different entity categories.

[0116] In this embodiment, entity recognition and entity category recognition are performed on the knowledge not included in the database corresponding to the first graph model at the t-1 moment, and graph models corresponding to different entity categories are constructed, so that the first graph model at the t-1 moment can be quickly and accurately updated based on the constructed second graph model.

[0117] In an optional embodiment, the step of constructing the first graph model at time t-1 includes:

[0118] Acquire second knowledge in the knowledge base; determine multiple entities and corresponding entity categories in the second knowledge; and construct a first graph model at time t-1 based on the multiple entities and corresponding entity categories.

[0119] In this embodiment, the first graph model at time t-1 is constructed based on the second knowledge of the external knowledge base. If t=1, entity recognition and entity category recognition can be performed based on the second knowledge of the external knowledge base through the corpus segmentation model, and then a version of entity undirected graph models of different entity categories are initialized based on the entities and entity categories to obtain the first graph model at time 0. If t>1, for example t=2, after there is new corpus, such as the latest document input, entity recognition and entity category recognition are performed through the same corpus segmentation model to construct second graph models of different entity categories respectively. Then it is incorporated into the existing category of the first graph model at time 0 to obtain the first graph model at time t-1, that is, the first graph model at time 1. For the case of t>2, the first graph model can be updated according to the update steps at t=2 to obtain the first graph model at time t-1;

[0120] In this embodiment, based on the second knowledge in the knowledge base, a first graph model at time t-1 is constructed, and a graph model with diverse entity categories can be obtained.

[0121] In an optional embodiment, the step of constructing the first graph model at time t includes:

[0122] Determine the entities under each entity category in the second graph model; merge the entities under each entity category into the corresponding entity category in the first graph model at time t-1 to obtain the first graph model at time t.

[0123] In this embodiment, by incorporating entities under each entity category in the second graph model into the corresponding entity category in the first graph model at time t-1, it is possible to update the first graph model at time t-1 in a relatively simple manner to obtain the first graph model at time t.

[0124] In some embodiments, after the construction of the first graph model at time t-1, the entropy of each entity under each entity category in the first graph model at time t-1 can also be determined based on each entity in the first graph model at time t-1 and the association relationship between the entity and the entity category. After the construction of the first graph model at time t, the entropy and retrieval weight of each entity under each entity category in the first graph model at time t can also be determined based on each entity in the first graph model at time t and the association relationship between the entity and the entity category; then, based on the entropy of each entity under each entity category in the first graph model at time t-1 and the entropy of each entity under each entity category in the first graph model at time t, the entropy change of each entity under each entity category in the first graph model at time t is determined.

[0125] In specific implementation, the entropy calculation formula of entities under each entity category is: Among them, n is the entity node, C is the degree of the node, and w i is the weight of the edge between n and its i-th node, that is, the association relationship between entity n and entity i or entity category i; W n is the total weight of the edge of n. The retrieval weight calculation formula of entity n is: Among them, j represents any entity in the graph, W j is the total weight of the edges of entity j, and M is the total number of entities.

[0126] In this way, it is convenient to determine the correspondence between entities, entity categories and importance at the t moment based on the entropy change of each entity under each entity category when the first graph model at the t-1 moment is updated to the first graph model at the t moment, and the retrieval weight of each entity in the first graph model at the t moment.

[0127] The present application embodiment provides a data query device, such as Figure 4 As shown, including:

[0128] The first acquisition module 41 is used to acquire the information to be queried input by the user.

[0129] The identification module 42 is used to identify the target entity in the information to be queried.

[0130] Determination module 43 is used to determine the importance of the target entity in each entity category in the first graph model at time t; wherein the first graph model at time t is obtained by updating the first graph model at time t-1 according to the second graph model, and the second graph model is constructed according to the knowledge not included in the database corresponding to the first graph model at time t-1.

[0131] The second acquisition module 44 is used to acquire the first knowledge corresponding to the target entity from the database corresponding to the first graph model at the tth moment based on the importance.

[0132] The sending module 45 is used to send the information to be queried and the first knowledge to the big model, so that the big model determines the reply information corresponding to the information to be queried based on the first knowledge.

[0133] The data query device provided in the embodiment of the present application establishes a graph model and a database corresponding to the graph model outside the external knowledge base, and updates the graph model and the corresponding database in real time based on the real-time updated knowledge, and determines the first knowledge corresponding to the information to be queried based on the latest graph model, and sends it to the big model. It can supplement the knowledge that has not been retrieved from the external knowledge base and the knowledge that has not been updated, so as to make full use of the existing knowledge to assist the big model in answering questions, thereby improving the quality of the big model's answers to questions and enhancing the user experience.

[0134] According to an embodiment of the present application, the present application also provides an electronic device and a readable storage medium.

[0135] Figure 5 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, 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, 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 application described and / or required herein.

[0136] like Figure 5As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0137] Multiple components in the electronic device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the electronic device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0138] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as a data query method. For example, in some embodiments, the data query method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the data query method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the data query method in any other appropriate manner (e.g., by means of firmware).

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

[0140] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code can 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.

[0141] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. 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.

[0142] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer 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 pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0143] The systems and techniques described herein may be implemented in a computing system that includes back-end 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 front-end 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 back-end components, middleware components, or front-end 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), and the Internet.

[0144] A computer 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 relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0145] 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 recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.

[0146] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0147] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A data query method, comprising: Get the information to be queried input by the user; Identifying a target entity in the information to be queried; Determine the importance of the target entity in each entity category in the first graph model at time t; wherein the first graph model at time t is obtained by updating the first graph model at time t-1 according to the second graph model, and the second graph model is constructed according to the knowledge not included in the database corresponding to the first graph model at time t-1; Based on the importance, acquiring first knowledge corresponding to the target entity from a database corresponding to the first graph model at the time t; The information to be queried and the first knowledge are sent to the big model, so that the big model determines the reply information corresponding to the information to be queried based on the first knowledge.

2. The data query method according to claim 1, determining the importance of the target entity in each entity category in the first graph model at time t, comprising: Determine each target entity category corresponding to the target entity in the first graph model at time t; Based on the corresponding relationship between the entity, entity category and importance at the tth moment, the importance of the target entity in each target entity category is determined.

3. According to the data query method of claim 2, the step of constructing the corresponding relationship between the entity, entity category and importance at the t-th moment comprises: Get training data; identifying training entities in the training data; Determine the entropy change and retrieval weight of each entity category in the first graph model of the training entity at time t based on the entropy change of each entity under each entity category when the first graph model at time t-1 is updated to the first graph model at time t, and the retrieval weight of each entity in the first graph model at time t; Based on the training entity, acquiring a first preset amount of training knowledge from a database corresponding to the first graph model at the time t; Based on the training data, the entropy change amount and retrieval weight of each entity category in the first graph model of the training entity at the t moment, and the training knowledge, the large model is trained to determine the optimization function, wherein the optimization function includes the importance of each entity under each entity category in the first graph model at the t moment; Based on the optimization function, the corresponding relationship between the entity, entity category and importance at the tth moment is determined.

4. The data query method according to claim 1, based on the importance, acquiring the first knowledge corresponding to the target entity from the database corresponding to the first graph model at the t-th time, comprising: Based on the importance, determining the knowledge acquisition ratio of the target entity under each entity category corresponding to the first graph model at the tth time; According to the knowledge acquisition ratio, a second preset amount of first knowledge corresponding to the target entity is acquired from the database corresponding to the first graph model at the t-th moment.

5. According to the data query method of claim 1, the step of constructing the second graph model comprises: Acquire the knowledge not included in the database corresponding to the first graph model at the time t-1; Determine each entity in the excluded knowledge and the entity category corresponding to each entity; Based on each entity in the excluded knowledge and the entity category corresponding to each entity, graph models corresponding to different entity categories are constructed respectively to obtain a second graph model.

6. According to the data query method of claim 1, the step of constructing the first graph model at time t-1 comprises: Acquire the second knowledge in the knowledge base; Determine a plurality of entities and corresponding entity categories in the second knowledge; Based on the multiple entities and the corresponding entity categories, a first graph model at the time t-1 is constructed.

7. According to the data query method of claim 1, the step of constructing the first graph model at time t comprises: Determine entities under each entity category in the second graph model; The entities under each entity category are merged into the corresponding entity category in the first graph model at time t-1 to obtain the first graph model at time t.

8. The data query method according to claim 7, further comprising: Determine the entropy of each entity under each entity category in the first graph model at time t-1 based on the association relationship between each entity and the entity category in the first graph model at time t-1; Determine the entropy and retrieval weight of each entity under each entity category in the first graph model at time t based on the association relationship between each entity and the entity category in the first graph model at time t; Based on the entropy of each entity under each entity category in the first graph model at time t-1 and the entropy of each entity under each entity category in the first graph model at time t, the entropy change of each entity under each entity category in the first graph model at time t is determined.

9. A data query device, comprising: The first acquisition module is used to acquire the information to be queried input by the user; An identification module, used to identify a target entity in the information to be queried; A determination module, used to determine the importance of the target entity in each entity category in the first graph model at time t; wherein the first graph model at time t is obtained by updating the first graph model at time t-1 according to the second graph model, and the second graph model is constructed according to the knowledge not included in the database corresponding to the first graph model at time t-1; A second acquisition module is used to acquire the first knowledge corresponding to the target entity from the database corresponding to the first graph model at the time t based on the importance; A sending module is used to send the information to be queried and the first knowledge to the big model, so that the big model determines the reply information corresponding to the information to be queried based on the first knowledge.

10. An electronic device, comprising: at least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the data query method as described in any one of claims 1-8.