Knowledge graph logic rule mining method and system based on large language model

By combining large language models and knowledge graphs, using a small number of rule examples to guide large language models to generate high-quality logical rules, the problem of insufficient use of semantic information and poor interpretability in mining knowledge graph logic rules is solved, the mining efficiency and accuracy are improved, and large-scale application is promoted.

CN120146165APending Publication Date: 2025-06-13NAT UNIV OF DEFENSE TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510191312.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-20
Publication Date
2025-06-13

AI Technical Summary

Technical Problem

The prior art has insufficient use of semantic information in the mining of knowledge graph logic rules, and has poor interpretability, which affects efficiency and accuracy, limits large-scale applications.

Method used

Using a method based on a large language model, a triple is selected from the knowledge graph as a sample, and the sample logical rules are reasoned and expanded through the large language model, the final logical rules are generated, and applied to knowledge graph completion.

Benefits of technology

It improves the efficiency and accuracy of logical rule mining, generates high-quality logical rules, and promotes the large-scale application of knowledge graphs in more fields.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120146165A_ABST
    Figure CN120146165A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a knowledge graph logic rule mining method based on a large language model, and the method comprises the steps: selecting a triple from a knowledge graph, and taking the triple as a sample triple; determining a sample logic rule through the sample triad; reasoning and expanding the sample logic rule through a large language model to obtain a final logic rule; and applying the final logic rule to the knowledge graph to complete the knowledge graph. According to the technical scheme, the large language model is combined with the knowledge graph, and a small number of rule examples in the knowledge graph are utilized to guide the large language model to generate a large number of high-quality logic rules, so that the efficiency and the accuracy of carrying out logic rule mining on the large-scale knowledge graph are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of knowledge graphs, and in particular, to a method and system for mining logical rules of a knowledge graph based on a large language model. Background Art

[0002] Knowledge is the cornerstone of the development and progress of human society. In the era of big data, the need to extract valuable knowledge from massive amounts of information is becoming increasingly urgent. As a structured and dynamic information source, the knowledge graph is crucial for knowledge discovery. For example, in the modern military field, the advancement of weapons and equipment has a decisive impact on national defense security and strategic implementation. Facing scattered weapon and equipment data, the knowledge graph realizes data integration and standardization through ontology construction, providing a new perspective for analysis and prediction. Logical rules, as the concentrated manifestation of frequent patterns in the knowledge graph, are of great significance to the development of human society and artificial intelligence. However, early methods for mining knowledge graph rules mostly enumerated based on indicators such as support and confidence, which were inefficient and ineffective when dealing with large-scale knowledge graphs. To improve the computational efficiency of rule mining and the generalization ability of the model, various improvement methods have emerged in the prior art, such as the RLogic framework, the NTP framework, the NCRL framework, etc., to enhance the efficiency and accuracy of rule mining.

[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0004] The aforementioned improvement methods still have many deficiencies. For example, they do not utilize the semantic information of the knowledge graph sufficiently, and there are deficiencies in the interpretability during the process of mining logical rules, which still affect the efficiency and accuracy of logical rule mining and limit the large-scale applications of knowledge graphs in high-risk fields such as medicine, finance, and military command and control. Therefore, how to more effectively improve the efficiency and accuracy of logical rule mining is a problem that needs to be solved. Summary of the Invention

[0005] Embodiments of the present invention provide a method and system for mining logical rules of a knowledge graph based on a large language model to improve the efficiency and accuracy of logical rule mining.

[0006] To achieve the above object, on the one hand, an embodiment of the present invention provides a method for mining logical rules of a knowledge graph based on a large language model, including: selecting triples from the knowledge graph as example triples; determining example logical rules through the example triples; reasoning and expanding the example logical rules through a large language model to obtain final logical rules; and applying the final logical rules to the knowledge graph for knowledge graph completion.

[0007] On the other hand, an embodiment of the present invention provides a knowledge graph logic rule mining system based on a large language model, including: a sample selection module for selecting triples from the knowledge graph as sample triples; a sample logic rule determination module for determining sample logic rules through the sample triples; a logic rule extension module for reasoning and extending the sample logic rules through the large language model to obtain final logic rules; and applying the final logic rules to the knowledge graph for knowledge graph completion.

