Method, medium, device and product for named entity recognition of bio-environmental text
By employing a proximal strategy optimization algorithm and a dynamic factor calculation method in named entity recognition of biological environment text, the adaptiveness and stability issues in the model training process are resolved, resulting in more efficient named entity recognition performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA UNIV OF GEOSCIENCES (WUHAN)
- Filing Date
- 2026-02-06
- Publication Date
- 2026-05-01
AI Technical Summary
Existing deep learning models lack adaptability during training in biological environment text named entity recognition. The unreasonable design of the reward function and the fixed discount factor in the PPO optimization algorithm lead to unstable updates, affecting the accuracy and robustness of the model.
A proximal strategy optimization algorithm is adopted, which calculates the reward function by the cosine similarity of the embedded vectors and uses dynamic discount factor and dynamic balance factor to calculate the advantage function, thereby optimizing the model parameters and improving the training process of the language model.
It improves the model's update stability and convergence, enhances the accuracy and generalization ability of named entity recognition, and performs particularly well when dealing with complex biological environment text.
Smart Images

Figure CN121659944B_ABST
Abstract
Description
Named entity recognition methods, media, equipment and products for biological environmental text Technical Field
[0001] This invention relates to the field of biological environmental entity recognition technology, and in particular to named entity recognition methods, media, devices and products for biological environmental text. Background Technology
[0002] With the rapid development of the field of biological environment, a large number of unstructured biological environment-related documents have emerged, containing rich information on biological environment entities and complex entity relationships. Traditional methods for extracting biological environment entities typically employ rule-based or supervised learning approaches. The performance of these methods is highly dependent on manually defined features and rules, lacking adaptability and generalization ability. When dealing with complex and variable semantic scenarios, they often exhibit low accuracy and poor generalization. Therefore, researchers propose using deep learning models for entity relationship extraction to improve extraction performance and reduce the degree of human 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 relation extraction tasks. However, these methods typically employ 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 the actual extraction results. This leads to a lack of adaptability in the training process, making it prone to getting trapped in local optima, which limits the accuracy and robustness of relation extraction.
[0004] Proximal Policy Optimization (PPO) has been successfully applied in reinforcement learning. By constraining the step size of policy updates, it avoids drastic fluctuations between old and new policies, achieving a more stable and efficient policy optimization process. However, current PPO algorithms suffer from the following problems: Inappropriate reward function design: Conventional rewards such as accuracy, F1 score, or negative loss are often sparse and discrete, which are not suitable for token-level multi-class tasks, leading to weak training signals and unstable updates; Fixed advantage estimation and discount factors: Fixed γ and λ can easily lead to high variance and unreasonable credit allocation in long-sequence token-level tasks, thus causing policy update oscillations or premature convergence to suboptimal solutions. Summary of the Invention
[0005] The purpose of this invention is to address the problems of poor update stability and convergence in existing PPO optimization models by proposing a named entity recognition method for biological environmental text, comprising the following steps:
[0006] S1. Obtain biological environment text and convert it into training samples and test samples.
[0007] S2. Input the training samples into the fine-tuned language model, optimize the fine-tuned language model using the proximal policy optimization algorithm, calculate the reward function through the cosine similarity of the embedding vectors of the input samples, and calculate the advantage function through the dynamic discount factor and dynamic balance factor to obtain the trained language model.
[0008] S3. Input the test samples into the trained language model, test the trained language model, and use the tested language model to perform named entity recognition of biological environmental text.
[0009] Furthermore, the language model is fine-tuned to BERT-base-uncased, SciBERT-uncased, or ALBERT-large-v1.
[0010] Furthermore, the formula for calculating the reward function is as follows:
[0011]
[0012]
[0013] in, Let represent the reward function for the l-th token of the b-th sample. express and cosine similarity, A mask indicating whether the l-th token of the b-th sample is valid. =1 is valid. =0 indicates invalidity; C represents the total number of categories, and c represents the category index. This represents the probability that the l-th token of the b-th sample is predicted to be of category c. This represents the embedding vector corresponding to the c-th category. This represents the embedding vector corresponding to the true category of the l-th token in the b-th sample. Represents the magnitude of a vector.
[0014] Furthermore, the formula for calculating the dominance function is as follows:
[0015]
[0016]
[0017]
[0018] in, This represents the advantage estimate of the token at time step t. This represents the reward value of the token at time step t. Let be the dynamic discount factor at time step t. This represents the estimated state value of the (t+1)th token. This represents the estimated state value of the t-th token. This represents the dynamic GAE (Generalized Advantage Estimation) balance factor at time step t. Let L represent the odds estimate of the (t+1)th token, and L represent the length of the token sequence. This represents the initial value of the dynamic equilibrium factor, used to control the bias-variance tradeoff value of the dominance estimate, and its range is 0 < 0. ≤1; The attenuation coefficient / adjustment coefficient of the dynamic equilibrium factor is used for control. The magnitude of the change with the token's position, with a value range of: ≥0; This represents the initial value of the dynamic discount factor, used to control future return discounts, and its value ranges from 0 to 1. ≤1; This represents the attenuation coefficient / adjustment coefficient of the dynamic discount factor, used to control... The magnitude of the change with the token's position, with a value range of: ≥0;
[0019] When the sequence index is L-1, the dominance function is calculated as follows:
[0020]
[0021] in, This represents the advantage estimate of the (L-1)th token. This represents the reward value for the (L-1)th token. This represents the state value estimate of the (L-1)th token.
[0022] Furthermore, the loss function during model training is:
[0023]
[0024]
[0025]
[0026]
[0027] in, This represents the joint loss function during model training. This represents the near-end optimization loss function. This represents the total loss function for fine-tuning the language model. and They are respectively and The weights, E[ ] represent the expected value, This represents the ratio of the probability of taking the same action when the new strategy and the old strategy are employed. This represents the log probabilities of the new policy with respect to the action, while old_log_probs represents the log probabilities of the old policy with respect to the action. Represents the dominance function. Indicates will Limited to Internal clipping strategies Here, N represents the batch size and C represents the total number of categories. The actual label representing the entity, This represents the predicted probability of the model for the i-th batch and the j-th category.
[0028] The present invention also proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned named entity recognition method for biological environmental text.
[0029] The present invention also proposes an electronic device, including 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 including computer-readable instructions, and the processor is configured to invoke the computer-readable instructions to execute the aforementioned named entity recognition method for biological environmental text.
[0030] The present invention also proposes a computer program product, including a computer program / instruction that, when executed by a processor, implements the steps of the aforementioned named entity recognition method for biological environmental text.
[0031] The beneficial effects of the technical solution provided by this invention are:
[0032] The fine-tuned language model of this invention uses a proximal policy optimization algorithm during training. It calculates the reward function by using the cosine similarity of the embedding vectors of the input samples, making the reward denser and more continuous, which can express the semantic similarity between categories, making the model training smoother and improving the stability and convergence of PPO updates. It calculates the advantage function by using dynamic discount factors and dynamic balance factors, and uses dynamic balance factors to balance variance and bias. It allows the discount and balance factors to change with the token position, so as to allocate credit more reasonably, improve update stability, and improve convergence speed and final recognition performance. Attached Figure Description
[0033] Figure 1 is a flowchart of the named entity recognition method for biological environmental text according to an embodiment of the present invention;
[0034] Figure 2 is a graph showing the change in loss during the training process of the Bert-base-uncased model according to an embodiment of the present invention;
[0035] Figure 3 is a graph showing the change in loss during training of the SciBERT-uncased model according to an embodiment of the present invention.
[0036] Figure 4 is a graph showing the change in loss during training of the ALBERT-large-v1 model according to an embodiment of the present invention.
[0037] Figure 5 is a block diagram of an electronic device according to an exemplary embodiment of the present invention. Detailed Implementation
[0038] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be further described below with reference to the accompanying drawings.
[0039] The flowchart of the named entity recognition method for biological environmental text according to an embodiment of the present invention is shown in Figure 1, and specifically includes the following steps:
[0040] S1. Obtain biological environment text and convert it into training samples and test samples.
[0041] This invention's dataset contains over 15,000 data entries, primarily used for named entity recognition in biological environments, particularly for entities such as "ecological level, evolutionary stage, environmental matrix, species record, and biomolecules." Entities and their labels in the data are accurately identified using a biological environment dictionary and expert opinions in bioenvironmental science, ensuring the professionalism and accuracy of entity recognition. The identified entities in the dataset are evenly distributed, ensuring data representativeness. The raw data is converted into a format suitable for neural networks, laying the foundation for subsequent model training and evaluation. Finally, the dataset is divided into training and testing samples. The training samples are used for model training, and the testing samples are used to verify the model's performance, thereby ensuring the model's generalization ability.
[0042] S2. Input the training samples into the fine-tuned language model, optimize the fine-tuned language model using the proximal policy optimization algorithm, calculate the reward function through the cosine similarity of the embedding vectors of the input samples, calculate the advantage function through the dynamic discount factor and dynamic balance factor, optimize the model parameters, and obtain the trained language model.
[0043] When using the proximal policy optimization algorithm to optimize a fine-tuned language model, the following settings should be made:
[0044] The biological environment named entity recognition task is represented as a Markov decision M= S,A,P,R,γ Where S represents the state space, and the token sequence of length L is obtained by tokenizing the input sentence using a tokenizer. ,…, At time step t (corresponding to the t-th token), the state is... The contextual semantic representation of the current token can be composed of the hidden vector output by the pre-trained language model encoder, positional information, and a valid bitmask. ,in For the encoder to the first The context representation of a token, The mask indicates whether the location contains a valid token.
[0045] A represents the action space, and the action... To predict the entity category label for the t-th token, select one from C categories, i.e. In sequence labeling scenarios, the action space can correspond to the category set of labeling systems such as BIO.
[0046] P represents a state transition, and the action to be performed is executed. Then, the environment transitions to the state of the next time step. That is, the transition is generated naturally by the advancement of the token sequence when t=L 1 or The state terminates when the value is 0.
[0047] R represents the reward function, which generates an immediate reward at time step t. This invention employs a reward function based on cosine similarity, which correlates the reward with the similarity between the predicted category embedding and the true category embedding.
[0048] γ represents the discount factor. To enable adaptive adjustment of the importance of different positions in sequence labeling, this invention introduces a dynamic discount factor γ for calculating the return and advantage function.
[0049] The fine-tuned language models of this invention use BERT-base-uncased, SciBERT-uncased, or 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 representations through bidirectional context learning; SciBERT-uncased is trained on a large amount of scientific literature (such as papers in medicine, computer science, etc.), thus it is better at handling specialized terminology and sentence structures; and ALBERT-large-v1 reduces computational resource consumption through parameter sharing and matrix factorization while maintaining high performance. By fine-tuning these models, they can be adapted to specific task requirements, such as entity relation extraction, thereby further improving the accuracy and generalization ability of the models. The hyperparameters of the experiment were set, including maximum sequence length (128), batch size (16), number of training epochs (15), and the AdamW optimizer and learning rate (2×10⁻⁶). -5 ).
[0050] During training, each batch of data is first fed into the model for feedforward computation. The model generates predicted logits based on the input sentence and entities and calculates the loss value. Next, the gradient of each model parameter is calculated through backpropagation, and the weights are updated using the optimizer.
[0051] First, the training samples are input into the fine-tuned language model. Based on the fine-tuned language model, the embedding vectors of the input samples are obtained. The reward function is calculated using the cosine similarity of the embedding vectors of the input samples. The formula for calculating the reward function is as follows:
[0052]
[0053]
[0054] in, Let L represent the reward function for the l-th token of the b-th sample; express and Cosine similarity; The mask indicates whether the l-th token of the b-th sample is valid. When the l-th token of the b-th sample is a valid token (not padding), =1, when the token has invalid padding and needs to be masked. =0; C represents the total number of categories, and c represents the category index; Let represent the probability that the l-th token of the b-th sample is predicted to be of category c. This represents the embedding vector corresponding to the c-th category. This represents the embedding vector corresponding to the true category of the l-th token in the b-th sample. Represents the magnitude of a vector.
[0055] Conventional reward functions (such as 0 / 1 rewards based on whether the token prediction is correct, accuracy rewards, and rewards based on negative loss or log-likelihood) have the following problems: they are insensitive to class similarity, sensitive to class imbalance, and the training signal is unstable in token-level multi-class classification tasks.
[0056] This invention calculates the reward function by using the cosine similarity of the embedding vectors corresponding to the true and model-predicted categories. The advantages are: 1) the reward is denser and more continuous (not just right / wrong); 2) it can express the semantic similarity between categories (similar categories receive more reasonable partial rewards); 3) training is smoother; 4) it improves the stability and convergence of PPO updates; and it is more suitable for token-level optimization of multi-class NER.
[0057] The dominance function is calculated using a dynamic discount factor and a dynamic balance factor. The formula for calculating the dominance function is as follows:
[0058]
[0059]
[0060]
[0061] in, This represents the advantage estimate of the token at time step t. This represents the reward value of the token at time step t. Let be the dynamic discount factor at time step t. This represents the estimated state value of the (t+1)th token. This represents the estimated state value of the t-th token. This represents the dynamic GAE balance factor at time step t. Let L represent the odds estimate of the (t+1)th token, and L represent the length of the token sequence. This represents the initial value of the dynamic equilibrium factor (at t=0), used to control the bias-variance tradeoff value of the dominance estimate, with a range of 0 < 0. ≤1; The attenuation coefficient / adjustment coefficient of the dynamic equilibrium factor is used for control. The magnitude of the change with the token's position, with a value range of: ≥0; This represents the initial value of the dynamic discount factor (at t=0), used to control future return discounts, and its value ranges from 0 to 1. ≤1; This represents the attenuation coefficient / adjustment coefficient of the dynamic discount factor, used to control... The magnitude of the change with the token's position, with a value range of: ≥0.
[0062] When the sequence index is L-1, the dominance function is calculated as follows:
[0063]
[0064] in, This represents the advantage estimate of the (L-1)th token. This represents the reward value for the (L-1)th token. This represents the state value estimate of the (L-1)th token.
[0065] Conventional advantage functions have fixed γ and λ for consistent processing of all tokens; when the sequence is long, the early token signal decay is unreasonable; and the large variance of advantage estimation leads to unstable and oscillating policy updates.
[0066] This invention calculates the advantage function through dynamic discounting factors and dynamic balancing factors. The advantages are that the discounting and balancing factors change with the token position, resulting in more reasonable credit allocation; in the early stages of training / long sequences, it can reduce the variance of advantage estimation and improve update stability; and it can improve convergence speed and final recognition performance (accuracy, F1, etc.).
[0067] The training data sampling and parameter update process for near-end policy optimization includes the following steps:
[0068] 1) Initialize the policy and value network: Construct the policy network Used to output the probability distribution of actions for each category and construct a value network. Used to estimate the state-value function; where For policy network parameters, These are the parameters for the value network. The policy network can consist of a pre-trained language model encoder and a classification head, while the value network can share the encoder with the policy network but have a separate value function head.
[0069] 2) Generate trajectories and cache old policy probabilities: For each training sample sentence, perform an interaction of length L in token order. For each time step t, the policy network outputs... And record the logarithm of the old strategy for the actions already performed. Simultaneously record state value estimates Instant rewards With mask .in This represents the old policy parameters that were frozen before the update, used to construct the probability ratio.
[0070] 3) Calculate the return and advantage function: based on the sequence { , }, using dynamic discount factors With dynamic balance factors (such as dynamic) ) Calculate advantage estimation This allows us to obtain the dominant sequence at each time step. ,…, }
[0071] 4) Construct the probability ratio: For each time step, calculate the probability ratio of the old and new policies on the same action:
[0072]
[0073] 5) Clipped objective: To limit the policy update stride, a clipping mechanism is used to restrict the ratio to [1]. Within the interval [ε, 1+ε], construct the optimization objective of the PPO strategy:
[0074]
[0075] 6) Multi-round mini-batch update: Divide the sampled sequence data into batches / mini-batches, and perform K rounds of parameter updates for the same batch of sampled data; each round is based on... Calculate gradients and update policy network parameters .
[0076] 7) Value Network Update: Value Network Parameters Update the odds estimate by minimizing the error between the return and the value estimate, for example, by using a mean squared error form to improve the stability of the odds estimate.
[0077] 8) Synchronize old strategy parameters: After completing one iteration update, Copy as new Then, proceed to the next round of "sampling-update" iteration until the convergence condition is met or the preset number of training rounds is reached.
[0078] Through the above process, this invention, while ensuring the stability of policy updates, introduces reward and dynamic discount advantage estimation based on cosine similarity, enabling the policy to adaptively optimize according to the feedback signal of entity recognition.
[0079] The loss function during model training is:
[0080]
[0081]
[0082]
[0083]
[0084] in, This represents the joint loss function during model training. This represents the near-end optimization loss function. This represents the total loss function for fine-tuning the language model. and They are respectively and The weights, E[ ] represent the expected value, This represents the ratio of the probability of taking the same action when the new strategy and the old strategy are employed. This represents the log probabilities of the new policy with respect to the action, while old_log_probs represents the log probabilities of the old policy with respect to the action. The advantage function measures the degree of advantage of a particular action relative to the average level, reflecting the additional benefits brought by that action. Indicates will Limited to Internal clipping strategies Here, N represents the batch size and C represents the total number of categories. The actual label representing the entity (usually one-hot encoded). This represents the predicted probability of the model for the i-th batch and the j-th category.
[0085] α and β control the relative contributions of PPO loss and total loss to the joint optimization process, respectively. Appropriate selection and adjustment of these two weighting coefficients are crucial during optimization. By adjusting the loss weights, the optimizer can find a balance between policy optimization and model training, enabling the model to effectively explore the optimal policy in reinforcement learning while maintaining good generalization ability in supervised learning.
[0086] Specifically It optimizes the policy loss using the PPO algorithm in reinforcement learning, which measures the effectiveness of the model in exploring policies. The original loss of the model is typically composed of classification loss, regression loss, or other task-related losses, and it directly measures the model's performance when processing training samples. By weighting and combining these two, the joint loss function ensures that the reinforcement learning policy optimization is adequately optimized while preventing overfitting during the optimization process.
[0087] When adjusting the loss weights, the goal is to maintain a reasonable balance between the two loss terms. If α and β are set improperly, one loss term may dominate the optimization process, thus affecting the model's training performance. For example, an excessively high α may cause the reinforcement learning loss to dominate, neglecting the supervised learning loss and thus affecting the model's generalization ability; while an excessively low α may lead to insufficient reinforcement learning optimization, thereby reducing the model's performance in policy optimization.
[0088] Therefore, in practical applications, the loss weight coefficients α and β usually need to be adjusted experimentally to ensure that the model can find the optimal balance between optimizing the strategy and improving generalization ability when facing complex tasks, thereby avoiding overfitting or unnecessary losses during training.
[0089] S3. Input the test samples into the trained language model, test the trained language model, and use the tested language model to perform named entity recognition of biological environmental text.
[0090] First, the saved trained model and tokenizer are loaded, and the model weights and configuration obtained during training are restored by calling `model.from_pretrained()` and `tokenizer.from_pretrained()`. Then, the new input data undergoes the same preprocessing as in the training phase, and the sentences are tokenized using the tokenizer. Next, the preprocessed data is input into the model, feedforward computation is performed, the model's output logits are obtained, and the predicted biological environment entity categories are acquired. Finally, the identified entity categories are output and parsed. The trained and tested model can accurately identify biological environment entity categories in new sentences, thereby improving the automation level of biological environment data processing and analysis.
[0091] The loss table in Table 1 shows the loss used in this invention when training a fine-tuned language model.
[0092] Table 1
[0093]
[0094] After the Bert-base-uncased model is trained, its performance is evaluated on the test set by calculating accuracy, recall, and F1 score to verify the model's effectiveness. The model performance evaluation on the test set is shown in Table 2.
[0095] Table 2
[0096]
[0097] During training, the loss function value steadily decreased and stabilized after approximately 10 epochs, indicating that the model converged rapidly and reliably. Looking at specific metrics for entity categories, the overall F1 score reached 91.23%, with the "ecological level" category performing best, achieving accuracy and recall both exceeding 94% and an F1 score of 95.56%; the "evolutionary stage" category also achieved a high F1 score of 93.03%. Even when identifying more complex categories such as "species record" and "environmental matrix," the model still demonstrated high stability, with F1 scores of 84.91% and 88.40%, respectively. See Figure 2 for a graph showing the loss variation during the Bert-base-uncased model training process.
[0098] The loss of the SciBERT-uncased model used in this invention for training the fine-tuned language model is shown in Table 3.
[0099] Table 3
[0100]
[0101] After the SciBERT-uncased model is trained, its performance is evaluated on the test set by calculating accuracy, recall, and F1 score to verify the model's effectiveness. The model performance evaluation on the test set is shown in Table 4.
[0102] Table 4
[0103]
[0104] The loss of the SciBERT-uncased model steadily decreased and plateaued across different epochs, indicating a stable and effective training process. The lowest loss value (-2.7174) was finally reached in the 15th epoch, demonstrating good convergence performance. Evaluation metrics show outstanding overall model performance: for the "ecological level" and "evolutionary stage" categories, accuracy, recall, and F1 score all exceeded 90%, especially for the "ecological level" category, where accuracy and recall reached 94.46% and 96.24% respectively, demonstrating excellent recognition ability. For the "environmental matrix," "species record," and "biomolecule" categories, although relatively lower, accuracy and recall still remained above 84%, showing robust recognition performance. The weighted average metrics show excellent performance in accuracy (90.06%), recall (91.51%), and F1 score (90.77%). Figure 3 shows the variation of the loss during SciBERT-uncased model training.
[0105] The loss of the ALBERT-large-v1 model used in this invention for training the fine-tuned language model is shown in Table 5.
[0106] Table 5
[0107]
[0108] After the ALBERT-large-v1 model is trained, its performance is evaluated on the test set by calculating accuracy, recall, and F1 score to verify the model's effectiveness. The model performance evaluation on the test set is shown in Table 6.
[0109] Table 6
[0110]
[0111] From the training process, the ALBERT-large-v1 model gradually converged in the first 12 rounds, with the loss value gradually decreasing from -1.1106 to about -1.2639, and then stabilizing after the 10th round, indicating that the model has effectively learned the task features and reached a convergent state.
[0112] In terms of entity recognition evaluation metrics, ALBERT-large-v1 demonstrated superior performance. The average accuracy for the five entity classes reached 0.9000, recall 0.9189, and F1 score 0.9093, showing stable and balanced overall performance. Specifically, the model performed best in ecological level recognition, achieving an F1 score of 0.9442, indicating a strong ability to capture temporal entities. It also performed well in evolutionary stage entities, achieving an F1 score of 0.9327, demonstrating its powerful ability to process stratified biological environmental information. For entity categories such as environmental matrix and species records, despite the relatively high recognition difficulty, the model still achieved F1 scores of 0.8841 and 0.8459 respectively, showing strong generalization ability. The F1 score for biomolecular entities was 0.9085, indicating that the method is also suitable for extracting named entities from the biological environment. Figure 4 shows the variation of the loss during ALBERT-large-v1 model training.
[0113] In summary:
[0114] (1) The improvement in F1 score indicates a steady improvement in the overall performance of the model, and a more optimized balance between precision and recall. The improvement in recall greatly reduces missed detections and improves the model's ability to capture key information. The improvement in accuracy indicates a significant increase in the reliability of the prediction results and an improvement in the model's generalization ability. The stable and significant improvement in the indicators proves the effectiveness of the adopted parameter strategy, training method and overfitting prevention strategy.
[0115] (2) This invention utilizes a large language model to perform entity recognition tasks in biological environmental texts. During the training process, it can be observed that as training progresses, the model loss value continuously decreases and gradually stabilizes, demonstrating the effectiveness of the training process and the stability of model convergence.
[0116] In entity category recognition, the improved model demonstrates excellent recognition performance for ecological levels, evolutionary stages, and cellular entities, reflecting its strong contextual understanding and generalization ability regarding these biological environment-related terms. Simultaneously, it exhibits good stability in recognizing rock and mineral entities, proving the model's comprehensiveness and reliability in recognizing entities in diverse biological environments.
[0117] Overall, the method of this invention demonstrates excellent recognition accuracy and generalization performance, verifying the advantages and applicability of the improved model in text mining tasks in the field of biological environment, and laying a solid foundation for further automated processing of biological environment data.
[0118] In one exemplary embodiment, a computer-readable storage medium is included, which stores a computer program that, when executed by a processor, implements the aforementioned named entity recognition method for biological environmental text.
[0119] Referring to Figure 5, in one exemplary embodiment, an electronic device is also included, comprising at least one processor, at least one memory, and at least one communication bus.
[0120] The memory stores a computer program, which includes computer-readable instructions. The processor calls the computer-readable instructions stored in the memory through a communication bus to execute the aforementioned named entity recognition method for biological environmental text.
[0121] In one exemplary embodiment, a computer program product is proposed, including a computer program / instructions that, when executed by a processor, implement the steps of the named entity recognition method for biological environmental text described above.
[0122] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those 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 invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A named entity recognition method for biological environmental text, characterized in that, Includes the following steps: S1. Obtain biological environment text and convert it into training and test samples; S2. Input the training samples into a fine-tuned language model, optimize the model using a proximal policy optimization algorithm, calculate the reward function using the cosine similarity of the embedding vectors of the input samples, and calculate the advantage function using a dynamic discount factor and a dynamic balance factor to obtain the trained language model; S3. Input the test samples into the trained language model, test the model, and use the tested language model to perform named entity recognition on the biological environment text; the formula for calculating the advantage function is as follows: in, This represents the advantage estimate of the token at time step t. This represents the reward value of the token at time step t. Let be the dynamic discount factor at time step t. This represents the estimated state value of the (t+1)th token. This represents the estimated state value of the t-th token. This represents the dynamic GAE balance factor at time step t. Let L represent the odds estimate of the (t+1)th token, and L represent the length of the token sequence. This represents the initial value of the dynamic equilibrium factor, used to control the bias-variance tradeoff value of the dominance estimation, and its range is 0 < ≤1; The attenuation coefficient / adjustment coefficient of the dynamic equilibrium factor is used for control. The magnitude of the change with the token's position, with a value range of: ≥0; This represents the initial value of the dynamic discount factor, used to control future return discounts, and its value ranges from 0 to 1. ≤1; This represents the attenuation coefficient / adjustment coefficient of the dynamic discount factor, used to control... The magnitude of the change with the token's position, with a value range of: ≥0; When the sequence index is L-1, the dominance function is calculated as follows: in, This represents the advantage estimate of the (L-1)th token. This represents the reward value for the (L-1)th token. This represents the estimated state value of the (L-1)th token.
2. The named entity recognition method for biological environmental text according to claim 1, characterized in that, The language model is fine-tuned as BERT-base-uncased, SciBERT-uncased, or ALBERT-large-v1.
3. The named entity recognition method for biological environmental text according to claim 1, characterized in that, The formula for calculating the reward function is as follows: in, Let represent the reward function for the l-th token of the b-th sample. express and cosine similarity, A mask indicating whether the l-th token of the b-th sample is valid. =1 is valid. =0 indicates invalidity; C represents the total number of categories, and c represents the category index. This represents the probability that the l-th token of the b-th sample is predicted to be of category c. This represents the embedding vector corresponding to the c-th category. This represents the embedding vector corresponding to the true category of the l-th token in the b-th sample. Represents the magnitude of a vector.
4. The named entity recognition method for biological environmental text according to claim 1, characterized in that, The loss function during model training is: in, This represents the joint loss function during model training. This represents the near-end optimization loss function. This represents the total loss function for fine-tuning the language model. and They are respectively and The weights, E[ ] represent the expected value, This represents the ratio of the probability of taking the same action when the new strategy and the old strategy are employed. This represents the log probabilities of the new policy with respect to the action, while old_log_probs represents the log probabilities of the old policy with respect to the action. Represents the dominance function. Indicates will Limited to Internal clipping strategies Here, N represents the batch size and C represents the total number of categories. The actual label representing the entity, This represents the predicted probability of the model for the i-th batch and the j-th category.
5. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it implements the method as described in any one of claims 1-4.
6. An electronic device, characterized in that, The device includes a processor and a memory interconnected thereto, wherein the memory is used to store a computer program, the computer program including computer-readable instructions, and the processor is configured to invoke the computer-readable instructions to perform the method as described in any one of claims 1-4.
7. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method according to any one of claims 1-4.
Citation Information
Patent Citations
Self-adaptive dynamic discount factor reinforcement learning method
CN114897141A
Earth science geological entity relation extraction method, medium and equipment
CN120354909A