Anomaly detection algorithm selection method for cloud monitoring knowledge enhancement time series

By using the time series anomaly detection algorithm selection method of soft tags and knowledge fusion modules in cloud monitoring, the problem of low efficiency and accuracy of selection algorithms in the prior art is solved, and more efficient and accurate abnormality detection is achieved, which enhances the normalization of the problem. Understanding and processing capabilities of cloud monitoring tasks.

CN119066557APending Publication Date: 2024-12-03BEIJING NOSI SPACETIME TECH CO LTD
6 Cites 0 Cited by

Patent Information

Application Number
CN202411182645.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-27
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

Existing time series anomaly detection algorithms are inefficient and accurate in cloud monitoring applications. This is mainly due to the fact that only hard label training is used and the lack of full utilization of cloud monitoring related knowledge, it is impossible to effectively learn the correlation between anomaly detection algorithms. and exploit external knowledge.

Method used

Using the time series anomaly detection algorithm selection method for cloud monitoring knowledge enhancement, the algorithm selector is constructed through the time series feature extractor and linear classifier, using soft labels and knowledge fusion modules, using soft labels and external knowledge for training, and constructing soft label losses and knowledge fusion loss, update model parameters, and improve the accuracy of algorithm selection.

Benefits of technology

It improves the selection accuracy and efficiency of abnormal detection algorithms in cloud monitoring, enhances the understanding and processing capabilities of abnormal detection tasks, improves the detection accuracy, and seamlessly integrates into the cloud monitoring system, reducing additional computing time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119066557A_ABST
    Figure CN119066557A_ABST
Patent Text Reader

Abstract

The invention discloses a cloud monitoring knowledge enhancement time sequence-oriented anomaly detection algorithm selection method, and belongs to the field of deep learning. The problems that in an automatic selection method of an existing anomaly detection algorithm, only hard tags are used for training, time sequence anomaly detection related knowledge is lacked to be fully utilized, and consequently the algorithm selection efficiency and accuracy are low are solved. Knowledge enhancement is carried out in two aspects, firstly, knowledge enhancement is carried out based on soft label classification of historical tasks, and soft labels provide more knowledge about the relation between candidate anomaly detection algorithms for learning of an algorithm selector f; and secondly, mutual information between time sequence representation and knowledge representation is maximized based on knowledge enhancement of a time sequence anomaly detection external knowledge fusion module, external knowledge is fused into an algorithm selector, and the selection capability of an anomaly detection algorithm is improved, so that the accuracy of anomaly detection in cloud monitoring is improved. The method is mainly used for carrying out abnormal algorithm selection on the time sequence.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of deep learning. Background Art

[0002] Time series anomaly detection technology is an important supporting technology in many practical applications, especially in the monitoring and operation of cloud-native database systems. By using time series anomaly detection algorithms to analyze continuously collected time series data, such as CPU, memory, disk and other resource utilization, database call status and other monitoring indicators, and detect abnormal values, it can help operation and maintenance personnel discover possible faults in complex and large cloud-native database systems as early as possible, reduce losses caused by system failures and save precious manpower and time costs.

[0003] Due to the heterogeneity of time series data characteristics and the diversity of anomaly types, the accuracy of various current time series anomaly detection algorithms in different application scenarios (such as monitoring indicators or business loads) varies, and there is no universal best method.

[0004] A direct solution is to combine multiple anomaly detection algorithms through ensemble learning to improve the optimal detection effect in different application scenarios. However, this method has problems such as high computational cost and detection accuracy that is often lower than the best level that can be achieved by running each algorithm alone. Therefore, in practice, it is necessary to select the best time series anomaly detection algorithm based on the data characteristics of different scenarios to achieve the best detection effect.

[0005] To this end, researchers proposed a method to automatically select time series anomaly detection algorithms. The core idea of ​​this method is to use meta-learning technology to build a classification model through offline training for existing historical time series data. Specifically, the model will learn which anomaly detection algorithms can provide the best detection accuracy under different time series characteristics. Then, in practical applications, the model can predict the most suitable anomaly detection algorithm in real time based on the new time series data characteristics. This process can minimize manual intervention while improving detection efficiency and accuracy, thereby reducing costs.

[0006] Although the current automatic selection method of time series anomaly detection algorithm can effectively make up for the insufficiency of a single anomaly detection algorithm in coping with different scenarios, the existing method has a serious defect in cloud monitoring applications, that is, it only uses standard time series classification technology to build algorithm prediction models, lacks full use of cloud monitoring related knowledge, resulting in low efficiency and low accuracy of algorithm selection, which is mainly reflected in two aspects: First, when training time series classification models for cloud monitoring, the existing method uses hard labels to annotate historical time series, that is, the category of each time series is marked as the anomaly detection algorithm with the highest accuracy. This labeling method ignores the detection accuracy information of other anomaly detection algorithms other than the labeled category on the historical time series, making it difficult for the model to fully learn the knowledge about the correlation between various anomaly detection algorithms; second, the standard time series classification method can only learn the original time series and annotations (that is, the accuracy of the anomaly detection algorithm), and cannot effectively utilize external knowledge related to cloud monitoring tasks, such as application fields, characteristics of key performance indicators, and descriptions of abnormal situations. The above defects result in the limited ability of existing methods in selecting the best anomaly detection algorithm for cloud monitoring, and the low accuracy of anomaly detection. Summary of the invention

