A kpis prediction method based on multi-scale selection and adaptive weight

CN122904954APending Publication Date: 2026-10-13DALIAN MARITIME UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611121048.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-27
Publication Date
2026-10-13

AI Technical Summary

Technical Problem

[0009]为了解决微服务系统中关键性能指标预测时不同指标统计分布差异显著导致全局共享模型对不同特征的表征精度受限的问题,本发明采用的技术方案是:一种基于多尺度选择与自适应权重的KPIs预测方法,包括以下步骤:

Benefits of technology

[0021]最后,通过门控机制对来自不同尺度的特征表示进行加权融合,输出未来的KPIs预测值。本发明能够有效提升多维KPIs时间序列的预测表现。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122904954A_ABST
    Figure CN122904954A_ABST
Patent Text Reader

Abstract

The application is a KPIs prediction method based on multi-scale selection and adaptive weight, and belongs to the technical field of deep learning method: including the following steps: obtaining key performance indicator data to be predicted; based on the key performance indicator data set, a KPIs prediction model based on multi-scale selection and adaptive weight is constructed for predicting multiple key performance indicators; the KPIs prediction model is trained to obtain a trained KPIs prediction model; the key performance indicator data to be predicted is input into the trained KPIs prediction model to realize the prediction of multiple key performance indicators. The application can effectively improve the prediction performance of multi-dimensional KPIs time series by weighting and fusing the feature representations from different scales through the gating mechanism to output the future KPIs prediction value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of deep learning methods technology, and relates to a KPIs prediction method based on multi-scale selection and adaptive weights. Background Technology

[0002] With the widespread adoption of cloud computing and microservice architectures, the scale and complexity of modern distributed systems are growing exponentially. To ensure high availability and Quality of Service (QoS), operations personnel typically rely on Key Performance Indicators (KPIs) to monitor system health. Typical KPIs include service response time, throughput, system response rate, and service reliability. These indicators are usually presented in multivariate time series format, characterized by large data volumes, high sampling frequencies, strong nonlinearity, and diverse indicator distributions. Accurately predicting the future trends of these KPIs plays a crucial role in enabling automatic resource scaling and early fault warnings.

[0003] Currently, time series forecasting methods for KPIs mainly include statistical methods, traditional machine learning methods, and deep learning methods.

[0004] (1) Statistical methods Early KPI forecasting primarily relied on classic statistical models, such as the Autoregressive Moving Average (ARIMA), Holt-Winters exponential smoothing, and the Kalman filter. These methods fit the trends and seasonality of time series data using mathematical formulas. They offer advantages such as low computational cost, theoretical completeness, and strong interpretability, and perform reasonably well when dealing with simple, stationary univariate KPIs. However, statistical methods are typically based on linear assumptions, making it difficult to capture the complex nonlinear dynamic changes in KPI data. Furthermore, they have limited ability to handle the coupling relationships between multiple variables, and are ill-equipped to cope with the rapidly changing traffic patterns in modern microservice systems.

[0005] (2) Methods based on traditional machine learning To address nonlinear issues, machine learning algorithms such as Support Vector Regression (SVR), Random Forest, and XGBoost have been introduced into time series forecasting. These methods, through feature engineering, utilize historical statistical features within a sliding window to predict future values, exhibiting strong nonlinear fitting capabilities. However, traditional machine learning methods are highly dependent on the quality of manually extracted features and struggle to capture long-term dependencies in time series data. Furthermore, when dealing with high-dimensional, multivariate KPI data, these methods often neglect the dynamic interactions between indicators, leading to bottlenecks in prediction accuracy.

[0006] (3) Deep learning-based methods In recent years, deep learning has become mainstream due to its powerful feature extraction capabilities. Recurrent Neural Networks (RNNs) and their variants (such as LSTM and GRU) were once the preferred choice for processing time-series data, but their serial computation mechanism led to low training efficiency and the vanishing gradient problem, making it difficult to capture extremely long temporal dependencies. Subsequently, Transformer architectures based on self-attention mechanisms (such as Informer, Autoformer, and PatchTST) have made breakthrough progress in long sequence prediction tasks. These models can effectively process long sequences in parallel and capture global dependencies through global attention mechanisms.

[0007] However, while existing Transformer-type models perform well on routine prediction tasks, they still face irreconcilable limitations when dealing with the specific scenarios of microservice KPIs. On one hand, their inherent single-time-scale modeling mechanism struggles to simultaneously capture both long-term seasonal information and instantaneous local bursts. Microservice KPI data often mixes low-frequency components reflecting business cycles with high-frequency components representing instantaneous fluctuations. While a single large-scale setting can capture the macro-level outline, it easily "smooths out" key short-term fluctuations, leading to a sluggish perception of signal abrupt changes. Conversely, a single small-scale setting struggles to grasp global evolutionary patterns. On the other hand, the widely adopted global parameter sharing strategy severely ignores the inconsistency in statistical distribution among indicators. For example, throughput is dominated by user activity patterns, exhibiting significant seasonality and relatively smooth waveforms; while system response time and response rate are relatively stable but often accompanied by irregular high-frequency disturbances, lacking clear seasonal patterns. Forcibly using the same weight matrix to uniformly map these data with different physical characteristics leads the model to tend to fit the dominant normal distribution samples during training.

[0008] In summary, the main problem with current methods for predicting KPIs in complex microservices is the lack of adaptability to differences in the statistical distribution among indicators. Existing models mostly use globally shared weights, ignoring the differences in the statistical distribution of different KPI indicators, and thus cannot achieve refined modeling that varies from indicator to indicator, thereby limiting the accuracy of KPI prediction. Summary of the Invention

