Why a One-Line Baseline Does Well on Time Series Anomaly Detection Benchmarks: A Follow-up to Wu and Keogh
Why scoring each point by the size of its step does well on several anomaly detection benchmarks, and what that implies for comparisons against it.
In this essay Contents
Abstract
Scoring each time point by the size of the step into it, , matches or beats published deep learning detectors on several standard time series anomaly detection benchmarks. We derive when this score separates normal from abnormal points and what it cannot detect, and use these results to ask what a benchmark comparison against it can establish.
A note on audience. This post is written for undergraduates who have finished their introductory machine learning courses and are looking at research areas to work in. It assumes that background and introduces what is specific to time series anomaly detection along the way.
Diff on Standard Benchmarks
In time series anomaly detection, a method receives a sequence of measurements, such as requests per minute to a web service or a patient’s pulse, and assigns every time point a score; a threshold on the score marks points as anomalous. Benchmarks are collections of such series in which annotators have labelled the anomalous points, and methods are ranked by F1 against those labels.
In 2020, Wu and Keogh examined the most widely used benchmarks, including the Yahoo collection and the Numenta archive (NAB), and showed that a large fraction of their series can be solved by a single line of code: a simple formula plus a well-chosen threshold flags the labelled anomalies and little else [1]. Their conclusion was that much of the reported progress on these benchmarks may be illusory, since a benchmark on which a one-liner matches a deep model cannot measure what the deep model adds. They released the UCR anomaly archive as a replacement.
We study one of the simplest one-liners of this kind, which EasyTSAD [2], an open-source library that runs many detectors under a common protocol, calls Diff: Figure 1 shows how it fares in one of our EasyTSAD runs against thirteen other detectors, including Anomaly Transformer [3], DCdetector [4] and FCVAE [5]. Diff ranks first on Yahoo, NAB and TODS, second on AIOPS, third on WSD and fifth on UCR, the archive Wu and Keogh built to address these problems.
In this protocol each detector’s threshold is chosen per series to maximise F1 against the test labels, an optimistic choice applied to all detectors alike. The F1 is also computed after point adjustment: if any point inside a labelled anomalous segment is flagged, every point of that segment counts as detected [6].
Figure 2 looks at individual series, using plain pointwise F1 without point adjustment. On two Yahoo series, one threshold on Diff recovers the labels almost perfectly. On BIDMC1 from the UCR archive it fails badly. That series is a plethysmograph recording, the pulse wave of the blood, and its labelled anomaly is a premature ventricular contraction (an early heartbeat) that Wu and Keogh identified from an ECG recorded at the same time [1].
The derivation in Sections 2 to 4 accounts for the Yahoo series, and the information Diff discards, studied in Sections 5 and 6, accounts for the pulse recording. Sections 7 and 8 then use these results to examine evaluation, first the smallest error achievable from a given set of features and then the conditions under which a benchmark margin over Diff reflects a better detector.
Notation
A series is , one real number per time point. We write for the step into point , and use the same notation for any sequence. EasyTSAD’s Diff score is It has no parameters, and a detector based on it flags when .
Benchmarks label points, but Diff responds to steps, so our analysis labels steps: means the step is anomalous. A single-point spike at then has two anomalous steps, into and out of , while a jump to a new level has one. The two conventions differ for events that last many points, which Section 6 treats.
When a Threshold on Diff Is Exact
Write the series as , where is the signal an annotator would call anomalous (a jump, a spike) and is what a healthy series does anyway, including trend, periodic structure and sensor noise. The split cannot be observed and serves only to describe the class of data on which Diff works. Assume that for every On a normal step, . On an anomalous step, the nuisance can work against the jump but by at most , so by the reverse triangle inequality . Hence every threshold with classifies every step correctly, and such a threshold exists if and only if The argument uses no probability, so it also holds when the noise is dependent across time, as it usually is.
The constant cannot be improved, because if , a normal step with and an anomalous step with , both produce , and no rule that sees only this step separates them (Figure 4b).
What determines
Split the nuisance further into a baseline with and measurement error with . Then and the condition becomes . Differencing replaces a baseline by its per-step slope , which is small for anything slow relative to the sampling rate, such as a daily cycle sampled every minute. It also counts the measurement error twice, and an error sequence alternating between attains the bound (Figure 4c). Figure 3 shows a constructed example.
Random Noise
Sensor noise is rarely bounded, so we replace the bound by a tail condition. Fix a step and write , with on normal steps, on anomalous ones, and the nuisance step. At the midpoint threshold , a normal step is misclassified only if , and an anomalous one only if , which again forces . So every error lies in the event , whatever the dependence between , and .
If is centred and sub-Gaussian with variance proxy , meaning for all , the Chernoff bound gives For independent Gaussian sensor errors with standard deviation , has and the bound is : about per step at and at . At the exact Gaussian rates are about for false alarms and for misses. The miss rate is roughly half the false-alarm rate because only noise opposing the jump causes a miss, while a false alarm can come from either tail (Figure 5a).
A baseline step with shifts the effective margin from to , giving for (Figure 5b).
Because anomalies are rare, we bound the two error rates separately. For , which makes the trade-off in explicit (Figure 5c). These bounds hold per step. Over a series of points the expected number of false alarms is by linearity, with no independence needed, so a rate on a 10,000-point series still means about ten false alarms.
Information Lost by Differencing
Computing Diff scores discards some information about a series, and no threshold or model trained on the scores can recover it.
Signed steps determine a series up to an additive constant: if and only if . So nothing about the level of a series is available from its steps. A slow climb to a dangerous value produces only small steps. Whether such a climb is an anomaly is the labeller’s decision; Diff cannot distinguish it from a harmless drift.
Taking absolute values also discards the sign of every step. Precisely, if and only if at every , with the sign chosen independently at each step. The ramp and the oscillation therefore have identical scores . A task that labels the ramp normal and the oscillation anomalous, with equal prior probability, cannot be solved from the scores at better than error . The same holds for any window of the two series, so a pointwise detector that looks at the scores in a neighbourhood of cannot do better either.
Figure 6c tests this with trained classifiers. One class of series moves monotonically (up or down with equal probability), the other alternates, and the step magnitudes are i.i.d. from the same distribution in both classes, so the score sequences are identically distributed across classes. On signed steps, k-NN, random forests, gradient boosting and an MLP reach zero test error, while on Diff scores all five classifiers stay at . Logistic regression is at chance even on signed steps: any linear function of the steps takes values of both signs on the monotone class (whose sign is random) and values near zero on the alternating class, so no single cut on it separates them.
In general, a property of a series is a function of its Diff scores if and only if it is invariant under adding a constant and under flipping the sign of any subset of steps.
Event Labels and the Pulse Recording
Diff fails on the pulse recording of Figure 2c for two reasons. Its precision is low because every normal heartbeat produces a pulse with a steep upstroke, so in the decomposition of Section 3 the regular beats belong to , and is set by their steep edges. The pulse of the premature beat does produce the largest steps in the recording, but they exceed the normal pulses’ steps by far less than a factor of two. Any threshold low enough to catch more than its single largest step also catches normal pulses.
The 200-point annotation explains the low recall. It marks an abnormal state, while Diff responds to individual steps. Consider the cleanest version, a level shift of height held for points (Figure 6d,e). A threshold between the noise and flags the first point of the shift and the first point after it, giving , , and about for , although the event was detected at its onset. A detector that flags only the onset gets .
Point adjustment, used in Figure 1, was designed for this case: one flagged point inside a labelled segment credits the whole segment. It is why Diff averages on UCR there while scoring pointwise on BIDMC1. It also makes detection easy to overstate, since a detector that fires at random is likely to land inside every long segment; Kim et al. analyse this inflation and show that random scores can reach a high F1 under point adjustment [6].
The Bayes Error of a Feature Map
The ramp and oscillation example is an instance of a general calculation that applies to any detector. Let be the features a detector sees (the Diff score at one point, the whole score sequence, or the raw series), and assume for simplicity that takes finitely many values. Inputs with the same value of must receive the same prediction, so the Bayes error of is attained by a majority vote within each level set of . It is zero if and only if each value of occurs with one label only. For the ramp and oscillation, has a single value carrying probability under each label, so the Bayes error is .
The masses in this sum belong to the joint distribution of features and labels, so the Bayes error depends on the dataset as well as on . Diff’s near-perfect F1 on the Yahoo series of Figure 2 shows that the Bayes error of its score is small there and carries no information about data from another source, and an in-distribution test split cannot reveal the difference. Figure 7a–c shows a binary feature in three datasets. On the benchmark it equals the label (Bayes error ); on independent data its Bayes error is ; on data where the relation is reversed the Bayes error is again, yet the rule learned on the benchmark, , now errs everywhere, so the Bayes error and the error of the learned rule move in opposite directions.
To bound the change, let and be the benchmark and deployment distributions over pairs , let be the benchmark’s label and the correct one, and let . With the total variation distance , the Bayes error of under and under differ by at most . Each relabelled point moves at most its own mass between the two minima in the sum, and changing the distribution moves at most of mass; this is the same mechanism as the classical domain-adaptation bounds [7]. Neither term is identifiable from the benchmark: requires correct labels and requires deployment data.
The bound is attained when the benchmark is mixed with the independent dataset: for , and the Bayes error is exactly (Figure 7d). Mixing with the reversed dataset, , gives Bayes error , while the learned rule’s error grows linearly to (Figure 7e).
Interpreting a Benchmark Margin
Suppose detector beats detector on a benchmark. We would like to conclude that has lower error on deployment data with correct labels. We use 0-1 error rather than F1 here because it decomposes over points, which makes the argument a few lines long; sampling error, label errors and distribution shift act on F1 in the same way, with the extra complication of a random denominator.
Only points where the two detectors disagree can affect the comparison. Where and output the same label they incur the same loss under any label and any distribution, so the per-point loss difference is in and is nonzero only when ; on such a point, flipping the label changes it by . Define Then the error difference on and the error difference on differ by at most . The factor 2 is the label flip; has no because the loss difference ranges over an interval of length 2 rather than 1. Adding the sampling error between the test-set difference and its expectation under , a measured margin larger than certifies the ranking on deployment data.
Both correction terms are supported on the disagreement set, which makes the bound usable in practice. Estimating only requires re-annotating the points where the two detectors disagree, typically a small fraction of the data. Suppose the detectors disagree on of points and leads by one percentage point. If of all labels are wrong and all of those fall on disagreements, erases the lead; if they fall where the detectors agree, . Label noise spread uniformly at random lands almost entirely on agreements and barely moves the comparison (Figure 8a).
For the sampling term, the independent unit is the series. Points within a series are strongly autocorrelated, and treating them as independent overstates the effective sample size. With series and per-series error differences in , Hoeffding’s inequality gives with probability at least , so a one-sided 5% test needs . That is for Yahoo A1’s 67 series and for the UCR archive’s 250. These are worst-case margins, since real per-series differences rarely use the full range, but a gap of a few F1 points is well below either. Selecting the best of thresholds or detectors on the same labels multiplies the failure probability by up to (union bound), giving (Figure 8b). The per-series oracle threshold in Figures 1 and 2 is such a selection, applied to every detector alike.
F1 itself is unstable when a series has few labelled points: one missing annotation can move a series from F1 1 to F1 0, and a detector that flags only the recorded anomalies outscores one that also finds unrecorded ones. Precision also depends on prevalence : At and , even perfect recall gives precision (in 10,000 points, 50 true alarms against about 498 false ones), and the bound caps it at . Two detectors on the same collection share , but averages across collections, and comparisons between papers that use different collections, mix very different prevalences (Figure 8c).
Conclusions and Next Steps
Diff is exact whenever anomalies are steps more than twice the largest normal step, and under sub-Gaussian noise its error decays like . The Yahoo series in Figure 2 have this form. We have not yet measured how much of each collection does, but Figure 1 suggests it is a large share for Yahoo, NAB and TODS under point-adjusted scoring. Diff fails when normal behaviour itself takes large steps, as in the pulse recording, and when labels mark long states, which point adjustment then partly hides.
For reading the literature, the consequence is that a margin of a few F1 points over Diff on these collections is weak evidence that a method detects anything Diff misses. Such a margin is within the sampling error of a few dozen series. Label errors on the small set of points where the two detectors disagree can produce or erase it, and switching between pointwise and adjusted scoring can change it.
Our next step is to test the assumptions above on real archives: measure step distributions at normal and anomalous points and test separation with thresholds fixed on held-out series, estimate the overlap of normal and anomalous score distributions (which bounds the Bayes error of Diff from below), re-annotate disagreement points between Diff and a stronger detector to estimate , and repeat published comparisons with series as the sampling unit.
This is joint work with Vidyut Veedgav, Donovan Wu, Sreya Srinidhi and Weicong Chen. It grew out of our work on anomaly detection by estimating what typical data looks like, for images in Forte [8], for system logs in K⁴ [9] and its streaming deployment K4-Serve [10], and for language model prompts in Trust The Typical [11]. Diff’s results came up when we benchmarked that approach on time series.
References
Cite this essay
Debargha Ganguly, Vidyut Veedgav, Donovan Wu, Sreya Srinidhi, and Weicong Chen. “Why a One-Line Baseline Does Well on Time Series Anomaly Detection Benchmarks: A Follow-up to Wu and Keogh.” Research notes, November 5, 2026. https://blog.debargha.com/essays/when-diff-works/
@misc{ganguly2026whyoneline,
author = {Ganguly, Debargha and Veedgav, Vidyut and Wu, Donovan and Srinidhi, Sreya and Chen, Weicong},
title = {Why a One-Line Baseline Does Well on Time Series Anomaly Detection Benchmarks: A Follow-up to Wu and Keogh},
howpublished = {Research notes},
year = {2026},
month = nov,
url = {https://blog.debargha.com/essays/when-diff-works/},
}