A knowledge graph triple credibility verification method based on large language model

Through large language models and evidence fusion reasoning technology, it solves the complex relationship processing and data sparsity problems of triple verification in knowledge graphs, improves prediction accuracy and efficiency, and overcomes the shortcomings of traditional methods.

CN118520944BActive Publication Date: 2024-10-18HANGZHOU DIANZI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411003289.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-25
Publication Date
2024-10-18
Estimated Expiration
2044-07-25

AI Technical Summary

Technical Problem

Traditional methods do not handle complex relationships well when verifying the credibility of triples in knowledge graphs, rely on a large amount of annotated data and perform poorly in sparse data situations, and the quality of randomly generated negative samples is unstable.

Method used

Using the knowledge graph triple credibility verification method based on the large language model, using evidence fusion reasoning technology to generate multiple negative samples and using the consistency function and genetic algorithm to obtain the reliability and importance weight of the evidence, and conduct multiple evidence Fusion to improve prediction performance.

Benefits of technology

It significantly improves the accuracy of triple prediction, overcomes the problems of data sparsity and poor generalization ability, reduces labor costs, and improves the efficiency and large-scale processing capabilities of knowledge graph triple verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118520944B_ABST
    Figure CN118520944B_ABST
Patent Text Reader

Abstract

The present invention discloses a knowledge graph triple credibility verification method based on a large language model. The method first divides the triples of the constructed knowledge graph into two categories: credible and to-be-verified. The credible triples are used as positive samples, and randomly generated n Negative samples are constructed from n Sample datasets are used to fine-tune the large language model and obtain n A fine-tuned large language model is constructed. Secondly, a triple credibility identification framework is established to convert the output of each large language model into evidence form, and obtain the reliability and importance weight parameters of the evidence. The triples to be verified are then input into the fine-tuned large language model respectively, and the output results are fused. Finally, a decision is made based on the fused credibility distribution to obtain the credibility verification result of the triple to be verified. The present invention overcomes the problem that traditional methods perform poorly on sparse data and significantly improves the effect of label prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the intersection of large language models and knowledge graph technology, and in particular relates to a knowledge graph triple credibility verification method based on a large language model. Background Art

[0002] Knowledge graph quality assessment technology is a key link in the construction and maintenance of knowledge graphs. It aims to judge the credibility of triples in knowledge graphs through manual or automated methods to improve the modeling quality of graphs. Traditional methods include Translational Embedding (TransE) and Relational Translational Embedding (TransR). Although they have solved the credibility verification problem of triples in knowledge graphs to a certain extent, they still have many shortcomings. These traditional methods are relatively simple in design but rely on linear transformations and perform poorly when dealing with complex relationships (such as one-to-many, many-to-one, and many-to-many). In addition, traditional methods usually rely on a large amount of labeled data for training, but in practical applications, labeled data is often insufficient, resulting in poor performance of the model on sparse data and difficulty in accurately predicting the labels of triples.

[0003] With the rapid development of natural language processing technology, such as the Generative Pre-trained Transformer (GPT) developed by OpenAI and the Grand Language Model (GLM) developed by the Tsinghua team, they have shown great potential in the field of knowledge graphs. Judging the credibility of triples in knowledge graphs based on large language models has many advantages over traditional methods. Large language models can capture rich semantic and contextual information through pre-training of large-scale corpus, handle complex relationships and non-linear relationships between entities, and improve the accuracy of predictions. At the same time, large language models have good transfer learning capabilities. With a small amount of labeled data, they can obtain better prediction results through fine-tuning of pre-trained models, overcoming the problem of data sparsity.

[0004] To use a large language model to judge the credibility of triples in a knowledge graph, it is necessary to use existing knowledge graph information to build a sample dataset and fine-tune the large language model. In this process, it is necessary to randomly generate negative samples to improve the fine-tuning effect. However, randomly generated negative samples usually have the problem of unstable quality. Summary of the invention

