Abnormal log detection method based on personalized federal learning

Through a personalized federated learning method that performs local training in the data center and aggregates model parameters, combined with meta-learning and GAN, it solves the data leakage and efficiency problems in traditional centralized detection methods, and achieves efficient anomaly log detection and privacy protection.

CN118860705APending Publication Date: 2024-10-29NANJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410837348.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-10-29

AI Technical Summary

Technical Problem

Traditional centralized anomaly detection methods have risks of data leakage and privacy invasion, low processing efficiency, difficulty in adapting to uneven data distribution and environmental changes, and poor generalization ability to small sample data.

Method used

A personalized federated learning method based on meta-learning is adopted to generate a personalized global model by locally training the model and aggregating parameters on the central server. It combines the improved meta-learning algorithm and the generative adversarial network (GAN) to protect the privacy of log data. Adapt to abnormal log detection in distributed environments.

Benefits of technology

It effectively reduces the risk of data leakage, improves processing efficiency and model adaptability, improves the detection ability of small sample log data, reduces manual intervention costs, and ensures data privacy protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118860705A_ABST
    Figure CN118860705A_ABST
Patent Text Reader

Abstract

The invention discloses an abnormal log detection method based on personalized federal learning. The method comprises the following steps: step 1, a local client meta-learning algorithm training process; 2, the data center cluster participates in the personalized federal learning training process, and the abnormal log detection method is provided for the requirements of a modern large software system. According to the method, the problem that abnormal log samples are insufficient is solved by means of a meta-learning method. Meanwhile, personalized federation learning is introduced to ensure high privacy protection of the log data, so that the potential risk possibly causing data leakage is reduced. Aiming at the problem of unbalanced log data distribution in a distributed environment, an abnormal log detection system is constructed in combination with an improved meta-learning algorithm and personalized federated learning, and aims to realize automatic detection of abnormal logs so as to reduce the cost required by manual intervention.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of intelligent operation and maintenance, and specifically relates to an abnormal log detection method based on personalized federated learning. Background Art

[0002] As software systems increase in size and complexity, anomalies in a single service may seriously affect the user experience of a large number of users. Logging plays a key role in system management, maintenance, monitoring, and troubleshooting. Logs record system and application operations, events, and error information, which helps to quickly locate problems and reduce system downtime. In addition, logs are also used to detect and track security incidents and potential threats, thereby strengthening system security. However, with the dramatic increase in the amount of log data, processing this data has become a daunting task. The research and application of automated detection methods have become crucial to improve processing efficiency. Anomaly detection technology plays an important role in log data analysis, but traditional methods may have data leakage and privacy issues.

[0003] Traditional centralized anomaly detection methods require sensitive data to be centralized on a central server for processing, which brings the risk of data leakage and privacy violation:

[0004] 1. Data leakage and privacy issues: Traditional centralized anomaly detection methods require sensitive data to be centralized on a central server for processing, which brings the risk of data leakage and privacy violation;

[0005] 2. Processing efficiency: With the rapid increase in the amount of log data, processing this data has become a difficult task, and traditional methods are insufficient in processing efficiency;

[0006] 3. Uneven data distribution: In a distributed environment, the log data generated by different devices may show different distributions. Traditional anomaly detection models may tend to process categories with larger data volumes, resulting in poor performance for categories with smaller data volumes.

[0007] 4. Environmental and system changes: Changes in software systems and network environments pose challenges to model performance, and traditional methods may find it difficult to quickly adapt to new environments and tasks. Summary of the invention

[0008] To achieve the above objectives, the present invention proposes a detection method for abnormal logs in response to the needs of modern large-scale software systems. In the present invention, a meta-learning method is used to deal with the problem of insufficient abnormal log samples. At the same time, personalized federated learning is introduced to ensure a high degree of privacy protection for log data, thereby reducing the potential risk of data leakage. In view of the problem of unbalanced distribution of log data in a distributed environment, an abnormal log detection system is constructed by combining an improved meta-learning algorithm and personalized federated learning, aiming to realize the automatic detection of abnormal logs to reduce the cost required for manual intervention.

