Anomaly Detection on Unstable Logs with GPT Models

Fatemeh Hadadi, Qinghua Xu, Domenico Bianculli, Lionel C. BriandarXiv 2024 · DOI

TL;DR

This paper introduces FLEXLOG, a novel approach for anomaly detection in unstable system logs that leverages the power of Large Language Models (LLMs) combined with traditional Machine Learning (ML) techniques. FLEXLOG significantly reduces the need for labeled data while achieving state-of-the-art performance, making anomaly detection more practical and efficient in real-world, dynamic software environments.

What Problem Does This Paper Address?

Modern software systems generate vast amounts of logs, which are crucial for monitoring system health and detecting anomalies. However, traditional anomaly detection methods often struggle with "unstable logs" – logs whose structure or content changes over time due to software updates or environmental shifts. This instability, coupled with the high cost and effort required to label log data, presents a significant challenge. Existing methods often assume stable log distributions and require extensive labeled data, making them impractical for dynamic, real-world scenarios. Furthermore, data leakage issues in benchmark datasets can artificially inflate performance metrics, masking the true effectiveness of these methods.

Methods

FLEXLOG tackles these challenges through a multi-pronged approach:

  • Hybrid Ensemble Learning: It combines the strengths of both LLMs and ML models. A fine-tuned LLM (Mistral) provides broad knowledge and adaptability to novel patterns, while ML models (KNN, DT, SLFN) excel at capturing specific anomalous patterns. These models are ensembled using majority voting for a robust final prediction.
  • Data Efficiency: To address the scarcity of labeled data, FLEXLOG employs:
  • Parameter-Efficient Fine-Tuning (PEFT): For LLMs, reducing computational cost and training time.
  • Sampling from Stable Logs: Training the ensemble on a limited subset of stable logs to capture general patterns.
  • Handling Instability (C1):
    • Retrieval-Augmented Generation (RAG): Integrates external contextual information to enrich prompts for the LLM, improving its understanding of log sequences.
  • De-duplication: Rigorous removal of overlapping log sequences between training and testing sets to prevent data leakage and ensure a realistic evaluation.
  • Cache-Empowered Inference: A cache stores predictions for previously seen log sequences, allowing for direct retrieval and significantly speeding up inference time by avoiding redundant computations.

Datasets

The paper utilizes and configures several datasets for their experiments:

  • Real-world Datasets:
    • ADFA: Australian Defense Force Academy Linux Dataset, featuring system calls and contemporary web attacks.
  • LOGEVOL: Captures software evolution from Hadoop 2 to Hadoop 3 and Spark 2 to Spark 3, with injected faults.
  • HDFS: Hadoop Distributed File System logs from MapReduce jobs.
  • Synthesized Datasets:
    • SynHDFS-U: Created by injecting sequence-level instability into HDFS logs.
  • SYNEVOL-U: Created by injecting sequence- and template-level instability into LOGEVOL logs.

These datasets were configured for both Unstable Log Anomaly Detection (ULAD) and Stable Log Anomaly Detection (SLAD) scenarios, with a focus on ULAD.

Key Insights and Ideas

  • LLMs are powerful for unstable logs: The paper strongly suggests that LLMs, when combined with ML models, are highly effective in handling the dynamic nature of unstable logs, a significant improvement over traditional methods.
  • Data efficiency is achievable: FLEXLOG demonstrates that state-of-the-art performance can be achieved with substantially less labeled data, a critical factor for practical deployment.
  • De-duplication is crucial for realistic evaluation: The paper highlights how data leakage inflates performance metrics and emphasizes the importance of de-duplicating test data to get a true understanding of a model's capabilities.
  • Ensemble of diverse models is key: Combining LLMs with traditional ML models leverages complementary strengths, leading to more robust and effective anomaly detection.
  • Mistral is a strong open-source contender: The paper finds that Mistral, an open-source LLM, performs comparably to closed-source models like GPT-40, offering a cost-effective and flexible solution.

Key Results

  • State-of-the-art Effectiveness: FLEXLOG achieves state-of-the-art F1 scores on ULAD tasks across real-world and synthesized datasets.
  • Significant Data Reduction: FLEXLOG reduces labeled data usage by 62.87 pp to 78.43 pp compared to baselines trained on full datasets.
  • Robustness to Instability: FLEXLOG maintains high effectiveness even with up to 30% sequence- and template-level instability.
  • Competitive Inference Time: While training is more time-consuming, FLEXLOG's inference time per log sequence remains below 1 second, making it suitable for many monitoring systems.
  • Efficient Memory Usage: The caching mechanism keeps memory overhead low, typically below 4 MB for most datasets.
  • Mistral vs. GPT-40: FLEXLOG with Mistral performs comparably to GPT-40, outperforming Llama 3.1 8B.

Limitations and Future Work

  • Extreme Data Scarcity: At very low sample sizes (D# = 50), all methods, including FLEXLOG, struggle due to insufficient data diversity.
  • Latency-Sensitive Domains: FLEXLOG's inference time (seconds) might not be suitable for extremely low-latency applications like high-frequency trading.
  • Realism of Synthetic Data: While efforts were made to ensure realism, the synthetic nature of some datasets could still pose a threat to external validity.
  • Future Work:
    • Exploring more powerful open-source LLMs and advanced prompting techniques.
  • Investigating dynamic ensemble composition and similarity-based retrieval for caching.
  • Utilizing Generative Adversarial Networks (GANs) for synthetic log data augmentation to address class imbalance.
  • Further evaluation on a broader range of real-world systems to assess applicability in highly unstable logging environments.

Summary updated

BibTeX
@misc{hadadi2024anomaly,
  author = {Fatemeh Hadadi and Qinghua Xu and Domenico Bianculli and Lionel C. Briand},
  title = {{Anomaly Detection on Unstable Logs with GPT Models}},
  year = {2024},
  eprint = {2406.07467},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.07467},
}
Figure