HYDRA: A Multi-Level HierarchY-Driven Approach for Robust Anomaly Detection in Time Series
June 14, 2026 ยท View on GitHub

About HYDRA
Time-series anomaly detection is critical across various domains. Despite advances in neural networks and foundation models, recent studies show that traditional data mining methods remain highly competitive due to their effectiveness and scalability. However, these approaches suffer from distinct limitations: discord-based methods fail in the presence of repeated anomalies, whereas clustering-based techniques, though mitigating this issue, struggle to capture fine-grained deviations. Moreover, both approaches rely on distance computation, whose effectiveness fundamentally depends on data normalization, with z-score serving as the de facto standard. However, we observe that while normalization reduces scale bias and can enhance anomaly detectability, it may also suppress amplitude-driven anomalies, making the choice of an appropriate normalization scheme both critical and non-trivial. To address these challenges, we propose HYDRA, a multi-level hierarchical and unsupervised approach that integrates the strengths of distance-based methods while reducing reliance on explicit normalization. HYDRA (i) employs a lightweight approximate nearest-neighbor detector with graph-based selection to identify representative subsequences; (ii) constructs multi-resolution representations of the time series and aggregates anomaly evidence from fine to coarse scales; and (iii) introduces a hierarchical ensemble mechanism that fuses level-wise scores to improve robustness against contamination and scale imbalance. This design allows HYDRA to detect diverse anomaly types, from short, isolated discords to long, persistent deviations, allowing it to detect patterns overlooked by single-scale methods. Extensive evaluation on 40 univariate and multivariate time-series anomaly detection datasets from the TSB-AD benchmark demonstrates that HYDRA achieves state-of-the-art performance, ranking first among 40 competing algorithms, while maintaining scalability to ultra-long sequences.
Getting Started
Benchmark
Benchmark for evaluation: TSB-AD
Installation
To install HYDRA from source, you will need the following tools:
gitconda(anaconda or miniconda)
Step 1: Clone this repository using git and change into its root directory.
git clone #place holder
Step 2: Create and activate a conda environment named TSB-AD.
conda create -n HYDRA python=3.11 # Currently we support python>=3.8, up to 3.12
conda activate HYDRA
Step 3: Install the dependencies from requirements.txt:
pip install -r requirements.txt
If you have problem installing torch using pip, try the following:
conda install pytorch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 pytorch-cuda=12.1 -c pytorch -c nvidia
If you have problem installing hnswlib using pip, try the following:
conda install -c conda-forge hnswlib
Step 4: Install the package:
pip install -e .
Basic Usage
See Example in HYDRA/main.py
python -m HYDRA.main
Or the following example on how to run HYDRA in 10 lines of code:
import HYDRA_loader as loader
def run_HYDRA(data, winsize=30):
model = loader.HYDRA(winsize, mode='approx')
model.compress_and_score_multi(data)
ens_score,_ = model.ensemble_maxpool_windows()
return ens_score.ravel()
X = np.sin(np.linspace(0, 20, 500)) + 0.1 * np.random.randn(500)
score = run_HYDRA(X)
Citation
If you find this work useful, please consider citing our paper:
HYDRA: A Multi-Level Hierarchy-Driven Approach for Robust Anomaly Detection in Time Series
Proceedings of the ACM on Management of Data, 2026.
Paper link: https://dl.acm.org/doi/10.1145/3802074
@article{Huang2026HYDRA,
author = {Huang, Mingyi and Liu, Qinghua and Boniol, Paul and Paparrizos, John},
title = {HYDRA: A Multi-Level Hierarchy-Driven Approach for Robust Anomaly Detection in Time Series},
journal = {Proceedings of the ACM on Management of Data},
volume = {4},
number = {3},
year = {2026},
month = jun,
articleno = {197},
pages = {1--30},
doi = {10.1145/3802074},
publisher = {ACM}
}
We also present a companion demo paper, GlassboxAD: An Interactive System for Dissecting Hierarchical Time-Series Anomaly Detection, which showcases an interactive system built around HYDRA.
Demo paper link: https://dl.acm.org/doi/10.1145/3788853.3801594
@inproceedings{huang2026glassboxad,
author = {Huang, Mingyi and Liu, Qinghua and Boniol, Paul and Paparrizos, John},
title = {GlassboxAD: An Interactive System for Dissecting Hierarchical Time-Series Anomaly Detection},
booktitle = {Companion of the International Conference on Management of Data (SIGMOD Companion '26)},
year = {2026},
month = jun,
isbn = {979-8-4007-2450-3/2026/05},
doi = {10.1145/3788853.3801594},
url = {https://doi.org/10.1145/3788853.3801594}
}