[0009] In most cases, the normal operation logs of software systems are far more than the abnormal logs. This is because the abnormal logs of many software systems only record information when problems or errors occur. On the other hand, abnormal data is usually specific and therefore relatively difficult to detect and identify. In addition, with the overall increase in the amount of logs, the proportion of abnormal logs in the overall log data is relatively small. Compared with meta-learning, traditional anomaly detection methods may require more labeled data to build accurate models. Existing anomaly detection methods have poor generalization ability for new anomaly classes with fewer samples, but it is currently impossible to collect training data for all possible anomaly classes. Meta-learning can reduce the dependence on a large number of abnormal samples and improve the adaptability to unstable logs by learning how to generalize to new abnormal patterns from limited samples. This research method will extract multi-dimensional log information from small sample log data in data centers and use the improved model-agnostic meta-learning algorithm (MAML) to solve the problem of abnormal log detection in data centers.

[0010] The specific technical solution adopted by the present invention is an abnormal log detection method based on personalized federated learning: in order to capture abnormal log information, for small sample log data, multi-dimensional log information is extracted, and the problem of abnormal log detection in the data center is solved by using an improved model-independent meta-learning algorithm. In order to protect the privacy of log data, each data center, as a client of federated learning, uses local data for model training, and then uploads the model parameters of each client to the central server and aggregates and groups them to obtain multiple cluster centers. In this way, multiple global models are optimized, and the client can select the global model closest to its local data to perform personalization.

[0011] The technical solution of the present invention is as follows: an abnormal log detection method based on personalized federated learning, the method comprising the following steps:

[0012] Step 1: Local client meta-learning algorithm training process;

[0013] Step 2: The data center cluster participates in the personalized federated learning training process.

[0014] As an improvement of the present invention, the steps include the local client meta-learning algorithm training process including:

[0015] Step 1.1: Use regular expressions to classify log data by component name, input the data into the model in sequence format, define the anomaly label of the log sequence, and predict anomalies in advance using the window size n.

[0016] In a logging system, a component usually refers to a field in the log information, which is used to identify the source of the log record or the associated module, subsystem, service or application. It can help system administrators or developers quickly locate the location where the log is generated, and can also clearly indicate which part of the log record is generated.

[0017] The component field allows you to classify and filter logs, so that when analyzing logs, you can focus only on the logs of specific modules and ignore the logs of other modules that are not related to the current problem. When a problem occurs in the system, this field can help quickly locate the module where the problem occurs, improving the efficiency of troubleshooting. In addition, different components can generate different types of performance logs. By analyzing these logs, you can understand the performance status of each component and perform targeted optimization.

[0018] To adapt to the meta-learning training task, before parsing the log data, the log data set is effectively classified according to the component name (Component) of the log by using regular expressions. The component name of the log data represents different functions of the system. For example, in the BGL dataset, the component name KERNEL represents the core part of the system, that is, the operating system kernel, and the component name LINKCARD represents the part related to network connection, such as the module for processing network connection or communication. Since the logs generated by each component may contain normal and abnormal samples, the original label of each log is the state of a component (normal or abnormal). In order to capture the time series information of the log, the format of the log sequence is required as the model input. For a specific component, whether the log sequence is abnormal is defined as: assuming that the log window size is n, the n logs within the window range are used as sequence data, and if the next window (n+1 to 2n) contains abnormal logs, the window is marked with an abnormal label, so as to achieve the purpose of predicting abnormal information one window in advance.

[0019] Step 1.2: Use the online stream processing method Brain to parse the log information, extract the static log template and remove useless information to retain the semantic, timing and dynamic parameter information;

[0020] When analyzing log information, logs are composed of signatures, timestamps, and parameters, which correspond to the semantic information, timing information, and dynamic parameter information of log data, respectively. These information can provide useful insights for troubleshooting, performance optimization, and system monitoring. The original log information contains a lot of useless information, so log parsing is required. This method uses an online stream processing log parsing method Drain to extract static log templates.