[0005] In view of the shortcomings of the prior art, the present invention provides a knowledge graph triple credibility verification method based on a large language model, and introduces evidence fusion reasoning technology to solve the problem of unstable quality of negative samples generated by large language models during training. Even if the quality of negative samples used in model training is unstable, multiple evidence fusions of model output results can significantly improve the effect of model prediction. This method gives full play to the advantages of large language models, provides strong technical support for the widespread application of knowledge graph triple credibility verification, and solves problems such as data sparsity and poor generalization ability.

[0006] The technical solution adopted by the present invention to achieve the above-mentioned purpose is:

[0007] A knowledge graph triple credibility verification method based on a large language model comprises the following steps:

[0008] S1. Based on the constructed knowledge graph, the triples are divided into two categories: credible and to be verified.

[0009] S2. Take the triplets of the credible part as positive samples, and generate n negative samples based on them, thereby constructing n sample datasets for fine-tuning the large language model.

[0010] S3. Fine-tune the large language model according to each constructed sample data set to obtain n fine-tuned large language models.

[0011] S4. Establish a triple credibility identification framework to convert the output of each fine-tuned large language model into evidence form.

[0012] S5. Based on the consistency function and genetic algorithm, the reliability and importance weight parameters of the evidence are obtained.

[0013] S6. Input the triples to be verified into n fine-tuned large language models respectively, and fuse the output results using the evidential reasoning method.

[0014] S7. Make a decision based on the fused credibility distribution to obtain the credibility verification result of the triplet to be verified.

[0015] Furthermore, the step S1 preprocesses the constructed knowledge graph and divides the triples in the graph into a set of credible triples and a set of triples to be verified, which are denoted as S x and S d ; The set of all entities in the knowledge graph is denoted as T.

[0016] Furthermore, the step S2 sets the trusted set S xThe triples in are taken as positive samples, and then entities are randomly extracted from the entity set T, and the head entity or tail entity of the positive sample triplet is replaced to generate a new negative sample triplet. The number of generated negative samples is consistent with the positive sample. Based on this, n negative samples are randomly generated, thereby constructing n sample data sets for fine-tuning the large language model; the input sequence required by the large language model is generated according to the sample data set. The template of the input sequence required by the model is as follows: {"prompt": "Is this true: head entity relationship type tail entity?", "response": "Yes, thisis true."}, {"prompt": "Is this true: head entity relationship type tail entity?", "response": "No,this is not true."}, where Yes (label is 1) and No (label is 0) represent positive and negative samples.

[0017] Furthermore, in step S3, the present invention adopts Tsinghua's Chat Grand Language Model2 (Chatglm2), and the process of fine-tuning the large language model for n sample data sets is consistent, and the feature sequence of the input sequence in step S2 is obtained by using the model segmenter, and then the model Chatglm2 is trained with these feature sequences, and the loss value is calculated by the cross entropy loss function, and the model parameters are updated by back propagation, so as to obtain the weight of the training part and save the fine-tuning model. Fine-tune using n sample data sets respectively to obtain n fine-tuning models.

[0018] Furthermore, step S4 first establishes a triple credibility identification framework Θ={θ1,θ2}, which contains two propositions: θ1 indicates that the triple does not exist, and θ2 indicates that the triple exists. Thus, the output of each model is expressed as evidence. The triples in the sample data set are input into the fine-tuned model, and the probability value of the output of the fine-tuned model is extracted as a positive sample or a negative sample. The output of the generative large language model is a sequence composed of multiple tokens; the probability value of the first token triple label is output using the softmax function, and the probability value of the triple label is converted into evidence form e i :[p i,0 ,p i,1 ] represents the evidence form of the output transformation of the i-th fine-tuning model, p i,0 Indicates the confidence that the triple does not exist, p i,1 Indicates the confidence of the existence of a triple, which is the probability value of the corresponding triple label. The n fine-tuned models will output n label probability results and convert them into n evidence forms at the same time.

[0019] Furthermore, in step S5, the reliability and importance weights of the n pieces of evidence are obtained using the outputs of the n fine-tuning models. First, the relative reliability R of each piece of evidence is obtained by using the Krippendorff's alpha function. y,j , the calculation formula is as follows:

[0020] (1)