[0007] The purpose of the present invention is to solve the problem that the existing automatic selection method of anomaly detection algorithm only uses hard labels for training, lacks full utilization of knowledge related to time series anomaly detection, and leads to low efficiency and accuracy of the selection algorithm. The present invention provides an anomaly detection algorithm selection method for cloud monitoring knowledge-enhanced time series, which makes full use of knowledge related to time series anomaly detection, improves the selection ability of anomaly detection algorithm, and thus improves the accuracy of anomaly detection in cloud monitoring.

[0008] The anomaly detection algorithm selection method for cloud monitoring knowledge-enhanced time series includes the following steps:

[0009] Data segmentation preprocessing: segment each historical time series data T obtained by cloud monitoring to obtain the corresponding subsequence set

[0010] Training phase: The algorithm selector f is composed of a time series feature extractor and a linear classifier. The time series feature extractor extracts the corresponding subsequence set. The temporal representation vector of each subsequence in After that, it is sent to the linear classifier to predict the probability vector p i ;x T,i,l is the time series representation vector corresponding to the i-th subsequence, p i For x T,i,l The probability vector of candidate algorithms belonging to each category; D T dimensional real vector space;

[0011] Given a set of candidate anomaly detection algorithms For the corresponding subsequence set Each subsequence in the soft,i and hard label vector p hard,i ; where p soft,i is the soft label vector corresponding to the i-th subsequence, p hard,i is the hard label vector corresponding to the i-th subsequence;

[0012] The corresponding subsequence set is fused through the pre-trained external knowledge fusion module The corresponding prompt word description of each subsequence in is encoded to obtain the corresponding knowledge representation vector x K,i,l ∈D K ;x K,i,l is the knowledge representation vector corresponding to the i-th subsequence; D K A knowledge base related to external knowledge;

[0013] Compare corresponding subsequence sets The hard label vector p corresponding to each subsequence in hard,i and the predicted probability vector p i , construct hard label loss Compare corresponding subsequence sets The soft label vector p corresponding to each subsequence in soft,i and the predicted probability vector p i , construct soft label loss Compare corresponding subsequence sets The time series representation vector x corresponding to each subsequence in T,i,l and knowledge representation vector x K,i,l , construct knowledge fusion loss is the hard label loss corresponding to the i-th subsequence; is the soft label loss corresponding to the i-th subsequence; is the knowledge fusion loss corresponding to the i-th subsequence;

[0014] According to the corresponding subsequences of each historical time series data T and Get the total loss corresponding to the corresponding historical time series data T According to the total loss The parameters of the time series feature extractor and the linear classifier are updated using the gradient descent method. After the preset number of updates is met, the trained algorithm selector f is obtained.

[0015] Inference stage: The time series data collected by the current cloud monitoring is segmented using the data segmentation preprocessing method to obtain multiple subsequences. After each subsequence is input into the trained algorithm selector f for candidate algorithm selection, the trained algorithm selector f outputs the candidate algorithm with the maximum prediction probability corresponding to the subsequence, and uses it as the anomaly detection algorithm selected for the subsequence. The algorithm with the highest category proportion among all selected anomaly detection algorithms is used as the optimal algorithm selected for the time series data collected by the current cloud monitoring, and the selection of the anomaly detection algorithm is completed.

[0016] Preferably,

[0017] s(·) is the softmax function, t soft is the temperature coefficient hyperparameter, T i,l is the i-th subsequence of length l, A j (T i,l ) is the j-th candidate algorithm pair T i,l The detection results, j = 1, ..., m, m is the set The total number of candidate algorithms, Acc(A j (T i,l ), L) is the test result A j (T i,l ) relative to the accuracy of the true anomaly label L, where L is the true anomaly label of T.

[0018] Preferably, p hard,i =(p hard,i,1 , p hard,i,2 ,......,p hard,i,m );

[0019]

[0020] O(T i,l )=argmax k=1,...,m {Acc(A k (T i,l ),L)};

[0021] In the above formula, p hard,i,j is the value of the jth element in the hard label vector corresponding to the i-th subsequence; O(T i,l ) is the index of the candidate algorithm with the highest accuracy corresponding to the i-th subsequence; T i,l is the i-th subsequence of length l, A k (T i,l ) is the k-th candidate algorithm pair T i,l The detection result, m is the set The total number of candidate algorithms, Acc(A k (Ti,l ), L) is the test result A k (T i,l ) relative to the accuracy of the true anomaly label L, where L is the true anomaly label of T.