[0021] Step 1.3: Map the words in the log template to one-hot encoding, generate semantic representation through the Transformer encoder, and fuse the timing information and parameter information to obtain the log sequence representation;

[0022] Step 1.4: Based on the model-independent meta-learning algorithm, each task is defined as a 2-way, N-shot problem, and the performance of the target component is improved through the knowledge of the source component, including initializing meta-parameters, calculating inner parameters by gradient descent, and updating meta-parameters.

[0023] Step 1.5: Build a memory module to store support set samples and retrieve the most similar samples in the query phase.

[0024] Step 1.6: Construct a value predictor based on a model-independent meta-learning algorithm to imitate the support set behavior. By weighted fusion of the predicted values ​​of the meta-learning algorithm and the imitation module, the model's dependence on the support set is enhanced and the model performance is optimized.

[0025] As an improvement of the present invention, the step 1.3 includes feature extraction, and the feature extraction includes the following steps:

[0026] Step 1.3.1, log template encoding: Use the tokenizer to map each word in the log template to a one-hot encoding vector. The log template S is converted into a vector list X:

[0027] X=[x 1, x2,…,z m ]

[0028] Where m is the length of the log template S, x i is a one-hot vector;

[0029] Step 1.3.2, generate semantic information representation of log template: pass the encoded vector list X to the Transformer encoder, use the last hidden state to obtain the semantic information representation of the log template, and use mean pooling to generate a vector of fixed dimension d as the semantic information representation H of a single log template:

[0030] H=[h 1, h 2,…, hd ];

[0031] Step 1.3.3, parameter value encoding and representation acquisition: The parameter values ​​in the log usually record important system status indicators. Encoding the parameter values ​​can capture the information in the parameters and help detect performance anomalies. Use the Transformer encoder to model the parameters in each log template and obtain the parameter information representation L of a single log:

[0032] P = [p 1, p 2,…, p d ];

[0033] Step 1.3.4: Add the semantic information representation H and parameter information representation P in each log sequence element by element and take the average to obtain a comprehensive representation of each log. For n log representations, the log sequence representation is finally obtained.

[0034] As an improvement of the present invention, this method is based on model-independent meta-learning MAML, and each meta-learning task T i It is defined as a 2-way, N-shot problem. Specifically, each meta-learning task contains a normal class and an abnormal class, and each class contains n samples. Given that the logs output by different components have certain similarities, we can transfer valuable knowledge from the source component to the target component, thereby improving the performance of the model on the target component. Specifically, this method divides the logs into training sets and test sets based on the components to which they belong. The goal is to n}, learn the abnormal pattern of the target component of the test set {C target}, where each component may contain normal and abnormal samples.

[0035] The meta-learning in step 1.4 mainly includes the following steps:

[0036] Step 1.4.1, initialize the meta-parameter θ;

[0037] Step 1.4.2: From the training set components {C1, C2, …, C n} Sample a meta-training task T i (D suppor t_i ,D query_i ), initialize the inner parameters:

[0038] θ′ i =θ;

[0039] Step 1.4.3: On the support set D support_i The inner layer parameter θ′ is calculated by the following gradient descent formula i :

[0040]

[0041] Step 1.4.4, query set D query_i Above, calculate the meta-loss:

[0042]

[0043] Step 1.4.5, finally update the meta-parameter θ:

[0044]

[0045] In the above formula, α and β represent the hyperparameters of the inner and outer layer update gradients, respectively. As the network model, this method uses GRU (Gate Recurrent Unit). In the meta-test phase, from the target component {C target}Sampling element test task T test (D support_test ,D query_test ), in the support set D support_test Fine-tune the model and use the updated parameters θ′ i_test In the query set D query_test Evaluate the model performance on.