[0008] The above technical solution has the following beneficial effects:

[0009] In the technical solution of this application, the advantages of the large language model are fully utilized. The large language model is combined with the knowledge graph. By using a small number of rule examples in the knowledge graph, the large language model is guided to generate a large number of high-quality logic rules, thereby improving the efficiency and accuracy of logic rule mining on a large-scale knowledge graph and promoting the application of large-scale knowledge graphs in more fields. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0011] Figure 1 is a flowchart of a knowledge graph logic rule mining method based on a large language model according to an embodiment of the present invention;

[0012] Figure 2 is a composition diagram of a knowledge graph logic rule mining system based on a large language model according to an embodiment of the present invention;

[0013] Figure 3 is a schematic diagram of the logic rule mining process in a specific embodiment of the present invention;

[0014] Figure 4 is a schematic diagram of generating new logic rules through a large language model in a specific embodiment of the present invention;

[0015] Figure 5 is a visual display of some knowledge graph data in the simulation experiment of the embodiment of the present invention;

[0016] Figure 6 is a schematic diagram of radar-related data in the simulation experiment of the embodiment of the present invention;

[0017] Figure 7Parameter Inference Diagram in the Simulation Experiment of the Embodiment of the Present Invention

[0018] Figure 8 Comparison of Knowledge Graph Completion Results in the Simulation Experiment of the Embodiment of the Present Invention Detailed Implementation Manner

[0019] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0020] As Figure 1 shown, the embodiment of the present invention provides a method for mining knowledge graph logic rules based on a large language model, including:

[0021] S101. Select triples from the knowledge graph as example triples;

[0022] S102. Determine example logic rules through the example triples;

[0023] S103. Reason and expand the example logic rules through the large language model to obtain the final logic rules;

[0024] S104. Apply the final logic rules to the knowledge graph for knowledge graph completion.

[0025] The powerful capabilities of large language models in natural language processing and logical reasoning have enabled them to demonstrate excellent performance in multiple cross - fields related to natural language processing. The most significant advantage of large language models is their ability to capture information that small - scale models cannot obtain. After being trained on a vast amount of corpus, large language models usually contain hundreds of millions of parameters, which enables them to capture the nuances in language. At the same time, the pre - training - fine - tuning mode of large language models enables them to adapt to different downstream tasks. In addition, large language models have powerful generation capabilities and can achieve fast and efficient logical reasoning, and have been widely applied in many fields.

[0026] In view of this, in this technical solution, it is intended to leverage the advantages of large language models, combine large language models with knowledge graphs, use a small number of rule examples in the knowledge graph to guide large language models to generate a large number of high - quality logical rules, and thus utilize the efficient reasoning ability and powerful natural language understanding ability demonstrated by large language models to further improve the effect of knowledge graph logic rule mining and solve the aforementioned problems.

[0027] Further, the triple includes two entities and an entity relationship, and the entity relationship is used to describe the association between the two entities in the triple; the entities form the nodes of the knowledge graph, and the entity relationships form the edges of the knowledge graph;

[0028] The specific steps of S102 include:

[0029] S1021. Taking the two entities in the sample triple as anchor points, performing a breadth-first search strategy to wander, and obtaining a closed path for constructing the entity relationship corresponding to the anchor points;

[0030] S1022. Sorting all the closed paths in descending order according to the repetition times;

[0031] S1023. According to the sorting result, selecting the closed paths that meet the first preset quantity requirement as alternative closed paths;

[0032] S1024. Constructing a sample logical rule with the entity relationship corresponding to the anchor point as the rule head and the alternative closed path as the rule body. Each sample logical rule includes a rule head and a rule body;

[0033] S1025. Summarizing all the obtained sample logical rules.

[0034] A logical rule can be expressed as a logical rule body and a logical rule head. The rule body is composed of multiple logical predicates. The rule body is a single logical predicate, and the logical rule body is used to explain the logical rule head. The logical rule referred to in this article is the horn logical rule in first order logic (FOL). In the horn logical rule, the logical predicate refers to the logical relationship, that is, the entity relationship r mentioned above defines a complete logical rule ρ:

[0035] ρ: = r h ← r 1 ∧ r 2 … ∧ r n

[0036] Among them, the rule head ρ h = r h , and the rule body ρ b = r 1 ∧ r 2 … ∧ r n .

