Power accident event extraction method based on knowledge distillation and preference optimization

Through knowledge distillation and preference optimization technology, the problem of poor adaptability in the field of event extraction in professional texts in the power industry is solved, the processing efficiency and extraction effect of power incident stories are improved, and more efficient text understanding and reasoning capabilities are achieved.

CN118780249BActive Publication Date: 2024-12-10SHANDONG JINGHONG TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411245259.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2024-12-10
Estimated Expiration
2044-09-06

AI Technical Summary

Technical Problem

When the existing event extraction technology processes professional texts in the power industry, the field is poor, resulting in unsatisfactory extraction results, which affects the processing efficiency of power incidents.

Method used

Using knowledge distillation and preference optimization methods, we can learn professional knowledge by collecting and preprocessing the raw data of power incident stories, using the mistral-instruct student model, and building efficient event extraction models through supervised fine-tuning and preference optimization algorithms to improve the model's model's Domain adaptability and extraction effect.

Benefits of technology

It effectively improves the processing efficiency of power incident stories, and through knowledge distillation and preference optimization, the model's inference speed and resource use efficiency are improved, making the extraction results more in line with user needs and preferences in actual scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118780249B_ABST
    Figure CN118780249B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for extracting power accident events based on knowledge distillation and preference optimization, relates to the technical field of natural language processing, and solves the technical problems that the existing extraction method has poor domain adaptability and unsatisfactory extraction effect when processing professional texts in the power industry. The method comprises: collecting the original data of power accident events and preprocessing them to obtain power accident event training data; based on the knowledge distillation method, the teacher model simultaneously integrates knowledge and supervises and fine-tunes the mistral-instruct student model to obtain a fine-tuned student model; based on the fine-tuned student model, the extraction of the test power accident event is performed to obtain the student model prediction #imgabs0#; constructing a preference data set #imgabs1#; using the direct preference optimization algorithm DPO to optimize the preference data set #imgabs2# to obtain a power accident event extraction model. When the present invention processes professional texts in the power industry, it has the advantages of strong domain adaptability and good extraction effect, which improves the processing efficiency of power accident events.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of natural language processing, and in particular to a method for extracting power accident events based on knowledge distillation and preference optimization. Background Art

[0002] The power industry is a basic industry of the national economy, and the safety and efficiency of its operation have an important impact on social and economic development. A large amount of text data is generated during the operation and maintenance of the power system, such as fault reports, maintenance logs, accident investigation reports, etc. These text data contain rich event information, which is crucial to improving the fault handling efficiency and maintenance management level of the power system.

[0003] Event extraction is a technology in natural language processing, which refers to the automatic identification and extraction of event-related information from text. Events usually include a trigger word (a word indicating the occurrence of an event) and several arguments (entities or roles related to the event). The goal of this task is to extract structured event descriptions from unstructured text to help understand the time, place, people and other related information in the text, and provide support for applications such as information retrieval. The purpose of event extraction is to quickly identify events and their entities in a large number of documents. Events may involve the behavior of multiple entities. As events occur, the relationships and states of entities will continue to change. Event extraction is mainly used to analyze "who did what to whom and when and where" in the text and find one or more participants in the event. The complex structure of events and the semantic gap between text and events bring great challenges to the task of event extraction. First, event records are similar to tables, including: event type, trigger words, arguments, and argument roles. Different types of events have different structures; secondly, multiple texts can be used to express an event, resulting in inconsistent trigger words and different syntactic structures. Taking all the above factors into consideration, event extraction belongs to the deep-level content in the field of information extraction, and is more difficult than information extraction tasks such as entity extraction and relationship extraction.

[0004] In the event extraction task, given a text T containing several words , the goal of event extraction is to identify all events in a document , and related information for each event. It can usually be represented as a triple: ,in Indicates the event type, Indicates trigger words, Represents the jth argument contained in the event, each of which includes the argument and argument roles There are two subtasks: event trigger word extraction and event argument extraction. Trigger word extraction is to extract the event type contained in the text T. and trigger words Argument extraction is based on the event type, extracting each argument role in the event Corresponding argument .

