LLM writes fast accurate interpretable anomaly detectors for time series

Have an LLM Write Your Anomaly Detector: Autonomous Discovery of Compact, Interpretable Detectors for Time Series

Machine LearningArtificial Intelligence

Summary

Detecting unusual events in time-based data often involves a trade-off between speed, accuracy, and ease of understanding results. The authors let a large language model write and improve a small program repeatedly to find the best detector. This process produced two simple programs that spot anomalies by looking at local patterns and how they compare to normal behavior. These detectors outperform many existing complex methods while needing less computation and making their decisions easier to understand.

What this means in practice

  • For industrial monitoring teams: Detect subtle faults or unusual patterns in sensor data with fast interpretable detectors that do not require heavy computing resources.
  • For financial data analysts: Analyze trading or market signals for anomalies using compact models that provide transparent explanations without costly training.

Authors

David Berghaus

Abstract

Time-series anomaly detection trades off predictive accuracy, computational efficiency, and interpretability. We use a large language model not as the detector but as the author of one: an autonomous research loop in which the model repeatedly edits a single short NumPy program under a leakage-free objective, keeping the best-scoring detector it finds. The loop discovers two compact detectors, one for univariate and one for multivariate series, that describe short windows by their local spectral features and compare them with the training-region distribution through a covariance-aware distance. On the TSB-AD benchmark these detectors lead the field across metrics, ahead of the strongest classical, deep, and foundation-model baselines including Time-RCD, yet they train no network and use no GPU, and the multivariate detector is faster than every similarly performing baseline. LLM-driven program search is thus a practical route to accurate, efficient, and transparent detectors.