[0037] Further, the specific steps of S103 include:

[0038] S1031. Taking the current sample logical rule as the initial value of the demonstration logical rule;

[0039] S1032. Compiling a prompt word according to the demonstration logical rule and the output requirement;

[0040] S1033. Input the prompt into the large language model to enable the large language model to understand the semantic information of the prompt and output a new logical rule that meets the output requirements. The rule head of the new logical rule is the same as that of the current demonstration logical rule, and the rule body of the new logical rule is different from that of the current demonstration logical rule;

[0041] S1034. Calculate the index value of the new logical rule using the preset verification rule and sort the new logical rules according to the index value;

[0042] S1035. Select the new logical rules that meet the requirements of the second preset quantity as alternative logical rules;

[0043] S1036. Update the demonstration logical rule with the alternative logical rule;

[0044] Repeat the above steps S1032 to S1036 until the number of iterations meets the preset number of iterations requirement:

[0045] S1037. Use the alternative logical rule obtained in the last iteration of the iterative process as the final logical rule.

[0046] When applying the large language model, attention should also be paid to the problems of knowledge conflict and hallucination. Knowledge conflict usually stems from the inconsistency between the training corpus of the large language model and the knowledge in the knowledge graph. To alleviate this problem, an effective strategy is to input the information in the knowledge graph into the large language model to enhance the model's understanding of the knowledge graph. The hallucination problem, that is, the large language model may generate inaccurate information, is an inherent problem of the large language model. In this application, it is intended to reduce its adverse effects by introducing a verification mechanism.

[0047] Furthermore, the preset verification rule in step S1034 includes coverage and confidence;

[0048] The calculation method of confidence is:

[0049]

[0050] Among them,

[0051] support(ρ) = #(e x , e y ): ρ h (e x , e y ) ∧ ρ b (e x , x y ),

[0052] support(ρ) is the support degree, ρ represents the logical rule, # represents the counting operation, (ex , e y ) refers to an entity pair with e x as the head entity and e y as the tail entity and connected by any entity relationship; ρ h is the rule head, and ρ b is the rule body;

[0053] #(e x , e y ): ρ b (e x , e y ) indicates the number of entity pairs (e b , e x ) that can be connected by the rule body ρ y ;

[0054] The calculation method of the coverage is as follows:

[0055]

[0056] Among them, #(e x , e y ): ρ h (e x , e y ) indicates the number of entity pairs (e h , e x ) that can be connected by the rule head ρ y ;

[0057] Step S1034 specifically includes: calculating the coverage value and the confidence value of the new logical rule respectively, and taking the average of the coverage value and the confidence value as the index value of the new logical rule.

[0058] Furthermore, the prompt word can also include the index value of the new logical rule obtained in the previous iteration process. Such an input method helps the large language model better understand the required logical rule form, and thus generate higher quality logical rules.

[0059] As Figure 2 shown, the embodiment of the present invention also provides a knowledge graph logical rule mining system based on a large language model, which is characterized by including:

[0060] An example selection module 21, configured to select triples from the knowledge graph as example triples;

[0061] An example logical rule determination module 22, configured to determine an example logical rule through the example triples;

[0062] A logical rule extension module 23, configured to infer and extend the example logical rule through the large language model to obtain the final logical rule;

[0063] The final logic rule application module 24 is used to apply the final logic rule to the knowledge graph for knowledge graph completion.

[0064] Furthermore, a triple includes two entities and an entity relationship. The entity relationship is used to describe the association between the two entities in the triple; the entities form the nodes of the knowledge graph, and the entity relationships form the edges of the knowledge graph.

[0065] The sample logic rule determination module 22 is specifically used for: taking the two entities in the sample triple as anchor points, performing a walk using the breadth-first search strategy to obtain a closed path for constructing the entity relationship corresponding to the anchor points; sorting all the closed paths in descending order according to the number of repetitions; according to the sorting result, selecting the closed paths that meet the first preset quantity requirement as alternative closed paths; constructing sample logic rules with the entity relationship corresponding to the anchor points as the rule head and the alternative closed paths as the rule body, where each sample logic rule includes a rule head and a rule body; aggregating all the obtained sample logic rules.