[0005] Current event extraction focuses on the use of deep learning methods. According to the different extraction methods, it can be divided into classification-based methods and generation-based methods. Among them, classification-based methods usually adopt the form of sequence labeling, representing each word or phrase in the text as a global representation containing rich information, and then jointly reasoning these representations to uniformly model the dependencies of events in the text. By combining conditional random fields and pre-trained language models, the contextual dependencies and state transitions of events in the text can be modeled; or by constructing the elements in the event in the form of questions, machine reading comprehension methods are used for extraction. With the continuous emergence of generative large language models, there has been a method of converting event extraction methods into sequence generation problems. Such methods include converting them into translation tasks, generating them using constrained decoding methods, and template-based generation methods.

[0006] Existing event extraction technologies are usually based on classification methods and generative methods, which make them ineffective for event extraction tasks, including the following problems. (1) When based on public data (such as the ACE dataset), there are many incorrectly labeled data in these datasets, which greatly affects the performance of the model. (2) Secondly, most existing technologies are based on large language models for zero-sample extraction. The models are not trained, or are trained based on small models with insufficient knowledge comprehension capabilities, resulting in poor reasoning and text comprehension capabilities of the models. (3) Existing technologies do not pay attention to the scope of fuzzy entities output by the model. These entities with fuzzy scopes will lead to errors in the final judgment when evaluated using traditional methods, and misjudge the performance of the model.

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

[0008] When processing professional texts in the power industry, existing event extraction methods have poor domain adaptability and unsatisfactory extraction effects, which affects the efficiency of handling power accident events. Summary of the invention

[0009] The purpose of the present invention is to provide a method for extracting power accident events based on knowledge distillation and preference optimization, so as to solve the technical problem that the event extraction method in the prior art has poor domain adaptability and unsatisfactory extraction effect when processing professional texts in the power industry, which affects the efficiency of power accident event processing. The many technical effects that can be produced by the preferred technical solution among the many technical solutions provided by the present invention are described in detail below.

[0010] To achieve the above object, the present invention provides the following technical solutions:

[0011] The present invention provides a method for extracting power accident events based on knowledge distillation and preference optimization, comprising the following steps: S100: collecting raw data of power accident events and preprocessing them to obtain an event data set of power accident events , and for the event dataset Conduct training processing to obtain power accident event training data; event data set of power accident events The following steps are performed: S110: Collect various types of power accident related information through network channels to obtain the original data of power accident events; S120: Preliminarily find text data sets related to predefined event types from the original data of power accident events. ; S130: Use word segmentation technology and semantic matching technology to analyze text data sets Label and obtain event dataset ; S200: Based on the knowledge distillation method, the mistral-instruct student model learns the professional knowledge of power accidents from the power accident event training data and obtains the event extraction ability. The teacher model simultaneously integrates the knowledge and supervises the fine-tuning training of the mistral-instruct student model to obtain the fine-tuned student model; S300: Based on the fine-tuned student model, the power accident event extraction is tested to obtain the student model prediction ; S400: Predictions of the student model on the validation set by fine-tuning the student model Validate and build a preference dataset ; S500: Use the direct preference optimization algorithm DPO to optimize the preference data set Preference optimization is performed, and a power accident event extraction model is obtained based on fine-tuning the student model. Power accident events are extracted through the power accident event extraction model.

[0012] Preferably, in step S100, the event data set is processed by the following steps: Training process: S140: Using the preset prompt template, the event data set The teacher text t and teacher label l of each structured data in is converted into the teacher natural language input required by the large language model ,in , Teacher prompt template designed to obtain teacher model knowledge in knowledge distillation method; S150: input through natural language Get the output of the large language model as each teacher's natural language input Teacher's Notes , where the teacher notes , LLM is the large language model corresponding to the teacher model, Parameters of the large language model; S160: based on teacher annotations , records that cannot be explained by associating text and labels are recorded as mislabeled data, and keyword matching is performed on the mislabeled data. Find and delete it; at the same time, the teacher's natural language input corresponding to each correct data prompt and comments Extract and construct an explanation dataset , as power accident event training data.

[0013] Preferably, step S200 specifically includes: S210: Prompt template through students Student Text and Student Tags Converted into natural language input for students and student natural language tags , , Student Prompt Template It includes four parts: task description, output space, text, and answer format; S220: Use the Lora fine-tuning method to perform fully supervised fine-tuning SFT training on the mistral-instruct student model; S230: Explain the dataset Each sample in the As input, the teacher notes As labels, the event extraction task and the reasoning task are simultaneously input into the mistral-instruct student model for learning, and the student input is obtained. , so that the mistral-instruct student model is optimized according to the label; S240: using the language model loss as the loss function, the mistral-instruct student model is supervised fine-tuned to obtain a fine-tuned student model.