[0021] Among them, α represents the consistency measure, D o represents the actual observed disagreement, D e represents the expected divergence, n represents the number of model fine-tuning times, L represents the number of sample data output by the model, and A ij represents the predicted label of the jth fine-tuned model for the i-th triplet, and F represents the total number of triples predicted by all fine-tuned models in the output sample data. a is the number of times the model predicts label a, F b is the number of times the model predicts label b, α j is the consistency measure of the j-th fine-tuning model result, α n is the consistency measure of the n-times fine-tuning results, λ and ε are normalization coefficients, and R y,j represents the relative reliability of the j-th evidence obtained by Krippendorff's alpha function, The Kronecker delta function is as follows:

[0022] (2)

[0023] The uncertainty calculated by the model information entropy is used to measure the unreliability of evidence. The calculation formula is as follows:

[0024] (3)

[0025] Among them, R x,j represents the unreliability of the jth piece of evidence calculated by the model information entropy, P a represents the probability of label a, and L represents the number of sample data output by the model.

[0026] In summary, the reliability r calculation formula is as follows:

[0027] (4)

[0028] Among them, r j represents the reliability of the jth piece of evidence, R y,j represents the relative reliability of the jth piece of evidence obtained by Krippendorff's alpha function, R x,jIndicates the unreliability of the j-th evidence calculated by the model information entropy.

[0029] The importance weight parameter w of the evidence can be optimized using a genetic algorithm based on the output of the fine-tuning model, with a value range of [0,1], on the premise that r is calculated.

[0030] Furthermore, in step S6, the model is fine-tuned using n sample data sets to test the validation set, and n pieces of evidence are obtained. Then, the n pieces of evidence are fused using the ER fusion algorithm according to the reliability and weight parameters of the acquired evidence. The ER fusion algorithm is as follows:

[0031] (5)

[0032] (6)

[0033] Among them, e n represents the evidence form of the n-times fine-tuned model output transformation, p 1,0 、p 1,1 represents the confidence of the existence and non-existence of the triple under evidence e1, p n,0 、p n,1 Indicates evidence n The confidence of the existence and non-existence of the next triple. r and w represent the reliability and importance weight of the evidence, m n represents the evidence after integrating the importance weight w, Indicates the confidence that the triple does not exist after fusion, Indicates the confidence of the existence of the triple after fusion. m j,0 represents the jth piece of evidence m j The confidence that the triple does not exist in m j,1 The jth piece of evidence m j The confidence of the existence of the triple in .

[0034] Furthermore, in step S7, according to the reliability distribution after the fusion of n pieces of evidence, the subscript of the maximum reliability in the one-dimensional array is obtained by using the maximum value index function argmax, and the identification framework Θ={θ 1, The decision result is obtained from θ2}, and the credibility verification result of the triplet to be verified is obtained.

[0035] Beneficial effects of the present invention: The large language model has good transfer learning capabilities. Even when the labeled data is insufficient, better prediction results can be obtained by fine-tuning the pre-trained model, effectively overcoming the problem that traditional methods perform poorly on sparse data. At the same time, the multi-output result prediction of the fusion model is fused using evidence fusion reasoning technology. Even if the generated negative samples have unstable quality, the label prediction effect can be significantly improved after multiple evidence fusions.

[0036] In addition, through the fine-tuning and reasoning process of the large language model, this method can reduce labor costs and improve the efficiency and scale processing capabilities of knowledge graph triple verification. At the same time, by calculating the reliability of evidence through Krippendorff's alpha function and information entropy, and using genetic algorithms to determine the importance weight of evidence, it is possible to more accurately evaluate the reliability and importance of each piece of evidence for the accuracy of decision-making. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 is a flow chart of the method of the present invention;

[0038] Figure 2 Fine-tune the Chatglm2 model test flow chart for the present invention;

[0039] Figure 3 Flowchart for optimizing w parameters using genetic algorithm;

[0040] Figure 4 This is the flow chart of the ER fusion algorithm. DETAILED DESCRIPTION

[0041] In order to more clearly understand the above advantages, features and purposes of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. In the following description, many specific details of the present invention are explained, and the embodiments described are only part of the embodiments of the present invention.