[0066] Furthermore, the logic rule extension module 23 is specifically used for: taking the current sample logic rule as the initial value of the demonstration logic rule; compiling a prompt word according to the demonstration logic rule and the output requirement; inputting the prompt word into the large language model to enable the large language model to understand the semantic information of the prompt word and output a new logic rule that meets the output requirement, where the rule head of the new logic rule is the same as the rule head of the current demonstration logic rule, and the rule body of the new logic rule is different from the rule body of the current demonstration logic rule; calculating the index value of the new logic rule using the preset verification rule and sorting the new logic rules according to the index value; selecting the new logic rules that meet the second preset quantity requirement as alternative logic rules; updating the demonstration logic rule with the alternative logic rules; repeating the above iterative process until the number of iterations meets the preset number requirement. The initial step of the iterative process is: compiling a prompt word according to the demonstration logic rule and the output requirement; taking the alternative logic rules obtained in the last time of the iterative process as the final logic rules.

[0067] Furthermore, the preset verification rule includes coverage and confidence.

[0068] The calculation method of the confidence is:

[0069]

[0070] where

[0071] support(ρ) = #(e x , e y ): ρ h (e x , ey ) ∧ ρ b (e x ,x y ),

[0072] support(ρ) is the support degree, ρ represents a logical rule, # represents a counting operation, (e x ,e y ) refers to an entity pair with e x as the head entity and e y as the tail entity and connected by any entity relationship; ρ h is the rule head, and ρ b is the rule body;

[0073] The calculation method of the coverage degree is as follows:

[0074]

[0075] The logical rule expansion module 23 also includes a calculation sub-module for calculating the index value of the new logical rule by using a preset inspection rule, specifically for: calculating the coverage degree value and the confidence degree value of the new logical rule respectively, and taking the average of the coverage degree value and the confidence degree value as the index value of the new logical rule.

[0076] Furthermore, the prompt word also includes the index value of the new logical rule obtained in the previous iteration process.

[0077] As Figure 3 shown, it is the work flow of a specific embodiment adopting the foregoing method of the present application:

[0078] This specific embodiment is mainly divided into three parts: knowledge graph sampling, large language model rule generation, and rule inspection and sorting.

[0079] Using a large language model to solve the need for relevant content input in professional field knowledge, therefore, it is necessary to sample on the knowledge graph to obtain the input of logical rules.

[0080] First, select each relationship that needs to be inferred, and sample a certain number of triples from the knowledge graph. On this basis, starting from the head entity of each triple, use the breadth-first search strategy to perform a walk. During the walk, check whether there is a relationship between the current node and the head node. When reaching the tail node, store the obtained logical rule, thereby obtaining a relationship instance. Finally, summarize according to the occurrence frequency of the relationship instance to obtain a logical rule. The sampling method based on the anchor point improves the efficiency of rule sampling while ensuring the acquisition of target rules. After obtaining sufficient rule instances, sort them according to the occurrence frequency, and the instances with high occurrence frequency (closed paths) can be summarized as alternative closed paths, and then sample logical rules can be obtained according to the alternative closed paths.

[0081] After that, a large language model is used to generate new logical rules. The key to using a large language model for solving specific problems lies in ensuring that the large language model can comprehensively understand the knowledge in the relevant field. Therefore, this framework uses the method of prompt tuning to transmit logical rules to the large model.

[0082] The prompt mainly contains three parts. First is the background information, which is used to clarify the type of the task and the meaning of the logical rules; second is the logical rule examples, which are the logical rules obtained by sampling and transmit the internal structure of the knowledge graph to the model; finally is the user requirements, which are used to input specific task requirements to the large language model, and an example input and output is as Figure 4 shown.

[0083] Due to the hallucination problem of the large language model, it is necessary to verify the obtained new logical rules. Since illegal relationships may be synonymous relationships of the relationships in the knowledge base, this paper selects the rule with the highest similarity in the rule base that exceeds the threshold for replacement by comparing semantic similarity. The replacement makes full use of the semantic understanding ability of the large language model while ensuring the effectiveness of the logical rules.

[0084] In knowledge graph reasoning, indicators such as support, coverage, and confidence are usually used to evaluate the quality of logical rules. By sorting and filtering based on these indicator values, high-quality rules applicable to downstream tasks can be obtained. The following details these indicators and their specific meanings:

[0085] The calculation formula for the support ρ of a logical rule is:

[0086] support(ρ) = #(e x , e y ): ρ h (e x , e y ) ∧ ρ b (e x , x y ),

[0087] where # represents the counting operation, ":" means equivalent in mathematics, (e x , e y ) refers to the entity pair (triple) with e x as the head entity, e y as the tail entity and connected by any relationship, ρ b (e x , e y ) means that (e x , e y ) can be connected by the rule body ρ b , ρ h (ex , e y ) represents (e x , e y ) can be connected through the rule body ρ h This formula indicates that the confidence of a certain logical rule in the knowledge graph can be equivalent to the number of entity pairs (e x , e y ) that make the rule head and the rule body hold simultaneously.

[0088] The calculation method of the confidence is as follows:

[0089]

[0090] Among them, #(e x , e y ): ρ b (e x , e y ) represents the number of entity pairs (e b , e x , e y ) that can be connected through the rule body ρ

[0091] The calculation method of the coverage is as follows:

[0092]

[0093] Among them, #(e x , e y ): ρ h (e x , e y ) represents the number of entity pairs (e h , e x , e y ) that can be connected through the rule head ρ

[0094] Knowledge graph completion is the task of automatically predicting and filling in the missing entities or relationships in the knowledge graph. Since the knowledge graphs constructed in the real world often have deficiencies, completing the knowledge graph can improve its integrity and thus enhance its application value. Logical rules are often used for knowledge graph completion. Therefore, this paper uses the knowledge graph completion task to test the effectiveness of the knowledge graph logical rule mining method based on the large language model in this application.

[0095] This application uses three metrics, Hits@1, Hits@10, and MRR, to measure the task effectiveness. Hits@k measures the ratio of the correct entity or relationship appearing in the top k positions of the prediction results, reflecting the prediction accuracy and ranking ability of the model.

[0096]

[0097] MRR refers to the Mean Reciprocal Rank, which calculates the average of the reciprocals of the correct entity ranks for all test triples, emphasizing the importance of prediction results with higher ranks.

[0098]

[0099] Where S is the set of triples in the test set, and |S| is the number of triples in the set. I is the indicator function, whose value is 1 when the predicted correct entity appears in the top k prediction results, and 0 otherwise. rank i represents the predicted rank of the i-th triple.

[0100] The following illustrates the application value of the method of the present invention in the modern military field through a simulation experiment.

[0101] 1) Data source and analysis: This experiment uses a publicly available weapon and equipment dataset for simulation experiments. After preprocessing, a knowledge graph is constructed, which contains 9,529 entities and 16 relationships. The entities mainly include various types of weapon and equipment, the R & D units of weapon and equipment, information such as the components of the equipment, etc. The relationships mainly describe the subordination relationships of each equipment, component composition, etc. Table 1 specifically shows 5 triples.

[0102]

[0103] Table 1. Display of example triples

[0104] To better display the relationships between the data, Neo4j is used for data visualization, and part of the data is shown as Figure 5 shown.

[0105] 2) Problem modeling and solution

[0106] The radar polarization type parameter is crucial for improving the performance of the radar system. Assume that Country A has developed a new type of radar, and Country B intends to indirectly detect the polarization type parameter of Country A's radar by using previously mastered intelligence and other relevant information. Model and solve this problem, and mine logical rules from the knowledge graph according to the algorithm process. Part of the logical rules are shown in Table 2.

[0107] In Table 2, "inv_" represents the reverse inference relationship of the original relationship. For example, in the original triple, the radar is the head entity and the tail entity is a certain technical system. Then "inv_technical system" means deriving the radar type from the specific technical system.

[0108]

[0109] Table 2. Part of the logical rules and their confidence levels

[0110] If you want to detect the radar polarization type parameters, it is best to know the PRI type, technical system, and pulse width type of the radar at the same time. If only some of the parameters can be detected, the effect will be poor. These information are specifically shown in the knowledge graph as Figure 6 shown. It can be intuitively felt from Figure 6 the complex connection relationships between these parameters.

[0111] 3) Result analysis