[0014] Preferably, step S220 specifically includes: S221: retaining the original parameters of the mistral-instruct student model No change, add additional paths A and B in parallel next to the linear layer of each model block; S222: during training, only update the parameters in paths A and B, expressed as formula: ,in Indicates the incremental parameter, and represents the input dimension and output dimension of the original linear layer in the mistral-instruct student model, Representation parameters The feature space of ; r represents the rank in the low-rank decomposition, is a hyperparameter during training, and ,make ; S223: Only update incremental parameters during parameter update , for students’ natural language input , after word segmentation and embedding representation, we get vectorized student input .

[0015] Preferably, step S400 specifically includes: S410: fine-tuning the student model to predict the student model on the validation set To verify, extract the wrongly predicted samples separately as counterexamples ; S420: will be with counterexample The corresponding label is used as a positive example , and use the input prompt as the input for fine-tuning the student model to obtain the preference dataset .

[0016] Implementing one of the above technical solutions of the present invention has the following advantages or beneficial effects:

[0017] This application processes the original data of power accident events, effectively avoiding the misleading of the model by erroneous data, and uses the knowledge distillation method to make the mistral-instruct student model simulate the teacher model's interpretation of the sample, perform reasoning ability transfer and data processing, and distill the reasoning ability in the teacher model to the student model, so that the student model can learn the ability of the large model with a smaller amount of parameters. After distillation, it can be more efficient in reasoning speed and resource usage, while trying to retain the language understanding and generation ability of the original model. And use supervised learning and preference optimization to achieve a highly generalizable and robust event extraction method. A specific preference data set is also constructed, and the preference optimization algorithm is used to further optimize the student model to output answers that meet the evaluation criteria of the event extraction task, improve the actual application effect of the student model, and make its output more in line with user needs and preferences in actual scenarios. Therefore, when processing professional texts in the power industry, this method has the advantages of strong domain adaptability and good extraction effect, and improves the processing efficiency of power accident events. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. It is obvious that the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0019] Figure 1 is a flow chart of a method for extracting power accident events based on knowledge distillation and preference optimization according to an embodiment of the present invention;

[0020] Figure 2 The embodiment of the present invention Figure 1 The process of step S100 Figure 1 ;

[0021] Figure 3 The embodiment of the present invention Figure 1 The process of step S100 Figure 2 ;

[0022] Figure 4 The embodiment of the present invention Figure 1 Flow chart of step S200;

[0023] Figure 5 The embodiment of the present invention Figure 4 Flow chart of step S220;

[0024] Figure 6 The embodiment of the present invention Figure 4 Flow chart of step S240;

[0025] Figure 7 The embodiment of the present invention Figure 1 Flow chart of step S300;

[0026] Figure 8 The embodiment of the present invention Figure 1 Flow chart of step S400 in FIG. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solutions and advantages of the present invention clearer, the various exemplary embodiments to be described below will refer to the corresponding drawings, which constitute a part of the exemplary embodiments, wherein various exemplary embodiments that may be used to implement the present invention are described. Unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation methods described in the following exemplary embodiments do not represent all implementation methods consistent with the present disclosure. It should be understood that they are only examples of processes, methods, devices, etc. that are consistent with some aspects of the present disclosure as detailed in the attached claims, and other embodiments may also be used, or the embodiments listed herein may be modified in structure and function without departing from the scope and essence of the present invention.

[0028] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", etc. indicate the orientation or positional relationship based on the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the elements referred to must have a specific orientation, be constructed and operated in a specific orientation. The terms "first", "second", etc. are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. The term "multiple" means two or more. The terms "connected" and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, an integral connection, a mechanical connection, an electrical connection, a communication connection, a direct connection, an indirect connection through an intermediate medium, and can be the internal connection of two elements or the interaction relationship between two elements. The term "and / or" includes any and all combinations of one or more related listed items. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to the specific circumstances.

[0029] In order to illustrate the technical solution of the present invention, a specific embodiment is used below for description, and only the parts related to the embodiment of the present invention are shown.

[0030] Example:

[0031] like Figure 1As shown, the present invention provides a method for extracting power accident events based on knowledge distillation and preference optimization, comprising the following steps: S100: collecting raw data of power accident events and preprocessing them to obtain an event data set of power accident events , and for the event dataset Training processing is performed to obtain power accident event training data. The collection and processing of raw data is the basis of model training. Through data preprocessing and training processing, the accuracy, reliability, processing efficiency and response speed of the model can be effectively improved. S200: Based on the knowledge distillation method, the mistral-instruct student model learns professional knowledge about power accidents from the power accident event training data and obtains event extraction capabilities. The teacher model simultaneously integrates knowledge and supervises fine-tuning training on the mistral-instruct student model to obtain a fine-tuned student model. Knowledge distillation is a model compression technology that reduces the consumption of computing resources while ensuring model performance by transferring knowledge from a complex and computationally expensive teacher model ("big" model) to a smaller and more efficient student model ("small" model). The process usually involves training the student model with soft labels generated by the teacher model so that it learns the behavior and characteristics of the teacher model. In knowledge distillation based on a large language model, the teacher model is usually a pre-trained deep neural network (such as GPT-4), and the student model is a smaller version. S300: Extracting a test power accident event based on a fine-tuned student model, where the test power accident event is a power accident event that has been prepared for model testing, and obtaining a student model prediction S400: Validate the student model through mistral-instruct and build a preference dataset . Aims to use the validation set for preference datasets S500: Using the direct preference optimization algorithm DPO to optimize the preference dataset Preference optimization is performed to obtain a power accident event extraction model, and power accident event extraction is performed through the power accident event extraction model. Preference optimization refers to the process of model training, through human intervention or specific algorithms, so that the model is more inclined to output results that meet expectations or specific standards. This optimization can be achieved by collecting and utilizing user feedback, designing specific loss functions, or adjusting model parameters. The direct preference optimization algorithm DPO method of this embodiment can bypass the explicit reward model learning and complex reinforcement learning process, and directly optimize the language model through a simple classification loss, so that it better meets human preferences, so that the student model can learn to output outputs that are more in line with user evaluation standards. This embodiment processes the original data of power accident events, effectively avoids the misleading of the model by erroneous data, and uses the knowledge distillation method to make the mistral-instruct student model simulate the teacher model's interpretation of the sample, perform reasoning ability migration and data processing, and distill the reasoning ability in the teacher model to the student model, so that the student model can learn the ability of the large model with a smaller amount of parameters. After distillation, it can be more efficient in reasoning speed and resource usage, while trying to retain the language understanding and generation capabilities of the original model. We also use supervised learning and preference optimization to achieve a highly generalizable and robust event extraction method. We also build a specific preference dataset. , and use the preference optimization algorithm to further optimize the student model to output answers that meet the evaluation criteria of the event extraction task, improve the actual application effect of the student model, and make its output results more in line with user needs and preferences in actual scenarios. Therefore, when processing professional texts in the power industry, this method has the advantages of strong domain adaptability and good extraction effect, and improves the efficiency of handling power accident events.

[0032] As an optional implementation, Figure 2 As shown, in step S100, the event data set of the power accident event The following steps are used to obtain: S110: Collect various types of power accident related information through network channels, such as power-related fault reports, maintenance logs, accident investigation reports and other text data, to improve the richness and completeness of power accident related information, improve the model training effect, and obtain the original data of power accident events. S120: Preliminarily find text data sets related to predefined event types from the original data of power accident events , predefined event types are set according to actual needs and model usage, that is, data that will be of interest during use, thereby reducing irrelevant data and reducing the workload of model training. Preliminary operations can be performed through existing large language models to reduce manual workload. It can be a specific type of power accident event, such as short circuit accidents, line break accidents, grounding accidents, and leakage accidents, thereby obtaining a data set specific to the power field. S130: Use word segmentation technology and semantic matching technology to analyze text data sets Label and obtain event dataset , which is convenient for further processing operations. Word segmentation technology enables computers to understand and divide words, and automatically divides words in sentences through computers; semantic matching is mainly to find the text most relevant to the target text. The relevant application scenarios mainly include search engines, question-answering systems, recommendation systems, text deduplication, etc. Word segmentation technology and semantic matching technology can be used to implement text data sets. The text dataset contains many incorrectly labeled samples, which need further screening and processing. It is preferred to use the general large language model ChatGPT to classify the text dataset. Due to the powerful text understanding and reasoning capabilities of this type of model, it can find data with unreasonable labels in the dataset, thereby further improving the quality of the dataset.

