[Paper Review] LogLLM: Log-based Anomaly Detection Using Large Language Models
LogLLM is a novel log-based anomaly detection framework that leverages BERT for semantic vector extraction and Llama for sequence classification, with a projector aligning their representation spaces. Trained via a three-stage procedure, it outperforms state-of-the-art methods on four public datasets, achieving robust anomaly detection even under unstable log conditions and data imbalance.
Software systems often record important runtime information in logs to help with troubleshooting. Log-based anomaly detection has become a key research area that aims to identify system issues through log data, ultimately enhancing the reliability of software systems. Traditional deep learning methods often struggle to capture the semantic information embedded in log data, which is typically organized in natural language. In this paper, we propose LogLLM, a log-based anomaly detection framework that leverages large language models (LLMs). LogLLM employs BERT for extracting semantic vectors from log messages, while utilizing Llama, a transformer decoder-based model, for classifying log sequences. Additionally, we introduce a projector to align the vector representation spaces of BERT and Llama, ensuring a cohesive understanding of log semantics. Unlike conventional methods that require log parsers to extract templates, LogLLM preprocesses log messages with regular expressions, streamlining the entire process. Our framework is trained through a novel three-stage procedure designed to enhance performance and adaptability. Experimental results across four public datasets demonstrate that LogLLM outperforms state-of-the-art methods. Even when handling unstable logs, it effectively captures the semantic meaning of log messages and detects anomalies accurately.
Motivation & Objective
- Address the limitation of traditional deep learning methods in capturing semantic meaning from natural language logs.
- Overcome challenges in LLM-based anomaly detection, such as poor semantic understanding, suboptimal LLM utilization, and memory overflow from long input sequences.
- Eliminate dependency on log parsers by using regular expressions for log preprocessing, simplifying the pipeline.
- Improve performance and adaptability in log anomaly detection through a novel three-stage training procedure.
- Ensure robustness to data imbalance by investigating minority class oversampling with hyperparameter $β$.
Proposed method
- Use BERT, a transformer encoder-based model, to extract dense semantic vectors from individual log messages.
- Employ Llama, a transformer decoder-based model, to classify entire log sequences based on their semantic representations.
- Introduce a learnable projector to align the vector representation spaces of BERT and Llama, ensuring semantic coherence across the pipeline.
- Preprocess log messages using regular expressions instead of log parsers to extract templates, streamlining the workflow.
- Train the model through a three-stage procedure: (1) pretrain the BERT and projector, (2) fine-tune the BERT and projector with Llama frozen, (3) jointly fine-tune the entire model.
- Apply minority class oversampling with a hyperparameter $β$ to address class imbalance in training data.
Experimental results
Research questions
- RQ1Can a framework that combines BERT and Llama with representation space alignment outperform existing log-based anomaly detection methods?
- RQ2Does a three-stage training procedure enhance model performance and adaptability in log anomaly detection?
- RQ3How effective is LogLLM in detecting anomalies under unstable log conditions with frequent template changes?
- RQ4What is the impact of minority class oversampling ($β$) on model performance and training efficiency?
- RQ5Can the framework maintain high performance despite data imbalance and long input sequences without memory overflow?
Key findings
- LogLLM achieves state-of-the-art performance across four public datasets, outperforming existing methods in anomaly detection.
- The ablation study confirms that the three-stage training procedure significantly improves performance, with F1-score decreases of 2.5% and 3.2% when stages 1 and 2 are omitted.
- Minority class oversampling with $β$ between 30% and 50% yields stable performance with minimal F1-score variation (≤0.07), indicating low sensitivity to $β$.
- When anomalies constitute only 1.05% of the Thunderbird dataset, LogLLM fails without oversampling (F1 = 0), highlighting the necessity of data balancing.
- Training time increases with $β$, but values between 30% and 50% are acceptable due to stable performance and manageable overhead.
- Even with unstable logs and evolving templates, LogLLM effectively captures semantic meaning and detects anomalies with high accuracy.
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.