[0009] To address the problem that significant differences in the statistical distribution of different key performance indicators (KPIs) in microservice systems limit the accuracy of the globally shared model in representing different features, this invention adopts a technical solution: a KPI prediction method based on multi-scale selection and adaptive weights, comprising the following steps: Obtain key performance indicator data to be predicted; Based on a dataset of key performance indicators (KPIs), a KPIs prediction model based on multi-scale selection and adaptive weights is constructed to predict multiple key performance indicators. The KPIs prediction model is trained to obtain a trained KPIs prediction model; The data of the key performance indicators to be predicted are input into the trained KPIs prediction model to achieve the prediction of multiple key performance indicators.

[0010] Furthermore: the KPIs prediction model includes: Time-frequency feature construction and multi-scale selection module: It is used for time-frequency deconstruction mechanism based on STL decomposition idea to construct time-frequency features, introduces a noisy Top-K gating mechanism, calculates the gating score of each scale using time-frequency features, and selects the K time scales and scale combinations that are most suitable for the current data features based on the scores. Adaptive attention weight generation module: used to assign a learnable indicator embedding vector as its identity for each KPI indicator, and introduce the scale embedding vector to represent the characteristics of the current time scale by the time-frequency feature construction and multi-scale selection module. The joint features of the indicator embedding vector and the scale embedding vector are transformed into an adaptive weight matrix of the indicator at the current scale using a hypernetwork. Spatiotemporal feature extraction module: used to construct a spatiotemporal dual-stream computing architecture based on the time-frequency features and the time scale combination output by the multi-scale selection module, and the adaptive weights under the time scale output by the adaptive attention weight generation module, and to extract the temporal evolution law and spatial coupling features of KPIs data in parallel. Multi-scale KPIs feature fusion module: used to construct multi-scale features by weighting and summing the time scale gating weights output by the time-frequency feature construction and multi-scale selection module and the spatiotemporal features output by the spatiotemporal feature extraction module. Prediction module: used to predict multiple key performance indicators based on the multi-scale features output by the multi-scale KPIs feature fusion module and MLP.

[0011] Furthermore: the time-frequency deconstruction mechanism based on the STL decomposition idea constructs time-frequency features, introduces a noisy Top-K gating mechanism, calculates the gating score at each scale using the time-frequency features, and selects the K most suitable time scales and scale combinations for the current data features based on the scores, as follows: S11: Input KPIs data Set the number of frequency domain retained components Average pooling kernel set Total number of scales listed and the number of scales selected Initialize the weight matrix of the gated network. and noise weight matrix ; S12: For each Standard score normalization was performed to obtain This constitutes the normalized sequence. ; S13: For the normalized... Perform a Fast Fourier Transform to map it to the frequency domain, retaining the top K amplitudes. freq The seasonal feature sequence X is obtained by retrieving the frequency components, setting the remaining components to zero, and then restoring them using a fast inverse Fourier transform. seas ; S14: Set different sizes of sliding window for verification Perform average pooling operations separately, and then merge the smoothed sequences generated by different kernels to obtain the trend feature sequence. ; S15: From Remove the extracted seasonal items. With trend items This allows us to obtain the residual terms that characterize sudden anomalies and high-frequency noise signals in the sequence. And perform feature fusion to obtain ; S16: Introduce random noise that follows a standard normal distribution. Calculate the raw gating score for each scale. ; S17: Yes Perform a Top-K selection operation to filter out the highest-scoring candidates. Index list of each scale and set the values ​​of other scales to Then, the gate weights for the selected scale combination are obtained by normalization using the Softmax function. .

[0012] Furthermore: the process of assigning a learnable indicator embedding vector as its identity for each KPI indicator, and introducing the time-frequency feature construction and multi-scale selection module to represent the scale embedding vector of the current time scale characteristics, and using a hypernetwork to transform the joint features of the indicator embedding vector and the scale embedding vector into an adaptive weight matrix for the indicator at the current scale, is as follows: S21: Let the index embedding matrix be... , of which row vector Indicates the first Embedding vectors of KPI indicators; scale embedding matrix is ,in The time scale is represented as The embedding vectors are first processed by the supernetwork using a multilayer perceptron. and fusion vector Core matrix mapped to intermediate state Then, the globally shared basis matrix is ​​used. and right A linear reconstruction is performed to generate the final attention weight matrix; the index embedding matrix is ​​initialized by obtaining the currently selected scale. and scale embedding matrix And globally shared parameters in the hypernetwork, the shared parameters including: the connection weight matrix and bias vector of each layer inside the MLP, denoted as 6 sets of shared basis matrices and and bias basis matrix , ; S22: From the indicator embedding matrix Search current Identity vector corresponding to each KPI indicator Simultaneously, based on the current scale, from the scale embedding matrix... Retrieve the corresponding scale vector in the middle Subsequently, feature splicing was used for fusion. and Constructing a fusion vector ; S23: Merge vectors Input into the MLP, using the initialized weight parameters right Perform layer-by-layer linear transformations and nonlinear activation operations to output the corresponding low-rank core matrix. ; S24: Using 6 independent shared basis matrices to respectively apply the low-rank core matrix Perform matrix multiplication and reconstruction to generate the first... The weight matrix of the KPI indicator under different attention channels, for any type Construct the weight matrix ; S25: Output the set of generated indicator-specific weight matrices and .