[0033] As an optional implementation, Figure 3 As shown, in step S100, the event data set is processed by the following steps: S140: Through the preset prompt template, the preset prompt template can be set according to the specific usage scenario, and the event data set is The teacher text t and teacher label l of each structured data in is converted into the teacher natural language input required by the large language model ,in , A teacher prompt template is designed to obtain the teacher model knowledge in the knowledge distillation method. Users can determine the prompt information containing task information based on the prompt template input, so that the large language model can more accurately understand the user's task requirements under the control of the prompt information, and output more accurate response information. Prompt learning, that is, adding specific text to the model input to make full use of the knowledge of the pre-trained language model, has become a technology that effectively utilizes the capabilities of pre-trained models. By designing appropriate prompts, the prompt template can guide the pre-trained language model to perform downstream tasks on demand, sometimes even without relying on specific downstream task training data. The core advantage is that with a set of carefully constructed prompts, a single unsupervised trained language model can cope with multiple downstream tasks. S150: Through natural language input Get the output of the large language model as each teacher's natural language input Teacher's Notes , where the teacher notes , LLM is the large language model corresponding to the teacher model, is the parameter of the large language model, so that the teacher model can predict the mistral-instruct student model. S160: Based on teacher annotations , records that cannot be explained by associating text and labels are recorded as mislabeled data, and keyword matching is performed on the mislabeled data. Find and delete it; at the same time, the teacher's natural language input corresponding to each correct data prompt and teacher notes Extract and construct an explanation dataset , as training data of power accident events, used for distillation of reasoning ability.

[0034] As an optional implementation, Figure 4 As shown, step S200 specifically includes: S210: Prompt template through students Student Text and Student Tags Converted into natural language input for students and student natural language tags , , Student Prompt Template It includes four parts: task description, output space, text, and answer format. Since the student model has poor capabilities, the prompts for the training data need to be designed in more detail. Based on the requirements of the event extraction task, the student prompt template is designed Includes: {task description - output space - text - answer format}, this template can maximize the ability of the model and achieve the best results during training. S220: Use the Lora fine-tuning method to perform fully supervised fine-tuning SFT training on the mistral-instruct student model. The Lora fine-tuning method has stronger applicability when hardware resources cannot perform full parameter training on the mistral-instruct student model, saving training resources and time. S230: Explain the dataset Each sample in the As input, the teacher notes As labels, the event extraction task and the reasoning task are simultaneously input into the mistral-instruct student model for learning, and the student input is obtained. , so that the mistral-instruct student model is optimized according to the label. Use the explanation dataset corresponding to the teacher model , add a task to the training of the student model so that it can understand the reasons behind the event extraction task while learning it, thus realizing the integration of the teacher model knowledge and integrating the teacher model's reasoning ability. S240: Use the language model loss as the loss function to perform supervised fine-tuning training on the mistral-instruct student model to obtain a fine-tuned student model.

[0035] As an optional implementation, Figure 5 As shown, step S220 specifically includes: S221: retaining the original parameters of the mistral-instruct student model The mistral-instruct student model is unchanged. Next to the linear layer of each model block (including query, key, value, output blocks in the self-attention module, and down, gate, up blocks in the fully connected module), additional channels A and B are added in parallel. Channels A and B are fully connected layers, which are used to simulate the update of the mistral-instruct student model parameters. S222: Only the parameters in channels A and B are updated during training, expressed as the formula: ,in Indicates the incremental parameter, and represents the input dimension and output dimension of the original linear layer in the mistral-instruct student model, Representation parameters The feature space of ; r represents the rank in the low-rank decomposition, is a hyperparameter during training, and ,make , thereby achieving the purpose of reducing training parameters. S223: Only update the incremental parameters during the parameter update process , optimal increment parameters Only original parameters About 1% of students’ natural language input , after word segmentation and embedding representation, we get vectorized student input . Then the forward propagation process is: During the reasoning process, Lora introduces almost no additional reasoning cost and only needs to calculate That's it.

[0036] As an optional implementation, Figure 6 As shown, step S240 specifically includes: S241: vectorizing students The mistral-instruct student model, through the multi-layer decoder structure in the mistral-instruct student model, obtains: , where the probability distribution represents the logits distribution of the i-th word predicted based on the words in the first i-1 positions in the text; N represents the length of the input text; LM represents the student model, are the parameters of the mistral-instruct student model; S242: probability distribution through the softmax function Normalize it and get the probability distribution , for the probability distribution The probability of the jth dimension is calculated by normalization as follows: ), where V is The vector dimension corresponds to the size of the vocabulary; e represents the exponential function; probability distribution Represents probability distribution The value corresponding to the kth dimension of The corresponding true probability distribution Calculate the cross entropy loss and get the loss function as: , where log represents the logarithmic function; It means that the loss function P is the probability distribution .

