A method, medium and device for extracting geological entity relationships in earth science
By performing first-stage training and second-stage PPO optimization on the pre-trained language model, the adaptability and accuracy problems in geological entity relationship extraction are solved, more efficient model migration and generalization capabilities are achieved, and the intelligent analysis effect of geological big data is improved.
Patent Information
- Application Number
- CN202510854944.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-06-25
AI Technical Summary
The traditional geological entity relationship extraction method has low accuracy and poor generalization when dealing with complex and variable semantic scenarios. The deep learning model training process lacks adaptability and is prone to falling into local optimality, resulting in limited accuracy and robustness of relationship extraction.
The pre-trained language model based on BERT, RoBERTa-large and ALBERT-large-v1 is used for one-stage training, and the two-stage training is combined with the near-end strategy optimization algorithm (PPO). By defining reward functions and advantage functions suitable for relationship extraction tasks, the policy gradient update is restricted in real time and the model parameters are optimized.
The adaptability and accuracy of the model are improved, the instability and overfitting risks during the training process are reduced, and the migration and generalization capabilities of the model are enhanced in different geological scenarios.
Smart Images

Figure CN120354909B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of entity relationship extraction, and in particular to a method, medium, and equipment for extracting geological entity relationships in geoscience. Background Art
[0002] With the rapid development of geoscience, a large amount of unstructured geoscience literature has emerged, containing rich geological entity information and complex entity relationships. Traditional geological entity relationship extraction methods typically use rule-based or supervised learning approaches. The performance of these methods is highly dependent on manually defined features and rules, lacking adaptability and generalization capabilities. When dealing with complex and changing semantic scenarios, they often exhibit problems such as low accuracy and poor generalization. Therefore, researchers have proposed using deep learning models for entity relationship extraction to improve extraction performance and reduce the need for manual intervention.
[0003] In recent years, deep learning methods, represented by pre-trained language models such as BERT and SciBERT, have made significant progress in entity relationship extraction. However, these methods typically use a fixed loss function during training. Once the parameters are determined in the initial training phase, it is difficult to dynamically adjust the model strategy based on actual extraction results. This results in a lack of adaptability in the training process and a tendency to fall into local optimality, which limits the accuracy and robustness of relationship extraction.
[0004] The Proximal Policy Optimization (PPO) algorithm has been successfully applied in the field of reinforcement learning. By constraining the pace of policy updates, it avoids drastic fluctuations between the old and new policies, achieving a more stable and efficient policy optimization process. However, the traditional PPO algorithm has not been directly applied to entity relationship extraction tasks, and further improvements are needed to make it suitable for complex natural language processing scenarios. Summary of the Invention
[0005] The purpose of the present invention is to solve the instability and local optimum problems in the neural network model training process and propose a method for extracting geological entity relationships in geoscience, comprising the following steps:
[0006] S1. Obtain geoscience geological data, extract entities from it and generate labels, and divide the geological data, entities, and labels into training and test sets;
[0007] S2. Constructing a neural network model for extracting geological entity relationships, inputting the training set into the neural network model for one-stage training to obtain a model after one-stage training;
[0008] S3. Use the training set to perform a second-stage training on the model trained in the first stage to obtain a second-stage training model. The input of the second-stage training model is used as the state, the output is the action probability distribution, and the reward function and advantage function are set. A proximal policy optimization model is constructed to optimize the second-stage training model.
[0009] S4. Construct a joint loss function based on the loss function of the first-stage training and the loss function of the proximal strategy optimization model during the second-stage training;
[0010] S5. Use the test set to test the model after the second stage training, and use the tested model to extract geoscience geological entity relationships.
[0011] Furthermore, the reward function of the proximal policy optimization model is as follows:
[0012] ,
[0013] in, represents the reward function, x represents the input of the two-stage training model, and y represents the true label output by the two-stage training model. represents the normalized score of y by the two-stage training model, represents the normalized score of the two-stage training model for c, and c represents the set of true labels output by the non-two-stage training model.
[0014] Furthermore, the advantage function of the proximal policy optimization model is as follows:
[0015] ,
[0016] ,
[0017] ,
[0018] in, represents the advantage of the i-th sample relative to the baseline, represents the reward value of the i-th sample, b represents the baseline function, represents the attenuation coefficient, represents the average batch reward, and N represents the batch size.
[0019] Furthermore, the joint loss function is as follows:
[0020] ,
[0021] in, represents the joint loss, represents the loss of one stage training, represents the loss of the proximal strategy optimization model during the two-stage training, Represents the hyperparameters for adjusting weights.
[0022] Furthermore, the loss function of one-stage training is:
[0023] ,
[0024] in, Indicates that the i-th input is the label of the j-th output category, represents the probability that the i-th input is the j-th output category, N is the input batch size, and C is the total number of categories.
[0025] Furthermore, the loss function of the proximal strategy optimization model during the two-stage training is:
[0026] ,
[0027] ,
[0028] ,
[0029] ,
[0030] ,
[0031] in, Expressing hope, represents the strategy loss, represents the value function loss, represents the entropy regularization term, and represents the weight coefficient, represents the probability ratio, represents the parameters of the neural network trained in two stages, represents the advantage function, Represents a clipping operation. Limited to the range Inside, represents the value function, represents the reward function, Indicates that the new policy is in state Select Action The probability ratio of Indicates that the old policy is in state Select Action The probability ratio of .
[0032] The present invention also proposes a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the above-mentioned geoscience geological entity relationship extraction method.
[0033] The present invention also proposes an electronic device comprising a processor and a memory, wherein the processor and the memory are interconnected, wherein the memory is used to store a computer program, the computer program comprises computer-readable instructions, and the processor is configured to call the computer-readable instructions to execute the above-mentioned geoscience geological entity relationship extraction method.
[0034] The beneficial effects brought about by the technical solution provided by the present invention are:
[0035] The present invention first conducts one-stage training through a neural network model, and uses labeled data for supervised learning to quickly obtain better entity recognition and relationship classification effects; uses the one-stage training model for two-stage training, and introduces the PPO algorithm to further optimize the strategy, realizing the transformation from supervised learning to reinforcement learning. By defining a reward function and advantage function suitable for the relationship extraction task, with the help of PPO's unique clipping target mechanism, the amplitude of the policy gradient update is limited in real time, avoiding excessive parameter changes during the training process and reducing the risk of overfitting. In addition, the adaptive strategy optimization based on the reward signal can achieve more efficient model migration between different documents and different geological scenarios, solving the semantic diversity and concept drift problems that are difficult to handle with traditional methods, and can dynamically adjust the model parameters according to the actual extraction feedback, thereby continuously improving the adaptability and accuracy of the model during the extraction process. The present invention combines the initial robustness of supervised learning with the adaptability of the reinforcement learning stage, improves the efficiency of relationship extraction, and effectively reduces the instability during the training process, overcomes the local optimal problem, and better adapts to the intelligent analysis needs of geological big data in the field of earth science. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 This is a flow chart of a method for extracting geoscience geological entity relationships according to an embodiment of the present invention;
[0037] Figure 2 is a block diagram of an electronic device in an exemplary embodiment of the present invention;
[0038] Figure 3 The embodiment of the present invention uses the Bert-base-uncased model as the loss change of the first-stage training and the second-stage training of the neural network model;
[0039] Figure 4 The embodiment of the present invention uses the Bert-base-uncased model as the loss change of the first-stage training and the second-stage training of the neural network model;
[0040] Figure 5The embodiment of the present invention uses the Roberta-large model as the first-stage training loss change of the neural network model;
[0041] Figure 6 The embodiment of the present invention uses the Roberta-large model as the second-stage training loss change of the neural network model;
[0042] Figure 7 This is the change in the first-stage training loss when the Albert-large-v1 model is used as the neural network model in an embodiment of the present invention.
[0043] Figure 8 This is the change in loss for the two-stage training of the neural network model using the Albert-large-v1 model in an embodiment of the present invention. DETAILED DESCRIPTION
[0044] To make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described below with reference to the accompanying drawings.
[0045] The flowchart of the method for extracting geoscience geological entity relationships according to the embodiment of the present invention is as follows: Figure 1 , specifically including the following steps:
[0046] S1. Obtain earth science geological data, extract entities from it and generate entity relationship annotation labels, and divide the geological data, entities and labels into training sets and test sets.
[0047] Entities in geoscience geological data are precisely extracted using geoscience dictionaries and the opinions of geological experts, ensuring their professionalism and accuracy. Geological dictionaries such as the "Geological Dictionary" are comprehensive, covering five major disciplines: atmospheric science, geography, geology, geophysics, and ocean science. Each discipline consists of a general introduction and sub-disciplines. The entire dictionary constructs a disciplinary knowledge tree based on the disciplinary knowledge system. This tree selects terms, determines their levels, and arranges them in order. Labels are generated based on a set of geoscience rules and expert opinions, ensuring high quality and reliability of data labels. The entity relationships in the dataset are evenly distributed, ensuring the representativeness of the data.
[0048] Converting the data into a format suitable for neural networks lays the foundation for subsequent model training and evaluation. Ultimately, the dataset is divided into training samples and test samples. The training samples are used for model training, while the test samples are used to verify the model's effectiveness and ensure its generalization ability.
[0049] S2. Construct a neural network model for geological entity relationship extraction, input the training set into the neural network model for one-stage training, use labels for supervised learning, and obtain a model after one-stage training.
[0050] Neural network models used for geological entity relationship extraction include: BERT-base-uncased, RoBERTa-large, and ALBERT-large-v1. These pre-trained models are all based on the Transformer architecture and possess powerful language understanding capabilities. BERT-base-uncased provides deep language representation through bidirectional contextual learning, RoBERTa-large achieves stronger performance across multiple tasks through improved training strategies, and ALBERT-large-v1 reduces computational resource consumption while maintaining efficient performance through parameter sharing and matrix factorization.
[0051] By training these models, we can adapt them to specific task requirements, such as entity relationship extraction, thereby further improving the accuracy and generalization ability of the models. The hyperparameters of the experiment were set, including the maximum sequence length (128), batch size (8), number of training epochs (3), and the use of AdamW optimizer and learning rate (2e-5). During the training process, each batch of data is first passed into the model for feedforward calculation. The model generates predicted logits based on the input sentences and entities and calculates the loss value. Then, the gradient of each model parameter is calculated through backpropagation, and the weight is updated using the optimizer. The training loss of each epoch is recorded and visualized to track the convergence of the model. After training, the model performance is evaluated on the test set, and the accuracy, recall rate and F1 score are calculated to verify the effect of the model. The whole process continuously optimizes the model through feedforward and backpropagation, gradually improving the performance of the model in the task of extracting entity relationships in geoscience.
[0052] The loss function of the first stage training of the neural network model is:
[0053] ,
[0054] in, Indicates that the i-th input is the label of the j-th output category, represents the probability that the i-th input is the j-th output category, N is the input batch size, and C is the total number of categories.
[0055] S3. Use the training set to perform a second-stage training on the model after the first-stage training to obtain the second-stage training model. The input of the second-stage training model is used as the state, and the output is the action probability distribution. The reward function and advantage function are set. The strategy represents the probability distribution of which actions the second-stage training model takes under a given state (input). A proximal policy optimization model is constructed to optimize the second-stage training model.
[0056] The construction of the proximal policy optimization model includes the following steps:
[0057] 1. Define the state, action, and reward function.
[0058] The input of the two-stage training model is the state of the proximal policy optimization model, and the output of the two-stage training model is the action probability distribution. The reward function is as follows:
[0059] ,
[0060] in, represents the reward function, when When the value is large, it means that the model's confidence in the correct category is much higher than any wrong category; x represents the input of the two-stage training model, and y represents the true label output by the two-stage training model. represents the normalized score of y by the two-stage training model, represents the normalized score of the two-stage training model for c, and c represents the set of true labels output by the non-two-stage training model.
[0061] 2. Calculate the advantage function to evaluate the performance of a certain action relative to the average performance in the state (advantage function). The advantage function is as follows:
[0062] ,
[0063] ,
[0064] ,
[0065] in, represents the advantage of the i-th sample relative to the baseline, represents the reward value of the i-th sample, b represents the baseline function, and the initial value is R; represents the attenuation coefficient, represents the average batch reward, and N represents the batch size.
[0066] 3. Calculate the probability ratio:
[0067] ,
[0068] in, represents the probability ratio, represents the parameters of the neural network trained in two stages, Indicates that the new policy is in state Select Action The probability ratio of Indicates that the old policy is in state Select Action The probability ratio of .
[0069] 4. Strategy Update:
[0070] If the update is too large (out of the clipping range ), will be penalized to ensure that the update is moderate, neither too conservative nor too aggressive. The policy loss is:
[0071] ,
[0072] in, represents the strategy loss, Expressing hope, represents the advantage function, Represents a clipping operation. Limited to the range Inside.
[0073] 5. Update the value function and optimize the value function using the following loss function:
[0074] ,
[0075] in, represents the value function loss, represents the value function, represents the reward function.
[0076] 6. The loss function of the proximal strategy optimization model when constructing the two-stage training is:
[0077] ,
[0078] in, represents the loss of the proximal strategy optimization model during the two-stage training, and Represents the weight coefficient. Repeat the above steps: Through multiple rounds of iteration, the strategy is gradually optimized until convergence.
[0079] S4. Based on the loss function of the first-stage training and the loss function of the proximal strategy optimization model during the second-stage training, a joint loss function is constructed. The joint loss function is as follows:
[0080] ,
[0081] in, represents the joint loss, represents the loss of one stage training, represents the loss of the proximal strategy optimization model during the two-stage training, Represents the hyperparameters for adjusting weights.
[0082] S5. Use the test set to test the model after the second stage training, and use the tested model to extract geoscience geological entity relationships.
[0083] Set different iterative training cycles. After each iterative training cycle is completed, test the model after the second stage training with test samples and calculate the loss data; adjust the structural parameters of the network model through the loss function calculation.
[0084] In an exemplary embodiment, a computer-readable storage medium is included, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned geoscience geological entity relationship extraction method is implemented.
[0085] See also Figure 2 In an exemplary embodiment, an electronic device is also included, including at least one processor, at least one memory, and at least one communication bus.
[0086] Wherein, a computer program is stored in the memory, and the computer program includes computer-readable instructions. The processor calls the computer-readable instructions stored in the memory through a communication bus to execute the above-mentioned geoscience geological entity relationship extraction method.
[0087] In order to verify the effectiveness of the proposed method, a data set containing more than 15,000 data was obtained for the extraction of geological entity relationships in geosciences. The hyperparameters of the experiment were set, including the maximum sequence length (128), batch size (8), number of training cycles (3), and the use of AdamW optimizer and learning rate (2e -5 ).
[0088] The results of the one-stage training and one-stage evaluation using the Bert-base-uncased model as the neural network model are shown in Table 1. The results of the two-stage training and two-stage evaluation using the Bert-base-uncased model are shown in Table 2. The loss changes of the one-stage training and two-stage training using the Bert-base-uncased model as the neural network model are shown in Table 2. Figure 3 and Figure 4 .
[0089] The results of the one-stage training and one-stage evaluation using the Roberta-large model as the neural network model are shown in Table 3. The results of the two-stage training and two-stage evaluation using the Roberta-large model as the neural network model are shown in Table 4. Figure 5 and Figure 6 .
[0090] The results of the one-stage training and one-stage evaluation using the Albert-large-v1 model as the neural network model are shown in Table 5. The results of the two-stage training and two-stage evaluation using the Albert-large-v1 model as the neural network model are shown in Table 6. Figure 7 and Figure 8 .
[0091] Among them, three rounds of first-stage and second-stage training are selected, and the loss of each round is calculated. The evaluation indicators of the first and second stages are F1 score, Recall rate and Accuracy rate.
[0092] Table 1
[0093]
[0094] Table 2
[0095]
[0096] It can be clearly seen from Tables 1 and 2 that after the second stage of optimization: F1 increased by 1.78%, Recall increased by 2.61%, and Accuracy increased by 2.76%. The initial loss of the second stage of training was significantly lower than the loss at the end of the first stage (from 0.0653 to 0.0261).
[0097] Table 3
[0098]
[0099] Table 4
[0100]
[0101] It can be clearly seen from Tables 3 and 4 that after the second stage of optimization: F1 increased by 1.28%, Recall increased by 2.29%, and Accuracy increased by 0.86%. The initial loss of the second stage of training was significantly lower than the loss at the end of the first stage (from 0.1297 to 0.0518).
[0102] Table 5
[0103]
[0104] Table 6
[0105]
[0106] It can be clearly seen from Tables 5 and 6 that after the second stage of optimization: F1 increased by 2.21%, Recall increased by 1.32%, and Accuracy increased by 2.14%. The initial loss of the second stage of training was significantly lower than the loss at the end of the first stage (from 0.0820 to 0.0227).
[0107] In summary, (1) the improvement in F1 indicates that the overall performance of the model has steadily improved, and the balance between precision and recall has been further optimized; the improvement in Recall has greatly reduced missed detections and improved the model's ability to capture key information; the improvement in Accuracy indicates that the credibility of the prediction results has been significantly enhanced and the model's generalization ability has been improved. (2) The initial loss of the second-stage training is lower than the loss at the end of the first stage, which indicates that the model training has better convergence and the parameter optimization is more refined. (3) The stable and significant improvement in indicators not only proves the effectiveness of continued training, but also proves the effectiveness of the parameter strategy, training method and anti-overfitting strategy adopted in the second stage. (4) The necessity of the second-stage training: When the performance of the first-stage model is close to the limit, continuing the second-stage training will usually only bring about a small or even stagnant improvement in indicators; if the training strategy is inappropriate (such as improperly setting regularization or adjusting the learning rate), it may lead to overfitting of the model and performance degradation. Therefore, the significant performance improvement of the second-stage training in this experiment shows that the model has not yet reached a bottleneck and there is still room for further optimization. In addition, this significant improvement also clearly verifies the effectiveness of the parameter optimization and strategy design adopted in the second-stage training, reflecting the good generalization ability of the model. In other words, the second-stage training does not simply increase the number of training rounds, but further taps into the data potential through more refined parameter adjustments and optimization strategies (such as learning rate decay and regularization), more comprehensively demonstrating the model's performance advantages and optimization space. This shows that the second-stage training is very necessary and effective in this experiment.
[0108] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not limited to the embodiments shown herein but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for extracting geological entity relationships in geoscience, characterized in that: The following steps are involved: S1. Obtain geoscience geological data, extract entities from it and generate labels, and divide the geological data, entities, and labels into training and test sets; S2. Constructing a neural network model for extracting geological entity relationships, inputting the training set into the neural network model for one-stage training to obtain a model after one-stage training; S3. Use the training set to perform a second-stage training on the model trained in the first stage to obtain a second-stage training model. The input of the second-stage training model is used as the state, the output is the action probability distribution, and the reward function and advantage function are set. A proximal policy optimization model is constructed to optimize the second-stage training model. S4. Construct a joint loss function based on the loss function of the first-stage training and the loss function of the proximal strategy optimization model during the second-stage training; S5. Use the test set to test the model after the second stage training, and use the tested model to extract geoscience geological entity relationships; The reward function of the proximal policy optimization model is as follows: , in, represents the reward function, x represents the input of the two-stage training model, and y represents the true label output by the two-stage training model. represents the normalized score of y by the two-stage training model, represents the normalized score of the two-stage training model for c, and c represents the set of true labels output by the non-two-stage training model; The advantage function of the proximal policy optimization model is as follows: , , , in, represents the advantage of the i-th sample relative to the baseline, represents the reward value of the i-th sample, b represents the baseline function, represents the attenuation coefficient, represents the average batch reward, and N represents the batch size.
2. A method for extracting geological entity relationships in geoscience according to claim 1, characterized in that: The joint loss function is as follows: , in, represents the joint loss, represents the loss of one stage training, represents the loss of the proximal strategy optimization model during the two-stage training, Represents the hyperparameters for adjusting weights.
3. A method for extracting geoscience geological entity relationships according to claim 2, characterized in that: The loss function of one-stage training is: , in, Indicates that the i-th input is the label of the j-th output category, represents the probability that the i-th input is the j-th output category, N is the input batch size, and C is the total number of categories.
4. A method for extracting geoscience geological entity relationships according to claim 2, characterized in that: The loss function of the proximal strategy optimization model during the two-stage training is: , , , , , in, Expressing hope, represents the strategy loss, represents the value function loss, represents the entropy regularization term, and represents the weight coefficient, represents the probability ratio, represents the parameters of the neural network trained in two stages, represents the advantage function, Represents a clipping operation. Limited to the range Inside, represents the value function, represents the reward function, Indicates that the new policy is in state Select Action The probability ratio of Indicates that the old policy is in state Select Action The probability ratio of .
5. A computer-readable storage medium storing a computer program, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
6. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the processor and the memory are interconnected, wherein the memory is used to store a computer program, the computer program includes computer-readable instructions, and the processor is configured to call the computer-readable instructions to execute the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Fine-grained Chinese geological entity spatial relationship joint extraction method and system
CN119474248A
Auditing domain knowledge graph ontology framework construction method based on large language model
CN119647580A