Skip to main content
QUICK REVIEW

[Paper Review] LAnoBERT: System Log Anomaly Detection based on BERT Masked Language Model

Yukyung Lee, Jina Kim|arXiv (Cornell University)|Nov 18, 2021
Software System Performance and ReliabilityComputer Science32 references10 citations
TL;DR

LAnoBERT proposes a parser-free, unsupervised system log anomaly detection method using BERT's masked language modeling (MLM) to learn normal log patterns without relying on log parsers. It achieves state-of-the-art performance on HDFS, BGL, and Thunderbird datasets, outperforming unsupervised models and matching supervised benchmarks, while enabling efficient inference for real-world deployment.

ABSTRACT

The system log generated in a computer system refers to large-scale data that are collected simultaneously and used as the basic data for determining errors, intrusion and abnormal behaviors. The aim of system log anomaly detection is to promptly identify anomalies while minimizing human intervention, which is a critical problem in the industry. Previous studies performed anomaly detection through algorithms after converting various forms of log data into a standardized template using a parser. Particularly, a template corresponding to a specific event should be defined in advance for all the log data using which the information within the log key may get lost. In this study, we propose LAnoBERT, a parser free system log anomaly detection method that uses the BERT model, exhibiting excellent natural language processing performance. The proposed method, LAnoBERT, learns the model through masked language modeling, which is a BERT-based pre-training method, and proceeds with unsupervised learning-based anomaly detection using the masked language modeling loss function per log key during the test process. In addition, we also propose an efficient inference process to establish a practically applicable pipeline to the actual system. Experiments on three well-known log datasets, i.e., HDFS, BGL, and Thunderbird, show that not only did LAnoBERT yield a higher anomaly detection performance compared to unsupervised learning-based benchmark models, but also it resulted in a comparable performance with supervised learning-based benchmark models.

Motivation & Objective

  • To address the limitations of parser-dependent log anomaly detection methods that risk information loss and require expert templates.
  • To develop a robust, unsupervised anomaly detection framework that learns normal log patterns directly from raw log sequences without preprocessing via log parsers.
  • To improve anomaly detection performance by leveraging contextualized embeddings from BERT fine-tuned on log data using masked language modeling.
  • To enable practical deployment through an efficient inference pipeline suitable for real-time system monitoring.
  • To explore the effectiveness of pre-trained BERT on log data with varying complexity, including natural language-like structures.

Proposed method

  • LAnoBERT uses a BERT-based architecture pre-trained from scratch on log sequences using masked language modeling (MLM) to learn contextual representations of normal log patterns.
  • The model processes raw log keys via regular expression-based preprocessing and WordPiece tokenization, avoiding log parser dependency.
  • During inference, anomaly scores are computed based on the prediction loss and top-k predictive probabilities from MLM, with higher loss indicating abnormality.
  • Anomalies are detected by measuring the deviation of predicted token probabilities from normal patterns, using a threshold on the top-k probability score.
  • The framework supports efficient inference by caching sequence embeddings and reusing attention patterns, enabling real-time deployment.
  • The model is fine-tuned on log data using MLM objective, with performance evaluated under unsupervised settings using only normal logs for training.
Figure 1: The architecture of LAnoBERT.
Figure 1: The architecture of LAnoBERT.

Experimental results

Research questions

  • RQ1Can a BERT-based model trained via masked language modeling detect system log anomalies effectively without requiring a log parser?
  • RQ2How does the performance of LAnoBERT compare to both unsupervised and supervised log anomaly detection baselines on standard benchmark datasets?
  • RQ3Does pre-training BERT on natural language corpus improve or degrade performance on log anomaly detection, especially on datasets with minimal vocabulary and simple structures?
  • RQ4Can an unsupervised, parser-free approach achieve performance comparable to supervised models in real-world log anomaly detection scenarios?
  • RQ5How can an efficient inference pipeline be designed to make BERT-based anomaly detection practical for production systems?

Key findings

  • LAnoBERT outperformed all unsupervised benchmark models on the HDFS, BGL, and Thunderbird datasets, achieving the highest F1 scores in each.
  • On the BGL dataset, LAnoBERT achieved an F1 score of 0.9020 when using a pre-trained BERT model, a 0.0271 improvement over training from scratch.
  • On the HDFS dataset, fine-tuning from scratch yielded an F1 score of 0.9304, outperforming the pre-trained BERT version by 0.0341, indicating that pre-training may harm performance on very simple log structures.
  • The results suggest that pre-trained BERT is beneficial only when the log data contains sufficient linguistic complexity (e.g., 1,000+ vocabularies), such as in BGL, but not in minimal-structure datasets like HDFS.
  • LAnoBERT achieved performance comparable to supervised learning-based models, demonstrating that unsupervised pre-training with MLM can rival supervised methods in anomaly detection.
  • The proposed efficient inference pipeline enables real-time deployment, making the model suitable for practical system monitoring.
Figure 2: Anomaly score distribution difference between normal and abnormal log sequences.
Figure 2: Anomaly score distribution difference between normal and abnormal log sequences.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.