Manuscript Offprint

arXiv:2611.00945

HieraNTP: Structured Risk Representations for Time-Series Anomaly Detection via Hierarchical Next-Token Prediction

Yujie Li, Zezhi Shao, Boyu Diao, Zhulin An, Yongjun Xu, Xueqi Cheng, Fei Wang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Time-series anomaly detection commonly converts deviations from learned temporal regularities into anomaly scores. This practice can conflate violations of temporal regularity with task-specific anomaly judgments: the same deviation may be anomalous under one task definition and benign under another. Aggregating heterogeneous deviations into a single score before task-specific adaptation can obscure the evidence needed to distinguish these cases. We introduce HieraNTP, a Hierarchical Next-Token Prediction framework that separates self-supervised predictive modeling from task-specific risk interpretation. HieraNTP pre trains a hierarchical tokenizer and a causal next-token predictor to capture temporal regularities at multiple scales. It then organizes prediction discrepancies into a structured risk representation, preserving complementary evidence across temporal scales in token, local-statistic, and observation spaces. A task-adaptive detector uses anomaly labels to select and combine this evidence for the target task. Across anomaly detection benchmarks, HieraNTP improves VUS-PR by 12.0% on TSB-AD-U and 15.5% on TSB-AD-M relative to the strongest baselines, and achieves the highest composite score on both TAB tracks, with controlled comparisons supporting the value of retaining distinct evidence. Our code is available at https://github.com/blisky-li/HieraNTP.

1 INTRODUCTION

Time-series anomaly detection (TSAD) identifies observations or intervals that depart from expected temporal behavior. It supports continuous monitoring of cloud services, industrial systems, and cyber-physical infrastructure, where anomalous events may signal service failures, equipment faults, or attacks (Xu et al., 2018; Su et al., 2019; Tuli et al., 2022; Khan et al., 2026).

Existing TSAD methods commonly learn temporal regularities and detect anomalies directly from forecasting or reconstruction errors (Xu et al., 2018; Su et al., 2019; Audibert et al., 2020; Tuli et al., 2022; Liu & Paparrizos, 2024; Sarfraz et al., 2024). Association- and contrastive-learning methods measure inconsistencies in temporal dependencies or representations (Xu et al., 2022; Yang et al., 2023; Lan et al., 2026; Han & Lee, 2025). Temporal pretraining learns transferable forecasting and representation capabilities (Goswami et al., 2024; Ansari et al., 2024; Das et al., 2024; Han & Lee, 2025; Khan et al., 2026). Larger departures generally indicate stronger anomaly evidence.

Direct discrepancy scoring can conflate violation of learned regularity with task-defined anomaly. The same deviation may be anomalous under one task definition and benign under another. Error magnitude alone may not capture the form and context relevant to these judgments. Contextual anomalies can disrupt temporal relations with small value deviations (Lan et al., 2026), while persistent abnormal dynamics may become predictable within context, reducing forecasting errors (Uray

∗^{*}Corresponding authors: Zezhi Shao and Fei Wang.

Figure

Figure 1: Schematic motivation using a Yahoo sequence from TSB-AD. The task treats missing peaks (A) as normal and disrupted cycles (B) as anomalous. (a) Early scalar reduction can obscure this distinction. (b) HieraNTP retains a structured risk representation for task-adaptive detection.

et al., 2026). Forecasting or reconstruction gains may yield little improvement in detection, and simple local statistics can closely approximate foundation-model errors (Zhu et al., 2026). We refer to this mismatch between task-agnostic predictive evidence and task-specific anomaly interpretation as the predictive risk–decision gap.

Task-specific interpretation depends on the information retained in predictive evidence. Figure 1 shows two types of deviation within one task: missing local peaks in region A and disrupted cycles in region B. Although both violate the preceding pattern, the illustrated task labels only region B as anomalous. Distinguishing them requires evidence about how each departs from that pattern. Scalar reduction can discard these distinctions before a decision boundary is learned, motivating the retention of complementary discrepancies across spaces and temporal supports.

We introduce HieraNTP, a Hierarchical Next-Token Prediction framework that separates self-supervised predictive modeling from task-specific risk interpretation. Its multiscale tokenizer produces continuous causal tokens, and its hierarchical predictor models their evolution. Comparing predicted and realized targets yields token-space, local-statistic, and observation-space discrepancies. Temporal summaries preserve sustained and peak responses, while variable aggregation captures broad or concentrated departures. With the tokenizer and predictor frozen, target labels train the task-adaptive detector on the resulting structured risk representation.

On the official TSB-AD benchmark (Liu & Paparrizos, 2024), HieraNTP outperforms the strongest baseline in VUS-PR on both the univariate and multivariate tracks. HieraNTP also achieves the highest dataset-mean VUS-PR on both TAB tracks (Qiu et al., 2025a). Our contributions are:

  • We identify the predictive risk–decision gap and explain how scalar scoring can discard distinctions needed for task-specific anomaly decisions.
  • We propose HieraNTP, which converts multiscale next-token prediction discrepancies into a structured risk representation before task-specific anomaly scoring.
  • Under matched detector training, multiview evidence outperforms scalar time-domain prediction errors and mean, maximum, or mean–maximum aggregation on TSB-AD.

References (100)

Couldn't load all references. Reload the page to try again.