[0022] Preferably, p i =(Pr(A1),Pr(A2),...,Pr(A m ));

[0023] Pr(A j ) is the j-th candidate algorithm A j The predicted probability of .

[0024] Preferably,

[0025] Among them, p hard,i,j is the hard label vector p corresponding to the i-th subsequence hard,i The value of the jth element in p hard,i,j The value is 0 or 1, p i,j is the predicted probability vector p corresponding to the i-th subsequence i The predicted probability of the j-th candidate algorithm in the set The total number of candidate algorithms.

[0026] Preferably,

[0027] Among them, p soft,i,j is the soft label vector p corresponding to the i-th subsequence soft,i The true probability of the j-th candidate algorithm in i,j is the predicted probability vector p corresponding to the i-th subsequence i The predicted probability of the j-th candidate algorithm in the set The total number of candidate algorithms.

[0028] Preferably,

[0029] Among them, Pr(A j ) is the j-th candidate algorithm A j The predicted probability, W j is the weight vector corresponding to the j-th candidate algorithm, W k is the weight vector corresponding to the k-th candidate algorithm.

[0030] Preferably,

[0031] z T,i,l =g T (x T,i,l )∈R D ;

[0032] z K,i,l =g K (x K,i,l )∈R D ;

[0033] Among them, τ is the temperature coefficient hyperparameter, sim(z T,i,l ,z K,i,l ) is z T,i,l With z K,i,l The cosine similarity of T,i,l For x T,i,l After mapping, in the shared space R D The temporal representation within z K,i,l For x K,i,l After mapping, in the shared space R D The knowledge representation within, g T (·) is the first mapping function, g K (·) is the second mapping function, R D is a D-dimensional real number shared space; sim(z T,i,l ,z T,i′,l ) is z T,i,l With z T,i′,l The cosine similarity of T,i′,l For shared space D Internal exclusion T,i,l External residual timing characterization.

[0034] Preferably,

[0035] Among them, α is a parameter used to balance the weight of soft label loss and hard label loss, and α∈(0,1], λ is a hyperparameter that controls the importance of knowledge fusion loss, and N is an integer.

[0036] Preferably, the segmentation of each historical time series data T obtained by cloud monitoring is implemented by segmenting T into multiple subsequences of length l that are adjacent to each other but do not overlap, and when T cannot be divided into l equal parts, there is partial overlap between the last two subsequences sorted.

[0037] Preferably, in the inference stage, the specific process of the trained algorithm selector f outputting the anomaly detection algorithm selected for each subsequence includes:

[0038] After the current subsequence is input into the time series feature extractor in the trained algorithm selector f, the time series representation vector is extracted by the time series feature extractor, and the time series representation vector is sent to the linear classifier to predict the probability vector, and the candidate algorithm corresponding to the maximum prediction probability is selected from the predicted probability vector as the anomaly detection algorithm output selected for the current subsequence.

[0039] Preferably, the prompt word description corresponding to each subsequence is a template for adding knowledge types, and the knowledge types include application fields, time series characteristics and abnormal characteristics; the specific contents of the application field include: field name and application scenario description;

[0040] The specific contents of time series features include: sequence length and average value of time series data;

[0041] The specific contents of the abnormal characteristics include: the location where the abnormality occurs, and the duration of the abnormality at that location.

[0042] Preferably, the external knowledge fusion module is implemented using a large language model.

[0043] The beneficial effects brought by the present invention are:

[0044] The method for selecting anomaly detection algorithms for cloud monitoring knowledge-enhanced time series described in the present invention mainly makes improvements in two aspects, specifically:

[0045] First, we use soft label classification based on historical task accuracy to enhance knowledge. We use the accuracy of all candidate algorithms on each historical time series to estimate the category distribution of the input time series as soft labels to guide the training of the algorithm selector. The advantages are: using soft labels not only reflects the most accurate anomaly detection algorithm on historical tasks, but also quantifies the accuracy relationship between all candidate algorithms, using p soft,i As the output target value, it can provide the algorithm selector f with information about the correlation between various time series anomaly detection algorithms, which helps the algorithm selector learn more about algorithm selection and improve the detection accuracy of new cloud monitoring tasks.

[0046] Second, a knowledge enhancement of the time series anomaly detection knowledge fusion module that can flexibly embed various types of external knowledge is proposed. Various types of time series anomaly detection knowledge are uniformly expressed as prompts, knowledge is mapped into a unified representation, and the mutual information between knowledge representation and time series representation is maximized through contrastive learning, so that external knowledge related to time series anomaly detection is integrated into the time series classification model. Its advantages are: it constructs an external knowledge fusion module that can flexibly and uniformly process various types of knowledge and deeply understand the relationship between knowledge, and decouples the processing of external knowledge from the processing of time series, so that the learning of the algorithm selector can be enhanced by using external knowledge in the training stage, thereby enhancing the model's understanding and processing capabilities for anomaly detection tasks and improving detection accuracy. At the same time, it is seamlessly integrated with any time series classification network architecture to improve universality. And in the test stage, compared with the existing non-knowledge integration method, no additional calculations will be added.