[0042] like Figure 1 As shown, the present invention provides a method for verifying the credibility of knowledge graph triples based on a large language model, including preprocessing the constructed knowledge graph, dividing the triples into two categories: credible and to-be-verified; taking the triples of the credible part as positive samples, and randomly generating n negative samples based on them, thereby constructing n sample data sets for fine-tuning the large language model.

[0043] According to each sample data set constructed, the large language model is fine-tuned to obtain n fine-tuned models; a triple credibility identification framework is established to convert the output of each model into evidence form; based on the consistency function and genetic algorithm, the reliability and importance weight parameters of the evidence are obtained; the triples to be verified are input into n fine-tuned models respectively, and the output results are fused using the evidence reasoning method; decisions are made based on the fused credibility distribution to obtain the credibility verification results of the triples to be verified;

[0044] In order to facilitate understanding of the above technical solution of the present invention, the above technical solution is described in detail below through a specific embodiment of a ship host system.

[0045] A knowledge graph triple credibility verification method based on a large language model includes the following steps:

[0046] S1. Based on the constructed knowledge graph, the triples are divided into two categories: credible and to be verified.

[0047] The triples in the graph are divided into a set of credible triples and a set of triples to be verified, denoted as S x and S d ; The set of all entities in the knowledge graph is denoted as T.

[0048] S2. Take the triplets of the credible part as positive samples, and generate n negative samples based on them, thereby constructing n sample datasets for fine-tuning the large language model.

[0049] The credible set S x The triples in are taken as positive samples, and then entities are randomly extracted from the entity set T, and the head entity or tail entity of the positive sample triplet is replaced to generate a new negative sample triplet. The number of generated negative samples is consistent with the positive sample. Based on this, n negative samples are randomly generated, thereby constructing n sample data sets for fine-tuning the large language model; the input sequence required by the large language model is generated according to the sample data set. The template of the input sequence required by the model is as follows: {"prompt": "Isthis true: head entity relationship type tail entity?", "response": "Yes, this is true."}, {"prompt": "Is this true: head entity relationship type tail entity?", "response": "No, this isnot true."}, where Yes (label is 1) and No (label is 0) represent positive and negative samples.

[0050] S3. Fine-tune the large language model according to each constructed sample data set to obtain n fine-tuned large language models.

[0051] The present invention adopts Tsinghua's Chat Grand Language Model2 (Chatglm2). The process of fine-tuning the large language model for n sample data sets is consistent. The model word segmenter is used to obtain the feature sequence of the input sequence in step S2, and then these feature sequences are used to train the model Chatglm2. The loss value is calculated by the cross entropy loss function, and the model parameters are updated by back propagation to obtain the training part weights and save the fine-tuning model. Fine-tune using n sample data sets respectively to obtain n fine-tuning models. The cross entropy loss function is as follows:

[0052] (1)

[0053] Where M is the number of input samples, C n is the number of labels, y ic is the true label of the i-th triple in the sample dataset, is the model's predicted label probability for the i-th triple in the sample dataset.

[0054] S4. Establish a triple credibility identification framework to convert the output of each fine-tuned large language model into evidence form.

[0055] First, a triple credibility identification framework Θ={θ1,θ2} is established, which contains two propositions: θ1 indicates that the triple does not exist, and θ2 indicates that the triple exists. In this way, the output of each model is expressed as evidence. The triples in the sample data set are input into the fine-tuned model, and the probability value of the output of the fine-tuned model is extracted as a positive sample or a negative sample. The output of the generative large language model is a sequence composed of multiple tokens; the probability value of the first token triple label is output using the softmax function, and the probability value of the triple label is converted into evidence. i :[p i,0 ,p i,1 ] represents the evidence form of the output transformation of the i-th fine-tuning model, p i,0 Indicates the confidence that the triple does not exist, p i,1 Indicates the confidence of the existence of the triple, which is the probability value of the corresponding triple label. The n fine-tuned models will output n label probability results and convert them into n evidence forms at the same time. The softmax function is as follows:

[0056] (2)

[0057] Among them, C represents the triple label set, a and b are triple labels, and z c,a represents the raw score logit of the triple label a. The denominator represents the exponential score e for all categories on the triple zc The sum of .