[0037] As an optional implementation, Figure 7 As shown, step S300 specifically includes: S310: using the temperature parameter to randomly adjust the mistral-instruct student model, specifically, introducing the temperature hyperparameter on the basis of the original softmax function , transform the normalized formula into: . A lower temperature parameter in the formula means less randomness. A temperature of 0 will always produce the same output. A higher temperature parameter means more randomness, which can help the model give more creative outputs. S320: This step uses kernel sampling for policy control. When generating the next token, the sampling space is constructed from the word with the highest probability in the probability distribution until the sum of the probabilities of all words in the sampling space exceeds the threshold. Stop at , and get the sampling space: , the final sampling probability distribution is: , and use top_k to control the selection of the top k highest probability tokens when generating the next token. Similar to kernel sampling, the sampling space is reduced before sampling, only the k words with the highest probability are retained, and then re-normalized to obtain a new probability distribution.

[0038] As an optional implementation, Figure 8 As shown, step S400 specifically includes: S410: Predicting the student model on the validation set by fine-tuning the student model To verify, extract the wrongly predicted samples separately as counterexamples ; S420: will be with counterexample The corresponding label is used as a positive example And use the input prompt as the input of the mistral-instruct student model to obtain the preference data set .

[0039] As an optional implementation, in step S500, the loss function of the direct preference optimization algorithm DPO is: ,in, , They represent the power accident event extraction model and the reference model respectively. In the optimization process, only the power accident event extraction model is used. Update the parameters. and Represents the preference data set Positive examples and counterexamples in represents the sigmoid function, β represents the hyperparameter, Indicates that given input x, the power accident event extraction model generates positive examples The cumulative probability of Indicates that given an input x, the reference model generates a counterexample The cumulative probability of. Through this optimization algorithm, the power accident event extraction model It learns the intrinsic knowledge of the event extraction task, the reasoning knowledge of the large language model, and the preference for entity span.

[0040] The effect of the method of this embodiment is verified by constructing power accident event data. The data is collected from the Internet and extracted from text data constructed by a generative language model. All data are in English. The data set defines five types of power accident events. The data is divided into a training set and a test set. The training set has 7172 sentences and the verification set has 923 sentences. Experimental environment and parameter settings, the relevant experiments are run on the server, and the environment configuration used is shown in Table 1.

[0041] Table 1 Experimental environment configuration information of this embodiment

[0042] In the experiment, the batch size (batch_size) used for model training is 32, and the maximum length of the input text is limited to 2048. The learning rate is set to 1e-4, and the entire training process consists of 2 rounds. In order to evaluate the model performance, an evaluation is performed on the validation set every 500 training steps, and the best performing model parameters are retained for subsequent prediction tasks. The rank r of the Lora module is 32, alpha is set to 64, and the target modules include: query, key, value, output blocks in the self-attention module, and down, gate, up blocks in the feedforward module. Dropout is set to 0.05 and bias is set to None.

[0043] Experimental results and analysis. The power accident event extraction method of this embodiment was used to verify the event trigger word extraction and event argument extraction respectively. Both use Micro-F1 as the main evaluation indicator, and add precision P and recall R. For any sample, for trigger word extraction, the event type and trigger word must be correct at the same time, and for argument recognition, the argument role and corresponding argument must be correct. In order to verify the effectiveness of the model in the event extraction task, experiments were conducted based on power accident event data, and the experimental results were compared with existing common models. The results are shown in Table 2. It can be seen from Table 2 that the power accident event extraction method based on knowledge distillation and preference optimization in this embodiment shows a high degree of stability and accuracy. Finally, an F1 score of 84.11 was achieved in trigger word extraction and an F1 score of 69.73 was achieved in argument extraction. This score is not only the highest among all listed models, but also significantly higher than other models. This shows that the model has a strong ability in capturing and understanding event characteristics, and demonstrates efficient text understanding and event reasoning capabilities in event extraction tasks, providing a reliable solution for power accident event extraction tasks.

[0044] Table 2 Comparison of experimental results based on power accident event extraction between the prior art and this embodiment

