TL;DR
Monitoring complex sensor networks for anomalies is tough because "normal" behavior spans multiple timescales, involves tangled interactions between variables, and drifts over time. COMET solves this by compressing normal multi-scale time-series patterns into a compact "dictionary" of discrete prototypes (a codebook) and safely updating that dictionary on the fly during deployment. It outperforms heavyweight Transformers on 39 out of 45 benchmark metrics using just a fraction of the parameters.
What Problem Does This Paper Address?
Imagine monitoring a water treatment plant or a spacecraft. Because anomalies are rare and expensive to label, we usually train unsupervised models on predominantly normal data and flag anything that looks unfamiliar. However, three nagging issues trip up existing methods:
- Tangled scales and variables: Recent models slice time series into "patches" (short windows), but often use a single fixed window size and treat each sensor independently—missing anomalies that emerge across different durations or from broken correlations between sensors.
- Timestep myopia: Many reconstruction models score anomalies one individual timestamp at a time. A subtle, collective deviation across a broader window can slip right by if each isolated point looks plausible enough.
- Concept drift at test time: Real-world systems aren't stationary; normal operating baselines drift. Adapting a model during inference (Test-Time Adaptation, or TTA) is risky because existing methods use brittle score thresholds to guess what is "normal." Guess wrong, and your model accidentally learns that an ongoing failure is the new normal.
Methods
COMET (Codebook-based Online-adaptive Multi-scale Embedding for Time-series anomaly detection) unifies three tightly coupled ideas into a surprisingly lightweight linear architecture:
- Multi-scale Patch Encoder: Instead of one window size, COMET slices the time series at multiple patch scales. At each scale, it runs a lightweight independent linear encoder per variable (capturing unique sensor quirks) alongside a shared "core" encoder across concatenated variables (capturing cross-sensor correlations), fusing both together.
- Vector-Quantized Coreset & Dual Scoring: Using Vector Quantization (VQ)—a standard technique for mapping continuous vectors to a finite set of discrete "codebook" entries—COMET compresses normal patch embeddings into representative prototypes. Any codebook entry activated during training enters a compact memory bank. At test time, patches are scored using two complementary signals:
- Quantization error: How poorly the continuous embedding fits its assigned prototype.
- Local scaling memory distance: How far that prototype sits from its neighbors in the memory bank, normalized by local neighborhood density so sparse normal regions don't trigger false alarms.
- Online Codebook Adaptation (The Novel Twist): How do you adapt at test time without arbitrary thresholds? COMET checks which codebook entry a test sample hits. If that entry was activated during normal training, the sample is pseudo-labeled "normal"; if it hits a dormant, unused entry, it's flagged "abnormal." COMET then uses contrastive learning to push normal and abnormal representations apart while updating only the normal prototypes—preventing anomaly contamination.
Datasets
No new datasets were introduced. The authors evaluate COMET on five standard, diverse multivariate time-series anomaly detection benchmarks:
- PSM (server machine metrics)
- SWaT & WADI (water treatment and distribution cyber-physical testbeds)
- SMAP & MSL (NASA spacecraft telemetry and rover sensor data)
Key Insights and Ideas
- Dormant codebook entries act as threshold-free anomaly traps: Using training-time codebook activation as a binary filter for Test-Time Adaptation is remarkably clever. It sidesteps hyperparameter-sensitive score thresholding altogether.
- You don't need massive Transformers: Because COMET relies on simple linear layers and discrete prototypes rather than heavy self-attention blocks, it achieves top-tier accuracy on PSM with just 567K parameters—roughly 1.2% the size of recent Transformer competitors like CATCH (48.6M).
- End-to-end VQ beats post-hoc clustering: Trying to build a memory bank after training via K-Means takes ~4× longer and performs worse across the board than learning the VQ codebook jointly during training.
- TTA shines brightest when the ground shifts: Measuring the distribution shift between train and test sets reveals a clear pattern—the bigger the drift (such as on SWaT and PSM), the larger the performance boost from Online Codebook Adaptation.
Key Results
Tested against seven baselines (including Anomaly Transformer, USAD, D3R, and CATCH) across 9 point-wise and range-based metrics on 5 datasets (45 total evaluations):
- State-of-the-art out of the box: Even without test-time adaptation, COMET ranks #1 on 39 out of 45 metrics, excelling on rigorous range-based metrics (like Affiliation-F1 and VUS-PR) where point-adjusted baselines often collapse.
- Consistent online gains: Turning on Online Codebook Adaptation further improves 35 out of 45 metrics over static COMET (e.g., boosting SWaT R-AUC-PR to 66.42% vs. the best baseline's 47.41%).
- Contamination resilience: When synthetic anomalies are injected into up to 25% of the training data, COMET maintains the highest VUS-PR on four of the five datasets.
Limitations and Future Work
The authors highlight two practical caveats:
- Manual codebook sizing: The total number of codebook entries ($M$) is empirically tuned per dataset rather than determined automatically.
- Vulnerability to heavy training contamination: Because Online Codebook Adaptation trusts codebook entries activated during training, severely polluted training data can corrupt those initial activations and weaken pseudo-labeling (as seen on contaminated MSL, where COMET trails the top baseline by 5–7%). Automating codebook capacity and hardening pseudo-labeling against dirty training sets remain open avenues for future work.
Summary updated