[0046] As an improvement of the present invention, in step 1.5, based on model-independent meta-learning MAML, each data set D includes a support set D support and query set D query In the meta-training phase, firstly, through its support set D support The gradient descent on each task T i Get task-specific inner layer parameters θ′ i , then according to θ i In the query set D query The performance on the update of its global initialization θ, the network of this method is selected as GRU, which can better capture the timing information. In the meta-test stage, the support set D support_test Fine-tune on the i_test In the query set D query_test Evaluate the model.

[0047] Optimization-based meta-learning algorithms usually suffer from the problem of memory overfitting. The learned model tends to solve all meta-training tasks by memorizing, rather than learning how to quickly adapt from one task to another through the support set. That is, the model tends to memorize the meta-training tasks and ignore the support set when adapting to new tasks, which leads to poor generalization of the meta-test set.

[0048] Therefore, a memory-enhanced meta-learning method is proposed to enhance the model's reliance on the task adaptation support set. In order to make full use of the information of the support set, key-value pairs are constructed from the support set samples and stored in the memory module. For each task-specific memory module M i , using the diversity score S(Mi) of the stored key. Here, a more diverse memory will get a higher diversity score. When the memory is not full, write the support set samples directly without selection; otherwise, calculate the diversity score of the current memory and the score after each old key-value pair is replaced by the new key-value pair. In this way, the constructed memory can carry more discriminative and representative information and effectively utilize the storage space. Afterwards, for a given sample K in the query set, i Retrieve the top N most similar slots from , where the similarity is measured based on the cosine similarity. These N key-value pairs are taken as the output of the memory read.

[0049] As an improvement of the present invention, the step 1.6 includes that for each sample in the query set, the input of the imitation module is the sample representation and the N memory slots it retrieved, the output is the predicted label of the sample To train the value predictor, fit the value predictor to each query set example, using the support set in memory To train the value predictor. The inner layer parameters θ′ are calculated by the following gradient descent formula p :

[0050]

[0051] The predictor performs several gradient descents to minimize the loss function L p :

[0052]

[0053] in is the generated prediction value of the predictor, is the memory read output of the query set sample,

[0054] In the query set D query The predicted value of the meta-learning algorithm is The predicted value of the imitation module is The loss function L of the global meta-learning algorithm is finally updated by adjusting the prediction value through the hyperparameter c:

[0055]

[0056] As an improvement of the present invention, in a distributed environment, different data centers usually contain sensitive information. Bringing the log data of these data centers together may lead to the risk of privacy leakage. Federated learning allows model training without sharing the original data, which helps to protect the privacy of the data. The data in each data center may have different characteristics and distributions. Federated learning may not adapt well to these differences using a global model. This is because the success of federated learning relies on an important assumption: the data in each data center is independent and identically distributed (IID). In actual scenarios, data is usually presented in non-IID form. Under the Non-IID setting, the optimization direction of each data center is inconsistent, which is like each component force has a different direction, and the final resultant force is smaller than each component force, which is called weight divergence in the literature. Because the weight divergence model converges slowly and has poor generalization ability.

[0057] Personalized federated learning is designed to solve the two problems of slow convergence and poor performance on highly heterogeneous (non-IID) data in federated learning, as well as the lack of personalization of the model for local tasks or data sets. Through personalized federated learning, each data center can fine-tune the local model based on the global model to obtain a model that is more suitable for its data, thereby improving the performance of the model.

[0058] In federated learning, generative adversarial networks (GANs) play an important role in privacy protection. Specifically, GANs prevent data leakage by generating data to mask the distribution and characteristics of real data. Federated learning achieves local processing of data by performing distributed training in multiple data centers without transmitting the original data to a central server. In this process, GANs generate virtual data similar to real data for training and exchanging model parameters, so that even if the data is intercepted, attackers cannot obtain the real data, thereby effectively protecting the privacy of users.

[0059] GAN mainly consists of two parts: generator G and discriminator D. Generator G is responsible for generating virtual data, and discriminator D is responsible for distinguishing real data from virtual data. Its goal is to make the data generated by the generator look real through continuous game.