[0047] The method of the present invention is designed in the form of a plug-in, so that it can be seamlessly integrated into the training of the network model of the cloud monitoring system, improving its ability to select the optimal anomaly detection algorithm, and the additional computing time brought about can be ignored.

[0048] The algorithm selection method of the present invention is mainly used to analyze the monitored time series data such as the utilization rate of resources such as CPU, memory and disk, database call status, etc., so as to efficiently and accurately select the optimal algorithm for the collected time series data. The present invention is mainly used to select anomaly algorithms for time series to be detected. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 It is a schematic diagram of the principle of the training phase of the anomaly detection algorithm selection method for cloud monitoring knowledge-enhanced time series;

[0050] Figure 2 This is a schematic diagram of the principle of the inference stage. DETAILED DESCRIPTION

[0051] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0052] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0053] Based on the original method, this paper supplements the effective mining and utilization of relevant knowledge of time series anomaly detection in historical tasks, and mainly proposes two types of knowledge enhancement:

[0054] First, knowledge enhancement based on soft label classification of historical tasks, using each historical time series T i,l The accuracy of all anomaly detection algorithms above is used to estimate their true category distribution, which is used as a soft label to provide more knowledge about the relationship between candidate anomaly detection algorithms for the learning of algorithm selector f;

[0055] Second, knowledge enhancement based on the external knowledge fusion module of time series anomaly detection uses a pre-trained external knowledge fusion module, that is, a large language model to obtain a common representation of external knowledge, and integrate the external knowledge into the algorithm selector by maximizing the mutual information between the time series representation and the knowledge representation.

[0056] The automatic selection problem of time series anomaly detection algorithms for cloud monitoring is defined as follows:

[0057] Given a set of time series anomaly detection algorithm candidates gather The anomaly detection algorithm in the time series is composed of different categories, and all categories of anomaly detection algorithms are used as candidate new algorithms. The goal of the automatic selection of the time series anomaly detection algorithm is to construct a mapping function f′(·), input the time series T obtained by cloud monitoring, and return The anomaly detection algorithm with the highest accuracy is expressed as:

[0058]

[0059] Among them, L is the true abnormal label of T, T i,l is the i-th subsequence of length l, f′(T i,l ) is a pair of subsequences T i,l For the anomaly detection algorithm with the highest accuracy, A j (T i,l ) is the j-th candidate algorithm pair T i,l The test results,

[0060] Acc(A k (T i,l ), L) is the test result A k (T i,l ) relative to the accuracy of the true anomaly label L.

[0061] See also Figure 1 The present embodiment is described. The method for selecting anomaly detection algorithms for cloud monitoring knowledge enhanced time series described in the present embodiment comprises the following steps:

[0062] (I) Data segmentation preprocessing: Segment each historical time series data T obtained by cloud monitoring to obtain the corresponding subsequence set

[0063] Specifically, the implementation method of segmenting the historical time series data T obtained by cloud monitoring is: segment T into multiple subsequences of length l that are adjacent to each other but do not overlap, and when T cannot be divided into l equal parts, there is partial overlap between the last two subsequences sorted. The mathematical representation of is as follows:

[0064]

[0065] Among them, T i,l is the i-th subsequence with a length of l, n is the length of the historical time series data T, To round up.

[0066] (II) Training phase:

[0067] The algorithm selector f is composed of a time series feature extractor and a linear classifier. The time series feature extractor extracts the corresponding subsequence set The temporal representation vector of each subsequence in After that, it is sent to the linear classifier to predict the probability vector p i ;x T,i,l is the time series representation vector corresponding to the i-th subsequence, p i For x T,i,l The probability vector of candidate algorithms belonging to each category; D T dimensional real vector space; and further, the predicted probability vector p is given i The expression is:

[0068] p i =(Pr(A1),Pr(A2),...,Pr(A m ));

[0069] Pr(A j ) is the j-th candidate algorithm A j The predicted probability of .

[0070] Given a set of candidate anomaly detection algorithms For the corresponding subsequence set Each subsequence in the soft,i and hard label vector p hard,i ; where p soft,i is the soft label vector corresponding to the i-th subsequence, p hard,i is the hard label vector corresponding to the i-th subsequence;

[0071] The soft label is p soft,i , it should satisfy two conditions:

[0072] (1) Probabilistic: p soft,i Should be a probability vector, that is, satisfying p soft,i ∈[0,1] m And the sum of the values ​​of each dimension is 1;