[0058] S5. Based on the consistency function and genetic algorithm, the reliability and importance weight parameters of the evidence are obtained.

[0059] The reliability and importance weights of n pieces of evidence are obtained using the outputs of n fine-tuning models. In order to conduct triple decision analysis, multiple pieces of evidence are fused. The Evidential Reasoning (ER) algorithm can be used to fuse the evidence for decision making. Among them, the reliability r and importance w of each piece of evidence in the ER fusion algorithm need to be calculated and obtained as follows: The reliability r is calculated using Krippendorff's alpha function and information entropy. Krippendorff's alpha is a statistic that measures the consistency between multiple raters and can solve the consistency problem between n model fine-tuning results. When measuring the reliability of evidence, the consistency of the current model and the overall consistency are compared to represent the relative reliability of the evidence. If the current model contributes more to the overall consistency, the consistency will decrease significantly after the current model is removed, so the reliability score of the current model will be higher. At the same time, the information entropy is used to represent the uncertainty of the model output results. The higher the model uncertainty, the lower the reliability score of the current model. The two can be calculated together to measure the reliability of the evidence.

[0060] First, the relative reliability R of each piece of evidence is obtained by Krippendorff's alpha function. y,j , the calculation formula is as follows:

[0061] (3)

[0062] Among them, α represents the consistency measure, D o represents the actual observed disagreement, D e represents the expected divergence, n represents the number of model fine-tuning times, L represents the number of sample data output by the model, and A ij represents the predicted label of the jth fine-tuned model for the i-th triplet, and F represents the total number of triples predicted by all fine-tuned models in the output sample data. a is the number of times the model predicts label a, F b is the number of times the model predicts label b, α j is the consistency measure of the j-th fine-tuning model result, α n is the consistency measure of the n-times fine-tuning results, λ and ε are normalization coefficients, generally λ=1, ε=0.5, R y,j represents the relative reliability of the j-th evidence obtained by Krippendorff's alpha function, The Kronecker delta function is as follows:

[0063] (4)

[0064] The uncertainty calculated by the model information entropy is used to measure the unreliability of evidence. The calculation formula is as follows:

[0065] (5)

[0066] Among them, R x,j represents the unreliability of the jth piece of evidence calculated by the model information entropy, P a represents the probability of label a, and L represents the number of sample data output by the model.

[0067] In summary, the reliability r calculation formula is as follows:

[0068] (6)

[0069] Among them, r j represents the reliability of the jth piece of evidence, R y,j represents the relative reliability of the jth piece of evidence obtained by Krippendorff's alpha function, R x,j Indicates the unreliability of the j-th evidence calculated by the model information entropy.

[0070] The importance weight parameter w of the evidence can be optimized using a genetic algorithm based on the output of the fine-tuning model, with a value range of [0,1], on the premise that r is calculated.

[0071] S6. Input the triples to be verified into n fine-tuned large language models respectively, and fuse the output results using the evidential reasoning method.

[0072] Use n sample data sets to fine-tune the model and test the validation set to obtain n pieces of evidence. Then, according to the reliability and weight parameters of the obtained evidence, the n pieces of evidence are fused using the ER fusion algorithm. The ER fusion algorithm is as follows:

[0073] (7)

[0074] (8)

[0075] Among them, e n represents the evidence form of the n-times fine-tuned model output transformation, p 1,0 、p 1,1 represents the confidence of the existence and non-existence of the triple under evidence e1, p n,0 、p n,1 Indicates evidence n The confidence of the existence and non-existence of the next triple. r and w represent the reliability and importance weight of the evidence, m n represents the evidence after integrating the importance weight w, Indicates the confidence that the triple does not exist after fusion, Indicates the confidence of the existence of the triple after fusion. m j,0 represents the jth piece of evidence m j The confidence that the triple does not exist in m j,1 The jth piece of evidence m j The confidence of the existence of the triple in .

[0076] S7. Make a decision based on the fused credibility distribution to obtain the credibility verification result of the triplet to be verified.

[0077] According to the reliability distribution after the fusion of n pieces of evidence, the maximum value index function argmax is used to obtain the subscript of the maximum reliability in the one-dimensional array, and the subscript is used to identify the maximum reliability of the framework Θ={θ 1, The decision result is obtained from θ2}, and the credibility verification result of the triplet to be verified is obtained.