[0112] Further analysis Figure 6 of the relationships and entities in it can find that for two specific radar models, their "polarization methods" can be derived through the logical rule bodies "intra-pulse modulation type" and "intra-pulse modulation type, PRI type". Figure 7 shows the association between the PRI type and the two relationships of intra-pulse modulation and the polarization type. The polarization type can be inferred through these two relationships (Note: Figure 7 is a partial enlargement of the content within the box of Figure 6 , and the logical connection is found through Figure 6 the rules of Figure 7 ). This is of great significance for a newly developed radar, that is, it can help military commanders and decision-makers quickly infer the performance parameters of this type of equipment.

[0113] To further illustrate the rationality of the logical rules obtained through this framework, this simulation experiment mined the logical rules corresponding to all 16 relationships using the method proposed in this application, and used these logical rules for the knowledge graph completion task. At the same time, ablation experiments were carried out to test the effect after removing the large language model. The experimental results are as Figure 8 shown. It can be seen from Figure 8 that with the help of the large language model ( Figure 8 Gear-LLM in it represents the knowledge graph logical rule mining method based on the large language model of this application), the inference effect has been significantly improved. Compared with the rules obtained only through sampling, the probability that the rules screened by the large language model are completely correct, that is, the Hits@1 index value, has increased by 0.164. MRR and Hits@10 have also increased by 0.147 and 0.266 respectively, which shows that the logical reasoning ability based on the large language model has a significant improvement on the effect of knowledge graph logical rule mining.

[0114] The above-described disclosed embodiments have been described so that any person skilled in the art can implement or use the present invention. For those skilled in the art, various modification methods of these embodiments are obvious, and the general principles defined in this application can also be applied to other embodiments without departing from the spirit and protection scope of this disclosure. Therefore, this disclosure is not limited to the embodiments given in this application, but is consistent with the broadest scope of the principles and novel features disclosed in this application.

[0115] The specific embodiments described above have further elaborated on the purpose, technical solutions, and beneficial effects of the present invention. It should be understood that the above is only the specific embodiment of the present invention and is not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A knowledge graph logical rule mining method based on a large language model, characterized in that: include: Select triples from the knowledge graph as sample triples; Determine a sample logic rule through the sample triples; The sample logic rules are inferred and expanded by a large language model to obtain final logic rules; The final logical rules are applied to the knowledge graph to complete the knowledge graph.

2. The knowledge graph logic rule mining method based on a large language model as claimed in claim 1, characterized in that: The triplet includes two entities and an entity relationship, and the entity relationship is used to describe the association between the two entities in the triplet; The entities constitute nodes of the knowledge graph, and the entity relationships constitute edges of the knowledge graph; Determining the sample logic rule by using the sample triples specifically includes: Taking the two entities in the sample triple as anchor points, a breadth-first search strategy is adopted to perform walking, so as to obtain a closed path for constructing entity relationships corresponding to the anchor points; Sort all closed paths by the number of repetitions from high to low; According to the sorting result, the closed paths that meet the first preset number requirement are selected as candidate closed paths; Constructing a sample logic rule using the entity relationship corresponding to the anchor point as a rule head and the alternative closed path as a rule body, wherein each of the sample logic rules includes a rule head and a rule body; Summarize all sample logic rules.

3. The knowledge graph logic rule mining method based on a large language model as claimed in claim 2, characterized in that: The method of inferring and expanding the sample logic rules through the large language model to obtain the final logic rules specifically includes: Using the current sample logic rule as the initial value of the demonstration logic rule; Compile prompt words according to the exemplary logic rules and output requirements; Inputting the prompt word into the large language model, so that the large language model understands the semantic information of the prompt word, and outputs a new logic rule that meets the output requirement, wherein the rule header of the new logic rule is the same as the rule header of the current demonstration logic rule, and the rule body of the new logic rule is different from the rule body of the current demonstration logic rule; Calculate the index value of the new logic rule by using the preset inspection rule, and sort the new logic rule according to the index value; Selecting the new logic rule that meets the second preset number requirement as the candidate logic rule; Updating the exemplary logic rule with the alternative logic rule; The iterative process is repeatedly performed until the number of iterations meets the preset number requirement. The initial step of the iterative process is: compiling prompt words according to the exemplary logic rules and output requirements: The candidate logic rule obtained in the last iteration process is used as the final logic rule.