[0073] (2) Monotonicity: p soft,i The probability value in each dimension should be positively correlated with the accuracy of its corresponding algorithm, that is, the higher the accuracy of the algorithm, the greater the corresponding output probability;

[0074] In order to meet the above conditions, the soft label vector p soft,i Defined as:

[0075]

[0076] s(·) is the softmax function, t soft>0 is the temperature coefficient hyperparameter, which is used to control the smoothness of the soft label distribution. soft The smaller, p soft,i The sharper the distribution shape, the greater the probability difference between different categories. soft When p approaches 0, soft,i The limit value is p hard,i ; T i,l is the i-th subsequence of length l, A j (T i,l ) is the j-th candidate algorithm pair T i,l The detection results, j = 1, ..., m, m is the set The total number of candidate algorithms, Acc(A j (T i,l ), L) is the test result A j (T i,l ) relative to the accuracy of the true anomaly label L, where L is the true anomaly label of T.

[0077] When using hard labels, the prediction target of the algorithm selector f is a probability vector of binary values, denoted by p hard,i ∈{0,1} m ,p hard,i Category index O(T i,l ) has a probability of 1, and the probability values ​​of the remaining category indices are 0, expressed as:

[0078]

[0079] The hard label vector p hard,i Defined as: p hard,i =(p hard,i,1 , p hard,i,2 ,......,p hard,i,m );

[0080] In the above formula, p hard,i,j is the value of the j-th element in the hard label vector corresponding to the i-th subsequence; p hard,i,j The value is 0 or 1, O(T i,l ) is the index of the candidate algorithm with the highest accuracy corresponding to the i-th subsequence; T i,l is the i-th subsequence of length l, A k (T i,l ) is the k-th candidate algorithm pair T i,l The detection result, m is the set The total number of candidate algorithms, Acc(A k (T i,l ), L) is the test result A k (T i,l) relative to the accuracy of the true anomaly label L, where L is the true anomaly label of T;

[0081] The corresponding subsequence set is fused through the pre-trained external knowledge fusion module The corresponding prompt word description of each subsequence in is encoded to obtain the corresponding knowledge representation vector x K,i,l ∈D K ;x K,i,l is the knowledge representation vector corresponding to the i-th subsequence; D K A knowledge base related to external knowledge;

[0082] Compare corresponding subsequence sets The hard label vector p corresponding to each subsequence in hard,i and the predicted probability vector p i , construct hard label loss is the hard label loss corresponding to the i-th subsequence;

[0083] Compare corresponding subsequence sets The soft label vector p corresponding to each subsequence in soft,i and the predicted probability vector p i , construct soft label loss is the soft label loss corresponding to the i-th subsequence;

[0084] Compare corresponding subsequence sets The time series representation vector x corresponding to each subsequence in T,i,l and knowledge representation vector x K,i,l , construct knowledge fusion loss is the knowledge fusion loss corresponding to the i-th subsequence;

[0085] According to the corresponding subsequences of each historical time series data T and Get the total loss corresponding to the corresponding historical time series data T According to the total loss The parameters of the time series feature extractor and the linear classifier are updated using the gradient descent method. After the preset number of updates is met, the trained algorithm selector f is obtained.

[0086] (III) See Figure 2, Reasoning stage: The time series data collected by the current cloud monitoring is segmented by the data segmentation preprocessing method to obtain multiple subsequences. After each subsequence is input into the trained algorithm selector f for candidate algorithm selection, the trained algorithm selector f outputs the candidate algorithm with the maximum prediction probability corresponding to the subsequence, and uses it as the anomaly detection algorithm selected for the subsequence. The algorithm with the highest category proportion among all selected anomaly detection algorithms is selected as the optimal algorithm selected for the time series data collected by the current cloud monitoring through majority voting, and the selection of the anomaly detection algorithm is completed.

[0087] The specific technical solution of the anomaly detection algorithm selection method for cloud monitoring knowledge-enhanced time series described in this embodiment is as follows: First, based on the accuracy of the candidate time series anomaly detection algorithm on the historical time series, the category distribution of the time series is estimated, which is used as a soft label, and a soft label classification loss function is designed to guide the training of the time series classification model, so that the model can learn more about the relationship between anomaly detection algorithms. Its advantages are: the use of soft labels not only reflects the most accurate anomaly detection algorithm on the historical task, but also quantifies the size relationship between the accuracy of all candidate algorithms, using p soft,i As the output target value, it can provide the algorithm selector f with information about the correlation between various time series anomaly detection algorithms, which helps the algorithm selector learn more about algorithm selection and improve the detection accuracy of new cloud monitoring tasks.