[0078] Example:

[0079] S1: Preprocess the constructed knowledge graph of ship main engine system failures, and divide the triples in the constructed knowledge graph into a set of credible triples and a set of triples to be verified, which are denoted as S x and S d ; The set of all entities in the graph is denoted by T.

[0080] After graph preprocessing, this embodiment extracts 46 fault mode entities, 46 state monitoring parameter entities, and 141 semantic association relationships, among which the credible triple set S x Contains 121 data and a set of triples to be verified S d Contains 20 data, the entity set T contains 92 entities, some of the data is shown in Table 1:

[0081] Table 1 Extracted relation storage table

[0082]

[0083] S2: From the trusted set S x Select 90 triplets as the training set, then randomly extract entities from the entity set T, replace the head entity or tail entity of the positive sample triplets (referred to as positive triplets) in the training set to generate new negative sample triplets (referred to as negative triplets). The number of generated negative triplets is the same as that of positive triplets. In this example, considering the problem of less data, 5 negative samples are generated, thereby constructing a 5-sample training set X for fine-tuning the large language model i (i=1,2,3,4,5); the remaining 31 positive triplets in the credible set generate negative triplets together as the test set U. Training set X iThe test set U is used for model training and the performance of the five fine-tuned models. The test set U is also used to obtain the parameters required for the evidence reasoning part. i Generate the input sequence required for model training. This example uses the generative large language model Chatglm2. The template of the input sequence required by the Chatglm2 model is as follows: {"prompt": "Is this true: Diesel engine crankshaft crack propagation Diesel engine crankcase crankshaft fracture?", "response": "Yes, this is true."}, {"prompt": "Is this true: Diesel engine crankshaft crack propagation Oil pump outlet pressure?", "response": "No, this is not true."}, where Yes and No represent positive and negative samples.

[0084] S3: According to Figure 2 As shown in the figure, the Chatglm2 generative model is fine-tuned using the prompt tuning v2 (P-Tuning v2) technology. The process is as follows. In P-Tuning v2, each Transformer layer in the model training adds prompts tokens as input. Prompts tokens are the input sequence of the training set. The word segmenter ChatglmTokenizer is used to obtain the feature sequence TokenIDs that the model can understand. For example, the input sequence {"prompt": "Isthis true: Diesel engine crankshaft crack propagation diesel engine crankcase crankshaft fracture?", "response": "Yes, thisis true."} is converted into the feature sequence input_ids: {64790, 64792, 790,..., 2033, 30930, 2, 0,0,..., 0, 0,}, labels: {-100, -100, -100,..., -100, 4291, 30932, 434, 323,2033, 30930, 2, -100,..., -100}, and then use these feature sequences to calculate the loss value using formula (1), perform back propagation to update the model parameters to obtain the prefix-encoding part weights after model training, and save the fine-tuning model. i Fine-tune and obtain 5 fine-tuned models.

[0085] S4: Establish a triple credibility identification framework Θ={triplet does not exist, triplet exists} in the knowledge graph of ship main engine system faults. First, the input sequence of the triples in the test set U is input into 5 fine-tuned Chatglm2 models, and the accuracy of the fine-tuned model for predicting the triple labels in the test set U can be obtained, as shown in Table 2. At the same time, the probability value of each fine-tuned model outputting Yes or No for each triple in the test set U is extracted. This technology extracts the logit of the first token output by the model, uses formula (2) to convert the logit into a probability value, and uses the probability value of the triple label to convert it into an evidence form. The 5 fine-tuned models will output 5 label probability results and convert them into 5 evidence forms at the same time. For example, a triple in the test set U {diesel engine fuel injection pump fuel supply is not atomized and propagated diesel engine speed is unstable}, after inputting 5 fine-tuned models, the 5 evidence forms obtained are shown in Table 3:

[0086] Table 2. Triple label prediction accuracy in test set U

[0087]

[0088] Table 3 Evidence forms

[0089]

