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.
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.
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.
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.
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.
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.