[0088] Secondly, a knowledge fusion module for time series anomaly detection that can flexibly embed various types of external knowledge is proposed, which maps knowledge into a unified representation, and maximizes the mutual information between knowledge representation and time series representation through contrastive learning, thereby integrating external knowledge related to time series anomaly detection into the time series classification model. Its advantages are: it constructs an external knowledge fusion module that can flexibly and uniformly process various types of knowledge and deeply understand the relationship between knowledge, and decouples the processing of external knowledge from the processing of time series, so that the learning of the algorithm selector can be enhanced by using external knowledge in the training phase, thereby enhancing the model's understanding and processing capabilities for anomaly detection tasks and improving detection accuracy. At the same time, it is seamlessly integrated with any time series classification network architecture to improve universality. And in the testing phase, compared with the existing knowledge-free integration method, no additional calculations are added.

[0089] Furthermore, hard label loss The expression is:

[0090] Among them, p hard,i,j is the hard label vector p corresponding to the i-th subsequence hard,i The value of the jth element in p hard,i,j The value is 0 or 1, pi,j is the predicted probability vector p corresponding to the i-th subsequence i The predicted probability of the j-th candidate algorithm in the set The total number of candidate algorithms.

[0091] Furthermore, the soft label loss The expression is:

[0092]

[0093] Among them, p soft,i,j is the soft label vector p corresponding to the i-th subsequence soft,i The true probability of the j-th candidate algorithm in i,j is the predicted probability vector p corresponding to the i-th subsequence i The predicted probability of the j-th candidate algorithm in the set The total number of candidate algorithms.

[0094] Said

[0095] Among them, Pr(A j ) is the j-th candidate algorithm A j The predicted probability, W j is the weight vector corresponding to the j-th candidate algorithm, W k is the weight vector corresponding to the k-th candidate algorithm.

[0096] For external knowledge fusion module:

[0097] The external knowledge fusion module can be implemented using a large language model. The external knowledge fusion module mainly consists of two parts:

[0098] Firstly, all kinds of time series anomaly detection knowledge are uniformly expressed as prompts, and the prompts are encoded through a pre-trained large language model. The general understanding ability of the large language model is used to convert external knowledge into vectorized knowledge representation. Secondly, based on comparative learning between time series and external knowledge, the mutual information between time series representation and knowledge representation is maximized, so as to use external knowledge related to time series anomaly detection to guide the learning of time series features.

[0099] Furthermore, the prompt word description corresponding to each subsequence is a template for adding knowledge types, and the knowledge types include application fields, time series characteristics and abnormal characteristics; the specific contents of the application field include: field name and application scenario description;

[0100] The specific contents of time series features include: sequence length and average value of time series data;

[0101] The specific contents of the abnormal characteristics include: the location where the abnormality occurs, and the duration of the abnormality at that location.

[0102] In order to realize the flexible application of various types of time series anomaly detection knowledge, the prompt word template is used to uniformly describe these external knowledge with prompt words. The example of the prompt word template (i.e., the template for adding knowledge types) is as follows:

[0103]

[0104] For example, in a cloud native database storage device monitoring application, the obtained time series records the I / O operations of the storage device per second. In a subsequence of length 128 divided from the original time series, the I / O operations are too frequent at the 99th to 104th sampling points, indicating that there is an abnormality in the system. Based on the prompt word template, the external knowledge related to the anomaly detection corresponding to the time series can be expressed as: "This time series comes from {cloud native database storage device monitoring}, {recording the I / O operations of the storage device per second, reflecting the scale, quality and machine operation status of the network service on the cloud native database}, the length of the sequence is {128}, the average value is {0.1538}, the sequence contains {1} anomalies, and the duration is {6}".

[0105] Based on the prompt words and considering the semantic complexity and diversity of external knowledge, the knowledge fusion module uses the general understanding ability of the pre-trained large language model to map the knowledge into a unified representation to facilitate its integration into the algorithm selector f.

[0106] Since external knowledge is a condensation of the key information contained in the corresponding time series data, the two should have semantic consistency in determining the optimal time series anomaly detection algorithm. From this perspective, the mutual information between time series and external knowledge is maximized through comparative learning, thereby utilizing external knowledge to improve the encoder's ability to express time series features.

[0107] Given a time series T i,l and its time series representation vector x T,i,l ∈R T , remember T i,l The corresponding knowledge representation is x K,i,l ∈D K , first through two different mapping functions g T (·) and g K (·), x T,i,l and x K,i,l They are mapped to the shared space respectively, expressed as:

[0108] z T,i,l =g T (x T,i,l )∈RD ;

[0109] z K,i,l =g K (x K,i,l )∈R D ;

[0110] Next, in the shared space R D On the top, minimize the time series representation z T,i,l and its corresponding knowledge representation z K,i,l The distance between them, while maximizing z T,i,l and all other timing representations z T,i',l (i'≠i) to achieve comparative learning of time series and external knowledge. This step is completed by minimizing the contrast loss, thus, the knowledge fusion loss Defined as:

[0111]

[0112] Among them, sim(u,v) represents the cosine similarity of vectors u and v, that is:

[0113]

