MCP
arXivarXiv
Preprint
Published: August 4, 2026
cs.LG
v2

TimeRLM: Recursive Language Models Enable Precise Anomaly Localization in Long-Context Time-Series

Abstract
Precise anomaly localization over long-context time series is a crucial task in monitoring applications across clinical care, industrial operations, financial services, and logistics, where brief evidence may hide inside long spans of high-frequency data. Time-Series Language Models (TSLMs) are able to ingest time series data and verbalize findings on anomalies in natural language; however, recent benchmarks report a decrease in retrieval performance at long contexts, mirroring failure modes in text, vision, and audio. In the text domain, Recursive Language Models (RLMs) can recover much of this lost performance by keeping context external to the large language model (LLM), allowing the model to query it through code. We present TimeRLM, an RLM formulation for time-series that sequentially manipulates the signal using code and vision capabilities. We further introduce AnomalyXL, a synthetic long-context anomaly localization benchmark with programmatically injected anomalies that require precise retrieval. We implement five different task categories and two variants: AnomalyXL-MCQ and AnomalyXL-Localize. TimeRLM outperforms every evaluated TSLM and single-pass baseline on four of the five AnomalyXL-Localize tasks, reaching 0.682 IoU on localization and 0.745 on classify-with-evidence, versus at most 0.329 and 0.072 across all baselines. We post-train TimeRLM using reinforcement learning. The resulting model further improves performance and requires approximately one-third as many agent interaction turns as its untrained base model to produce a final answer. On unseen real-world ECG, sleep and software observability recordings, the post-trained TimeRLM retains or improves performance, surpassing TSLMs despite being trained exclusively on synthetic data. Our findings suggest recursive interaction with time-series is an effective approach for long-horizon retrieval.
0
AI overview
Reviews
Citation graph
References · 45
Structured
This preview uses paper v1; the current paper is v2
Generated from v1 · the paper is now at v2

Overview

This paper addresses precise anomaly localization in long-context time-series scenarios by proposing TimeRLM, a method based on recursive language models, and also constructs AnomalyXL, an evidence-oriented long-context multichannel anomaly localization benchmark. On the benchmark tasks, it significantly outperforms all evaluated time-series language models and single-pass baseline models.

Core Challenges and Task Background of Long-Context Time-Series Anomaly Localization

In long-context time-series anomaly localization, the window width is defined as an absolute sample count ranging from 8 to 256, independent of the total length L of the time series, rather than a fraction of the total sequence length. This design choice is the core source of the sharply increased difficulty of anomaly localization in long-context scenarios.

When the total sequence length L reaches 131072, a single anomaly can account for as little as 0.006% of the entire sequence. In full-resolution time-series visualizations, such extremely low-proportion anomalies are nearly indistinguishable from noise and can only be identified through local zoom-in operations.

TimeRLM Recursive Model Design and Construction of the AnomalyXL Benchmark

The paper defines TimeRLM as a recursive language model that can query time-series data from context files. The initial version is a pure-text recursive language model that, over multiple rounds of interaction, outputs Python code to a code sandbox (REPL). The sandbox has standard Python data-science libraries built in and predefined JSON object variables storing the time-series data, so the model can directly manipulate the complete time-series records through code. You can combine this with the figure that follows to fully understand how the recursive reasoning and sandbox runtime work together.

Fig. 1: TimeRLM interacts with time-series data through code: the orchestrator reasons in natural language and then executes Python code in the sandbox REPL, and can invoke sub-RLMs to complete time-series anomaly detection tasks.

The paper proposes AnomalyXL, a long-context multichannel benchmark for evidence-oriented anomaly localization, where all task answers require precisely retrieving the corresponding time interval, channel, or anomaly magnitude. The benchmark's samples are generated from random noise processes, with optional periodic or trend components overlaid, and all channel data are z-score normalized to ensure that injected anomalies remain scale-consistent across heterogeneous base signals. The time-series context of the samples spans 16k to 131k points, supporting up to 16 channels.

Experimental Results, Generalization, and Applicability Boundaries

TimeRLM outperforms all evaluated time-series large language models and frontier single-pass models on four of the five AnomalyXL-Localize tasks, achieving an intersection-over-union of 0.682 on the localization task and a score of 0.745 on the classification-with-evidence task, while the corresponding best values among all baseline methods are only 0.329 and 0.072. After further training TimeRLM with reinforcement learning, performance improves further: the model surpasses time-series large language models on exact retrieval tasks, uses a large language model backbone as small as one-eighth the size of the compared schemes, and requires only about one-third of the agent interaction rounds needed by the untrained base model to produce final answers. You can observe in the figure below how the average exact reward varies with context length under different configurations.

Fig. 2: Curves of GPT-5.5's average accuracy on three types of exact tasks as context length varies, comparing performance differences across reasoning configurations.

In generalization testing, time-series large language models fine-tuned on AnomalyXL suffer performance collapse on the unseen LTAF and Sleep-PSG generalization sets, with the intersection-over-union of all models not exceeding 0.004; only ITFormer achieves F1 scores of 0.331 and 0.330 on LTAF and Sleep-PSG, respectively. In contrast, TimeRLM (built on the Qwen3.5-4B backbone) trained with reinforcement learning on the AnomalyXL generator shows clearly improved performance on clinical signal classification, AnomalyXL-MCQ, and ARFBench tasks. These results indicate that post-training on synthetic data can preserve the model's capability on unseen datasets while greatly improving out-of-domain transfer. The authors' hypothesis is that code-based reasoning provides a signal-agnostic learning environment in which the action space remains unchanged across different signal distributions.

The current approach and its accompanying benchmark also have clear known limitations: the programmatic construction of AnomalyXL limits the diversity of anomaly shapes, since all injected anomaly events are generated in a parameterized way, whereas real-world anomalies can be ambiguous and highly context-dependent. Therefore, the benchmark mainly evaluates precise retrieval of numerical deviations and cannot cover all semantically meaningful anomaly types.

Rating
No ratings yet
Rate
Community rating
—
/ 5
No ratings yet
Rating
—
Soundness
—
Presentation
—
Contribution
—
Confidence
—
Discussion
Top
Newest
Questions
Replication
Author
No comments yet — be the first