[0013] Furthermore: the process of constructing a spatiotemporal dual-stream computing architecture based on the time-frequency features and the time-scale combination output by the multi-scale selection module, and the adaptive weights under the time-scale output by the adaptive attention weight generation module, and extracting the temporal evolution law and spatial coupling features of KPIs data in parallel is as follows: S31: Get the current time scale and linear layer matrix and The sliding window size is set to normalize the set of KPI sequences. Divided along the time dimension The nth slice sequence, for the nth slice sequence in the set A sequence of indicators, reshaped into a slice matrix. ; S32: Slice the matrix Mapped to a unified hidden layer feature dimension ,get ; S33: Yes The query matrix is ​​obtained by performing linear projection. Key matrix Value matrix ; S34: Calculate the self-attention score in the time dimension based on the scaling dot product mechanism to capture the temporal characteristics of a single metric. ; S35: Yes The spatial flow weight matrices are mean-sampled along the index dimensions to obtain the spatial projection matrices. ; S36: Utilize the generated shared spatial weights to analyze all data within the same time slice. A shared query matrix is ​​obtained by linearly projecting the data from each indicator. Key matrix Value matrix ; S37: Calculate the self-attention score for the indicator dimension to obtain the spatial flow feature set. ; S38: The time flow feature set obtained by independent calculation Reorganized into a tensor consistent with the shape of the spatial flow features, and combined with the spatial flow features The features are then stitched together and then linearly projected to obtain the fused features. ; S39: Integrating Features The input is a feedforward neural network containing layer normalization and GELU activation functions. Dimensionality integration and nonlinear mapping are performed, and the output is the extracted high-dimensional feature tensor. .

[0014] Furthermore: the total loss function of the KPIs prediction model Including the main forecast loss and auxiliary load balancing losses ; The main prediction loss The expression is as follows:

[0015] In the formula, This indicates the batch size during model training. The dimensions representing KPIs; Auxiliary load balancing losses The expression is as follows:

[0016] In the formula, This represents the balance coefficient, which controls the weight of load balancing losses in the total losses. This indicates that in the current batch of data, the [number]th [item]... The average probability assigned by the gating mechanism at each time scale.

[0017] A KPIs prediction device based on multi-scale selection and adaptive weights, comprising: Acquisition module: Used to acquire key performance indicator data to be predicted; Module: Used to build a KPI prediction model based on multi-scale selection and adaptive weights based on a key performance indicator dataset, for predicting multiple key performance indicators; Training module: used to train the KPIs prediction model to obtain a trained KPIs prediction model; Implementation module: This module is used to input the key performance indicator data to be predicted into the trained KPIs prediction model to achieve prediction of multiple key performance indicators.

[0018] This invention provides a KPIs prediction method based on multi-scale selection and adaptive weights. The method first uses the STL concept to perform Fast Fourier Transform and multi-kernel average pooling on the normalized multidimensional KPIs time series, extracting and fusing the seasonal, trend, and residual features of the series to construct a time-frequency feature vector. Then, based on this vector, a gating network is used to calculate the gating scores for each scale, selecting the optimal combination of time scales.

[0019] Secondly, for the selected scale, the hypernetwork uses the embedding vector of each KPI indicator and the selected scale to map the fused features into a core matrix through a multilayer perceptron, and performs reconstruction in combination with the global shared basis matrix to generate adaptive weight parameters, so as to solve the problem of different statistical distributions of different indicators.

[0020] Subsequently, a sliding window is set up according to the selected scale to reconstruct the time series into discrete segments of fixed scale size, and spatiotemporal dual-stream attention calculation is performed on the segments using the generated exclusive attention weights to extract multi-dimensional coupling features and temporal evolution patterns in parallel.

[0021] Finally, a gating mechanism is used to weight and fuse feature representations from different scales to output predicted future KPIs. This invention can effectively improve the prediction performance of multidimensional KPI time series.

[0022] This method first normalizes the time series of multidimensional KPIs. Then, it introduces a time-frequency feature extraction and multi-scale selection mechanism based on STL decomposition. This mechanism uses Fast Fourier Transform to extract seasonal features and multi-kernel average pooling to extract trend features. Subsequently, it subtracts the trend and seasonal components from the original sequence to explicitly extract residual features containing irregular fluctuations. Next, it fuses the trend, seasonal, and residual features to construct a time-frequency feature vector, and uses a noisy Top-K gating mechanism to select the optimal combination of time scales based on this feature vector. For the selected time scale, this invention uses a hypernetwork-based adaptive weight generation mechanism to independently generate a dedicated attention weight matrix for each KPI indicator based on its embedding vector and the selected scale, thereby achieving differentiated modeling of indicators with different statistical distributions. Based on this, a sliding window is established according to the selected time scale, and the generated dedicated weights are used to perform spatiotemporal dual-stream attention calculation on the sequence to extract multidimensional coupling features between indicators and the evolutionary patterns of the time dimension. Finally, a gating mechanism is used to weight and fuse the feature representations at different scales to output the predicted values ​​of future KPIs. Attached Figure Description

[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0024] Figure 1 This invention proposes a KPIs prediction method based on multi-scale selection and adaptive weights.

[0025] Figure 2 This is a flowchart of the feature extraction process; Figure 3 This is a comparison chart of statistical distribution characteristics, where (a) is the system response rate and (b) is the throughput. Figure 4 It is a heatmap of similarity based on the weight of the indicator. Detailed Implementation

[0026] It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of the present invention can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and embodiments.

