Skip to main content
QUICK REVIEW

[Paper Review] Detecting Log Anomalies with Multi-Head Attention (LAMA)

Yicheng Guo, Yujin Wen|arXiv (Cornell University)|Jan 7, 2021
Software System Performance and ReliabilityComputer Science11 references6 citations
TL;DR

This paper proposes LAMA, a lightweight multi-head self-attention model for log anomaly detection that leverages sequential patterns in log streams without relying on RNNs. By training on a next-event prediction task, LAMA achieves an F1-score of 0.985 on the HDFS dataset, outperforming existing statistical and deep learning methods, demonstrating the effectiveness of self-attention in capturing long-range dependencies in log sequences.

ABSTRACT

Anomaly detection is a crucial and challenging subject that has been studied within diverse research areas. In this work, we explore the task of log anomaly detection (especially computer system logs and user behavior logs) by analyzing logs' sequential information. We propose LAMA, a multi-head attention based sequential model to process log streams as template activity (event) sequences. A next event prediction task is applied to train the model for anomaly detection. Extensive empirical studies demonstrate that our new model outperforms existing log anomaly detection methods including statistical and deep learning methodologies, which validate the effectiveness of our proposed method in learning sequence patterns of log data.

Motivation & Objective

  • To address the limitations of existing log anomaly detection methods that fail to capture long-range dependencies or suffer from high computational complexity.
  • To develop a lightweight, efficient model for log anomaly detection that replaces RNN-based architectures with a pure attention mechanism.
  • To improve detection accuracy by modeling intrinsic sequential patterns in log event streams using multi-head self-attention.
  • To evaluate the model’s robustness on real-world log datasets with out-of-vocabulary (OOV) events, which are common in production systems.

Proposed method

  • LAMA uses a multi-head self-attention mechanism inspired by the Transformer architecture to model sequential dependencies in log event streams.
  • Log sequences are formed via a sliding window of fixed length l, and each sequence is used to predict the next event in the sequence.
  • The model is trained end-to-end on a next-event prediction task, where anomaly detection is framed as a failure to predict the correct next event within top-k candidates.
  • The architecture excludes a decoder head, resulting in a lightweight design optimized for log anomaly detection rather than sequence-to-sequence generation.
  • Embedding layers map log events to dense vectors, and feed-forward networks process the attended representations before prediction.
  • The model is trained using cross-entropy loss on the prediction task, with dropout and layer normalization for regularization.

Experimental results

Research questions

  • RQ1Can a self-attention-based model effectively learn long-range dependencies in log event sequences without RNNs?
  • RQ2How does the performance of LAMA compare to state-of-the-art statistical and deep learning methods on standard log anomaly detection benchmarks?
  • RQ3How robust is LAMA to out-of-vocabulary (OOV) events, which are common in real-world log data?
  • RQ4What is the impact of varying the number of attention heads and layers on model performance and stability?

Key findings

  • LAMA achieves an F1-score of 0.985 on the 80/20 split of the HDFS dataset, significantly outperforming baseline models such as Isolation Forest, PCA, and Invariant Mining.
  • On the 1/99 split, which includes more OOV events, LAMA maintains strong performance with an F1-score of 0.946, demonstrating robustness to rare events.
  • The model converges faster than LSTM-based baselines, training in under one hour on a single Tesla V100 GPU.
  • Ablation studies show that 8 attention heads and 4–6 layers yield optimal performance, with fewer heads leading to higher variance and instability.
  • The model’s performance is stable across multiple runs, with low standard deviation, indicating consistent learning behavior.
  • LAMA’s lightweight design, without a decoder, makes it more efficient than seq2seq-based models like DeepLog, while maintaining superior accuracy.

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.