[0060] Generator G:

[0061] G(z;θ G )→x fake

[0062] Where z is random noise, θ G is the parameter of the generator, x fake is the generated dummy data.

[0063] Discriminator:

[0064] D(x;θ D )→[0,1]

[0065] Among them, x can be real data or virtual data, θ D is the parameter of the discriminator, and the output value represents the probability that the data is true.

[0066] The process of data center cluster participating in personalized federated learning training includes the following steps:

[0067] Step 2.1: The server initializes the meta-learning algorithm. The server initializes a Transformer-based extractor and a meta-learning-based classifier for the client.

[0068] Step 2.2: In the scenario of multiple data centers, each data center downloads the extractor and classifier and performs local training to adapt to local data. After the training is completed, each component in each center acts as a client to upload the classifier and generator to the server.

[0069] Step 2.3: The server performs k-clustering on the collected classifiers and generators, and divides them into several clusters according to feature similarity. The models in each cluster are aggregated through federation average to generate a joint model, and the parameter weights are reasonably allocated considering the data volume, data quality and local model performance;

[0070] Step 2.4: Each client downloads the classifier and generator of the cluster closest to itself, and performs secondary training locally to further adjust the model for personalization. During the local training process, GAN generates virtual data to protect data privacy, and the federated learning mechanism ensures that the data does not leave the local area.

[0071] As an improvement of the present invention, step 2.1 includes: first, the server initializes an extractor E based on the Transformer model for the client to obtain the log sequence representation:

[0072] E(x;θ E )→h

[0073] Where x is the input data, θ E is the parameter of the Transformer model, h is the log sequence representation,

[0074] In addition, a classifier C based on a meta-learning algorithm is trained based on a small-scale public dataset to determine whether the log is abnormal:

[0075] C(h;θ c )→y

[0076] Where h is the log sequence representation, θc is the classifier parameter, y is the classification result;

[0077] The present invention is oriented to multiple data centers, each of which has multiple components, and each component is a participant in federated learning. Each participant downloads the extractor E and classifier C initialized by the server, and each participant performs an initial training locally, using local data to adjust the parameters of the extractor and classifier. After the local training is completed, each participant sends their classifier C i and the generator G i Upload to the server, which will collect the classifiers and generators from all participants and proceed to the next step.

[0078] As an improvement of the present invention, in step 2.3, the collected classifiers and generators will be k-clustered on the server side. The k-clustering algorithm will divide these classifiers and generators into several clusters according to their feature similarities. In each cluster, the server will perform federated average aggregation on each classifier and generator to generate a joint model within the cluster. Suppose there are N participants in a cluster, and their classifiers and generators are and The federated average aggregation formula is as follows:

[0079]

[0080] In federated averaging, the weight of each local model parameter can be assigned according to different strategies. Usually, the weight assignment takes into account the data volume and quality of the data center, as well as the performance of the local model. Data centers with larger data volume, higher data quality, and better local model performance are usually given higher weights to ensure that they contribute more to the global model.

[0081] As an improvement of the present invention, each client downloads the classifier C to which the cluster closest to itself belongs. g and the generator G g , and conduct secondary training locally. Through secondary training, each participant further adjusts the downloaded classifier and generator according to local data to obtain a more personalized local model. In this process, GAN participates in training and exchange by generating virtual data, ensuring the protection of data privacy. At the same time, the federated learning mechanism makes it unnecessary for data to leave the local area, further improving the effect of privacy protection.

[0082] Compared with the prior art, the beneficial effects of the present invention are as follows: the specific technical solution adopted by the present invention is an abnormal log detection method based on personalized federated learning: in order to capture abnormal log information, for small sample log data, multi-dimensional log information is extracted, and the improved model-independent meta-learning algorithm is used to solve the problem of abnormal log detection in the data center. In order to protect the privacy of log data, each data center, as a client of federated learning, uses local data for model training, and then uploads the model parameters of each client to the central server and then aggregates and groups them to obtain multiple clustering centers. In this way, multiple global models are optimized, and the client can select the global model closest to its local data to perform personalization. BRIEF DESCRIPTION OF THE DRAWINGS