[0027] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the present invention or its application or use. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0028] A KPIs prediction method based on multi-scale selection and adaptive weights includes the following steps: Obtain key performance indicator data to be predicted; Based on a dataset of key performance indicators (KPIs), a KPIs prediction model based on multi-scale selection and adaptive weights is constructed to predict multiple key performance indicators. The KPIs prediction model is trained to obtain a trained KPIs prediction model; The key performance indicator data to be predicted is input into the trained KPIs prediction model to achieve prediction of multiple key performance indicators.

[0029] Furthermore: the KPIs prediction model includes: Time-frequency feature construction and multi-scale selection module: It is used for time-frequency deconstruction mechanism based on STL decomposition idea to construct time-frequency features, introduces a noisy Top-K gating mechanism, calculates the gating score of each scale using time-frequency features, and selects the K time scales and scale combinations that are most suitable for the current data features based on the scores. Adaptive attention weight generation module: used to assign a learnable indicator embedding vector as its identity for each KPI indicator, and introduce the scale embedding vector to represent the characteristics of the current time scale by the time-frequency feature construction and multi-scale selection module. The joint features of the indicator embedding vector and the scale embedding vector are transformed into an adaptive weight matrix of the indicator at the current scale using a hypernetwork. Spatiotemporal feature extraction module: used to construct a spatiotemporal dual-stream computing architecture based on the time-frequency features and the time scale combination output by the multi-scale selection module, and the adaptive weights under the time scale output by the adaptive attention weight generation module, and to extract the temporal evolution law and spatial coupling features of KPIs data in parallel. Multi-scale KPIs feature fusion module: used to construct multi-scale features by weighting and summing the time scale gating weights output by the time-frequency feature construction and multi-scale selection module and the spatiotemporal features output by the spatiotemporal feature extraction module. Prediction module: used to predict multiple key performance indicators based on the multi-scale features output by the multi-scale KPIs feature fusion module and MLP.

[0030] Let the KPIs sequence data be... in Indicates the first Time series of KPI indicators This indicates the dimension of KPIs. To eliminate significant differences in the dimensions and orders of magnitude among different KPIs, and to avoid the dominant influence of features with large numerical values ​​during subsequent model training, this invention... The normalized sequence was obtained by using the standard score normalization method. .

[0031] In order to extract more effectively To address the implicit seasonal characteristics, long-term evolution trends, and high-frequency abrupt change patterns in signals, this invention introduces a time-frequency decomposition mechanism based on the STL (Seasonal-Trend decomposition using LOESS) approach. This mechanism synergistically utilizes Fast Fourier Transform (FFT) and multi-kernel average pooling techniques to rapidly convert the time-domain signal into a frequency-domain representation, extracting seasonal characteristics of the sequence by screening for significant frequency components. Simultaneously, high-frequency fluctuations are filtered out through smoothing operations using sliding windows of different scales to highlight the long-term trend characteristics of the sequence. Based on this, the present invention extracts residual terms containing irregular fluctuations by explicitly separating seasonal and trend terms from the original sequence. This is used to capture high-frequency abrupt changes that indicate system failures. Specifically, the extraction process for each component is as follows: First, for... Perform an FFT transform to obtain the spectrum, and retain the spectrum with the largest amplitude. The frequency components are obtained by inverse transformation. Secondly, using a set of pooling kernels of different sizes right Perform a moving average operation and merge to obtain Finally, residual characteristics are obtained by calculating the differences between the original sequence and the seasonal and trend terms. Subsequently, , and Multi-dimensional feature fusion is performed to construct time-frequency features. Subsequently, a noisy Top-K gating mechanism was introduced, utilizing... Calculate the gating scores for each scale. Finally, select the gating score that best suits the current data features based on the scores. This allows for multi-scale modeling of KPIs across multiple time scales.

[0032] Furthermore: the time-frequency deconstruction mechanism based on the STL decomposition idea constructs time-frequency features, introduces a noisy Top-K gating mechanism, calculates the gating score at each scale using the time-frequency features, and selects the K most suitable time scales and scale combinations for the current data features based on the scores, as follows: S11: Input KPIs data Set the number of frequency domain retained components Average pooling kernel set Total number of scales listed and the number of scales selected Initialize the weight matrix of the gated network. and noise weight matrix ; S12: For each Standard score normalization was performed to obtain This constitutes the normalized sequence. ; (1) In the formula, and These are the mean and standard deviation of the sequence, respectively.

[0033] S13: For the normalized... Perform a Fast Fourier Transform to map it to the frequency domain, retaining the top K amplitudes. freq The seasonal feature sequence X is obtained by retrieving the frequency components, setting the remaining components to zero, and then restoring them using a fast inverse Fourier transform. seas The formula is as follows: (2) S14: Set different sizes of sliding window for verification Perform average pooling operations separately, and then merge the smoothed sequences generated by different kernels to obtain the trend feature sequence. ; (3) S15: From Remove the extracted seasonal items. With trend items This allows us to obtain the residual terms that characterize sudden anomalies and high-frequency noise signals in the sequence. And perform feature fusion to obtain ; (4) S16: Introduce random noise that follows a standard normal distribution. Calculate the raw gating score for each scale. ; (5) S17: Yes Perform a Top-K selection operation to filter out the highest-scoring candidates. Index list of each scale and set the values ​​of other scales to Then, the gate weights for the selected scale combination are obtained by normalization using the Softmax function. , (6) Returns a list of indices for the selected scale. Gating weights combined with scale .

