anomalygen-eval
AnomalyGen: Enhancing Log-Based Anomaly Detection with Code-Guided Data Augmentation — Xinyu Li et al. (arXiv:2604.11107, 2026)
What this evaluates
This benchmark evaluates log-based anomaly detection models by measuring their ability to classify log sequences as normal or anomalous. It specifically probes how well different model paradigms (classical ML, supervised/unsupervised deep learning, and LLM-based) generalize when trained on code-guided synthetic data augmentation across varying augmentation ratios.
Datasets
- HDFS — total 11175629; splits: train (46000), test (-1)
- Zookeeper — total 74380; splits: train (-1), test (-1)
Metrics
Precision — range: [0, 1]
- Precision measures the accuracy of positive predictions, calculated as TP / (TP + FP), where TP is true positives and FP is false positives.
Recall — range: [0, 1]
- Recall measures the model's ability to identify all actual positive instances, calculated as TP / (TP + FN), where FN is false negatives.
F1-score (primary) — range: [0, 1]
- F1-score is the harmonic mean of Precision and Recall, calculated as 2 * (Precision * Recall) / (Precision + Recall). It balances both metrics to provide a single score for anomaly detection performance.
Input / output format
Input: Log sequences encoded either sequentially by log event IDs or semantically by log message text.
Output: Binary anomaly label (normal vs. anomaly) for each input log sequence.
Scoring recipe
def compute_metrics(y_true, y_pred):
tp = sum(1 for t, p in zip(y_true, y_pred) if t == 1 and p == 1)
fp = sum(1 for t, p in zip(y_true, y_pred) if t == 0 and p == 1)
fn = sum(1 for t, p in zip(y_true, y_pred) if t == 1 and p == 0)
precision = tp / (tp + fp) if (tp + fp) > 0 else 0.0
recall = tp / (tp + fn) if (tp + fn) > 0 else 0.0
f1 = 2 * (precision * recall) / (precision + recall) if (precision + recall) > 0 else 0.0
return {'precision': precision, 'recall': recall, 'f1': f1}
Common pitfalls
- Augmentation ratio R is defined as synthetic sessions divided by real training sessions (R = N_syn/N_real), evaluated at fixed ratios (0.001, 0.01, 0.1, 1.0) while keeping the test set constant across all conditions.
- Sequence-aware encodings (next_log, sequentials) benefit significantly more from structural augmentation than semantic encodings, which aggregate content and discard ordering information.
- Classical ML models (DT, SLFN, KNN) often hit performance ceilings on these datasets, showing changes within measurement noise rather than meaningful gains.
Evidence (verbatim from paper)
To evaluate the accuracy and effectiveness of anomaly detection techniques, we employ Precision, Recall and F1-score as evaluation metrics. These metrics are calculated based on the number of True Positives (TP), False Positives (FP), and False Negatives (FN), where positive refers to an anomaly.
Citation
@misc{li2026anomalygen,
title={AnomalyGen: Enhancing Log-Based Anomaly Detection with Code-Guided Data Augmentation},
author={Xinyu Li et al.},
year={2026},
note={arXiv:2604.11107}
}
1---2name: anomalygen-eval3description: This benchmark evaluates log-based anomaly detection models by measuring their ability to classify log sequences as normal or anomalous. It specifically probes how well different model paradigms (classical ML, supervised/unsupervised deep learning, and LLM-based) generalize when trained on code-guided synthetic data augmentation across varying augmentation ratios. Use when the user wants to benchmark on HDFS, Zookeeper, or asks about evaluating this task. Reports F1-score.4---56# anomalygen-eval78> AnomalyGen: Enhancing Log-Based Anomaly Detection with Code-Guided Data Augmentation — Xinyu Li et al. (arXiv:2604.11107, 2026)910## What this evaluates1112This benchmark evaluates log-based anomaly detection models by measuring their ability to classify log sequences as normal or anomalous. It specifically probes how well different model paradigms (classical ML, supervised/unsupervised deep learning, and LLM-based) generalize when trained on code-guided synthetic data augmentation across varying augmentation ratios.1314## Datasets1516- **HDFS** — total 11175629; splits: train (46000), test (-1)17- **Zookeeper** — total 74380; splits: train (-1), test (-1)1819## Metrics2021- `Precision` — range: [0, 1]22 - Precision measures the accuracy of positive predictions, calculated as TP / (TP + FP), where TP is true positives and FP is false positives.23- `Recall` — range: [0, 1]24 - Recall measures the model's ability to identify all actual positive instances, calculated as TP / (TP + FN), where FN is false negatives.25- `F1-score` **(primary)** — range: [0, 1]26 - F1-score is the harmonic mean of Precision and Recall, calculated as 2 * (Precision * Recall) / (Precision + Recall). It balances both metrics to provide a single score for anomaly detection performance.2728## Input / output format2930**Input**: Log sequences encoded either sequentially by log event IDs or semantically by log message text.3132**Output**: Binary anomaly label (normal vs. anomaly) for each input log sequence.3334## Scoring recipe3536```python37def compute_metrics(y_true, y_pred):38 tp = sum(1 for t, p in zip(y_true, y_pred) if t == 1 and p == 1)39 fp = sum(1 for t, p in zip(y_true, y_pred) if t == 0 and p == 1)40 fn = sum(1 for t, p in zip(y_true, y_pred) if t == 1 and p == 0)41 precision = tp / (tp + fp) if (tp + fp) > 0 else 0.042 recall = tp / (tp + fn) if (tp + fn) > 0 else 0.043 f1 = 2 * (precision * recall) / (precision + recall) if (precision + recall) > 0 else 0.044 return {'precision': precision, 'recall': recall, 'f1': f1}45```4647## Common pitfalls4849- Augmentation ratio R is defined as synthetic sessions divided by real training sessions (R = N_syn/N_real), evaluated at fixed ratios (0.001, 0.01, 0.1, 1.0) while keeping the test set constant across all conditions.50- Sequence-aware encodings (next_log, sequentials) benefit significantly more from structural augmentation than semantic encodings, which aggregate content and discard ordering information.51- Classical ML models (DT, SLFN, KNN) often hit performance ceilings on these datasets, showing changes within measurement noise rather than meaningful gains.5253## Evidence (verbatim from paper)5455> To evaluate the accuracy and effectiveness of anomaly detection techniques, we employ Precision, Recall and F1-score as evaluation metrics. These metrics are calculated based on the number of True Positives (TP), False Positives (FP), and False Negatives (FN), where positive refers to an anomaly.5657## Citation5859```bibtex60@misc{li2026anomalygen,61 title={AnomalyGen: Enhancing Log-Based Anomaly Detection with Code-Guided Data Augmentation},62 author={Xinyu Li et al.},63 year={2026},64 note={arXiv:2604.11107}65}66```6768- arXiv: 2604.11107