[0090] S5. Use the results of the five fine-tuned models to output the test set U to obtain the reliability and importance weights of the five pieces of evidence. The reliability r is calculated using Krippendorff's alpha function and information entropy. First, the relative reliability R of each piece of evidence is obtained by equations (3) and (4): y,j =[0.5647, 0.4810, 0,4809, 0.5074, 0.4661], and the unreliability of each piece of evidence R is obtained by formula (5): x,j is [0.0160, 0.0158, 0.0314, 0.0758, 0.0457], and R is calculated y,j and R x,j Then, according to formula (6), the reliability r of each piece of evidence is [0.5487, 0.4652, 0.4495, 0.4316, 0.4204]. The importance parameter w of the evidence can be calculated based on the output of the fine-tuning model. Figure 3The genetic algorithm process shown in the figure is optimized. First, the error rate of the test set U label is defined as the fitness function, and then a population of 50 real individuals is initialized. The fitness of each individual in the population is evaluated by the defined fitness function. In each generation, the algorithm uses a random uniform selection function to select individuals for reproduction. Then, 80% of the individuals participate in a crossover process that depends on the problem constraints to produce new offspring. The mutation operation also follows the constraint dependency strategy to ensure the feasibility of the solution. The termination condition is set to 50 iterations. When the termination condition is met, the algorithm will stop and provide an approximate optimal solution to the optimization problem. Finally, w is [0.5450, 0.9030, 0.3550, 0.5150, 0.4170].

[0091] Using the obtained reliability r and importance w, according to Figure 4 The ER fusion process of fused the evidence obtained from the test set U. The accuracy results of triple label prediction in the test set U after fusion are shown in Table 4:

[0092] Table 4 ER fusion results

[0093]

[0094] From the comparison between Table 2 and Table 4, it can be seen that the label prediction accuracy of the test set U is significantly improved after evidence fusion.

[0095] S6, the verification set S d The credibility of the triplet input is verified. Taking {uneven mapping of fuel supply to each cylinder of a diesel engine to the injector opening pressure} as an example, 5 fine-tuning models are input to obtain 5 pieces of evidence. The evidence obtained is shown in Table 5:

[0096] Table 5 Triple evidence forms

[0097]

[0098] Then according to Figure 4 The ER fusion process uses the ER fusion algorithm to fuse the above five pieces of evidence. The confidence distribution after fusion is shown in Table 6:

[0099] Table 6 Reliability distribution of triples after fusion

[0100]

[0101] S7: According to the credibility distribution after the fusion of the five pieces of evidence, the argmax function is used to obtain the subscript of the maximum credibility in the one-dimensional array, and the decision result is obtained from the identification framework Θ={triplet does not exist, triplet exists} according to the subscript, and the credibility verification result of {uneven mapping of fuel supply to each cylinder of a diesel engine to the opening pressure of the injector} is obtained. The results are shown in Table 7:

[0102] Table 7 Triplet prediction results

[0103]

Claims