[0034] This invention employs an adaptive attention weight generation mechanism based on hypernetworks to generate the weight matrix for spatiotemporal dual-stream attention. This mechanism assigns a learnable indicator embedding vector as its identifier to each KPI, and introduces a scale embedding vector representing the characteristics of the current time scale. The hypernetwork then transforms the joint features of these two embedding vectors into a weight matrix specific to that indicator at the current scale. Specifically, this invention designs the weight generation mechanism based on low-rank decomposition technology.

[0035] The process of assigning a learnable indicator embedding vector to each KPI as its identity, and introducing the time-frequency feature construction and multi-scale selection module to represent the characteristics of the current time scale as a scale embedding vector, and using a hypernetwork to transform the joint features of the indicator embedding vector and the scale embedding vector into an adaptive weight matrix for the indicator at the current scale is as follows: S21: Let the index embedding matrix be... , of which row vector Indicates the first Embedding vectors of KPI indicators; scale embedding matrix is ,in The time scale is represented as The embedding vectors are first processed by the supernetwork using a multilayer perceptron. and fusion vector Core matrix mapped to intermediate state Then, the globally shared basis matrix is ​​used. and right A linear reconstruction is performed to generate the final attention weight matrix; the index embedding matrix is ​​initialized by obtaining the currently selected scale. and scale embedding matrix And globally shared parameters in the hypernetwork, the shared parameters including: the connection weight matrix and bias vector of each layer inside the MLP, denoted as 6 sets of shared basis matrices and and bias basis matrix , ; S22: From the indicator embedding matrix Search current Identity vector corresponding to each KPI indicator Simultaneously, based on the current scale, from the scale embedding matrix... Retrieve the corresponding scale vector in the middle Subsequently, feature splicing was used for fusion. and Constructing a fusion vector ; S23: Merge vectors Input into the MLP, using the initialized weight parameters right Perform layer-by-layer linear transformations and nonlinear activation operations to output the corresponding low-rank core matrix. The formula is as follows: Through the above mechanism, the model can generate independent temporal attention weights and spatial attention weights for each KPI indicator. The specific implementation steps are as follows: (7) S24: Using 6 independent shared basis matrices to respectively apply the low-rank core matrix Perform matrix multiplication and reconstruction to generate the first... The weight matrix of the KPI indicator under different attention channels, for any type Construct the weight matrix The formula is as follows: (8) In the formula, for Flattened row vectors, bias term After broadcasting, and with the sovereign re-matrix Add them together to get .

[0036] S25: Output the set of generated indicator-specific weight matrices and .

[0037] Next, for the time scale combination selected in step one, the adaptive weights generated in step two are used to extract the temporal evolution patterns and spatial coupling characteristics of KPIs data in parallel by constructing a spatiotemporal dual-stream computing architecture.

[0038] like Figure 2 As shown, this step first establishes a sliding window size based on the current time scale, reconstructing the continuous time series into discrete slice sequences. Subsequently, the data stream is copied and fed into two parallel channels: a time stream and a spatial stream. This step constructs a parallel computing architecture: in the time stream, adaptive weight matrices specific to each indicator are used to capture the historical dependencies of individual indicators, ensuring that the calculations of different indicators do not interfere with each other, thus preserving the unique temporal patterns of the indicators; in the spatial stream, a shared matrix is ​​obtained by averaging the adaptive weights of each indicator, forcing all indicators to interact within a unified semantic space to accurately capture the correlations between indicators. Finally, the two feature streams are fused, and a high-dimensional feature representation at this scale is output via a feedforward neural network.

[0039] The process of constructing a spatiotemporal dual-stream computing architecture based on the time-frequency features and the time-scale combination output by the multi-scale selection module, and the adaptive weights under the time-scale output by the adaptive attention weight generation module, and extracting the temporal evolution law and spatial coupling features of KPIs data in parallel is as follows: S31: Get the current time scale and linear layer matrix and The sliding window size is set to normalize the set of KPI sequences. Divided along the time dimension The nth slice sequence, for the nth slice sequence in the set A sequence of indicators, reshaped into a slice matrix. ; S32: Slice the matrix Mapped to a unified hidden layer feature dimension ,get The formula is as follows: (9) S33: Yes The query matrix is ​​obtained by performing linear projection. Key matrix Value matrix ; (10) (11) (12) S34: Calculate the self-attention score in the time dimension based on the scaling dot product mechanism to capture the temporal characteristics of a single metric. ; (13) S35: Yes The spatial flow weight matrices are mean-sampled along the index dimensions to obtain the spatial projection matrices. The formula is as follows: (14) S36: Utilize the generated shared spatial weights to analyze all data within the same time slice. A shared query matrix is ​​obtained by linearly projecting the data from each indicator. Key matrix Value matrix ; (15) (16) (17) S37: Calculate the self-attention score for the indicator dimension to obtain the spatial flow feature set. ; (18) S38: The time flow feature set obtained by independent calculation Reorganized into a tensor consistent with the shape of the spatial flow features, and combined with the spatial flow features The features are then stitched together and then linearly projected to obtain the fused features. ; (19) S39: Integrating Features The input is a feedforward neural network containing layer normalization and GELU activation functions. Dimensionality integration and nonlinear mapping are performed, and the output is the extracted high-dimensional feature tensor. .

[0040] This invention utilizes calculated time-scale gating weights to perform weighted summation of output features, thereby constructing a multi-scale feature representation. Furthermore, to prevent the vanishing gradient problem in deep networks and preserve the statistical properties of the original sequence, a residual connection mechanism is introduced in this step.

