A log anomaly detection method based on a multi-modal gated linear transformer
By decoupling the textual semantics and numerical parameter features of log data through a multimodal gated linear Transformer, adaptive weighted fusion and long-range modeling are performed, solving the problems of accuracy and computational overhead in log anomaly detection in existing technologies, and achieving efficient log anomaly monitoring.
Patent Information
- Application Number
- CN202611391936.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-09
- Publication Date
- 2026-11-24
AI Technical Summary
Existing log anomaly detection methods rely on log parsers, which make it difficult to fully utilize continuous numerical parameters, leading to false alarms or missed alarms. Furthermore, long log sequence modeling is costly and fails to meet real-time and generalization requirements.
A multimodal gated linear Transformer is adopted, and semantic and numerical parameter features of the text are extracted through a semantic-numerical log encoder. Adaptive weighted fusion is performed using a gated cross-modal fusion module, and long-range time series modeling is performed through a linear time series encoder to calculate anomaly scores and output detection results.
It improves the accuracy of log anomaly detection, reduces computational and storage overhead, and is suitable for large-scale log anomaly monitoring and early warning in distributed systems, cloud platforms, and industrial systems.
Smart Images

Figure CN123158458A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of network security monitoring technology, and in particular to a log anomaly detection method based on a multimodal gated linear Transformer. Background Technology
[0002] Log files record event descriptions, component information, time context, and operating parameters in distributed systems, cloud-native platforms, industrial control systems, and safety-critical infrastructures. They serve as an important basis for fault diagnosis, performance analysis, and safety early warning. As system scale and complexity increase, traditional log anomaly detection methods that rely on manual inspection, static rules, or fixed thresholds are no longer sufficient to meet the requirements of real-time performance and generalization.
[0003] Most existing methods rely on log parsers to convert unstructured logs into template sequences before performing statistical analysis or deep modeling. However, their detection performance is greatly affected by the parsing quality. When the log format changes, template extraction is incorrect, or variable parameters have business meaning, the templateization process is prone to losing continuous numerical information such as response time, resource consumption, and count values, leading to false positives or false negatives. In recent years, although the ability to model log context has been improved through Transformer, self-supervised learning, and contrastive learning, most methods still rely on a single text modality, making it difficult to fully utilize continuous numerical parameters to reflect the dynamic state of the system. Furthermore, standard self-attention has high computational and storage overhead on long log sequences. Summary of the Invention
[0004] In view of this, the present invention proposes a log anomaly detection method based on a multimodal gated linear Transformer, which makes full use of continuous numerical parameters to improve the accuracy of log anomaly detection results and reduce computational and storage overhead.
[0005] The technical solution of this invention is implemented as follows: A log anomaly detection method based on multimodal gated linear Transformer includes the following steps: Step S1: Construct a log anomaly detection model that includes a semantic-numerical log encoder, a gated cross-modal fusion module, and a linear time-series encoder, and train it. Step S2: Obtain the raw log data to be detected, and extract unstructured text sequences and continuous numerical parameters from the raw log data; Step S3: Input the unstructured text sequence and continuous numerical parameters into the semantic-numerical log encoder for feature extraction to obtain the text semantic feature vector and the numerical parameter feature vector. Step S4: The gated cross-modal fusion module performs adaptive weighted fusion of text semantic feature vector and numerical parameter feature vector to obtain the multimodal fusion embedding of a single log. Step S5: Multimodal fusion and embedding of multiple logs in chronological order to form a log feature sequence. The linear time-series encoder performs long-range temporal dependency modeling on the log feature sequence and obtains the predicted embedding. Step S6: Calculate the anomaly score based on the reconstruction distance between the predicted embedding and the multimodal fusion embedding, and output the log anomaly detection result after comparing it with the preset threshold.
[0006] Preferably, the log anomaly detection model is trained using normal log sequences under stable operating conditions. Its training loss includes continuous embedding mask prediction loss and cross-modal self-supervised contrastive loss. The joint loss function of the log anomaly detection model is:
[0007] in For joint losses, For continuous embedding mask prediction loss, For cross-modal self-supervised contrastive loss, This is the balance coefficient.
[0008] Preferably, the raw log data comes from a distributed system, cloud-native platform, industrial control system, database service, or security monitoring system, and the continuous numerical parameters include response time, resource usage, error codes, count values, or other continuous operating indicators.
[0009] Preferably, the semantic-numerical log encoder includes a semantic context branch and a dynamic parameter feature branch. The semantic context branch extracts features from unstructured text sequences and obtains text semantic feature vectors. The dynamic parameter feature branch extracts features from continuous numerical parameters and obtains numerical parameter feature vectors.
[0010] Preferably, the steps for obtaining the text semantic feature vector are as follows: The semantic context branch performs word segmentation on the unstructured text sequence and converts it into a token sequence; The token sequence is input into the word embedding layer and positional enhancement is performed to obtain the positionally enhanced text representation; The location-enhanced text representation is input into the built-in Transformer encoder to obtain a token-level contextual semantic vector; The context semantic vector is subjected to masked average pooling using an attention mask to obtain the text semantic feature vector. The expression for the text semantic feature vector is as follows:
[0011] in This is a text semantic feature vector. For attention mask matrix, For contextual semantic vectors, This represents the length of the current log sequence.
[0012] Preferably, the specific steps for embedding the token sequence into the word embedding layer and performing positional enhancement to obtain the position-enhanced text representation are as follows: The embedding matrix is obtained by inputting the token sequence into the word embedding layer. For the embedding matrix By introducing learnable positional encoding, we obtain a position-enhanced text representation:
[0013] in For location-enhanced text representation, For the feature dimensions of the log anomaly detection model, For location-encoded index, This is the learnable location encoding matrix.
[0014] Preferably, the step of obtaining the numerical parameter feature vector is as follows: The dynamic parameter feature branch consists of a fully connected layer and a GELU nonlinear activation function. The dynamic parameter feature branch maps continuous numerical parameters to a high-dimensional space consistent with the text semantic feature vector, resulting in a numerical parameter feature vector. The expression for this numerical parameter feature vector is:
[0015] in For numerical parameter eigenvectors, and For learnable linear projection weights, and This is the bias term for the fully connected layer.
[0016] Preferably, the specific steps of step S4 are as follows: After obtaining the text semantic feature vector and numerical parameter feature vector, the gated cross-modal fusion module concatenates the two along the channel dimension to obtain the cross-modal joint features:
[0017] in For cross-modal joint features, This is a text semantic feature vector. For numerical parameter eigenvectors; The cross-modal joint features are input into a linear mapping layer, and gated weights are generated using a Sigmoid activation function:
[0018] in For gating weights, and These are the weight matrix and bias term of the linear mapping layer, respectively; Based on gated weights, an adaptive weighted fusion of text semantic feature vectors and numerical parameter feature vectors is performed to obtain intermediate fused features. :
[0019] Multimodal fusion embedding of a single log entry is output through dimensionality reduction using linear mapping based on the intermediate fusion matrix:
[0020] in Multimodal fusion embedding for a single log entry and These are the weight matrix and bias term for dimensionality reduction of the linear mapping, respectively.
[0021] Preferably, the specific steps of step S5 are as follows: The multimodal fusion embeddings of multiple logs within the same time window are arranged in chronological order to form a log feature sequence:
[0022] Where N is the number of logs within the current time window. This represents the multimodal fusion embedding corresponding to the Nth log entry; The linear time-series encoder performs batch normalization on the log feature sequence and maps it into a query matrix Q, a key matrix K, and a value matrix V. Normalization is performed using a forward kernel function mapping:
[0023] The key-value pair global statistics are calculated first based on the matrix multiplication associative law, and then combined with the query matrix to obtain the original time series sequence. The original time series is processed through a first-level residual connection, batch normalization, feedforward neural network, and a second-level residual connection to output the predicted embedding.
[0024] Preferably, the specific steps of step S6 are as follows: Perform mask prediction on the target log position in the test sliding window, and after obtaining the predicted embedding, extract the multimodal fusion embedding corresponding to that position. Calculate the reconstructed cosine distance between the predicted embedding and the multimodal fusion embedding to obtain the local anomaly score for a single log entry.
[0025] in Scoring for local anomalies, To predict embeddings, For multimodal fusion embedding; For multiple local anomaly scores within the test sliding window, a max-pooling strategy is used to obtain the sequence-level anomaly index:
[0026] in It is a sequence-level anomaly index. To test the sliding window; If the sequence-level anomaly index is greater than a preset threshold or an adaptive threshold determined based on the normal log validation set, the log is considered to be abnormal; otherwise, it is considered normal.
[0027] Compared with the prior art, the beneficial effects of the present invention are: This invention presents a log anomaly detection method based on a multimodal gated linear Transformer. With multimodal feature decoupling and linear temporal modeling as its core, it decouples the original log data extraction process into discrete text semantic encoding and continuous numerical parameter mapping, constructing a collaborative anomaly detection architecture between the message layer and the temporal layer. The message layer employs a semantic-numerical log encoder to independently extract heterogeneous features from individual log entries, and adaptively calculates the optimal weight allocation of semantics and parameters through a gated cross-modal fusion module, achieving comprehensive representation of local information in a single log entry. The temporal layer uses a linear temporal sequence encoder based on kernel function feature mapping to perform long-range context modeling on ultra-long log sequences. It replaces the traditional Softmax operation with the matrix multiplication associative law to calculate global attention. During the inference phase, it calculates the anomaly score and outputs the decision result by using the reconstructed cosine distance between the predicted embedding and the true fused embedding. This method effectively solves the problems of existing log anomaly detection methods, such as reliance on log parsers, loss of continuous numerical parameters, difficulty in fusing heterogeneous features, and high overhead in modeling ultra-long log sequences. It is suitable for large-scale log anomaly monitoring and early warning in distributed systems, cloud platforms, and industrial systems. Attached Figure Description
[0028] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only preferred embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0029] Figure 1 This is a flowchart of a log anomaly detection method based on a multimodal gated linear Transformer according to the present invention; Figure 2 A schematic diagram of the overall framework of the log anomaly detection model of the log anomaly detection method based on multimodal gated linear Transformer of the present invention; Figure 3 A schematic diagram of the semantic-numerical log encoder structure of the log anomaly detection model of the log anomaly detection method based on multimodal gated linear Transformer of the present invention. Figure 4 A schematic diagram of the structure of the gated cross-modal fusion module of the log anomaly detection model of the log anomaly detection method based on multimodal gated linear Transformer of the present invention; Figure 5 A schematic diagram of the structure of a linear time-series encoder in the log anomaly detection model of a log anomaly detection method based on a multimodal gated linear Transformer according to the present invention. Detailed Implementation
[0030] To better understand the technical content of this invention, a specific embodiment is provided below, and the invention will be further described in conjunction with the accompanying drawings.
[0031] See Figures 1 to 5 This invention provides a log anomaly detection method based on a multimodal gated linear Transformer, comprising the following steps: Step S1: Construct a log anomaly detection model that includes a semantic-numerical log encoder, a gated cross-modal fusion module, and a linear time-series encoder, and train it. Step S2: Obtain the raw log data to be detected, and extract unstructured text sequences and continuous numerical parameters from the raw log data; Step S3: Input the unstructured text sequence and continuous numerical parameters into the semantic-numerical log encoder for feature extraction to obtain the text semantic feature vector and the numerical parameter feature vector. Step S4: The gated cross-modal fusion module performs adaptive weighted fusion of text semantic feature vector and numerical parameter feature vector to obtain the multimodal fusion embedding of a single log. Step S5: Multimodal fusion and embedding of multiple logs in chronological order to form a log feature sequence. The linear time-series encoder performs long-range temporal dependency modeling on the log feature sequence and obtains the predicted embedding. Step S6: Calculate the anomaly score based on the reconstruction distance between the predicted embedding and the multimodal fusion embedding, and output the log anomaly detection result after comparing it with the preset threshold.
[0032] This invention discloses a log anomaly detection method based on a multimodal gated linear Transformer. It constructs a log anomaly detection model comprising a semantic-numerical log encoder, a gated cross-modal fusion module, and a linear temporal sequence encoder. The semantic-numerical log encoder and the gated cross-modal fusion module serve as the message layer, while the linear temporal sequence encoder serves as the temporal layer, thus establishing a collaborative anomaly detection architecture between the message and temporal layers. During log anomaly detection, the original log data to be detected is first acquired, and unstructured text sequences and continuous numerical parameters are extracted from the original log data. Then, feature extraction is performed on the unstructured text sequences and continuous numerical parameters. The feature extraction process is decoupled into discrete text semantic feature vectors and continuous numerical parameter feature vectors, thereby adapting to the respective data distribution characteristics of text and numerical modal data, avoiding mutual interference between different types of features, and facilitating subsequent adaptive complementary representation of the two types of information through gated cross-modal fusion.
[0033] The semantic-numerical log encoder extracts features from unstructured text sequences and continuous numerical parameters through a dual-branch structure, obtaining text semantic feature vectors and numerical parameter feature vectors. A gated cross-modal fusion module adaptively calculates the optimal weights for semantics and parameters and assigns them to the text semantic feature vector and numerical parameter feature vector for weighted fusion, resulting in a multimodal fusion embedding for a single log entry. This allows for a comprehensive representation of the local information of a single log entry. Then, the multimodal fusion embeddings of multiple log entries are combined in chronological order to form an ultra-long log feature sequence. Long-range context modeling is performed using a linear time-series encoder, ultimately yielding a predicted embedding. For a single log entry, the reconstruction distance between its predicted embedding and the multimodal fusion embedding used as the true fusion embedding is calculated as an anomaly score. The anomaly score is used to determine the log anomaly detection result. This approach effectively addresses the problems of existing log anomaly detection methods, such as reliance on log parsers, loss of continuous numerical parameters, difficulty in fusing heterogeneous features, and high modeling overhead for ultra-long log sequences. It is suitable for large-scale log anomaly monitoring and early warning in distributed systems, cloud platforms, and industrial systems.
[0034] Preferably, the log anomaly detection model is trained using normal log sequences under stable operating conditions. Its training loss includes continuous embedding mask prediction loss and cross-modal self-supervised contrastive loss. The joint loss function of the log anomaly detection model is:
[0035] in For joint losses, For continuous embedding mask prediction loss, For cross-modal self-supervised contrastive loss, This is the balance coefficient.
[0036] During the training phase, only normal log sequences under stable operating conditions are used. The gated cross-modal fusion module outputs multimodal fusion embeddings, while the linear time-series encoder randomly masks part of the log positions with a preset probability and uses the unmasked context to predict the continuous fusion embeddings of the masked positions. The continuous embedding mask prediction loss adopts mean squared error to constrain the predicted embeddings to be close to the true embeddings. The cross-modal self-supervised contrastive loss adopts the form of InfoNCE to enhance the discriminativeness of normal log representations. Through this training method, the log anomaly detection model can learn the correlation between log text semantics, numerical parameter fluctuations, and temporal context under normal operating conditions.
[0037] Preferably, the raw log data comes from a distributed system, cloud-native platform, industrial control system, database service, or security monitoring system, and the continuous numerical parameters include response time, resource usage, error codes, count values, or other continuous operating indicators.
[0038] The raw log data can come from various sources. For the i-th log entry, let its unstructured text sequence be denoted as . The response time, resource usage, error codes, count values, or other continuous operational metrics are extracted from the raw log data as input for continuous numerical parameters, where the continuous numerical parameters are represented as follows: .
[0039] Preferably, the semantic-numerical log encoder includes a semantic context branch and a dynamic parameter feature branch. The semantic context branch extracts features from the unstructured text sequence and obtains a text semantic feature vector. The steps for obtaining the feature vector are as follows: The semantic context branch performs word segmentation on the unstructured text sequence and converts it into a token sequence; Input the token sequence into the word embedding layer to obtain the embedding matrix. In order to preserve the position information of the token in the log text, the embedding matrix is... By introducing learnable positional encoding, we obtain a position-enhanced text representation:
[0040] in For location-enhanced text representation, For the feature dimensions of the log anomaly detection model, For location-encoded index, This is the learnable location encoding matrix.
[0041] The location-enhanced text representation is input into the built-in Transformer encoder to obtain a token-level contextual semantic vector; Since different log texts have different lengths, padding tokens may occur during batch processing. To avoid padding tokens affecting the semantic representation of the logs, attention masks are used to perform masked average pooling on the context semantic vector to obtain the text semantic feature vector. The expression for the text semantic feature vector is as follows:
[0042] in This is a text semantic feature vector. This is an attention mask matrix, where the actual token is set to 1 and the padding is set to 0. For contextual semantic vectors, The length of the current log sequence is given. Through the above steps, the textual semantic feature vector representation of a single log entry can be obtained.
[0043] The dynamic parameter feature branch extracts features from continuous numerical parameters to obtain numerical parameter feature vectors. The steps for obtaining these vectors are as follows: The dynamic parameter feature branch consists of a fully connected layer and a GELU nonlinear activation function. The dynamic parameter feature branch maps continuous numerical parameters to a high-dimensional space consistent with the text semantic feature vector, resulting in a numerical parameter feature vector. The expression for this numerical parameter feature vector is:
[0044] in For numerical parameter eigenvectors, and For learnable linear projection weights, and This is the bias term for the fully connected layer.
[0045] Through the above steps, the log anomaly detection model can retain dynamic operational status information such as response time, resource usage, error codes, and count changes when log events occur.
[0046] Preferably, the specific steps of step S4 are as follows: After obtaining the text semantic feature vector and numerical parameter feature vector, the gated cross-modal fusion module concatenates the two along the channel dimension to obtain the cross-modal joint features:
[0047] in For cross-modal joint features, This is a text semantic feature vector. For numerical parameter eigenvectors; The cross-modal joint features are input into a linear mapping layer, and gated weights are generated using a Sigmoid activation function:
[0048] in For gating weights, and These are the weight matrix and bias term of the linear mapping layer, respectively; Based on gated weights, an adaptive weighted fusion of text semantic feature vectors and numerical parameter feature vectors is performed to obtain intermediate fused features. :
[0049] Multimodal fusion embedding of a single log entry is output through dimensionality reduction using linear mapping based on the intermediate fusion matrix:
[0050] in Multimodal fusion embedding for a single log entry and These are the weight matrix and bias term for dimensionality reduction of the linear mapping, respectively.
[0051] Gating weights The adaptively generated gating weights adjust the relative importance of textual semantic information and numerical state information according to the current log content, thereby adaptively weighting and fusing the textual semantic feature vector and the numerical parameter feature vector to obtain intermediate fused features. Finally, the intermediate fused features are reduced in dimensionality through linear mapping to output the multimodal fused embedding of a single log. Through this fusion method, the log anomaly detection model can adaptively select more important feature information in different log contexts, reducing information bias caused by single textual features or single numerical features.
[0052] Preferably, the specific steps of step S5 are as follows: The multimodal fusion embeddings of multiple logs within the same time window are arranged in chronological order to form a log feature sequence:
[0053] Where N is the number of logs within the current time window. This represents the multimodal fusion embedding corresponding to the Nth log entry; The linear time-series encoder performs batch normalization on the log feature sequence and maps it into a query matrix Q, a key matrix K, and a value matrix V. To reduce the computational overhead of standard Softmax self-attention on long log sequences, a forward kernel function mapping is used instead of Softmax normalization:
[0054] The global statistical terms of key-value pairs are calculated first based on the matrix multiplication associative law, and then combined with the query matrix to reduce the complexity of sequence modeling and obtain the original time series sequence. The original time series is added to the input residual, then batch normalized, and then input into a feedforward neural network for nonlinear mapping. The output of the feedforward neural network is added to the residual of the original time series again to output the predicted embedding.
[0055] A linear time-series encoder can capture the contextual dependencies of system state changes over time in a log sequence, enabling long-range dependency modeling with approximately linear complexity.
[0056] Preferably, the specific steps of step S6 are as follows: Perform mask prediction on the target log position in the test sliding window, and after obtaining the predicted embedding, extract the multimodal fusion embedding corresponding to that position. Calculate the reconstructed cosine distance between the predicted embedding and the multimodal fusion embedding to obtain the local anomaly score for a single log entry.
[0057] in Scoring for local anomalies, To predict embeddings, For multimodal fusion embedding; For multiple local anomaly scores within the test sliding window, a max-pooling strategy is used to obtain the sequence-level anomaly index:
[0058] in It is a sequence-level anomaly index. To test the sliding window; If the sequence-level anomaly index is greater than a preset threshold or an adaptive threshold determined based on the normal log validation set, the log is considered to be abnormal; otherwise, it is considered normal.
[0059] During the inference phase of the log anomaly detection model, the model parameters after training can be frozen. Mask prediction is performed on the target log position in the test sliding window to obtain the predicted embedding. The multimodal fusion embedding corresponding to this position is extracted as the real fusion embedding. Finally, the local anomaly score of a single log is calculated using the reconstructed cosine distance between the predicted embedding and the real fusion embedding. Then, max pooling is performed, and the highest local anomaly score in the test sliding window is taken as the comprehensive anomaly index of the entire time series window. This index is compared with a threshold, and the anomaly detection result of the corresponding log is finally output.
[0060] Table 1 shows the anomaly detection performance metrics of the log anomaly detection model of the present invention on the HDFS, BGL and Spark datasets. As can be seen from Table 1, compared with the existing baseline model, the embodiment of the present invention achieves significant improvement in various evaluation metrics of log anomaly detection, while greatly reducing the computational overhead of long time-series scenarios, and balancing anomaly recognition accuracy and inference real-time performance.
[0061] Table 1
[0062] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A log anomaly detection method based on a multimodal gated linear Transformer, characterized in that, Includes the following steps: Step S1: Construct a log anomaly detection model that includes a semantic-numerical log encoder, a gated cross-modal fusion module, and a linear time-series encoder, and train it. Step S2: Obtain the raw log data to be detected, and extract unstructured text sequences and continuous numerical parameters from the raw log data; Step S3: Input the unstructured text sequence and continuous numerical parameters into the semantic-numerical log encoder for feature extraction to obtain the text semantic feature vector and the numerical parameter feature vector. Step S4: The gated cross-modal fusion module performs adaptive weighted fusion of text semantic feature vector and numerical parameter feature vector to obtain the multimodal fusion embedding of a single log. Step S5: Multimodal fusion and embedding of multiple logs in chronological order to form a log feature sequence. The linear time-series encoder performs long-range temporal dependency modeling on the log feature sequence and obtains the predicted embedding. Step S6: Calculate the anomaly score based on the reconstruction distance between the predicted embedding and the multimodal fusion embedding, and output the log anomaly detection result after comparing it with the preset threshold.
2. The log anomaly detection method based on a multimodal gated linear Transformer according to claim 1, characterized in that, The log anomaly detection model is trained using normal log sequences under stable operating conditions. Its training loss includes continuous embedding mask prediction loss and cross-modal self-supervised contrastive loss. The joint loss function of the log anomaly detection model is: in For joint losses, For continuous embedding mask prediction loss, For cross-modal self-supervised contrastive loss, This is the balance coefficient.
3. The log anomaly detection method based on a multimodal gated linear Transformer according to claim 1, characterized in that, The raw log data comes from distributed systems, cloud-native platforms, industrial control systems, database services, or security monitoring systems, and the continuous numerical parameters include response time, resource usage, error codes, count values, or other continuous operating indicators.
4. The log anomaly detection method based on a multimodal gated linear Transformer according to claim 1, characterized in that, The semantic-numerical log encoder includes a semantic context branch and a dynamic parameter feature branch. The semantic context branch extracts features from unstructured text sequences and obtains text semantic feature vectors. The dynamic parameter feature branch extracts features from continuous numerical parameters and obtains numerical parameter feature vectors.
5. The log anomaly detection method based on a multimodal gated linear Transformer according to claim 4, characterized in that, The steps for obtaining the text semantic feature vector are as follows: The semantic context branch performs word segmentation on the unstructured text sequence and converts it into a token sequence; The token sequence is input into the word embedding layer and positional enhancement is performed to obtain the positionally enhanced text representation; The location-enhanced text representation is input into the built-in Transformer encoder to obtain a token-level contextual semantic vector; The context semantic vector is subjected to masked average pooling using an attention mask to obtain the text semantic feature vector. The expression for the text semantic feature vector is as follows: in This is a text semantic feature vector. For attention mask matrix, For contextual semantic vectors, This represents the length of the current log sequence.
6. The log anomaly detection method based on a multimodal gated linear Transformer according to claim 5, characterized in that, The specific steps for embedding the token sequence into the word embedding layer and performing positional enhancement to obtain the position-enhanced text representation are as follows: The embedding matrix is obtained by inputting the token sequence into the word embedding layer. For the embedding matrix By introducing learnable positional encoding, we obtain a position-enhanced text representation: in For location-enhanced text representation, For the feature dimensions of the log anomaly detection model, For location-encoded index, This is the learnable location encoding matrix.
7. The log anomaly detection method based on a multimodal gated linear Transformer according to claim 4, characterized in that, The steps for obtaining the numerical parameter feature vector are as follows: The dynamic parameter feature branch consists of a fully connected layer and a GELU nonlinear activation function. The dynamic parameter feature branch maps continuous numerical parameters to a high-dimensional space consistent with the text semantic feature vector, resulting in a numerical parameter feature vector. The expression for this numerical parameter feature vector is: in For numerical parameter eigenvectors, and For learnable linear projection weights, and This is the bias term for the fully connected layer.
8. The log anomaly detection method based on a multimodal gated linear Transformer according to claim 1, characterized in that, The specific steps of step S4 are as follows: After obtaining the text semantic feature vector and numerical parameter feature vector, the gated cross-modal fusion module concatenates the two along the channel dimension to obtain the cross-modal joint features: in For cross-modal joint features, This is a text semantic feature vector. For numerical parameter eigenvectors; The cross-modal joint features are input into a linear mapping layer, and gated weights are generated using a Sigmoid activation function: in For gating weights, and These are the weight matrix and bias term of the linear mapping layer, respectively; Based on gated weights, an adaptive weighted fusion of text semantic feature vectors and numerical parameter feature vectors is performed to obtain intermediate fused features. : Multimodal fusion embedding of a single log entry is output through dimensionality reduction using linear mapping based on the intermediate fusion matrix: in Multimodal fusion embedding for a single log entry and These are the weight matrix and bias term for dimensionality reduction of the linear mapping, respectively.
9. The log anomaly detection method based on a multimodal gated linear Transformer according to claim 1, characterized in that, The specific steps of step S5 are as follows: The multimodal fusion embeddings of multiple logs within the same time window are arranged in chronological order to form a log feature sequence: Where N is the number of logs within the current time window. This represents the multimodal fusion embedding corresponding to the Nth log entry; The linear time-series encoder performs batch normalization on the log feature sequence and maps it into a query matrix Q, a key matrix K, and a value matrix V. Normalization is performed using a forward kernel function mapping: The key-value pair global statistics are calculated first based on the matrix multiplication associative law, and then combined with the query matrix to obtain the original time series sequence. The original time series is processed through a first-level residual connection, batch normalization, feedforward neural network, and a second-level residual connection to output the predicted embedding.
10. The log anomaly detection method based on a multimodal gated linear Transformer according to claim 1, characterized in that, The specific steps of step S6 are as follows: Perform mask prediction on the target log position in the test sliding window, and after obtaining the predicted embedding, extract the multimodal fusion embedding corresponding to that position. Calculate the reconstructed cosine distance between the predicted embedding and the multimodal fusion embedding to obtain the local anomaly score for a single log entry. in Scoring for local anomalies, To predict embeddings, For multimodal fusion embedding; For multiple local anomaly scores within the test sliding window, a max-pooling strategy is used to obtain the sequence-level anomaly index: in It is a sequence-level anomaly index. To test the sliding window; If the sequence-level anomaly index is greater than a preset threshold or an adaptive threshold determined based on the normal log validation set, the log is considered to be abnormal; otherwise, it is considered normal.
