Reason-based verification and feedback-enhanced large model relationship extraction method and system
By collecting unbiased and biased reasons through causal intervention and observation methods, training a reason supervisor, and iteratively correcting the predictions of the large language model, the problem of lacking correction for biased predictions in relation extraction of the large language model is solved, and more accurate relation extraction is achieved.
Patent Information
- Application Number
- CN202411701239.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2044-11-26
AI Technical Summary
Existing relation extraction methods based on large language models lack verification and feedback mechanisms to correct biased predictions, which limits the performance of relation extraction.
A causal intervention and observation method is used to collect unbiased and biased justifications, train a justification supervisor, and correct the predictions of a large language model through iterative validation and feedback.
It improves the accuracy of large language models in relation extraction, and corrects biased predictions through validation and feedback mechanisms, thereby enhancing the performance of relation extraction.
Smart Images

Figure CN119692354B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of large model relationship extraction, and in particular relates to a large model relationship extraction method and system based on reason verification and feedback enhancement. Background Art
[0002] With the rapid development of information technology and the internet, big-model relationship extraction technology is enabling smarter, more personalized services and experiences, from search engines to social media to smart assistants. In search engines, it accurately understands user search intent and quickly presents the most relevant search results, making information retrieval more efficient and convenient. On social media platforms, big-model relationship extraction not only strengthens connections between users but also uncovers user interests and trending topics, fostering deeper and broader social interactions and providing users with a richer social experience. Smart assistants and chatbots leverage this technology to not only more accurately understand user needs but also provide smarter, more personalized services and recommendations based on personalized preferences and habits. In healthcare, the application of big-model relationship extraction technology can accelerate the acquisition of medical information and decision-making, significantly improving the quality of medical services.
[0003] The relation extraction task aims to extract semantic relationships between entities in text, which is an important task in information extraction. Unlike previous fine-tuning strategies based on small language models, recent research has leveraged the powerful instruction understanding capabilities and rich intrinsic knowledge of large language models to improve the performance of relation extraction. Although this approach has made significant progress, methods based on large language models may suffer from relation bias when forming relation extraction. In addition, existing relation extraction methods based on large language models focus on pre-selection of contextual demonstrations or instruction design to improve performance, so current relation extraction research based on large language models still lacks verification and feedback mechanisms to correct biased predictions. Summary of the Invention
[0004] One object of the present invention is to address the shortcomings of the existing technology and provide a large model relationship extraction method based on reason verification and feedback enhancement. The method trains a reason supervisor and uses it to not only verify the predictions of the large language model, but also provide new demonstration improvement feedback for correction during the reasoning process.
[0005] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0006] A large model relationship extraction method based on reason verification and feedback enhancement includes the following steps:
[0007] Step 1: Use causal intervention and observation methods to collect unbiased and biased reasons for the large language model;
[0008] Step 2: Train the justification supervisor using the unbiased and biased justifications obtained in step 1.
[0009] Step 3: Use the trained justification supervisor to iteratively verify the output justification and provide feedback to correct the large language model based on the verified deviation justification to guide the large language model to make more accurate predictions.
[0010] Furthermore, the implementation in step 1 includes two steps: inducing unbiased reasons and observing biased reasons.
[0011] Furthermore, the implementation of inducing unbiased reasons includes:
[0012] Cutting off the deviation Impact prediction The causal direction is to only provide the text of the gold label in the input prompt, so that the gold label can guide the large language model to generate reasons through context learning. , the reason for observing the generation of large language models is ;
[0013] Reasons Perform intervention operations, that is, only provide observation reasons in the input prompt The text is then used to guide the large language model to generate the label of the given text through context learning. ;if The observation value is equal to the gold label , then Reasons for being considered as no deviation.
[0014] Furthermore, some implementations of observational bias reasons include:
[0015] For labeled samples ,in, Represents the input sample sentence and head and tail entities, Represents the relationship label between the head and tail entities, Represents the sample sequence number, randomly selects a context example set with different labels ,in, comes from a set of labeled samples, and The label of each demonstration is not equal to the label of the observed sample ;
[0016] The context example Set to From Sample ,in, Indicates the explanation of the sample relationship label. Indicates the sample number, that is, only the sample is provided in the input prompt , guiding the large language model to generate predicted labels through contextual learning;
[0017] If the predicted labels of the observed large language model are inconsistent with the sample annotated labels, the reasons generated by the observed large language model are regarded as biased reasons.
[0018] Furthermore, in step 2, the contrastive learning method is used to train the reason supervisor so that the reason supervisor can obtain the following capabilities:
[0019] Identify reasons for bias and non-bias;
[0020] Learn the differences in the various reasons for the deviations.
[0021] Furthermore, the specific method of training the reason supervisor includes:
[0022] Design positive and negative pairs for comparative training, where the unbiased reasons with the same golden relationship label and the biased reasons under the same bias situation are used as positive pairs, and the biased and unbiased reasons from the same sample are used as negative pairs. Use positive and negative pairs to train the reason supervisor so that the reason supervisor can distinguish between biased and unbiased reasons.
[0023] And according to different deviation situations, corresponding biased reasons are used to train the reason supervisor, so that the reason supervisor can distinguish different deviation situations and provide feedback according to the biased reasons during reasoning.
[0024] Furthermore, the loss of contrastive learning is calculated as follows:
[0025]
[0026]
[0027] in, , ; and represents two pairs of sets, and Represents two sets of negative pairs, 、 Indicates the reasons for the deviation of the two positive sets, Represents the temperature hyperparameter and uses dot product as the similarity function ;
[0028] During the contrastive training process, update Parameters , so that minimize.
[0029] Furthermore, the method of verifying the output reason using the trained reason supervisor includes:
[0030] The set of bias reasons collected from step 1 and unbiased reason set Select and predict labels with large language models Related subsets and , which is then used as an anchor point to determine whether the current output justification is close to the biased or unbiased group, and The definition is as follows:
[0031]
[0032]
[0033] Where, Indicates a subset of bias reasons There are reasons for deviation, represents an unbiased reason subset The unbiased reason in Indicates reasons for deviation The corresponding biased relationship type, represents an unbiased relationship type;
[0034] Then, judge the prediction reason of the large language model The bias index score is calculated as follows:
[0035]
[0036] Among them, dot product is used as the similarity function ,when When it is greater than 0, it means The characteristic ratio The characteristic field is closer to The characteristic field of and the corresponding relationship predictions It is considered to be biased and needs to be corrected.
[0037] Furthermore, the method of providing feedback based on the verified bias reasons to correct the large language model includes:
[0038] When the prediction reason was verified to be biased, first in The semantic similarity retrieval method of the reason text is used to select The most similar reason for deviation, expressed as , defined as:
[0039]
[0040] k Indicates the search ranking range set during the similarity search process;
[0041] Then, from Select and The labeled samples corresponding to the biased reasons in are used as feedback demonstrations , defined as:
[0042]
[0043] in, Corresponding to the sample Reasons for deviation and predictions;
[0044] In Select Feedback Demo Afterwards, the large language model By Regenerate justification as an example in contextual learning and predicted labels ,Right now ;
[0045] After the generation, the aforementioned reason verification step will be re-executed, that is, the whole process will be iterated until the reason generated by the large language model is It is verified to be unbiased in the justification verification step, and the corresponding unbiased relationship prediction will be output eventually .
[0046] Another object of the present invention is to provide a system for implementing the above-mentioned large model relationship extraction method based on reason verification and feedback enhancement, comprising:
[0047] A data collection module, used to collect unbiased and biased reasons for large language models using causal intervention and observation methods;
[0048] A supervisor training module is used to train a reason supervisor based on the collected unbiased reasons and biased reasons;
[0049] The large language model correction module is used to iteratively verify the output reasons using the trained reason supervisor and provide feedback based on the verified deviation reasons to correct the large language model, so as to guide the large language model to make better predictions.
[0050] Compared with the prior art, the present invention has the following beneficial effects: In response to the problem that there is still a lack of verification and feedback mechanisms for correcting biased predictions in the research on relationship extraction of large language models, the present invention provides a relationship extraction framework that checks whether the relationship predictions of large language models are biased by verifying reasons, and provides automatic feedback for relevance based on this. This framework is used to solve two problems existing in existing methods in relationship extraction: one is that they are designed for other tasks, such as reasoning tasks, and the feedback goals are also tailored for these tasks, so they cannot be directly applied to the feedback framework design of relationship extraction tasks; the other is that existing methods do not include any demonstration in their feedback; the present invention proposes a novel automatic feedback framework that trains a reason supervisor and uses it to not only verify predictions but also correct the biased predictions of large language models in relationship extraction tasks through verification feedback; in addition, the present invention proposes a causal intervention and observation method for collecting unbiased and biased reasons to train the reason supervisor, and uses the trained reason supervisor to iteratively improve the ability of the large language model in correcting biased predictions through a verification-feedback-correction process. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 A flowchart of a method for collecting unbiased and biased justifications for an embodiment of the present invention;
[0052] Figure 2 A diagram showing the steps for training a reason supervisor according to an embodiment of the present invention;
[0053] Figure 3 A diagram of the verification feedback correction process of the present invention using a reason supervisor during reasoning. DETAILED DESCRIPTION
[0054] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0055] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0056] The present invention will be further described below with reference to specific examples, but they are not intended to limit the present invention.
[0057] Since training a reason supervisor requires collecting both unbiased and biased reasons, and the purpose and method of collecting reasons in existing verification methods are not suitable for relationship extraction tasks, in view of this, an embodiment of the present invention provides a large-model relationship extraction method based on reason verification and feedback enhancement, comprising the following steps:
[0058] Step 1: Use causal intervention and observation methods to collect unbiased and biased reasons for the large language model;
[0059] The implementation of this step includes: "inducing unbiased reasons" and "observing biased reasons". Figure 1 As shown in (a), its implementation method includes:
[0060] Sub-step 1: Cut off possible deviations Impact prediction The causal direction is to not give any text other than the gold label in the input prompt, and let the gold label guide the large language model to generate reasons through context learning. , formally expressed as intervention operation and ,in, y i It is said that the reason for observing the generation of large language models is ;
[0061] Sub-step 2: Reason Perform similar interventions, i.e., do not give any reason for observation in the input prompt. The text outside is formally expressed as , , and then guide the large language model to generate the label observation of the sample through context learning ;if The observation value is equal to the gold label , then Reasons for being considered as no deviation.
[0062] In the step of “observing the reasons for the deviation”, as shown in the attached Figure 1 (b), its implementation methods include:
[0063] For labeled samples ( Represents the input sample sentence and head and tail entities, Represents the relationship label between the head and tail entities, represents the sample number), first randomly select a context example set with different labels ,in comes from a set of labeled samples, and The label of each demonstration is not equal to the label of the observed sample ;
[0064] Next, the context example Set to From Sample ( Represents the input sample sentence and head and tail entities, Indicates the explanation of the sample relationship label. Represents the relationship label between the head and tail entities, Indicates the sample number), that is, no sample is given in the input prompt. External text, formally represented as intervention operations , guiding the large model to generate predicted labels through context learning. At this time, if the predicted labels of the large language model are observed to be inconsistent with the sample labels, the reasons generated by the observed large language model will be regarded as biased reasons. The unbiased reasons and biased reasons obtained in the above steps will be added to the unbiased set and deviation set middle.
[0065] Step 2: Reason Supervisor Training. Train the reason supervisor using the unbiased reasons and biased reasons obtained in step 1.
[0066] like Figure 2 As shown, this step uses the unbiased and biased reasons obtained in step 1 as training data. At this stage, the reason supervisor is expected to verify whether the output reason is biased and provide different feedback for different bias situations to correct the initial prediction. To achieve this, this embodiment uses contrastive learning to train the reason supervisor to acquire two capabilities: distinguishing biased and unbiased reasons and learning the differences between various biased reasons.
[0067] In this embodiment, two positive and negative pairs are designed for comparative training. Specifically, the unbiased reasons with the same golden relationship label (e.g. →← ) and the reasons for the deviation in the same deviation situation (e.g. →← ) as two positive pairs. The biased and unbiased reasons from the same sample (e.g. ↔ ) as negative pairs, and train the reason supervisor through positive and negative pairs to enable it to distinguish biased and unbiased reasons. Then, the corresponding biased reason pairs (e.g. ↔ and ↔ ) train a justification supervisor such that the trained justification supervisor can distinguish different bias cases and provide feedback based on the biased justifications during inference.
[0068] In this embodiment, the contrast loss is calculated as follows:
[0069]
[0070]
[0071] in , , and represents two pairs of sets, and Represents two sets of negative pairs, 、 Indicates the reason for the deviation between the two sets of positive pairs. This embodiment uses the dot product as the similarity function , and add the temperature hyperparameter To pay more attention to the difficult pairs. In the process of rational comparison training, update Parameters ,make minimize.
[0072] Step 3: Use the trained justification supervisor to iteratively verify the output justification and provide feedback to correct the large language model based on the verified deviation justification to guide the large language model to make more accurate predictions.
[0073] In the reason verification and feedback phase, this embodiment uses a trained reason supervisor To iteratively verify the output reasons and provide feedback based on the verified deviation reasons to guide the large language model to make better predictions. Figure 3 As shown, in this embodiment, it is divided into three steps, and the implementation process of each step is described below.
[0074] 1) Reason Verification
[0075] In order to verify whether the reason prediction is biased, we need to get the deviation set from step 1 and unbiased sets Selection and prediction of large prediction models Related subsets and , which is then used as an anchor point to determine whether the current output justification is close to the biased or unbiased group. and The definition is as follows:
[0076]
[0077]
[0078] Where, Indicates a subset of bias reasons There are reasons for deviation, represents an unbiased reason subset The unbiased reason in Indicates reasons for deviation The corresponding biased relationship type, represents the unbiased relationship type (i.e., the true label of the sample);
[0079] Then, judge the large language model relationship extraction prediction reason The bias index score is calculated as follows:
[0080]
[0081] Among them, the similarity function Defined in step 2. When When it is greater than 0, it means The characteristic ratio The characteristic field is closer to characteristic field, which means and the corresponding relationship predictions should be considered as biased and feedback is needed to correct them.
[0082] 2) Feedback Demonstration Retrieval
[0083] Once the reason is output If it is verified to be biased, it needs to be The feature of retrieval is a new set of contextual demonstrations to guide the large language model to make better predictions. Specifically, first in The semantic similarity retrieval method of the reason text is used to select The most similar reason for deviation, expressed as , defined as:
[0084]
[0085] k Indicates the search ranking range set during the similarity search process;
[0086] Then, from Select and The labeled samples corresponding to the biased reasons in are used as feedback demonstrations , defined as:
[0087]
[0088] in, Corresponding to the sample Reasons and predictions for deviations.
[0089] 3) Correction through contextual learning
[0090] In Select Feedback Demo Afterwards, we use a large language model By Regenerate justification as an example in contextual learning and predicted labels ,Right now After the generation, the aforementioned reason verification steps will be re-executed, that is, the whole process will be iterated until the reason for the large model generation is It is verified to be unbiased in the justification verification step, and the corresponding unbiased relationship prediction will be output eventually For example, for the input sample "Sentence: Someone has been working at YY Company for 3 years. Head entity: 'Someone'; tail entity: 'YY Company'", without iterative correction, the large language model may output an incorrect relationship prediction "Head entity and tail entity relationship: 'Person: Creator'" (this may be due to interference from the large model training corpus or initial incorrect context examples). After iterative correction, the large language model gives the correct prediction "Head entity and tail entity relationship: 'Person: Employee'".
[0091] An embodiment of the present invention further provides a system for implementing the above-mentioned large model relationship extraction method based on reason verification and feedback enhancement, comprising:
[0092] A data collection module, used to collect unbiased and biased reasons for large language models using causal intervention and observation methods;
[0093] A supervisor training module is used to train a reason supervisor based on the collected unbiased reasons and biased reasons;
[0094] The large language model correction module is used to iteratively verify the output reasons using the trained reason supervisor and provide feedback based on the verified deviation reasons to correct the large language model, so as to guide the large language model to make better predictions.
[0095] The above are only preferred embodiments of the present invention and do not limit the implementation mode and protection scope of the present invention. For those skilled in the art, it should be aware that all solutions obtained by equivalent substitutions and obvious changes made using the contents of the present invention specification should be included in the protection scope of the present invention.
Claims
1. A large model relationship extraction method based on reason verification and feedback enhancement, characterized in that: The following steps are involved: Step 1: Use causal intervention and observation methods to collect unbiased and biased reasons for the large language model; Step 2: Train the justification supervisor using the unbiased and biased justifications obtained in step 1. Step 3: Use the trained justification supervisor to iteratively verify the output justification and provide feedback based on the verified deviation justification to correct the large language model to guide the large language model to make more accurate predictions; Among them, the method of using the trained reason supervisor to verify the output reason includes: The set of bias reasons collected from step 1 and unbiased reason set Select and predict labels with large language models Related subsets and , which is then used as an anchor point to determine whether the current output justification is close to the biased or unbiased group, and The definition is as follows: Where, Indicates a subset of bias reasons There are reasons for deviation, represents an unbiased reason subset The unbiased reason in Indicates reasons for deviation The corresponding biased relationship type, represents an unbiased relationship type; Then, judge the prediction reason of the large language model The bias index score is calculated as follows: Among them, dot product is used as the similarity function ,when When it is greater than 0, it means The characteristic ratio The characteristic field is closer to The characteristic field of and the corresponding relationship predictions It is considered to be deviant and needs to be corrected; Methods for correcting large language models by providing feedback based on validated bias justifications include: When the prediction reason was verified to be biased, first in The semantic similarity retrieval method of the reason text is used to select The most similar reason for deviation, expressed as , defined as: k Indicates the search ranking range set during the similarity search process; Then, from Select and The labeled samples corresponding to the biased reasons in are used as feedback demonstrations , defined as: in, Corresponding to the sample Reasons for deviation and predictions; In Select Feedback Demo Afterwards, the large language model By Regenerate justification as an example in contextual learning and predicted labels ,Right now ; After the generation, the aforementioned reason verification step will be re-executed, that is, the whole process will be iterated until the reason generated by the large language model is It is verified to be unbiased in the justification verification step, and the corresponding unbiased relationship prediction will be output eventually .
2. The large model relationship extraction method based on reason verification and feedback enhancement according to claim 1 is characterized in that: The implementation in step 1 consists of two steps: inducing unbiased reasons and observing biased reasons.
3. The large model relationship extraction method based on reason verification and feedback enhancement according to claim 2 is characterized in that: Ways to induce unbiased reasons include: Cutting off the deviation Impact prediction The causal direction is to only provide the text of the gold label in the input prompt, so that the gold label can guide the large language model to generate reasons through context learning. , the reason for observing the generation of large language models is ; Reasons Perform intervention operations, that is, only provide observation reasons in the input prompt The text is then used to guide the large language model to generate the label of the given text through context learning. ;if The observation value is equal to the gold label , then Reasons for being considered as no deviation.
4. The large model relationship extraction method based on reason verification and feedback enhancement according to claim 2 is characterized in that: Ways to implement observation biased justification include: For labeled samples ,in, Represents the input sample sentence and head and tail entities, Represents the relationship label between the head and tail entities, Represents the sample sequence number, randomly selects a context example set with different labels ,in, comes from a set of labeled samples, and The label of each demonstration is not equal to the label of the observed sample ; The context example Set to From Sample ,in, Indicates the explanation of the sample relationship label. Indicates the sample number, that is, only the sample is provided in the input prompt , guiding the large language model to generate predicted labels through contextual learning; If the predicted labels of the observed large language model are inconsistent with the sample annotated labels, the reasons generated by the observed large language model are regarded as biased reasons.
5. The large model relationship extraction method based on reason verification and feedback enhancement according to claim 1 is characterized in that: In step 2, the contrastive learning method is used to train the reason supervisor so that the reason supervisor can obtain the following capabilities: Identify reasons for bias and non-bias; Learn the differences in the various reasons for the deviations.
6. The large model relationship extraction method based on reason verification and feedback enhancement according to claim 5 is characterized in that: The specific methods for training the justification supervisor include: Design positive and negative pairs for comparative training, where the unbiased reasons with the same golden relationship label and the biased reasons under the same bias situation are used as positive pairs, and the biased and unbiased reasons from the same sample are used as negative pairs. Use positive and negative pairs to train the reason supervisor so that the reason supervisor can distinguish between biased and unbiased reasons. And according to different deviation situations, corresponding biased reasons are used to train the reason supervisor, so that the reason supervisor can distinguish different deviation situations and provide feedback according to the biased reasons during reasoning.
7. The large model relationship extraction method based on reason verification and feedback enhancement according to claim 6 is characterized in that: The loss for contrastive learning is calculated as follows: in, , ; and represents two pairs of sets, and Represents two sets of negative pairs, 、 Indicates the reasons for the deviation of the two positive sets, Represents the temperature hyperparameter and uses dot product as the similarity function ; During the contrastive training process, update Parameters , so that minimize.
8. A system for implementing the large model relationship extraction method based on reason verification and feedback enhancement according to any one of claims 1 to 7, characterized in that: include: A data collection module, used to collect unbiased and biased reasons for large language models using causal intervention and observation methods; A supervisor training module is used to train a reason supervisor based on the collected unbiased reasons and biased reasons; The large language model correction module is used to iteratively verify the output reasons using the trained reason supervisor and provide feedback based on the verified deviation reasons to correct the large language model, so as to guide the large language model to make better predictions.
Citation Information
Patent Citations
Task processing method, traffic task processing method and task processing model training method
CN117971420A
Digital Platform for Trading and Management of Investment Securities
US20220138280A1