[0041] The specific steps are as follows: S41: Based on the list of selected time scales Collect the set of high-dimensional feature tensors output at the corresponding scale. .

[0042] S42: Gating weights using scale combinations The collected features are then linearly weighted and aggregated. The resulting multi-scale features... The calculation formula is as follows: (20) S43: Normalize the original sequence Multi-scale features after linear projection and aggregation The residuals are summed to output the final fused features. .

[0043] This invention designs a composite objective function that includes prediction error loss and load balancing loss, and jointly optimizes the parameters of the hypernetwork, spatiotemporal dual-stream attention network, and gating network through backpropagation algorithm. Finally, the trained model is used to infer from the test set data to output the predicted results of key indicators such as service response time and throughput within the future time window.

[0044] Construct a fully connected linear layer with the following weight matrix: , bias is . Fusing features Input this layer, and the feature dimensions Mapped to prediction step size This allows us to obtain a predicted sequence of KPIs for future time periods. The calculation formula is as follows: (twenty one) The total loss function of the KPIs prediction model Including the main forecast loss and auxiliary load balancing losses ; The main prediction loss The expression is as follows: (twenty two) In the formula, This indicates the batch size during model training. The dimensions representing KPIs; Auxiliary load balancing losses The expression is as follows:

[0045] In the formula, This represents the balance coefficient, which controls the weight of load balancing losses in the total losses. This indicates that in the current batch of data, the [number]th [item]... The average probability assigned by the gating mechanism at each time scale.

[0046] Based on total loss The gradients of all learnable parameters in the network are calculated using the backpropagation algorithm, and the parameters are updated using the Adam optimizer until the loss function converges or the preset number of iterations is reached.

[0047] The KPIs sequence to be tested is input into the trained model to obtain the normalized prediction result, and then the result is restored to the true physical dimension value through inverse normalization, and finally the evaluation result is output.

[0048] A KPIs prediction device based on multi-scale selection and adaptive weights, comprising: Acquisition module: Used to acquire key performance indicator data to be predicted; Module: Used to build a KPI prediction model based on multi-scale selection and adaptive weights based on a key performance indicator dataset, for predicting multiple key performance indicators; Training module: used to train the KPIs prediction model to obtain a trained KPIs prediction model; Implementation module: This module is used to input the key performance indicator data to be predicted into the trained KPIs prediction model to achieve prediction of multiple key performance indicators.

[0049] Example 1 This invention uses the business metrics dataset from the 2022 AIOps Challenge. The specific dataset can be downloaded from the competition's official website. This dataset contains 15,481 data entries across 10 microservices. Each data entry includes a reliability value and four closely related metrics: throughput, response time, and system response rate. The effectiveness of this invention is verified through the following three aspects: (1) data analysis; (2) adaptive weight analysis; and (3) comparative experiments.

[0050] This experiment uses the following two indicators to evaluate the predictive performance of each method: MAE (mean absolute error) and MSE (mean squared error). Formulas (23) and (24) give the mathematical definitions of the two evaluation indicators, respectively.

[0051] (twenty four) (25) During model training, the batch size was fixed at 16, the learning rate was set to 0.0001, and an early stopping strategy was adopted. If the MAE did not decrease, training was stopped after 20 epochs. The distance calculation method used was MMD. All models were implemented in PyTorch using the Adam optimizer on an NVIDIA GeForce GTX 1650 Ti GPU.

[0052] (1) Data Analysis To demonstrate that the dataset used in this invention truly exhibits different statistical distributions for different indicators, the following experiment was conducted.

[0053] First, missing values ​​are filled into the original KPI data. Then, the Z-score normalization algorithm is used to map all indicators to the same order of magnitude. Finally, the kernel density estimation algorithm is used to calculate the probability density function of each indicator in the normalized space to identify its statistical distribution pattern. Figure 3 This is a comparison chart of statistical distribution characteristics, where (a) is the system response rate and (b) is the throughput. This experiment analyzed two representative indicators. It can be seen that the system response rate curve is highly concentrated around the mean, with high kurtosis and a significant left skew. This indicates that the indicator is stable most of the time but accompanied by high-frequency abrupt changes. In contrast, the throughput curve is relatively flat with low kurtosis. This reflects that the indicator exhibits relatively regular fluctuations.

[0054] (2) Adaptive weight analysis First, the model parameters after training convergence are loaded to obtain the attention weight matrix specific to different KPI indicators. Then, the weight matrix corresponding to each indicator is flattened into a high-dimensional feature vector, and the cosine similarity algorithm is used to quantify the correlation of the processing logic between different indicators, and a heatmap is constructed for visualization.

[0055] like Figure 4 As shown, this experiment analyzed the correlation between the specific weights of different indicators. It can be seen that the weight similarity between system response rate and throughput is extremely low, only 0.044. This highly corresponds to the significant difference in their statistical distributions. This experiment strongly demonstrates that the adaptive weighting mechanism can achieve refined modeling for different indicators.

[0056] (3) Comparative experiment Four mainstream deep learning-based KPI prediction methods were selected for comparison with the method of this invention. The baseline methods are as follows: iTransformer: An inverted-dimensional Transformer model. It effectively solves the problem of redundant temporal dimensional information in long sequence prediction by treating independent dimensions as token embeddings to capture correlations between variables and by using a feedforward network to learn nonlinear features.

[0057] Patroemer: A time series prediction model based on multi-scale selection. This model slices the series into multiple granularities using a pre-defined set of fixed time scales and dynamically allocates weights among feature expert paths at different scales using a gating mechanism. It aims to balance the modeling of global trends and local detailed patterns through multi-scale fusion.