[0114] τ is a temperature coefficient hyperparameter, which is used to control the degree of attention paid to difficult-to-learn samples. T,i,l ,z K,i,l ) is z T,i,l With z K,i,l The cosine similarity of T,i,l For x T,i,l After mapping, in the shared space R D The temporal representation within z K,i,l For x K,i,l After mapping, in the shared space R D The knowledge representation within, g T (·) is the first mapping function, g K (·) is the second mapping function, R D is a D-dimensional real number shared space; sim(z T,i,l ,z T,i′,l ) is z T,i,l With z T,i′,l The cosine similarity of T,i′,l For shared space D Internal exclusion T,i,l External residual timing characterization.

[0115] Considering that the pre-trained large language model has general language understanding capabilities, its parameters remain frozen during the training process; therefore, the knowledge integration module only applies to the function g K Perform optimization updates.

[0116] Furthermore, the total loss is given The expression

[0117] Among them, α is a parameter used to balance the weight of soft label loss and hard label loss, and α∈(0,1], λ is a hyperparameter that controls the importance of knowledge fusion loss, and N is an integer.

[0118] Furthermore, in the inference phase, the specific process of the trained algorithm selector f outputting the anomaly detection algorithm selected for each subsequence includes:

[0119] After the current subsequence is input into the time series feature extractor in the trained algorithm selector f, the time series representation vector is extracted by the time series feature extractor, and the time series representation vector is sent to the linear classifier to predict the probability vector, and the candidate algorithm corresponding to the maximum prediction probability is selected from the predicted probability vector as the anomaly detection algorithm output selected for the current subsequence.

[0120] At the same time, the present invention conducted multiple groups of comparative experiments to verify the effectiveness of the method proposed in the present invention in the problem of automatic selection of anomaly detection algorithms in time series cloud monitoring systems.

[0121] Although the present invention is described herein with reference to specific embodiments, it should be understood that these embodiments are merely examples of the principles and applications of the present invention. It should therefore be understood that many modifications may be made to the exemplary embodiments and that other arrangements may be devised without departing from the spirit and scope of the present invention as defined by the appended claims. It should be understood that the various dependent claims and features described herein may be combined in a manner different from that described in the original claims. It should also be understood that features described in conjunction with individual embodiments may be used in other described embodiments.

Claims

1. Anomaly detection algorithm selection method for cloud monitoring knowledge-enhanced time series, characterized by: The selection method includes the following steps: Data segmentation preprocessing: segment each historical time series data T obtained by cloud monitoring to obtain the corresponding subsequence set Training phase: The algorithm selector f is composed of a time series feature extractor and a linear classifier. The time series feature extractor extracts the corresponding subsequence set. The temporal representation vector of each subsequence in After that, it is sent to the linear classifier to predict the probability vector p i ;x T,i,l is the time series representation vector corresponding to the i-th subsequence, p i For x T,i,l The probability vector of candidate algorithms belonging to each category; D T dimensional real vector space; Given a set of candidate anomaly detection algorithms For the corresponding subsequence set Each subsequence in the soft,i and hard label vector p hard,i ; where p soft,i is the soft label vector corresponding to the i-th subsequence, p hard,i is the hard label vector corresponding to the i-th subsequence; The corresponding subsequence set is fused through the pre-trained external knowledge fusion module The corresponding prompt word description of each subsequence in is encoded to obtain the corresponding knowledge representation vector x K,i,l ∈D K ;x K,i,l is the knowledge representation vector corresponding to the i-th subsequence; D K A knowledge base related to external knowledge; Compare corresponding subsequence sets The hard label vector p corresponding to each subsequence in hard,i and the predicted probability vector p i , construct hard label loss Compare corresponding subsequence sets The soft label vector p corresponding to each subsequence in soft,i and the predicted probability vector p i , construct soft label loss Compare corresponding subsequence sets The time series representation vector x corresponding to each subsequence in T,i,l and knowledge representation vector x K,i,l , construct knowledge fusion loss is the hard label loss corresponding to the i-th subsequence; is the soft label loss corresponding to the i-th subsequence; is the knowledge fusion loss corresponding to the i-th subsequence; According to the corresponding subsequences of each historical time series data T and Get the total loss corresponding to the corresponding historical time series data T According to the total loss The parameters of the time series feature extractor and the linear classifier are updated using the gradient descent method. After the preset number of updates is met, the trained algorithm selector f is obtained. Inference stage: The time series data collected by the current cloud monitoring is segmented using the data segmentation preprocessing method to obtain multiple subsequences. After each subsequence is input into the trained algorithm selector f for candidate algorithm selection, the trained algorithm selector f outputs the candidate algorithm with the maximum prediction probability corresponding to the subsequence, and uses it as the anomaly detection algorithm selected for the subsequence. The algorithm with the highest category proportion among all selected anomaly detection algorithms is used as the optimal algorithm selected for the time series data collected by the current cloud monitoring, and the selection of the anomaly detection algorithm is completed.

