[Paper Review] Pinpointing Anomaly Events in Logs from Stability Testing -- N-Grams vs. Deep-Learning
This paper proposes and compares an N-gram model and an LSTM-based deep learning model for scoring individual log events for anomalousness in stability testing. Trained only on normal log sequences, the N-gram model achieves near-similar accuracy to LSTM (0.904 vs. 0.900 on HDFS; 0.848 vs. 0.865 on Android logs) but with vastly superior computational efficiency (4–13 seconds vs. 16 minutes to nearly 4 hours), making it the preferred choice for industrial deployment in log root cause analysis.
As stability testing execution logs can be very long, software engineers need help in locating anomalous events. We develop and evaluate two models for scoring individual log-events for anomalousness, namely an N-Gram model and a Deep Learning model with LSTM (Long short-term memory). Both are trained on normal log sequences only. We evaluate the models with long log sequences of Android stability testing in our company case and with short log sequences from HDFS (Hadoop Distributed File System) public dataset. We evaluate next event prediction accuracy and computational efficiency. The LSTM model is more accurate in stability testing logs (0.848 vs 0.865), whereas in HDFS logs the N-Gram is slightly more accurate (0.904 vs 0.900). The N-Gram model has far superior computational efficiency compared to the Deep model (4 to 13 seconds vs 16 minutes to nearly 4 hours), making it the preferred choice for our case company. Scoring individual log events for anomalousness seems like a good aid for root cause analysis of failing test cases, and our case company plans to add it to its online services. Despite the recent surge in using deep learning in software system anomaly detection, we found limited benefits in doing so. However, future work should consider whether our finding holds with different LSTM-model hyper-parameters, other datasets, and with other deep-learning approaches that promise better accuracy and computational efficiency than LSTM based models.
Motivation & Objective
- To address the challenge of identifying anomalous log events in long-running stability tests where failures develop gradually and are hard to reproduce.
- To evaluate whether deep learning offers significant advantages over classical N-gram models in log anomaly detection for software reliability testing.
- To support root cause analysis by providing event-level anomalousness scores that highlight suspicious log entries for engineers.
- To prioritize computational efficiency alongside accuracy, given industrial constraints in processing large-scale log data.
Proposed method
- Train both N-gram and LSTM models exclusively on normal log sequences to learn context-dependent patterns.
- Score each log event based on its likelihood given the preceding context: lower probability indicates higher anomalousness.
- Use n-gram frequency counts to estimate the probability of the next event given the previous n-1 events.
- Employ Long Short-Term Memory (LSTM) networks to model sequential dependencies and predict the next event in the sequence.
- Apply next-event prediction accuracy as a proxy for anomalousness detection performance.
- Visualize anomalous events using scored log sequences to support root cause investigation.
Experimental results
Research questions
- RQ1RQ1: Which model performs better—N-gram or LSTM—in detecting anomalous log events?
- RQ2RQ2: What is the optimal N-gram configuration (e.g., n-value) for anomaly detection in log sequences?
- RQ3RQ3: Which model offers better overall accuracy across all configurations when considering both datasets?
- RQ4RQ4: How can individual event anomalousness be effectively measured and visualized for debugging purposes?
Key findings
- The N-gram model achieved slightly higher accuracy than the LSTM model on the HDFS dataset (0.904 vs. 0.900) in next-event prediction.
- The LSTM model showed slightly higher accuracy than the N-gram model on Android stability test logs (0.865 vs. 0.848) in next-event prediction.
- The N-gram model was significantly more computationally efficient than the LSTM model, requiring 4–13 seconds compared to 16 minutes to nearly 4 hours for the same task.
- The computational efficiency gap strongly favors the N-gram model, making it more suitable for industrial deployment where processing time is critical.
- Despite the recent trend toward deep learning in anomaly detection, the study found limited practical benefit in using LSTM over N-grams for software logs due to minimal accuracy gains and high computational cost.
- The company plans to integrate event-level anomalousness scoring into its online stability testing services, highlighting its perceived value for root cause analysis.
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.