[0058] AdaRNN: An adaptive prediction model designed for non-stationary time series. It solves the problem of time covariate offset by a distribution matching algorithm, effectively improving the model's generalization ability on dynamically distributed data.

[0059] STanHop-Net: A memory-enhanced model based on sparse Hopfield networks. It utilizes associative memory mechanisms to capture long-range temporal dependencies and focuses on key temporal patterns through sparsification, thereby improving prediction accuracy in complex relational scenarios.

[0060] Table 1 Comparative Experimental Results

[0061] As can be seen from Table 1, the method of the present invention achieved the best results in prediction metrics for three different services. In particular, on Service 2, the MAE decreased to 0.0057 and the MSE decreased to 0.0021, showing a significant performance improvement compared to the baseline model.

[0062] In comparison, while iTransformer has an advantage in long sequence feature extraction by utilizing inverted dimensions, it performs poorly in capturing local mutations and rare events in microservice KPIs; Pathformer, while having an advantage in multi-granularity feature aggregation by utilizing multi-scale path selection, is limited by the global parameter sharing strategy and struggles to finely characterize indicators with different distributions when dealing with significant differences in statistical distributions among indicators; AdaRNN, while alleviating non-stationarity issues through distribution matching, is still insufficient in handling physical heterogeneity among multiple variables, resulting in an overall error higher than our method; STanHop-Net, utilizing a memory network, shows strong competitiveness in Service 3 MSE, but our method has a more significant advantage in the MAE indicator, which reflects prediction bias, indicating that our method fits the overall trend more accurately and stably.

[0063] In summary, the method based on multi-scale selection and adaptive weights proposed in this invention can effectively overcome the shortcomings of existing models in dealing with different distributions of various indicators, and verifies its effectiveness in complex KPI prediction tasks.

[0064] Current mainstream microservice KPI prediction methods ignore the significant differences in the statistical distribution of different indicators, which can easily lead to overfitting of the model to normal data and limit its prediction accuracy in complex scenarios. To address this issue, this invention proposes a KPI prediction method based on multi-scale selection and adaptive weights. This method deconstructs the time-frequency components of a sequence using the STL decomposition approach, utilizes a gating network to match the optimal scale, and further introduces a hypernetwork mechanism to customize exclusive attention weights for different indicators. Finally, a spatiotemporal dual-stream attention mechanism is used to achieve high-precision multi-dimensional indicator collaborative prediction. This method significantly improves the monitoring and early warning accuracy of microservice systems under complex loads. By accurately capturing signals of precipitous drops in response rate, it effectively improves prediction accuracy. It helps operations teams identify performance bottlenecks and shorten the mean time to repair (MTBT). This not only directly reduces economic losses caused by system downtime but also significantly enhances the operational resilience and service stability of large-scale distributed architectures.

[0065] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A KPIs prediction method based on multi-scale selection and adaptive weights, characterized in that: Includes the following steps: Obtain the key performance indicator data to be predicted; Based on a dataset of key performance indicators (KPIs), a KPIs prediction model based on multi-scale selection and adaptive weights is constructed to predict multiple key performance indicators. The KPIs prediction model is trained to obtain a trained KPIs prediction model; The key performance indicator data to be predicted is input into the trained KPIs prediction model to achieve prediction of multiple key performance indicators.

2. The KPIs prediction method based on multi-scale selection and adaptive weights according to claim 1, characterized in that: The KPIs prediction model includes: Time-frequency feature construction and multi-scale selection module: It is used for time-frequency deconstruction mechanism based on STL decomposition idea to construct time-frequency features, introduces a noisy Top-K gating mechanism, calculates the gating score of each scale using time-frequency features, and selects the K time scales and scale combinations that are most suitable for the current data features based on the scores. Adaptive attention weight generation module: used to assign a learnable indicator embedding vector as its identity for each KPI indicator, and introduce the scale embedding vector to represent the characteristics of the current time scale by the time-frequency feature construction and multi-scale selection module. The joint features of the indicator embedding vector and the scale embedding vector are transformed into an adaptive weight matrix of the indicator at the current scale using a hypernetwork. Spatiotemporal feature extraction module: used to construct a spatiotemporal dual-stream computing architecture based on the time-frequency features and the time scale combination output by the multi-scale selection module, and the adaptive weights under the time scale output by the adaptive attention weight generation module, and to extract the temporal evolution law and spatial coupling features of KPIs data in parallel. Multi-scale KPIs feature fusion module: used to construct multi-scale features by weighting and summing the time scale gating weights output by the time-frequency feature construction and multi-scale selection module and the spatiotemporal features output by the spatiotemporal feature extraction module. Prediction module: used to predict multiple key performance indicators based on the multi-scale features output by the multi-scale KPIs feature fusion module and MLP.