[0045] The embodiment is only a specific example and does not represent only one implementation mode of the present invention.

[0046] The above description is only the preferred embodiment of the present invention. It is known to those skilled in the art that various changes or equivalent substitutions may be made to these features and embodiments without departing from the spirit and scope of the present invention. In addition, under the teachings of the present invention, these features and embodiments may be modified to adapt to specific circumstances and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application belong to the protection scope of the present invention.

Claims

1. A power accident event extraction method based on knowledge distillation and preference optimization, characterized in that: The following steps are involved: S100: Collect and pre-process the original data of power accident events to obtain the event data set of power accident events , and for the event dataset Perform training processing to obtain power accident event training data; Event dataset of power accident events The following steps are performed: S110: collecting various types of power accident related information through network channels to obtain the original data of power accident events; S120: preliminarily finding text data sets related to predefined event types from the original data of power accident events. ; S130: Use word segmentation technology and semantic matching technology to analyze text data sets Label and obtain event dataset ; S200: Based on the knowledge distillation method, the mistral-instruct student model learns the professional knowledge of power accidents from the power accident event training data and obtains the event extraction capability. The teacher model simultaneously integrates the knowledge and performs supervised fine-tuning training on the mistral-instruct student model to obtain the fine-tuned student model. S300: Extraction of test power accident events based on fine-tuning student model to obtain student model prediction ; S400: Predictions of the student model on the validation set by fine-tuning the student model Validate and build a preference dataset ; S500: Using the Direct Preference Optimization (DPO) algorithm on the preference dataset Preference optimization is performed, and a power accident event extraction model is obtained based on fine-tuning the student model. Power accident events are extracted through the power accident event extraction model.

2. According to claim 1, a method for extracting power accident events based on knowledge distillation and preference optimization is characterized in that: In step S100, the event dataset is processed through the following steps: Perform training processing: S140: The event data set is converted into The teacher text t and teacher label l of each structured data in is converted into the teacher natural language input required by the large language model ,in , A teacher prompt template designed to obtain teacher model knowledge in knowledge distillation methods; S150: Through natural language input Get the output of the large language model as each teacher's natural language input Teacher's Notes , where the teacher notes , LLM is the large language model corresponding to the teacher model, are the parameters of the large language model; S160: Based on teacher annotations , records that cannot be explained by associating text and labels are recorded as mislabeled data, and keyword matching is performed on the mislabeled data. Find and delete it; at the same time, the teacher's natural language input corresponding to each correct data prompt and comments Extract and construct an explanation dataset , as power accident event training data.

3. According to claim 1, a method for extracting power accident events based on knowledge distillation and preference optimization is characterized in that: Step S200 specifically includes: S210: Pass Student Prompt Template Student Text and Student Tags Converted into natural language input for students and student natural language tags , , Student Prompt Template It includes four parts: task description, output space, text, and answer format; S220: Use Lora fine-tuning method to perform fully supervised fine-tuning SFT training on the mistral-instruct student model; S230: Explain the data set Each sample in the As input, the teacher notes As labels, the event extraction task and the reasoning task are simultaneously input into the mistral-instruct student model for learning, and the student input is obtained. , so that the mistral-instruct student model is optimized according to the label; S240: Use the language model loss as the loss function to perform supervised fine-tuning training on the mistral-instruct student model to obtain a fine-tuned student model.

4. According to claim 3, a method for extracting power accident events based on knowledge distillation and preference optimization is characterized in that: Step S220 specifically includes: S221: Keep the original parameters of the mistral-instruct student model No change, add additional channels A and B in parallel next to the linear layer of each model block; S222: During training, only the parameters in pathway A and pathway B are updated, which can be expressed as the formula: ,in Indicates the incremental parameter, and represents the input dimension and output dimension of the original linear layer in the mistral-instruct student model, Representation parameters The feature space of ; r represents the rank in the low-rank decomposition, is a hyperparameter during training, and ,make ; S223: Only incremental parameters are updated during parameter update , for students’ natural language input , after word segmentation and embedding representation, we get vectorized student input .

5. According to claim 1, a method for extracting power accident events based on knowledge distillation and preference optimization is characterized in that: Step S400 specifically includes: S410: Fine-tune the student model to predict the student model on the validation set To verify, extract the wrongly predicted samples separately as counterexamples ; S420: Will and counterexample The corresponding label is used as a positive example , and use the input prompt as the input for fine-tuning the student model to obtain the preference dataset .