[0083] Figure 1 This is the abnormal log detection process in this embodiment;

[0084] Figure 2 This is the meta-learning framework diagram in this embodiment;

[0085] Figure 3 This is a diagram of the personalized federated learning framework in this embodiment. DETAILED DESCRIPTION

[0086] The present invention will be further explained below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the following specific embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention.

[0087] Embodiment: This embodiment proposes an abnormal log detection method based on personalized federated learning. This method is divided into two parts, namely the meta-learning framework and the personalized federated learning framework. First, the abnormal detection process is as shown in the attached Figure 1 As shown in the figure, for each federated learning client, the original log needs to be parsed, and the parsed log contains structured template semantic information and parameter information. Then, the log sequence representation is extracted through Transformer as the input of the improved meta-learning algorithm. Each client uses the improved model-independent meta-learning algorithm to train the local model. Then, each data center uploads some model parameters to the central server for aggregation and grouping, forming multiple clustering centers and optimizing multiple global models. Finally, the client selects the most suitable global model for personalized anomaly detection based on local data.

[0088] The specific steps include:

[0089] Local client meta-learning algorithm training process:

[0090] Step 1: Use regular expressions to classify log data by component name and input the model in sequence format. Define the anomaly label of the log sequence and predict anomalies in advance using the window size n.

[0091] Step 2: Use the online stream processing method Brain to parse the log information, extract the static log template and remove useless information to retain the semantic, timing and dynamic parameter information.

[0092] The following is an example of a BGL log message:

[0093] "-1125082044 2005.08.26R63-M1-N7-C:J09-U11 2005-08-26-11.47.24.991121

[0094] R63-M1-N7-C:J09-U11 RAS KERNEL INFO iar 003a90fc dear 00c07208”

[0095] After being parsed by Brain, the log template is: "iar<*>dear<*>"; the parameter information list is: "['003a90fc','00c07208']".

[0096] Step 3: Map the words in the log template to one-hot encoding, generate semantic representation through the Transformer encoder, and fuse the timing information and parameter information to obtain the log sequence representation.

[0097] The following is an example of a log sequence representation:

[0098] “[[-0.10741758346557617,-0.07356251031160355,0.20172417163848877,…,

[0099] -0.05423731729388237]]".

[0100] Step 4: Based on the model-independent meta-learning algorithm, each task is defined as a 2-way, N-shot problem, and the performance of the target component is improved through the knowledge of the source component, including initializing meta-parameters, calculating inner parameters by gradient descent, and updating meta-parameters.

[0101] Step 5: Build a memory module to store support set samples and retrieve the most similar samples in the query phase to solve the memory overfitting problem and improve generalization performance.

[0102] Step 6: Construct a value predictor based on a model-independent meta-learning algorithm to imitate the support set behavior, and enhance the model's dependence on the support set and optimize the model performance by weighted fusion of the predicted values ​​of the meta-learning algorithm and the imitation module.

[0103] Data center clusters participate in the personalized federated learning training process:

[0104] Step 1: The server initializes the meta-learning algorithm. The server initializes a Transformer-based extractor and a meta-learning-based classifier for the client.

[0105] Step 2: In the scenario of multiple data centers, each data center downloads the extractor and classifier and performs local training to adapt to local data. After training, each component in each center acts as a client to upload the classifier and generator to the server.

[0106] Step 3: The server performs k-clustering on the collected classifiers and generators, and divides them into several clusters based on feature similarity. The models in each cluster are aggregated through federated average to generate a joint model, taking into account the data volume, data quality and local model performance, and reasonably allocating parameter weights.

[0107] Step 4: Each client downloads the classifier and generator of the cluster closest to itself and performs secondary training locally to further adjust the model for personalization. During local training, GAN generates virtual data to protect data privacy, and the federated learning mechanism ensures that the data does not leave the local area.

