Role specialization
The frozen LLM performs tool planning and evidence-consistency assessment. The trainable forecasting LLM translates the resulting context into a complete refined forecast, using the ensemble prior as a numerical starting point.
Research manuscript
Bridging Evidence Acquisition and Accurate Prediction in Agentic Time Series Forecasting
State Key Laboratory of Cognitive Intelligence, University of Science and Technology of China
Abstract
Time series forecasting is a fundamental task in temporal data analytics, and large language model (LLM)-based agents offer a promising paradigm through autonomous tool interaction and evidence-grounded reasoning. However, two fundamental challenges remain: how to acquire forecast-relevant evidence through adaptive tool interactions, and how to translate such evidence into accurate numerical predictions. To address these challenges, we propose CastFlow, a role-specialized agentic forecasting framework that bridges general-purpose tool reasoning and specialized temporal forecasting. Specifically, CastFlow introduces an Experience Memory that distills successful tool-use trajectories from training data, guiding a frozen LLM to orchestrate a multi-view toolkit for evidence acquisition. A lightweight specialized LLM then performs evidence-grounded temporal reasoning to refine an ensemble forecasting prior. To enhance this capability, we develop a two-stage training strategy combining supervised fine-tuning and reinforcement learning with verifiable rewards, where final forecasting outcomes of the overall workflow guide the optimization of the specialized model. Extensive experiments on ten real-world benchmarks demonstrate that CastFlow outperforms competitive baselines on nine datasets. Our findings highlight the importance of bridging autonomous evidence acquisition and specialized temporal reasoning for accurate and adaptive agentic forecasting. The source code is available at https://github.com/Forever-Pan/CastFlow.
Motivation
An agent must identify which evidence is useful for the current temporal dynamics and translate heterogeneous diagnostic signals into precise numerical predictions. Recognizing a trend or turning point alone does not determine how much each future value should change.
CastFlow addresses evidence acquisition through retrieved procedural experience. Selected training trajectories guide a frozen general-purpose LLM in adapting diagnostic tool plans to the current instance, using information available at the forecast origin.
Forecasting-specific supervision addresses evidence-to-prediction translation. A specialized LLM conditions on the observed history, diagnostic evidence, and ensemble prior to generate a refined forecast. SFT and RLVR update this forecasting model, while planning and reflection remain frozen.
Method
A frozen general-purpose LLM plans diagnostic tool use and assesses evidence consistency. Deterministic tool execution supplies the evidence, and a specialized forecasting LLM generates a complete numerical forecast conditioned on that evidence and an ensemble prior.
Uses retrieved Experience Memory to select optional diagnostics for the current lookback, alongside mandatory model auxiliary and exogenous analysis tools.
Executes tools to extract temporal statistics, trend signals, covariate associations, and an ensemble forecast prior. The residual diagnoser is used only during training.
Uses the observed lookback, available origin-issued covariate forecasts, diagnostic evidence, and retrieved procedural guidance to refine the ensemble prior with a specialized forecasting LLM.
Checks forecast structure and evidence consistency, then provides feedback for bounded replanning and revision when checks fail.
The frozen LLM performs tool planning and evidence-consistency assessment. The trainable forecasting LLM translates the resulting context into a complete refined forecast, using the ensemble prior as a numerical starting point.
Experience Memory stores selected training trajectories and stays fixed during testing. Retrieved schedules guide diagnostic tool selection, while associated evidence and responses provide procedural context for the specialized forecaster.
The toolkit covers ensemble anchoring, statistical and spectral profiling, dynamic pattern monitoring, and training-side residual diagnosis. Test-time tools use information available at the forecast origin, including previously issued auxiliary forecasts where applicable.
| Family | Representative tools | Role in forecasting |
|---|---|---|
| Foundational Anchorer | model_auxiliary_tool |
Selects a related historical cluster and combines its configured forecasting experts with softmax weights derived from historical validation losses. |
| Statistical and Spectral Profiler | statistical_analysis_tool, basic_statistics_tool, data_quality_tool, comprehensive_feature_tool |
Summarizes scale, dispersion, robust deviations, quantiles, autocorrelation, spectral entropy, missingness, and descriptive range bounds. |
| Dynamics Monitor | trend_analysis_tool, changepoint_trend_tool, cross_channel_tool, exogenous_analysis_tool, event_summary_tool |
Summarizes trends, temporal differences, lagged and cross-channel associations, and dominant rise, fall, flat, or oscillation patterns. |
| Residual Diagnoser | autoregressive_residual_tool |
Summarizes residual mean and lag-one autocorrelation from an autoregressive proxy fitted to training lookback windows. |
Training
CastFlow collects tool-use experience from training windows. SFT trains the specialized forecasting model on selected teacher responses conditioned on workflow context. GRPO scores each candidate's numerical answer under a fixed evidence context and ensemble prior. Planning and reflection remain frozen.
Experiments
CastFlow is evaluated on electricity markets, power-grid temperature, renewable energy generation, and streamflow. It is compared with statistical models, tree models, deep forecasters, foundation models, LLM forecasters, and agentic forecasting baselines.
BE, DE, NP, FR, and PJM use a 168-hour lookback window and a 24-hour forecast horizon.
ETTh, ETTm, WP, SP, and MOPEX use 96-step horizons across grid, renewable, and streamflow domains.
The benchmark covers statistical, tree-based, deep, foundation, LLM-based, and agentic forecasting methods.
PJM is the only exception on both metrics: Chronos gives the lowest MSE, while AlphaCast gives the lowest MAE. MSE and MAE are compared separately against the best competing value for each dataset.
Change = 100 × (CastFlow − best competing baseline) / baseline. Negative values indicate lower error. Bar lengths share a common scale.
Baseline suite
The main table is not a narrow comparison against a single model family. It spans classical forecasting, machine learning, deep neural forecasting, time-series foundation models, LLM-based forecasters, and agentic reasoning baselines.
| Dataset | Setting | Best baseline MSE | CastFlow MSE | MSE change | Best baseline MAE | CastFlow MAE | MAE change | Outcome |
|---|---|---|---|---|---|---|---|---|
| BE | Short | 606.71, iTransformer | 546.87 | -9.9% | 9.63, Chronos | 9.60 | -0.3% | Best MSE/MAE |
| DE | Short | 208.93, PatchTST | 200.47 | -4.0% | 9.57, LightGBM | 9.50 | -0.7% | Best MSE/MAE |
| NP | Short | 24.16, AlphaCast | 23.92 | -1.0% | 3.19, AlphaCast | 3.11 | -2.5% | Best MSE/MAE |
| FR | Short | 797.42, PatchTST | 707.96 | -11.2% | 8.24, Chronos | 8.16 | -1.0% | Best MSE/MAE |
| PJM | Short | 25.70, Chronos | 27.45 | +6.8% | 3.59, AlphaCast | 3.74 | +4.2% | Baseline best |
| ETTh | Long | 8.02, Time-R1 | 8.00 | -0.2% | 2.04, Time-R1 | 2.03 | -0.5% | Best MSE/MAE |
| ETTm | Long | 2.48, AlphaCast | 2.36 | -4.8% | 1.10, TokenCast | 1.04 | -5.5% | Best MSE/MAE |
| WP | Long | 1932.59, DLinear | 1719.99 | -11.0% | 28.52, ConvTimeNet | 27.40 | -3.9% | Best MSE/MAE |
| SP | Long | 17.25, Time-LLM | 16.90 | -2.0% | 2.67, iTransformer/Time-R1 | 2.50 | -6.4% | Best MSE/MAE |
| MOPEX | Long | 4.83, TimeXer | 3.60 | -25.5% | 1.28, TimeXer | 1.19 | -7.0% | Best MSE/MAE |
Values are point estimates from the reported benchmark. Small differences do not establish statistical significance.
| Dataset | Domain | Frequency | Dim | L | H | Stride | Features |
|---|---|---|---|---|---|---|---|
| BE | Electricity Market | 1h | 4 | 168 | 24 | 48 | Electricity price, generation forecast, system load forecast |
| DE | Electricity Market | 1h | 4 | 168 | 24 | 48 | Electricity price, wind power forecast, Amprion zonal load forecast |
| NP | Electricity Market | 1h | 4 | 168 | 24 | 48 | Electricity price, grid load forecast, wind power forecast |
| FR | Electricity Market | 1h | 4 | 168 | 24 | 48 | Electricity price, generation forecast, system load forecast |
| PJM | Electricity Market | 1h | 4 | 168 | 24 | 48 | Electricity price, system load forecast, zonal COMED load forecast |
| ETTh | Power Grid | 1h | 8 | 96 | 96 | 48 | Oil temperature and useful/useless load covariates |
| ETTm | Power Grid | 15min | 8 | 96 | 96 | 96 | Oil temperature and useful/useless load covariates |
| WP | Renewable Energy Generation | 15min | 8 | 96 | 96 | 96 | Real power, radiation, wind, temperature, humidity, precipitation |
| SP | Renewable Energy Generation | 15min | 8 | 96 | 96 | 96 | Real power, radiation, wind, temperature, humidity, precipitation |
| MOPEX | Streamflow | 1day | 6 | 96 | 96 | 48 | Streamflow discharge, precipitation, evaporation, max/min temperature |
Analysis
The ablations compare complete forecasting configurations. The trajectory plots and case study illustrate selected windows and the intended information flow.
| Study | Removed or varied | What it shows | Representative numbers |
|---|---|---|---|
| Core workflow | w/o Reflection | Removing reflection disables self-correction in the evaluated configuration; this comparison does not isolate semantic reflection from structural checks. | BE MSE 1027.76 vs 546.87; WP 5102.29 vs 1719.99. |
| Core workflow | w/o Toolkit | The configuration removes the ensemble prior and diagnostics together with their dependent tool planning. | ETTm MSE 17.68 vs 2.36; WP 3517.03 vs 1719.99. |
| Toolkit | w/o Anchorer | Removing the anchorer yields the largest MSE increase among toolkit-category removals on every reported dataset. | PJM MSE 47.89 vs 27.45; WP 2718.42 vs 1719.99. |
| Reward | Hybrid MSE | The combined reward gives the lowest MSE on the four evaluated datasets; DE has a small MAE exception. | Best MSE on BE, DE, SP, and ETTh among reward variants. |
Workflow execution
Separate execution studies examine repeated diagnostic computation and recovery after a controlled interruption.
Current-plan reuse preserves identical diagnostic outputs across six datasets. Speedups are 1.11–1.45× under fresh planning; measurements cover diagnostic computation.
For 35 pairs reaching the post-forecast interruption point, resuming committed stages preserves final predictions and reduces forecast calls from 70 to 35. Normal execution times remain similar.
Recovery uses six fixed training windows per dataset, fixed full-tool plans, deterministic validation, greedy decoding, and dataset-specific SFT-plus-RLVR checkpoints. The main forecasting experiment uses a jointly trained model. Timing includes journal I/O and all attempts, excluding service initialization. See the paper and runtime notes for the execution setup.
Code
The implementation provides one-command preparation of expert libraries and cross-domain Experience Memory, followed by forecasting-model training, inference, and evaluation. Configure task-specific prompts in an external private pack using the repository's English reference templates. Data and model weights are supplied separately. Initialization writes libraries and memory to the configured runtime directory.
Build historical clusters and model-performance records for selecting and weighting the forecasting experts that produce the ensemble prior.
Construct cross-domain Experience Memory from selected training trajectories, including tool schedules, observations, and forecasting responses.
Export context-response pairs for SFT and forecasting contexts with numerical targets for response-level RLVR.
Serve the trained model, forecast test windows, and evaluate predictions with the same metrics used in the paper.
Citation
Please cite the CastFlow preprint. The arXiv identifier remains the same across versions.
@misc{pan2026castflow,
title = {CastFlow: Bridging Evidence Acquisition and Accurate Prediction in Agentic Time Series Forecasting},
author = {Pan, Bokai and Cheng, Mingyue and Tao, Xiaoyu and Liu, Zhiding and Yu, Shuo and Wu, Yuchong and Liu, Qi and Lian, Defu and Chen, Enhong},
year = {2026},
eprint = {2604.27840},
archivePrefix = {arXiv},
primaryClass = {cs.LG},
doi = {10.48550/arXiv.2604.27840},
url = {https://arxiv.org/abs/2604.27840}
}