2. The method for selecting anomaly detection algorithms for cloud monitoring knowledge-enhanced time series according to claim 1 is characterized in that: s(·) is the softmax function, t soft is the temperature coefficient hyperparameter, T i,l is the i-th subsequence of length l, A j (T i,l ) is the j-th candidate algorithm pair T i,l The detection results, j = 1, ..., m, m is the set The total number of candidate algorithms, Acc(A j (T i,l ), L) is the test result A j (T i,l ) relative to the accuracy of the true anomaly label L, where L is the true anomaly label of T.

3. The method for selecting anomaly detection algorithms for cloud monitoring knowledge-enhanced time series according to claim 1 is characterized in that: p hard,i =(p hard,i,1 ,p hard,i,2 ,......,p hard,i,m ); O(T i,l )=argmax k=1,...,m {Acc(A k (T i,l ),L)}; In the above formula, p hard,i,j is the value of the jth element in the hard label vector corresponding to the i-th subsequence; O(T i,l ) is the index of the candidate algorithm with the highest accuracy corresponding to the i-th subsequence; T i,l is the i-th subsequence of length l, A k (T i,l ) is the k-th candidate algorithm pair T i,l The detection result, m is the set The total number of candidate algorithms, Acc(A k (T i,l ), L) is the test result A k (T i,l ) relative to the accuracy of the true anomaly label L, where L is the true anomaly label of T.

4. The method for selecting anomaly detection algorithms for cloud monitoring knowledge-enhanced time series according to claim 1, characterized in that: p i =(Pr(A1),Pr(A2),...,Pr(A m , Pr(A j ) is the j-th candidate algorithm A j The predicted probability of .

5. The method for selecting anomaly detection algorithms for cloud monitoring knowledge-enhanced time series according to claim 1, characterized in that: Among them, p hard,i,j is the hard label vector p corresponding to the i-th subsequence hard,i The value of the jth element in p hard,i,j The value is 0 or 1, p i,j is the predicted probability vector p corresponding to the i-th subsequence i The predicted probability of the j-th candidate algorithm in the set The total number of candidate algorithms.

6. The method for selecting anomaly detection algorithms for cloud monitoring knowledge-enhanced time series according to claim 1, characterized in that: Among them, p soft,i,j is the soft label vector p corresponding to the i-th subsequence soft,i The true probability of the j-th candidate algorithm in i,j is the predicted probability vector p corresponding to the i-th subsequence i The predicted probability of the j-th candidate algorithm in the set The total number of candidate algorithms.

7. The method for selecting anomaly detection algorithm for cloud monitoring knowledge-enhanced time series according to claim 5 or 6, characterized in that: Among them, Pr(A j ) is the j-th candidate algorithm A j The predicted probability, W j is the weight vector corresponding to the j-th candidate algorithm, W k is the weight vector corresponding to the k-th candidate algorithm.

8. The method for selecting anomaly detection algorithms for cloud monitoring knowledge-enhanced time series according to claim 1, characterized in that: z T,i,l =g T (x T,i,l )∈R D ; z K,i,l =g K (x K,i,l )∈R D ; Among them, τ is the temperature coefficient hyperparameter, sim(z T,i,l ,z K,i,l ) is z T,i,l With z K,i,l The cosine similarity of T,i,l For x T,i,l After mapping, in the shared space R D The temporal representation within z K,i,l For x K,i,l After mapping, in the shared space R D The knowledge representation within, g T (·) is the first mapping function, g K (·) is the second mapping function, R D is a D-dimensional real number shared space; sim(z T,i,l ,z T,i′,l ) is z T,i,l With z T,i′,l The cosine similarity of T,i′,l For shared space D Internal exclusion T,i,l External residual timing characterization.

9. The method for selecting anomaly detection algorithms for cloud monitoring knowledge-enhanced time series according to claim 1, characterized in that: Among them, α is a parameter used to balance the weight of soft label loss and hard label loss, and α∈(0,1], λ is a hyperparameter that controls the importance of knowledge fusion loss, and N is an integer.

10. The method for selecting anomaly detection algorithms for cloud monitoring knowledge-enhanced time series according to claim 1, characterized in that: The implementation method of segmenting the historical time series data T obtained by cloud monitoring is: segment T into multiple subsequences of length l that are adjacent to each other but do not overlap, and when T cannot be divided into l equal parts, there is partial overlap between the last two subsequences sorted.

Citation Information

Patent Citations

  • Space payload anomaly detection method based on improved random forest

    CN117708739A

  • Power system fault state detection and classification method based on SCINet

    CN117725491A

  • Internal threat anomaly detection method based on heterogeneous knowledge distillation

    CN118070282A

  • Multitask time sequence analysis method and system driven by knowledge-enhanced large model

    CN118535747A

  • Method and system of dynamic model selection for time series forecasting

    US20200242483A1