[0108] It should be noted that the above content only illustrates the technical idea of ​​the present invention and cannot be used to limit the protection scope of the present invention. For ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications all fall within the protection scope of the claims of the present invention.

Claims

1. The abnormal log detection method based on personalized federated learning is characterized by: The method comprises the following steps: Step 1: Local client meta-learning algorithm training process; Step 2: The data center cluster participates in the personalized federated learning training process.

2. The abnormal log detection method based on personalized federated learning according to claim 1 is characterized in that: The steps include a local client meta-learning algorithm training process including: Step 1.1: Use regular expressions to classify log data by component name, input the data into the model in sequence format, define the anomaly label of the log sequence, and predict anomalies in advance using the window size n. Step 1.2: Use the online stream processing method Brain to parse the log information, extract the static log template and remove useless information to retain the semantic, timing and dynamic parameter information; Step 1.3: Map the words in the log template to one-hot encoding, generate semantic representation through the Transformer encoder, and fuse the timing information and parameter information to obtain the log sequence representation; Step 1.4: Based on the model-independent meta-learning algorithm, each task is defined as a 2-way, N-shot problem, and the performance of the target component is improved through the knowledge of the source component, including initializing meta-parameters, calculating inner parameters by gradient descent, and updating meta-parameters. Step 1.5: Build a memory module to store support set samples and retrieve the most similar samples in the query phase. Step 1.6: Construct a value predictor based on a model-independent meta-learning algorithm to imitate the support set behavior. By weighted fusion of the predicted values ​​of the meta-learning algorithm and the imitation module, the model's dependence on the support set is enhanced and the model performance is optimized.

3. The abnormal log detection method based on personalized federated learning according to claim 2 is characterized in that: The step 1.3 includes feature extraction, feature extraction The steps include: Step 1.3.1, log template encoding: Use the tokenizer to map each word in the log template to a one-hot encoding vector. The log template S is converted into a vector list X: X=[x1,x2,…,x m ] Where m is the length of the log template S, x i is a one-hot vector; Step 1.3.2, generate semantic information representation of log template: pass the encoded vector list X to the Transformer encoder, use the last hidden state to obtain the semantic information representation of the log template, and use mean pooling to generate a vector of fixed dimension d as the semantic information representation H of a single log template: H=[h 1, h 2,…, h d ]; Step 1.3.3, parameter value encoding and representation acquisition: The parameter values ​​in the log usually record important system status indicators. Encoding the parameter values ​​can capture the information in the parameters and help detect performance anomalies. Use the Transformer encoder to model the parameters in each log template and obtain the parameter information representation P of a single log: P=[p1,p2,…,p d ]; Step 1.3.4: Add the semantic information representation H and parameter information representation P in each log sequence element by element and take the average to obtain a comprehensive representation of each log. For n log representations, the log sequence representation is finally obtained.

4. The abnormal log detection method based on personalized federated learning according to claim 2 is characterized in that: The meta-learning in step 1.4 mainly includes the following steps: Step 1.4.1, initialize the meta-parameter θ; Step 1.4.2: From the training set components {C1, C2, …, C n } Sample a meta-training task T i (D suppor t_i ,D query_i ), initialize the inner parameters: θ′ i =θ; Step 1.4.3: On the support set D support_i The inner layer parameter θ′ is calculated by the following gradient descent formula i : Step 1.4.4, query set D query_i Above, calculate the meta-loss: Step 1.4.5, finally update the meta-parameter θ: In the above formula, α and β represent the hyperparameters of the inner and outer layer update gradients, respectively. As the network model, this method uses GRU (Gate Recurrent Unit). In the meta-test phase, from the target component {C target }Sampling element test task T test (D support_test ,D query_test ), in the support set D support_test Fine-tune the model and use the updated parameters θ′ i_test In the query set D query_test Evaluate the model performance on.