1. A knowledge graph triple credibility verification method based on a large language model, characterized in that: The following steps are involved: S1. Based on the constructed knowledge graph, the triples are divided into two categories: credible and to be verified; S2, taking the credible triples as positive samples, generating n negative samples, and constructing n sample data sets; S3. Fine-tune the large language model according to each sample data set to obtain n fine-tuned large language models; S4. Establish a triple credibility identification framework to convert the output of each fine-tuned large language model into evidence form. The specific implementation process is as follows: Establish a triple credibility identification framework Θ = {θ1, θ2}, which contains two propositions: θ1 means that the triple does not exist, and θ2 means that the triple exists; The triplet input in the sample data set is fine-tuned into the model, and the probability value of the model output after fine-tuning is extracted as a positive sample or a negative sample. The output of the generative large language model is a sequence composed of multiple tokens; the probability value of the first token triplet label is output using the softmax function, and the probability value of the triplet label is converted into evidence form e i :[p i,0 ,p i,1 ] represents the evidence form of the output transformation of the i-th fine-tuning model, p i,0 Indicates the confidence that the triple does not exist, p i,1 Indicates the confidence of the existence of the triple, which is the probability value of the corresponding triple label; S5. Based on the consistency function and genetic algorithm, the reliability and importance weight parameters of the evidence are obtained. The specific process is as follows: The relative reliability R of each piece of evidence is obtained by Krippendorff's alpha function y,j , the calculation formula is as follows: Among them, α represents the consistency measure, D o represents the actual observed disagreement, D e represents the expected divergence, n represents the number of model fine-tuning times, L represents the number of sample data output by the model, and A ij represents the predicted label of the jth fine-tuned model for the i-th triplet, and F represents the total number of triples predicted by all fine-tuned models in the output sample data. a is the number of times the model predicts label a, F b is the number of times the model predicts label b, α j is the consistency measure of the j-th fine-tuning model result, α n is the consistency measure of the n-times fine-tuning results, λ and ε are normalization coefficients, and R y,j represents the relative reliability of the j-th piece of evidence obtained by Krippendorff's alpha function, and δ is the Kronecker delta function as follows: The uncertainty calculated by the model information entropy is used to measure the unreliability of evidence. The calculation formula is as follows: Among them, R x,j represents the unreliability of the jth piece of evidence calculated by the model information entropy, P a represents the probability of label a, and L represents the number of sample data output by the model; The reliability r calculation formula is as follows: r j =R y,j -R x,j Among them, r j represents the reliability of the jth piece of evidence, R y,j represents the relative reliability of the jth piece of evidence obtained by Krippendorff's alpha function, R x,j Indicates the unreliability of the j-th piece of evidence calculated by the model information entropy; The importance weight parameter w of the evidence is optimized using a genetic algorithm based on the output of the fine-tuning model, with a value range of [0,1], on the premise that r is calculated. S6, input the triples to be verified into n fine-tuned large language models respectively, and fuse the output results using the evidential reasoning method; S7. Make a decision based on the fused credibility distribution to obtain the credibility verification result of the triplet to be verified.

2. The knowledge graph triple credibility verification method based on a large language model according to claim 1 is characterized in that: The specific implementation process of step S2 is as follows: The triples in the graph are divided into a set of credible triples and a set of triples to be verified, denoted as S x and S d ; The set of all entities in the knowledge graph is denoted as T; The credible set S x The triples in are taken as positive samples, and then entities are randomly extracted from the entity set T, and the head entity or the tail entity of the positive sample triplet is replaced to generate a new negative sample triplet. The number of generated negative samples is consistent with the positive sample. Based on this, n negative samples are randomly generated, thereby constructing n sample data sets for fine-tuning the large language model; the input sequence required by the large language model is generated according to the sample data set.

3. The knowledge graph triple credibility verification method based on a large language model according to claim 2 is characterized in that: The specific implementation process of step S6 is as follows: The model is fine-tuned using n sample data sets to test the validation set and obtain n pieces of evidence. Then, the ER fusion algorithm is used to fuse the n pieces of evidence according to the reliability and weight parameters of the obtained evidence. The ER fusion algorithm is as follows: Among them, e n represents the evidence form of the n-times fine-tuned model output transformation, p 1,0 、p 1,1 Indicates the confidence of the existence and non-existence of the triple under evidence e1, p n,0 、p n,1 Indicates evidence n The reliability of the existence and non-existence of the lower triple; r and w represent the reliability and importance weight of the evidence, m n represents the evidence after integrating the importance weight w, Indicates the confidence that the triple does not exist after fusion, Indicates the confidence of the existence of the triple after fusion; m j,0 represents the jth piece of evidence m j The confidence that the triple does not exist in m j,1 The jth piece of evidence m j The confidence of the existence of the triple in .

4. The knowledge graph triple credibility verification method based on a large language model according to claim 3 is characterized in that: The specific implementation process of step S7 is: according to the credibility distribution after the fusion of n pieces of evidence, the subscript of the maximum credibility in the one-dimensional array is obtained by using the maximum index function argmax, and the decision result is obtained from the identification framework Θ={θ1,θ2} according to the subscript to obtain the credibility verification result of the triple to be verified.

Citation Information

Patent Citations

  • Food safety uplink data credibility measurement method based on block chain

    CN113591148A

  • Electric power heterogeneous knowledge fusion method based on D-S evidence theory

    CN114117078A