Alarm classification method and system based on pre-training large model
Through the alarm classification method based on the pre-trained large model, using the Transformer model and specific task fine-tuning, the problems of low alarm classification accuracy and poor adaptability in the existing technology are solved, and high accuracy and efficiency in alarm data are achieved.
Patent Information
- Application Number
- CN202410691098.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2024-10-01
AI Technical Summary
Existing technologies have problems with low accuracy and poor adaptability in alarm classification. Especially when processing complex and unstructured text data, traditional models are difficult to capture text contextual relationships, and pre-trained models are not optimized for specific fields.
Adopting an alarm classification method based on a pre-trained large model, by building a Transformer model, combined with a multi-head self-attention mechanism and a feed-forward neural network, pre-training and secondary fine-tuning are performed, and MLM and NSP tasks are used to learn general language features and specific knowledge. Improve classification accuracy and efficiency.
It achieves high accuracy and efficiency in alarm data, can capture common language features and specific knowledge, improves classification accuracy and efficiency, and adapts to complex and diverse alarm information.
Smart Images

Figure CN118734152A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the fields of AI and data processing technology, and in particular to an alarm classification method and system based on a pre-trained large model. Background Art
[0002] Alarm classification is a critical task in the field of public safety, which involves classifying alarm information reported by the public according to its urgency, type, and required resources. Accurate alarm classification is crucial for the rational allocation of resources, shortened response time, and overall event handling efficiency. Traditionally, alarm classification mainly relies on the experience and judgment of the operator, which is not only time-consuming and error-prone, but also difficult to handle large or complex alarm information. With the increasing number of alarm calls, a more efficient and accurate automated solution is needed. Automated alarm classification faces multiple challenges, including but not limited to language diversity, colloquial expressions, dialects, and fast and disorganized speech in emergency situations. These challenges require classification models to have a high degree of understanding and adaptability.
[0003] Before the advent of deep learning, text classification tasks were usually solved using rule-based methods or traditional machine learning algorithms such as support vector machines (SVM), naive Bayes, etc. These methods rely on carefully designed feature extraction, but have limited performance when dealing with complex and unstructured text data. With the development of deep learning, neural network-based models such as convolutional neural networks (CNN), recurrent neural networks (RNN), and long short-term memory networks (LSTM) have made significant progress in text classification tasks. These models are able to automatically learn complex feature representations from data. More recently, transformer-based pre-trained language models such as BERT, GPT, and XLNet have made breakthrough progress in various natural language processing tasks. These models are pre-trained on large-scale corpora to learn rich language representations, and then fine-tuned on specific tasks to adapt to specific application scenarios.
[0004] For language classification tasks, there are classification models based on traditional models and some models based on pre-training. Compared with pre-trained models, alarm classification based on traditional models has poorer ability to capture text contextual relationships and lower accuracy. Pre-trained models are usually not optimized for specific types of text, such as alarm reports. Some models may perform well in their specific fields, but are not suitable for alarm classification. Summary of the invention
[0005] The embodiments of the present application provide an alarm classification method and system based on a pre-trained large model, which is used for secondary fine-tuning of specific alarm data, which can not only capture common language features, but also learn specific knowledge related to news topics and alarms, thereby improving the accuracy and efficiency of classification.
[0006] The present application embodiment provides an alarm classification method based on a pre-trained large model, including:
[0007] Constructing an alarm classification model, wherein the alarm classification model includes a specified number of transformer layers and a specified hidden layer dimension, each transformer module includes a multi-head self-attention mechanism and a feedforward neural network, the multi-head self-attention mechanism is connected to the feedforward neural network through a residual and normalization layer, and the hidden layer dimension is the dimension of the output vector of each layer in the transformer;
[0008] Based on the preset corpus, the corpus data is cleaned, and after cleaning, the data is converted into an input sequence through dictionary mapping;
[0009] Pre-training the alarm classification model using an input sequence corresponding to a preset corpus, and using MLM tasks and NSP tasks in the model pre-training process;
[0010] Obtaining a specified data set, converting it into an input sequence through dictionary mapping, performing first-stage training on the pre-trained alarm classification model, and using a fully connected layer with a tanh activation function in the first-stage training process, and using a cross-entropy loss to perform first-stage parameter adjustment, wherein the size of the hidden layer of the fully connected layer with the tanh activation function is the same as the dimension of the alarm classification model, the output of the fully connected layer is the same as the number of categories, and the model output is mapped into a probability distribution in the cross-entropy loss before calculating the loss;
[0011] After the first stage of training, the alarm-based data is selected to perform the second stage of training;
[0012] The alarm classification model trained in the second stage is used to perform alarm classification.
[0013] Optionally, converting the alarm data into an input sequence through dictionary mapping includes:
[0014] Converting Chinese characters into numerical values by using a preset Chinese dictionary to convert text into a text sequence, vectorizing the converted text sequence, and for different sentence lengths, padding or truncating the sequence so that the generated sequence meets the input length requirement, thereby generating a first field; and,
[0015] A second field is added based on the first field, where the second field is used to identify the information of interest in the first field.
[0016] Optionally, use a fully connected layer with a tanh activation function and train with a cross entropy loss to perform the first stage of model tuning, including:
[0017] The tanh activation function satisfies:
[0018] The softmax function satisfies:
[0019] The loss function satisfies:
[0020] Where N is the number of samples and M is the number of categories y i represents the true label of the i-th sample, p i is the output of the model, y ij is an indicator (0 or 1) of whether the i-th sample belongs to category j, p ij is the probability that the model predicts that the i-th sample belongs to category j.
[0021] Optionally, the alarm classification model is pre-trained using an input sequence corresponding to a preset corpus, and the MLM task and the NSP task are used in the model pre-training process, including:
[0022] In the MLM task, the training process randomly selects tokens in the input sequence and replaces the selected tokens with the specified tags;
[0023] In the NSP task, some continuous sentence pairs in the training data are used, and the rest are randomly combined sentence pairs, so as to train the alarm classification model to judge whether two sentences are in a continuous relationship according to the context.
[0024] Optionally, after the first stage of training, selecting data based on the alarm and performing the second stage of training includes:
[0025] Two parallel fully connected layers are added to the alarm classification model after the first stage training. The output of one fully connected layer is used for the classification of the parent class, and the output of the other is used for the classification of the child class. The second stage training is performed by selecting the alarm-based data.
[0026] Optionally, the loss function for performing the second stage of training uses the cross entropy loss function.
[0027] An embodiment of the present application also proposes an alarm classification system based on a pre-trained large model, including a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the steps of the alarm classification method based on the pre-trained large model as described above are implemented.
[0028] The classification method of the embodiment of the present application can perform secondary fine-tuning of specific alarm data, which can not only capture common language features, but also learn specific knowledge related to news topics and alarms, thereby improving the accuracy and efficiency of classification.
[0029] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0031] Figure 1 This is a flowchart of an alarm classification method based on a pre-trained large model according to an embodiment of the present application; DETAILED DESCRIPTION
[0032] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0033] The present application embodiment provides an alarm classification method based on a pre-trained large model, such as Figure 1 As shown, including:
[0034] In step S101, an alarm classification model is constructed, wherein the alarm classification model includes a specified number of transformer layers and a specified hidden layer dimension, each transformer module includes a multi-head self-attention mechanism and a feedforward neural network, the multi-head self-attention mechanism and the feedforward neural network are connected through residual and normalization layers, and the hidden layer dimension is the dimension of the output vector of each layer in the transformer. In some specific examples, the alarm classification model can use a network architecture with 12 layers and a hidden layer dimension of 768. The number of layers refers to the number of transformers, and each transformer module includes a multi-head self-attention mechanism and a feedforward neural network, which are combined through residual connections and layer normalization. The classifier structure adopts a fully connected layer, aiming to accurately capture high-level semantic features, convert the deep abstract knowledge of the model into specific category judgments, and effectively improve the classification accuracy and generalization ability of the task. The hidden layer dimension refers to the dimension of the output vector of each layer in the transformer. The size of the vector into which each word or token is converted by the model.
[0035] In step S102, based on a preset corpus, the data of the corpus is cleaned, and after the cleaning, the data is converted into an input sequence through dictionary mapping.
[0036] In some specific examples, specific data cleaning includes using regular expressions to implement text screening, remove irrelevant characters, punctuation, stop words, etc., replace sensitive words, and ensure data quality. Subsequently, with the help of encoding and serialization technology, the text information is converted into a sequence format suitable for model input through dictionary mapping, thereby enhancing data processing efficiency and model readability. In some specific examples, text files are all UTF-8 encoded. In some examples, the preset corpus can be, for example, CLUECorpusSmall, and the data in the corpus is cleaned before using the CLUECorpusSmall corpus.
[0037] In step S103, the alarm classification model is pre-trained using an input sequence corresponding to a preset corpus, and the MLM task and NSP task are used in the model pre-training process.
[0038] In some specific examples, the alarm classification model is pre-trained using an input sequence corresponding to a preset corpus, and the MLM task and the NSP task are used in the model pre-training process, including:
[0039] MLM specifically refers to the masked language model. In the MLM task, the training process randomly selects tokens (such as single words) in the input sequence and replaces the selected tokens with the specified tag [MASK]. The model's task is then to predict what these masked tokens were originally. This approach allows the model to take into account the left and right information in the context (i.e., bidirectional context) when predicting each token.
[0040] NSP refers to next sentence prediction. The NSP task is to let the model learn to understand the relationship between two sentences. In this task, the model is given a pair of sentences and needs to predict whether the second sentence is the sentence that appears immediately after the first sentence in the original text. In the NSP task, some continuous sentence pairs in the training data are used, and the rest are randomly combined sentence pairs to train the alarm classification model to determine whether the two sentences are in a continuous relationship based on the context. For example, if there are two sentences, each word of the first sentence is set to 0, and each word of the second sentence is set to 1.
[0041] In step S104, a specified data set is obtained, and after being converted into an input sequence through dictionary mapping, the first stage of training is performed on the pre-trained alarm classification model, and a fully connected layer with a tanh activation function is used in the first stage of training, and a cross entropy loss is used to perform the first stage of parameter adjustment, wherein the size of the hidden layer of the fully connected layer with the tanh activation function is the same as the dimension of the alarm classification model, and the output of the fully connected layer is the same as the number of categories, and the loss is calculated after the model output is mapped into a probability distribution in the cross entropy loss. In some specific examples, based on the above examples, a fully connected layer with a tanh activation function is used, wherein the size of the hidden layer is set to 768, and then the dimension of the output is fixed to 7, that is, the number of categories, using a fully connected layer.
[0042] The loss function uses cross-entropy loss, which is good at measuring the difference between the model's predicted probability distribution and the actual label distribution, prompting the model to continuously optimize the predicted probability during the training process and reduce classification errors. It is a widely recognized performance evaluation standard in classification problems. The optimizer uses the AdamW optimizer, which further optimizes the weight update process through weight decay (L2 regularization) based on the original Adam optimizer, effectively preventing overfitting and improving the generalization performance and training efficiency of the model, especially in deep learning and large-scale language model training scenarios.
[0043] The first stage of training, for example, can be completed based on the Chinanews news topic classification data set. The first stage of training is used to perform the first fine-tuning of the alarm classification model. The amount of data for this fine-tuning is large and the training batch is small.
[0044] In step S105, after the first stage of training, the alarm-based data is selected to perform the second stage of training. The second stage of training is used as the second fine-tuning, which is used to perform the second fine-tuning based on the model after the first fine-tuning using the alarm-based data. The second fine-tuning uses a small amount of training data, more training batches and a larger learning rate, which can achieve better results for the alarm classification feature task.
[0045] In step S106, alarm classification is performed using the alarm classification model trained in the second stage.
[0046] The classification method of the embodiment of the present application can perform secondary fine-tuning of specific alarm data, which can not only capture common language features, but also learn specific knowledge related to news topics and alarms, thereby improving the accuracy and efficiency of classification.
[0047] In some embodiments, converting the alarm data into an input sequence through dictionary mapping includes:
[0048] Chinese characters are converted into numerical values by using a preset Chinese dictionary to convert text into a text sequence, and the converted text sequence is vectorized. For different sentence lengths, padding or truncation is performed to make the generated sequence meet the input length requirement, thereby generating a first field.
[0049] In some specific examples, Chinese text is converted into an input sequence suitable for model processing through dictionary mapping. The input sequence contains two fields: input_ids and attention_mask.
[0050] For input_ids, first convert Chinese characters into positive integers through a given Chinese dictionary, convert a text into a sequence, and then vectorize the sequence. At the same time, in order to solve the problem of different sentence lengths, padding or truncation operations are used to truncate longer texts and pad shorter texts to meet the input length requirements of the model.
[0051] A second field is added based on the first field, where the second field is used to identify the information of interest in the first field.
[0052] Based on the above, for attention_mask, since shorter sentences need to be filled to meet this requirement, we do not want the model to take into account the filled parts that do not represent any meaningful parts, so 0 is used in attention_mask to represent the filled parts. Specifically, 1 in attention_mask usually represents the position that "needs attention", that is, the actual word in the input sequence. 0 in attention_mask represents the position that "does not need to pay attention to", that is, the filled part.
[0053] Furthermore, for the pre-training of the model, the CLUECorpusSmall corpus with a total of 14G corpus and about 5 billion words is used to pre-train the model. The corpus mainly includes the sub-corpora in Table 1:
[0054] Table 1 Subcorpora in CLUECorpusSmall
[0055] Subcorpus name size Number of files News Corpus 8G 2000~ Community interaction corpus 3G 900~ Wikipedia corpus 1.1G 300~ Comment data corpus 2.3G 784
[0056] The processing process is to unify all file formats into one sentence per line, separate different documents with blank lines, and place all files in one file.
[0057] Based on the above embodiment, the maximum length of the sequence input is 512, that is, the length of input_ids and attention_mask in step 2 is fixed to 512. Embedding is performed using three methods: word embedding, position embedding, and paragraph embedding. Word embedding: This is the most basic embedding. Each word is mapped to a vector of fixed length and randomly initialized. These vectors are continuously corrected as the model is trained. These vectors capture the semantic and grammatical information of the words. Position embedding: The model cannot directly obtain the position information of the word in the sequence, so position embedding is used to encode the order information of the word. Each position has a unique vector representation, so that the model can understand the position of each word in the sequence. For each sentence, its position vector is set to [0,1,2,...N], where the stride is 1 and the length is the same as the sentence length. Paragraph embedding: When processing two-sentence tasks (such as question answering, textual entailment, etc.), the model receives two sentences as input, labeled A and B respectively. Paragraph embedding is used to distinguish the two sentences, that is, adding different fixed vectors to each word of A and B, so that the model can distinguish the two contexts of the input.
[0058] Then, the alarm classification model is pre-trained by using the MLM task and the NSP task. For details, see step S103.
[0059] After pre-training, the model is fine-tuned for the first time (first stage training) using the Chinanews news topic classification dataset to enhance the model's feature representation capabilities. In this stage, based on the model in step 3, a fully connected layer with a tanh activation function is used, where the size of the hidden layer is set to 768, and then a fully connected layer is used to fix the output dimension to 7, i.e., the number of categories. In some embodiments, a fully connected layer with a tanh activation function is used and cross entropy loss is used for training to perform the first stage model adjustment, specifically including:
[0060] The tanh activation function satisfies:
[0061] The softmax function satisfies:
[0062] The loss function satisfies:
[0063] Where N is the number of samples and M is the number of categories y i represents the true label of the i-th sample, p i is the output of the model, y ij is an indicator (0 or 1) of whether the i-th sample belongs to category j, p ij is the probability that the model predicts that the i-th sample belongs to category j.
[0064] In some embodiments, after the first stage training, selecting data based on the alarm and performing the second stage training includes:
[0065] Two parallel fully connected layers are added to the alarm classification model after the first stage training. The output of one fully connected layer is used for the classification of the parent class, and the output of the other is used for the classification of the child class. The second stage training is performed by selecting the alarm-based data.
[0066] Specifically, based on the model after the first fine-tuning mentioned above, the second stage of fine-tuning is performed. The second fine-tuning selects data based on alarms. The data contains two types of labels, namely parent class and child class. Each parent class contains multiple child classes, and each child class is only contained by one parent class. In the specific example, there are 14 parent classes and 105 child classes, with a total of 4726 data. Using the model after the first fine-tuning, two parallel fully connected layers are added after the model. The output of one fully connected layer is used for the classification of the parent class, and the output dimension is set to 14. The other fully connected layer is used for the classification of the child class, and the output dimension is set to 105.
[0067] In some embodiments, the loss function for performing the second stage training uses a cross entropy loss function.
[0068] The present application embodiment also proposes an implementation case of an alarm classification method based on a pre-trained large model:
[0069] First, the model is pre-trained using the CLUECorpusSmall corpus, using the MLM and NSP tasks, with the embedding dimension set to 768, the sequence length set to 512, the training batch set to 3, and the batch size set to 2. For comparison with the model that was not pre-trained, both the pre-trained model and the non-pre-trained model are trained and tested using the alarm classification task. The results are shown in the second and third rows of Table 2. The accuracy of the pre-trained model is significantly improved compared to the non-pre-trained model.
[0070] The first fine-tuning was performed using different datasets, and the fine-tuned model was fine-tuned for the second time using the alarm dataset. The weight of the parent class cross entropy was set to 0.7, and the weight of the child class cross entropy was set to 0.3. The learning rate started from 0.00002, and three batches were trained. The learning rate of the second batch was half of the initial learning rate, and the learning rate of the third batch was one-quarter of the initial learning rate. The batch size was set to 4, and the adamw optimizer was used. No memory limit was set, the embedding dimension was set to 768, the sequence length was set to 512, and the Adam optimizer was used. The experimental results under different fine-tuning datasets are shown in Table 2. The pre-trained model is a model that has only been pre-trained but not fine-tuned for the first time. The third to seventh rows in the table use the five datasets of JD full sentiment classification, Dianping sentiment classification, Chinese Textual Inference SBERT NLI, CLUENER2020 NER, and China news news topic classification as the first fine-tuning dataset data. JD fullsentiment classification, Dianping sentiment classification, and Chinanews newstopic classification are classification tasks, ChineseTextualInference SBERT NLI is an inference task, and CLUENER2020 NER is a part-of-speech analysis task. The experimental results show that the best effect is achieved when the model is fine-tuned for the first time using the Chinanews news topicclassification dataset, which has 7 categories, 1,400,000 training sets, and 112,000 test sets.
[0071] Table 2 Experimental results (accuracy) under different fine-tuning datasets
[0072]
[0073]
[0074] The embodiment of the present application also proposes an alarm classification method case based on a pre-trained large model. This implementation case uses a trained alarm classification model to generate pseudo labels for unlabeled data, and at the same time, filters and excludes labels with lower scores based on a set threshold to improve the accuracy of the pseudo labels. The trained alarm classification model needs to be selected based on the accuracy of the pseudo labels after setting a fixed threshold in the test set.
[0075] 1. Input Example
[0076] The page displays the format that needs to be entered. The uploaded csv file needs to be a csv file, the format can be utf-8 or ANSI, the column name is text (i.e. the first row), and the first column is used to store text content.
[0077] 2. Score Distribution
[0078] Use the model to infer the text in the file and display the distribution range of the current text score. After uploading the text file, the system will use the selected model to infer it and carefully display the frequency distribution of the scores assigned by the model during the annotation process. This display is divided into two refined granularities: one is divided by deciles, that is, the overall score range from 0 to 1 is evenly divided into 10 scales, with each 0.1 as an interval; the other is divided by percentiles, refining the same score interval to 100 scales, achieving accurate measurement of each 0.01.
[0079] 3. Model Annotation
[0080] Use the alarm classification model to infer and annotate the text in the file, generate pseudo labels for each line of text, and format the generated results into csv format. Users can download the annotation results.
[0081] Prepare a text file according to the format in the input example, then upload the text file on the alarm classification model annotation page and set the score threshold. After clicking Run, the text with a score greater than the threshold will be annotated. This is mainly done by performing softmax on the output value of the model regression layer, and taking the maximum value in softmax as the predicted value of the text. The results of partial text annotation are displayed on the web page. The web page provides the following three files for download:
[0082] (1) Filter out text files whose predicted values are greater than the score threshold. The text file is divided into four columns, namely text, label1, score1, label2, and score2. Text is the classified text, label1 and score1 are the category and score of the parent class, and label2 and score2 are the category and score of the child class.
[0083] (2) Filter out text files whose predicted values are less than the score threshold. The text file is divided into a column text, which contains the remaining text lines except the annotated text in (1).
[0084] (3) Filter out the text files whose predicted values are less than the score threshold. The text files are divided into four columns, namely text, label1, score1, label2, and score2. Text is the classified text, label1 and score1 are the category and score of the parent class, and label2 and score2 are the category and score of the child class. A labeling reference is provided. Since the accuracy of this part is low, it can be re-labeled.
[0085] 4. Dual-label reasoning
[0086] In the web application we built, we integrated instant text input and reasoning functions to provide users with a convenient interactive experience. Users can directly type or paste the text content they want to analyze in the specified input box of the web page, without uploading files, to trigger the reasoning process. Once the text is submitted, the system will respond immediately by following the steps below:
[0087] Preprocessing: The input text first goes through the preprocessing stage, including removing irrelevant characters, standardizing the text format, etc., to ensure that it meets the requirements of the model input.
[0088] Model loading and inference: Using the loaded PyTorch model, the system performs inference on the received text. The model performs in-depth analysis of the input text based on the patterns and features learned during training.
[0089] Results display: After the inference is completed, the web page immediately displays the model prediction results. For the alarm classification task, this includes the predicted parent category label and subcategory label
[0090] The method pre-training data and the first fine-tuning in the embodiment of the present application use Chinese corpus, and this part of the corpus has a stronger correlation with the alarm classification and a wider range, which is more beneficial to subsequent training and prediction, and can effectively reduce the probability of unknown text appearing during prediction.
[0091] This application adopts a two-stage fine-tuning method to make the model more suitable for classification tasks, and at the same time can make up for the defects of small number of alarm data sets and many categories. The dual-label training method is adopted, and the model is trained with parent and child classes together, which improves the accuracy of the model and can also predict the parent and child classes together during prediction.
[0092] An embodiment of the present application also proposes an alarm classification system based on a pre-trained large model, including a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the steps of the alarm classification method based on the pre-trained large model as described above are implemented.
[0093] It should be noted that in the embodiments of the present application, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0094] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0095] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0096] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. An alarm classification method based on a pre-trained large model, characterized in that: include: Constructing an alarm classification model, wherein the alarm classification model includes a specified number of transformer layers and a specified hidden layer dimension, each transformer module includes a multi-head self-attention mechanism and a feedforward neural network, the multi-head self-attention mechanism is connected to the feedforward neural network through a residual and normalization layer, and the hidden layer dimension is the dimension of the output vector of each layer in the transformer; Based on the preset corpus, the corpus data is cleaned, and after cleaning, the data is converted into an input sequence through dictionary mapping; Pre-training the alarm classification model using an input sequence corresponding to a preset corpus, and using MLM tasks and NSP tasks in the model pre-training process; Obtaining a specified data set, converting it into an input sequence through dictionary mapping, performing first-stage training on the pre-trained alarm classification model, and using a fully connected layer with a tanh activation function in the first-stage training process, and using a cross-entropy loss to perform first-stage parameter adjustment, wherein the size of the hidden layer of the fully connected layer with the tanh activation function is the same as the dimension of the alarm classification model, the output of the fully connected layer is the same as the number of categories, and the model output is mapped into a probability distribution in the cross-entropy loss before calculating the loss; After the first stage of training, the alarm-based data is selected to perform the second stage of training; The alarm classification model trained in the second stage is used to perform alarm classification.
2. The alarm classification method based on the pre-trained large model as claimed in claim 1, characterized in that: Converting alarm data into input sequence through dictionary mapping includes: Converting Chinese characters into numerical values by using a preset Chinese dictionary to convert text into a text sequence, vectorizing the converted text sequence, and for different sentence lengths, padding or truncating the sequence so that the generated sequence meets the input length requirement, thereby generating a first field; and, A second field is added based on the first field, where the second field is used to identify the information of interest in the first field.
3. The alarm classification method based on the pre-trained large model according to claim 1 is characterized in that: The first stage of model adjustment is performed using fully connected layers with tanh activation function and cross entropy loss for training. Specifically, it includes: The tanh activation function satisfies: The softmax function satisfies: The loss function satisfies: Where N is the number of samples and M is the number of categories y i represents the true label of the i-th sample, p i is the output of the model, y ij is an indicator (0 or 1) of whether the i-th sample belongs to category j, p ij is the probability that the model predicts that the i-th sample belongs to category j.
4. The alarm classification method based on the pre-trained large model according to claim 1 is characterized in that: The alarm classification model is pre-trained using an input sequence corresponding to a preset corpus, and the MLM task and the NSP task are used in the model pre-training process. The method includes: In the MLM task, the training process randomly selects tokens in the input sequence and replaces the selected tokens with the specified tags; In the NSP task, some continuous sentence pairs in the training data are used, and the rest are randomly combined sentence pairs, so as to train the alarm classification model to judge whether two sentences are in a continuous relationship according to the context.
5. The alarm classification method based on the pre-trained large model as claimed in claim 3 is characterized in that: After the first phase of training, the second phase of training is performed by selecting data based on alarms, including: Two parallel fully connected layers are added to the alarm classification model after the first stage training. The output of one fully connected layer is used for the classification of the parent class, and the output of the other is used for the classification of the child class. The second stage training is performed by selecting alarm-based data.
6. The alarm classification method based on the pre-trained large model as claimed in claim 5, characterized in that: The loss function for performing the second stage of training uses the cross entropy loss function.
7. An alarm classification system based on a pre-trained large model, characterized in that: It comprises a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the steps of the alarm classification method based on the pre-trained large model as described in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
CN116304041A