5. The abnormal log detection method based on personalized federated learning according to claim 2 is characterized in that: In step 1.5, based on model-independent meta-learning MAML, each dataset D contains a support set D support and query set D query In the meta-training phase, firstly, through its support set D support The gradient descent on each task T i Get task-specific inner layer parameters θ′ i , then according to θ′ i In the query set D query The performance on the update of its global initialization θ, the network of this method is selected as GRU, which can better capture the timing information. In the meta-test stage, the support set D support_test Fine-tune on the i_test In the query set D query_test Evaluate the model.

6. The abnormal log detection method based on personalized federated learning according to claim 2 is characterized in that: The step 1.6 includes that for each sample in the query set, the input of the imitation module is the sample representation and the N memory slots it retrieved, the output is the predicted label of the sample To train the value predictor, fit the value predictor to each query set example, using the support set in memory To train the value predictor. The inner layer parameters θ′ are calculated by the following gradient descent formula p : The predictor performs several gradient descents to minimize the loss function L p : in is the generated prediction value of the predictor, is the memory read output of the query set sample, In the query set D query The predicted value of the meta-learning algorithm is The predicted value of the imitation module is The loss function L of the global meta-learning algorithm is finally updated by adjusting the prediction value through the hyperparameter c:

7. The abnormal log detection method based on personalized federated learning according to claim 1 is characterized in that: The process of data center cluster participating in personalized federated learning training includes the following steps: Step 2.1: The server initializes the meta-learning algorithm. The server initializes a Transformer-based extractor and a meta-learning-based classifier for the client. Step 2.2: In the scenario of multiple data centers, each data center downloads the extractor and classifier and performs local training to adapt to local data. After the training is completed, each component in each center acts as a client to upload the classifier and generator to the server. Step 2.3: The server performs k-clustering on the collected classifiers and generators, and divides them into several clusters according to feature similarity. The models in each cluster are aggregated through federation average to generate a joint model, and the parameter weights are reasonably allocated considering the data volume, data quality and local model performance; Step 2.4: Each client downloads the classifier and generator of the cluster closest to itself, and performs secondary training locally to further adjust the model for personalization. During the local training process, GAN generates virtual data to protect data privacy, and the federated learning mechanism ensures that the data does not leave the local area.

8. The abnormal log detection method based on personalized federated learning according to claim 7 is characterized in that: The step 2.1 includes: first, the server initializes an extractor E based on the Transformer model for the client to obtain the log sequence representation: E(x;θ E )→h Where x is the input data, θ E is the parameter of the Transformer model, h is the log sequence representation, In addition, a classifier C based on a meta-learning algorithm is trained based on a small-scale public dataset to determine whether the log is abnormal: C(h;θ c )→y Where h is the log sequence representation, θ c is the classifier parameter, y is the classification result; Each participant downloads the extractor E and classifier C initialized by the server. Each participant performs an initial training locally and adjusts the parameters of the extractor and classifier using local data. After the local training is completed, each participant sends their classifier C i and the generator G i Upload to the server, which will collect the classifiers and generators from all participants and proceed to the next step.

9. The abnormal log detection method based on personalized federated learning according to claim 7 is characterized in that: In step 2.3, on the server side, the collected classifiers and generators will be k-clustered. The k-clustering algorithm will cluster these classifiers and generators according to their feature similarities. It is divided into several clusters. In each cluster, the server will perform federated average aggregation on each classifier and generator to generate a joint model within the cluster. Suppose there are N participants in a cluster, and their classifiers and generators are and The federated average aggregation formula is as follows: In federated averaging, the weight of each local model parameter can be assigned according to different strategies.

10. The abnormal log detection method based on personalized federated learning according to claim 7 is characterized in that: Each client downloads the classifier C of the cluster closest to itself g and the generator G g , and conduct secondary training locally. Through secondary training, each participant further adjusts the downloaded classifier and generator according to local data to obtain a more personalized local model.

Citation Information

Cited By

  • Hybrid internal threat detection method based on DACGAN-Transform

    CN119397535A

  • A hybrid internal threat detection method based on DACGAN-Transformer

    CN119397535B