3. The KPIs prediction method based on multi-scale selection and adaptive weights according to claim 1, characterized in that: The time-frequency deconstruction mechanism based on the STL decomposition idea constructs time-frequency features, introduces a noisy Top-K gating mechanism, calculates the gating score at each scale using the time-frequency features, and selects the K most suitable time scales and scale combinations for the current data features based on the scores. The process is as follows: S11: Input KPIs data Set the number of frequency domain retained components Average pooling kernel set Total number of scales listed and the number of scales selected Initialize the weight matrix of the gated network. and noise weight matrix ; S12: For each Standard score normalization was performed to obtain This constitutes the normalized sequence. ; S13: For the normalized... Perform a Fast Fourier Transform to map it to the frequency domain, retaining the top K amplitudes. freq The seasonal feature sequence X is obtained by retrieving the frequency components, setting the remaining components to zero, and then restoring them using a fast inverse Fourier transform. seas ; S14: Set different sizes of sliding window for verification Perform average pooling operations separately, and then merge the smoothed sequences generated by different kernels to obtain the trend feature sequence. ; S15: From Remove the extracted seasonal items. With trend items This allows us to obtain the residual terms that characterize sudden anomalies and high-frequency noise signals in the sequence. And perform feature fusion to obtain ; S16: Introduce random noise that follows a standard normal distribution. Calculate the raw gating score for each scale. ; S17: Yes Perform a Top-K selection operation to filter out the highest-scoring candidates. Index list of each scale and set the values ​​of other scales to Then, the gate weights for the selected scale combination are obtained by normalization using the Softmax function. .

4. The KPIs prediction method based on multi-scale selection and adaptive weights according to claim 1, characterized in that: The process of assigning a learnable indicator embedding vector to each KPI as its identity, and introducing the time-frequency feature construction and multi-scale selection module to represent the characteristics of the current time scale as a scale embedding vector, and using a hypernetwork to transform the joint features of the indicator embedding vector and the scale embedding vector into an adaptive weight matrix for the indicator at the current scale, is as follows: S21: Let the index embedding matrix be... , of which row vector Indicates the first Embedding vectors of KPI indicators; scale embedding matrix is ,in The time scale is represented as The embedding vectors are first processed by the supernetwork using a multilayer perceptron. and fusion vector Core matrix mapped to intermediate state Then, the globally shared basis matrix is ​​used. and right A linear reconstruction is performed to generate the final attention weight matrix; the index embedding matrix is ​​initialized by obtaining the currently selected scale. and scale embedding matrix And globally shared parameters in the hypernetwork, the shared parameters including: the connection weight matrix and bias vector of each layer inside the MLP, denoted as 6 sets of shared basis matrices and and bias basis matrix , ; S22: From the indicator embedding matrix Search current Identity vector corresponding to each KPI indicator Simultaneously, based on the current scale, from the scale embedding matrix... Retrieve the corresponding scale vector in the middle Subsequently, feature splicing was used for fusion. and Constructing a fusion vector ; S23: Merge vectors Input the MLP and use the initialized weight parameters right Perform layer-by-layer linear transformations and nonlinear activation operations to output the corresponding low-rank core matrix. ; S24: Using 6 independent shared basis matrices to respectively apply the low-rank core matrix Perform matrix multiplication and reconstruction to generate the first... The weight matrix of the KPI indicator under different attention channels, for any type Construct a weight matrix ; S25: Output the set of generated indicator-specific weight matrices and .

5. The KPIs prediction method based on multi-scale selection and adaptive weights according to claim 1, characterized in that... The process of constructing a spatiotemporal dual-stream computing architecture based on the time-frequency features and the time-scale combination output by the multi-scale selection module, and the adaptive weights under the time-scale output by the adaptive attention weight generation module, and extracting the temporal evolution law and spatial coupling features of KPIs data in parallel is as follows: S31: Get the current time scale and linear layer matrix and The sliding window size is set to normalize the set of KPI sequences. Divided along the time dimension The nth slice sequence, for the nth slice sequence in the set A sequence of indicators, reshaped into a slice matrix. ; S32: Slice the matrix Mapped to a unified hidden layer feature dimension ,get ; S33: Yes The query matrix is ​​obtained by performing linear projection. Key matrix Value matrix ; S34: Calculate the self-attention score in the time dimension based on the scaling dot product mechanism to capture the temporal characteristics of a single metric. ; S35: Yes The spatial flow weight matrices are mean-sampled along the index dimensions to obtain the spatial projection matrices. ; S36: Utilize the generated shared spatial weights to analyze all data within the same time slice. A shared query matrix is ​​obtained by linearly projecting the data from each indicator. Key matrix Value matrix ; S37: Calculate the self-attention score for the indicator dimension to obtain the spatial flow feature set. ; S38: The time flow feature set obtained by independent calculation Reorganized into a tensor consistent with the shape of the spatial flow features, and combined with the spatial flow features The features are then stitched together and then linearly projected to obtain the fused features. ; S39: Integrating Features The input is a feedforward neural network containing layer normalization and GELU activation functions. Dimensionality integration and nonlinear mapping are performed, and the output is the extracted high-dimensional feature tensor. .

6. The KPIs prediction method based on multi-scale selection and adaptive weights according to claim 1, characterized in that: The total loss function of the KPIs prediction model Including the main forecast loss and auxiliary load balancing losses ; The main prediction loss The expression is as follows: In the formula, This indicates the batch size during model training. The dimensions representing KPIs; Auxiliary load balancing losses The expression is as follows: In the formula, This represents the balance coefficient, which controls the weight of load balancing losses in the total losses. This indicates that in the current batch of data, the [number]th [item]... The average probability assigned by the gating mechanism at each time scale.

7. A KPIs prediction device based on multi-scale selection and adaptive weights, characterized in that: include: Acquisition module: Used to acquire key performance indicator data to be predicted; Module: Used to build a KPI prediction model based on multi-scale selection and adaptive weights based on a key performance indicator dataset, for predicting multiple key performance indicators; Training module: used to train the KPIs prediction model to obtain a trained KPIs prediction model; Implementation module: This module is used to input the key performance indicator data to be predicted into the trained KPIs prediction model to achieve prediction of multiple key performance indicators.