# Time Series Forecasting as Reasoning: A Slow-Thinking Approach with Reinforced LLMs

Research code for a two-stage reinforcement fine-tuning method that trains large language models to reason step by step about time series data before producing a forecast.

Time-R1 is the official code for a paper studying slow-thinking reasoning applied to time series forecasting. Its two-stage reinforcement fine-tuning curriculum first uses supervised fine-tuning on synthetic chain-of-thought data so a model learns the structure and format of temporal reasoning, then uses reinforcement learning with a custom multi-objective reward covering ground-truth alignment, multi-horizon accuracy and domain principles to develop more effective reasoning patterns.

The reinforcement stage uses GRIP, a group-based sampling strategy that applies non-uniform sampling and adaptive weighting to strengthen useful reasoning paths during policy optimization. The repository includes the scripts and configuration for preparing training and evaluation datasets, training and running inference with the resulting Time-R1 model, and the complete training and evaluation source code.

The paper reports that the approach improves forecasting accuracy and generalization across multiple real-world datasets compared with baselines that lack the reasoning curriculum.

Website: https://github.com/ustc-time-series/Time-R1
