Multi-Scale One-Class Recurrent Neural Networks for Discrete Event Sequence Anomaly Detection

Zhiwei Wang, Zhengzhang Chen, Jingchao Ni, Hui Liu, Haifeng Chen, Jiliang Tang

TL;DR

OC4Seq is a novel anomaly detection framework that combines Recurrent Neural Networks (RNNs) with a one-class classification objective to identify irregularities in discrete event sequences, such as system logs. By simultaneously analyzing sequences at both a global and local (subsequence) scale, it significantly outperforms existing methods, particularly on complex datasets where anomalies may be subtle or buried in long event chains.

What Problem Does This Paper Address?

Modern Information and Communication Technology (ICT) systems generate massive amounts of monitoring data in the form of discrete event sequences—ordered series of events like system logs, user transactions, or control commands. Detecting anomalies in these sequences is critical for security and system health, but it faces three major hurdles:

  1. Data Imbalance: In the real world, "normal" behavior is the vast majority. Anomalies are rare, making traditional binary classification (which needs many examples of both classes) ineffective.
  2. Discrete Nature: Unlike sensor data (temperature, pressure), log events are discrete symbols (e.g., "File Opened," "Connection Reset"). It is difficult to mathematically capture the relationships between these abstract symbols.
  3. Multi-Scale Patterns: An anomaly might be a single "illegal" event, a short suspicious subsequence, or a long-term trend that only looks wrong when viewing the entire sequence. Most existing tools focus on only one of these scales.

Methods

The authors propose OC4Seq (Multi-Scale One-Class Recurrent Neural Networks), which tackles these challenges through a three-step architecture:

  • Event Embedding: To handle discrete symbols, the model first learns a dense vector representation (embedding) for each event type, mapping abstract symbols into a continuous latent space where relationships can be measured.
  • Multi-Scale RNNs: The core of the model uses two Gated Recurrent Units (GRUs):
  • Global Perspective: One GRU processes the entire sequence to capture long-term dependencies.
  • Local Perspective: A second GRU uses a sliding window to process short subsequences, ensuring that brief, localized anomalies aren't "washed out" by the rest of a long, normal sequence.
  • One-Class Objective: Inspired by Support Vector Data Description (SVDD), the model is trained to map all normal sequences and subsequences into tight hyperspheres in the latent space. During testing, any sequence that falls far from these "normalcy centers" is flagged as an anomaly.
Figure 2: The overview of the proposed framework OC4Seq. It consists of two major components that learn the sequential information from global and local perspectives, respectively.

Datasets

The model was evaluated on three widely recognized benchmark datasets for log anomaly detection:

  • HDFS: Logs from a Hadoop Distributed File System, containing over 500,000 normal sequences.
  • RUBiS: A weblog dataset from an auction site prototype, representing user behavior sessions.
  • BGL: Logs from a BlueGene/L supercomputer. This is the most challenging dataset due to its large vocabulary of over 1,500 unique log keys.

Key Insights and Ideas

  • The Power of "One-Class": By focusing only on defining what is "normal," OC4Seq avoids the need for labeled anomaly data during training, which is often impossible to obtain in practice.
  • Local vs. Global Trade-offs: The authors demonstrate that some anomalies are only visible globally, while others are strictly local. Figure 4 in the paper shows a case where a sequence looks normal globally but contains a highly anomalous 10th subsequence, proving why the multi-scale approach is necessary.
  • Latent Space Clustering: Visualization shows that the one-class objective successfully forces normal data to cluster tightly, while anomalies (which the model never saw during training) naturally scatter across the latent space.
Visualization of the HDFS dataset in latent space, showing normal data (blue) clustered tightly and anomalies (red) scattered widely.

Key Results

OC4Seq consistently achieved the highest F1-scores across all datasets, often by a significant margin:

  • BGL Dataset: This was the standout result. OC4Seq achieved an F1-score of 0.747, nearly doubling the performance of the next best baseline, Invariant Mining (0.428), and far exceeding DeepLog (0.326).
  • HDFS and RUBiS: The model reached F1-scores of 0.976 and 0.985 respectively, showing near-perfect detection capabilities on these benchmarks.
  • Robustness: The parameter analysis (Figure 3) showed that the model is relatively stable across different numbers of RNN layers, though the balance between local and global information ($\alpha$) is a key hyperparameter to tune.

Limitations and Future Work

While highly effective, the paper notes a few areas for further exploration:

  • Fixed Window Size: The local perspective currently relies on a fixed sliding window size ($M$). In dynamic systems, the optimal window size might change over time.
  • Training Purity: The one-class objective assumes the training data is entirely normal. While the SVDD-based loss has some inherent robustness to noise, a significant number of "hidden" anomalies in the training set could potentially shift the normalcy center.
  • Computational Cost: Running two parallel RNNs is more computationally intensive than simpler methods like PCA, which might be a consideration for real-time deployment in extremely high-throughput systems.

Summary updated

BibTeX
@inproceedings{wang2020multi,
  author = {Zhiwei Wang and Zhengzhang Chen and Jingchao Ni and Hui Liu and Haifeng Chen and Jiliang Tang},
  title = {{Multi-Scale One-Class Recurrent Neural Networks for Discrete Event Sequence Anomaly Detection}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2020},
  doi = {10.1145/3447548.3467125},
}
Figure