4. The knowledge graph logic rule mining method based on a large language model as claimed in claim 3 is characterized in that: The preset inspection rules include coverage and confidence; The confidence level is calculated as follows: in, support(ρ)=#(and x ,And y ):ρ h (And x ,And y )∧ρ b (And x ,x y ), support(ρ) is the support, ρ represents the logic rule, # represents the counting operation, (e x ,e y ) means x The head entity is e y is the tail entity and is an entity pair connected by any entity relationship; h is the rule head, ρ b is the rule body; The calculation method of the coverage is: The method of using preset verification rules to calculate the index value of the new logical rule specifically includes: respectively calculating the coverage value and the confidence value of the new logical rule, and taking the average value of the coverage value and the confidence value as the index value of the new logical rule.

5. The knowledge graph logic rule mining method based on a large language model as claimed in claim 4, characterized in that: The prompt word also includes the index value of the new logic rule obtained in the last iteration process.

6. A knowledge graph logic rule mining system based on a large language model, characterized in that: include: The sample selection module is used to select triples from the knowledge graph as sample triples; A sample logic rule determination module, used to determine the sample logic rule through the sample triples; A logic rule expansion module, used to infer and expand the sample logic rules through a large language model to obtain a final logic rule; The final logic rule application module is used to apply the final logic rule to the knowledge graph to complete the knowledge graph.

7. The knowledge graph logic rule mining system based on a large language model as claimed in claim 6, characterized in that: The triplet includes two entities and an entity relationship, and the entity relationship is used to describe the association between the two entities in the triplet; The entities constitute nodes of the knowledge graph, and the entity relationships constitute edges of the knowledge graph; The sample logic rule determination module is specifically used to: take the two entities in the sample triple as anchor points, adopt a breadth-first search strategy to walk, and obtain a closed path for constructing an entity relationship corresponding to the anchor point; sort all closed paths from high to low according to the number of repetitions; According to the sorting result, the closed paths that meet the first preset number requirement are selected as candidate closed paths; The sample logic rules are constructed by taking the entity relationship corresponding to the anchor point as the rule head and the alternative closed path as the rule body, wherein each of the sample logic rules includes a rule head and a rule body; and all the sample logic rules are summarized.

8. The knowledge graph logic rule mining system based on a large language model as claimed in claim 7, characterized in that: The logic rule expansion module is specifically used to: use the current sample logic rule as the initial value of the demonstration logic rule; compile prompt words according to the demonstration logic rule and output requirements; input the prompt words into the large language model so that the large language model understands the semantic information of the prompt words and outputs a new logic rule that meets the output requirements, wherein the rule header of the new logic rule is the same as the rule header of the current demonstration logic rule, and the rule body of the new logic rule is different from the rule body of the current demonstration logic rule; use the preset inspection rule to calculate the index value of the new logic rule, and sort the new logic rules according to the index value; select the new logic rule that meets the second preset number requirement as the candidate logic rule; update the demonstration logic rule with the candidate logic rule; repeat the iterative process until the number of iterations meets the preset number requirement, and the initial steps of the iterative process are: compile prompt words according to the demonstration logic rule and output requirements; use the candidate logic rule obtained for the last time in the iterative process as the final logic rule.

9. The knowledge graph logic rule mining system based on a large language model as claimed in claim 8, characterized in that: The preset inspection rules include coverage and confidence; The confidence level is calculated as follows: in, support(ρ)=#(and x ,And y ):ρ h (And x ,And y )∧ρ b (And x ,x y ), support(ρ) is the support, ρ represents the logic rule, # represents the counting operation, (e x ,e y ) means x The head entity is e y is the tail entity and is an entity pair connected by any entity relationship; h is the rule head, ρ b is the rule body; The calculation method of the coverage is: The method of using preset verification rules to calculate the index value of the new logical rule specifically includes: respectively calculating the coverage value and the confidence value of the new logical rule, and taking the average value of the coverage value and the confidence value as the index value of the new logical rule.

10. The knowledge graph logic rule mining system based on a large language model as claimed in claim 9, characterized in that: The prompt word also includes the index value of the new logic rule obtained in the last iteration process.

Citation Information

Cited By

  • Contract auditing-oriented custom text rule generation and auditing method and system and storage medium

    CN120725002A