TL;DR
This paper introduces TimeRLM, a framework that treats long-context time-series data as an external environment that a Large Language Model (LLM) queries and manipulates recursively using Python code and vision tools. By avoiding single-pass context ingestion, TimeRLM prevents the performance collapse typical of standard Time-Series Language Models (TSLMs), achieving up to a 10x improvement in precise anomaly localization.
What Problem Does This Paper Address?
In domains like healthcare, industrial manufacturing, and software observability, sensors generate massive streams of high-frequency data. The events that actually matter—such as an ectopic heartbeat or a transient software latency spike—are often brief anomalies buried inside hours or days of normal signals.
Recently developed Time-Series Language Models (TSLMs) can process raw time-series data and describe findings in natural language. However, they suffer from a major flaw: their retrieval performance collapses as the time-series length increases. Because they ingest and compress the entire signal in a single forward pass, they frequently miss fine-grained, localized events. Furthermore, existing benchmarks often rely on Multiple-Choice Questions (MCQs), which inadvertently hide this limitation because models can guess the correct answer using aggregate statistics without actually locating the anomaly.
Methods
To overcome the long-context bottleneck, the authors propose TimeRLM, adapting the concept of Recursive Language Models (RLMs) to the time-series domain.
Instead of stuffing thousands of data points directly into the LLM's prompt, TimeRLM stores the time-series as an external variable in a sandboxed Python environment (REPL). The root LLM acts as an agent that interacts with the data over multiple turns by writing and executing Python code (using libraries like numpy, scipy, and matplotlib).
The authors evaluate three configurations of this setup:
- Text-only RLM: The agent writes code and interprets text-based REPL outputs.
- Image/Vision RLM: The agent can additionally render plots of the signal and inspect them visually.
- Recursive RLM: The model can recursively spawn sub-agents (sub-RLMs) to analyze specific segments of the data in greater depth.
To optimize this process, the authors post-train TimeRLM using Group Relative Policy Optimization (GRPO), a reinforcement learning algorithm. The reward function penalizes both incorrect answers and high token usage, training the model to find anomalies efficiently with fewer interaction turns.
Datasets
The paper evaluates TimeRLM on a mix of synthetic and real-world datasets:
- AnomalyXL (New Benchmark): A newly introduced synthetic benchmark featuring long-context, multi-channel data (16k to 131k datapoints, up to 16 channels) with programmatically injected anomalies like transient spikes, level shifts, and seasonal changes. It features two evaluation tracks: AnomalyXL-MCQ (multiple-choice) and AnomalyXL-Localize (requiring precise JSON outputs of the anomaly's start and end timestamps).
- ARFBench Tier 2: A multiple-choice benchmark consisting of real-world production software telemetry data.
- Clinical Generalization Sets: Real-world clinical data used for zero-shot evaluation, including electrocardiograms (ECG) from the Long-Term Atrial Fibrillation (LTAF) database and respiratory channels from the Sleep Polysomnography (Sleep-PSG) corpus.
Key Insights and Ideas
- The MCQ Illusion: Multiple-choice benchmarks create a false sense of security. Traditional models score highly on MCQ anomaly detection because they can spot global statistical shifts (e.g., a change in variance), but they fail completely when forced to pinpoint the exact window where the anomaly occurred.
- Code as a Signal-Agnostic Interface: Writing code provides an invariant action space. Because the model learns how to write code to analyze data rather than memorizing specific signal patterns, reinforcement learning on purely synthetic data generalizes remarkably well to real-world clinical data.
- Flat Performance Curves: While single-pass models show a steep degradation in accuracy as sequence lengths grow from 16k to 131k points, TimeRLM's performance remains stable across the entire length axis.
Key Results
- Massive Localization Gains: On the AnomalyXL-Localize benchmark, TimeRLM (using a GPT-5.5 backbone) achieved an Intersection over Union (IoU) of 0.682 on localization and 0.745 on classify-with-evidence tasks. In comparison, the best single-pass TSLM baseline (Toto) maxed out at 0.329 and 0.072, respectively.
- RL Efficiency Boost: Post-training a smaller Qwen3.5-4B model with reinforcement learning improved its localization score from 0.035 to 0.538 IoU, while simultaneously cutting the required agent interaction turns by two-thirds.
- Zero-Shot Generalization: When tested on unseen real-world clinical data (LTAF and Sleep-PSG), fine-tuned traditional TSLMs collapsed completely, failing to exceed a localization score of 0.004 IoU. TimeRLM retained its capabilities zero-shot, drastically outperforming the baselines despite never seeing real clinical data during training.
Limitations and Future Work
The primary limitation acknowledged by the authors is the parametric nature of the AnomalyXL benchmark. Because the synthetic anomalies are programmatically generated, they lack the morphological complexity, ambiguity, and context-dependent nature of real-world anomalies.
Consequently, future work will need to focus on scaling inference-time search and expanding recursive language model frameworks to handle more semantically complex, real-world long-context time-series datasets.
Summary updated