[Paper Review] Robust and Transferable Anomaly Detection in Log Data using Pre-Trained Language Models
This paper proposes a plug-and-play framework for robust and transferable log anomaly detection using pre-trained language models (e.g., BERT, GPT-2, XL-Net) to generate semantic-aware log vector embeddings. By leveraging transfer learning and context-aware representations, the method achieves high performance and resilience to log message alterations caused by software updates, outperforming traditional template-based approaches in both accuracy and generalization across evolving system logs.
Anomalies or failures in large computer systems, such as the cloud, have an impact on a large number of users that communicate, compute, and store information. Therefore, timely and accurate anomaly detection is necessary for reliability, security, safe operation, and mitigation of losses in these increasingly important systems. Recently, the evolution of the software industry opens up several problems that need to be tackled including (1) addressing the software evolution due software upgrades, and (2) solving the cold-start problem, where data from the system of interest is not available. In this paper, we propose a framework for anomaly detection in log data, as a major troubleshooting source of system information. To that end, we utilize pre-trained general-purpose language models to preserve the semantics of log messages and map them into log vector embeddings. The key idea is that these representations for the logs are robust and less invariant to changes in the logs, and therefore, result in a better generalization of the anomaly detection models. We perform several experiments on a cloud dataset evaluating different language models for obtaining numerical log representations such as BERT, GPT-2, and XL. The robustness is evaluated by gradually altering log messages, to simulate a change in semantics. Our results show that the proposed approach achieves high performance and robustness, which opens up possibilities for future research in this direction.
Motivation & Objective
- Address the challenge of log anomaly detection in large-scale systems undergoing frequent software updates and log evolution.
- Overcome the limitations of template-based and keyword-matching methods that fail under log semantic shifts or software upgrades.
- Reduce the cold-start problem in anomaly detection by leveraging pre-trained language models to generalize across unseen log patterns.
- Evaluate the effectiveness of different pre-trained language models and learning objectives (regression vs. classification) for log representation learning.
- Develop a transferable framework that maintains high performance even when log messages are altered due to system updates or pre-processing noise.
Proposed method
- Utilize pre-trained general-purpose language models (BERT, GPT-2, XL-Net) to encode raw log messages into dense, semantic-aware vector representations.
- Apply a Bi-LSTM network to model sequential and contextual dependencies in log sequences using the learned embeddings.
- Train the anomaly detection model using two learning objectives: (1) regression to reconstruct log embeddings, and (2) classification to distinguish normal from anomalous log sequences.
- Implement a model transfer strategy where the framework reuses knowledge from prior log data to adapt to new log distributions after software updates.
- Apply data augmentation by systematically altering log messages (e.g., synonym replacement, reordering) to simulate real-world changes and evaluate robustness.
- Use numerical metrics (precision, recall, F1) to evaluate performance across varying degrees of log message alteration and learning objectives.
Experimental results
Research questions
- RQ1How do different pre-trained language models (BERT, GPT-2, XL-Net) compare in generating effective log embeddings for anomaly detection?
- RQ2Which learning objective—regression or classification—yields better performance and robustness in log anomaly detection under log evolution?
- RQ3To what extent can the proposed framework generalize to unseen log patterns after software updates or log message alterations?
- RQ4How does the model perform under varying degrees of log message alteration (e.g., 15% semantic changes) in terms of precision, recall, and F1 score?
- RQ5Can the framework effectively reduce false positives in cold-start scenarios where no prior logs from the new system version are available?
Key findings
- BERT outperformed GPT-2 and XL-Net across both learning objectives, especially under significant log message alterations, demonstrating superior robustness and generalization.
- The classification-based learning objective achieved higher F1 scores (up to 0.81) compared to regression (max F1 0.68), indicating better separation of normal and anomalous log patterns.
- For the B-similar alteration scenario (small changes), BERT maintained a high F1 score of 0.75 (classification), while GPT-2 dropped to 0.43, highlighting BERT’s stability.
- In the B-different scenario (large semantic changes), BERT achieved an F1 score of 0.68 (regression) and 0.81 (classification), significantly outperforming GPT-2 and XL-Net.
- The model transfer approach successfully reduced false positives after software updates, with BERT-based models showing the most consistent performance across altered log distributions.
- The framework demonstrated strong resilience to log message alterations, with F1 scores remaining above 0.6 across all conditions, proving its transferability and robustness in real-world deployment scenarios.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.