Research manuscript

CastFlow

Bridging Evidence Acquisition and Accurate Prediction in Agentic Time Series Forecasting

Bokai Pan, Mingyue Cheng, Xiaoyu Tao, Zhiding Liu, Shuo Yu, Yuchong Wu, Qi Liu, Defu Lian, Enhong Chen

State Key Laboratory of Cognitive Intelligence, University of Science and Technology of China

CastFlow framework overview
CastFlow system overview. Training-built Experience Memory guides tool planning and supplies procedural context for forecasting. A frozen LLM plans tool use and checks forecasts. A multi-view toolkit provides diagnostic evidence and an ensemble prior, which a specialized forecasting LLM uses to generate refined numerical forecasts. SFT and RLVR update only the forecasting LLM. Open PDF
4 workflow roles
11 tools in four families
10 datasets
21 baselines
9/10 best MSE and MAE

Abstract

Bridging evidence acquisition and prediction.

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

Two linked forecasting challenges.

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.

Two challenges addressed by experience-guided tool reasoning and specialized forecast refinement
Motivation. Experience-guided tool reasoning addresses evidence acquisition; the specialized forecaster translates that evidence and an ensemble prior into numerical predictions. Open PDF

Method

A four-role workflow with explicit intermediate artifacts.

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.

  1. 01

    Planning

    Uses retrieved Experience Memory to select optional diagnostics for the current lookback, alongside mandatory model auxiliary and exogenous analysis tools.

  2. 02

    Action

    Executes tools to extract temporal statistics, trend signals, covariate associations, and an ensemble forecast prior. The residual diagnoser is used only during training.

  3. 03

    Forecasting

    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.

  4. 04

    Reflection

    Checks forecast structure and evidence consistency, then provides feedback for bounded replanning and revision when checks fail.

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.

Memory-guided planning

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.

Multi-view toolkit

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.

Multi-view toolkit families
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

Workflow context trains evidence-guided forecasting.

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.

Trajectory collection K-parallel exploration retains the lowest-MSE trajectory among candidates passing format and logic checks.
SFT warmup The local model learns the response protocol and how to condition forecasts on evidence.
GRPO-based RLVR GRPO samples eight forecasting responses per fixed workflow context and scores each numerical answer directly.
Hybrid MSE reward Numerical validity, absolute MSE, and MSE improvement over the fixed ensemble prior guide forecast refinement.
SFT and RLVR ablation results
Training ablation. The full SFT-plus-RLVR model has the lowest error in all eight plotted comparisons: MAE on BE, DE, ETTh, and SP, and MSE on NP, PJM, ETTm, and MOPEX. Planning and reflection remain frozen. Open PDF
GRPO reward and response length curves
Optimization dynamics. GRPO reward rises rapidly early in training and then improves more gradually. Average response length initially grows and later fluctuates within a comparatively stable range. Open PDF

Experiments

Forecasting results across ten benchmarks.

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.

Short horizon 5 electricity-market datasets

BE, DE, NP, FR, and PJM use a 168-hour lookback window and a 24-hour forecast horizon.

Long horizon 5 cross-domain datasets

ETTh, ETTm, WP, SP, and MOPEX use 96-step horizons across grid, renewable, and streamflow domains.

Comparison scope 21 baselines

The benchmark covers statistical, tree-based, deep, foundation, LLM-based, and agentic forecasting methods.

Main result Best MSE and MAE on 9 of 10 datasets, including all 5 long-horizon benchmarks.

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.

9/10 MSE wins 9/10 MAE wins 5/5 long-horizon wins 21 baselines

Relative MSE change

vs. best competing baseline
BE
-9.9%
DE
-4.0%
NP
-1.0%
FR
-11.2%
PJM
+6.8%
ETTh
-0.2%
ETTm
-4.8%
WP
-11.0%
SP
-2.0%
MOPEX
-25.5%

Change = 100 × (CastFlow − best competing baseline) / baseline. Negative values indicate lower error. Bar lengths share a common scale.

Baseline suite

Complete comparison families

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.

  • StatisticalProphet, ARIMA
  • Tree modelsXGBoost, LightGBM
  • Deep forecastersAutoformer, DLinear, PatchTST, iTransformer, TimeXer, ConvTimeNet
  • Foundation modelsChronos, TimesFM, Sundial
  • LLM forecastersTime-LLM, PromptCast, TokenCast, S2IP-LLM
  • Agentic and reasoning baselinesTimeReasoner, Time-R1, TimeSeriesScientist, AlphaCast
Main comparison against the best competing baseline on each dataset
Dataset Setting Best baseline MSE CastFlow MSE MSE change Best baseline MAE CastFlow MAE MAE change Outcome
BEShort606.71, iTransformer546.87-9.9%9.63, Chronos9.60-0.3%Best MSE/MAE
DEShort208.93, PatchTST200.47-4.0%9.57, LightGBM9.50-0.7%Best MSE/MAE
NPShort24.16, AlphaCast23.92-1.0%3.19, AlphaCast3.11-2.5%Best MSE/MAE
FRShort797.42, PatchTST707.96-11.2%8.24, Chronos8.16-1.0%Best MSE/MAE
PJMShort25.70, Chronos27.45+6.8%3.59, AlphaCast3.74+4.2%Baseline best
ETThLong8.02, Time-R18.00-0.2%2.04, Time-R12.03-0.5%Best MSE/MAE
ETTmLong2.48, AlphaCast2.36-4.8%1.10, TokenCast1.04-5.5%Best MSE/MAE
WPLong1932.59, DLinear1719.99-11.0%28.52, ConvTimeNet27.40-3.9%Best MSE/MAE
SPLong17.25, Time-LLM16.90-2.0%2.67, iTransformer/Time-R12.50-6.4%Best MSE/MAE
MOPEXLong4.83, TimeXer3.60-25.5%1.28, TimeXer1.19-7.0%Best MSE/MAE

Values are point estimates from the reported benchmark. Small differences do not establish statistical significance.

Benchmark settings
Dataset Domain Frequency Dim L H Stride Features
BEElectricity Market1h41682448Electricity price, generation forecast, system load forecast
DEElectricity Market1h41682448Electricity price, wind power forecast, Amprion zonal load forecast
NPElectricity Market1h41682448Electricity price, grid load forecast, wind power forecast
FRElectricity Market1h41682448Electricity price, generation forecast, system load forecast
PJMElectricity Market1h41682448Electricity price, system load forecast, zonal COMED load forecast
ETThPower Grid1h8969648Oil temperature and useful/useless load covariates
ETTmPower Grid15min8969696Oil temperature and useful/useless load covariates
WPRenewable Energy Generation15min8969696Real power, radiation, wind, temperature, humidity, precipitation
SPRenewable Energy Generation15min8969696Real power, radiation, wind, temperature, humidity, precipitation
MOPEXStreamflow1day6969648Streamflow discharge, precipitation, evaporation, max/min temperature

Analysis

Where do the gains come from?

The ablations compare complete forecasting configurations. The trajectory plots and case study illustrate selected windows and the intended information flow.

Forecast trajectories for ensemble baseline, training-free CastFlow, and fine-tuned CastFlow
Forecast trajectory dynamics. The four windows compare the ensemble prior, training-free CastFlow, and the trained forecaster, illustrating how evidence-conditioned refinement changes peak magnitude and local alignment. Open PDF
Representative ablation evidence
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.
Case study on the BE electricity market dataset
Case study. The BE example shows retrieved experience, a tool schedule, and a forecasting response that describes peak and timing adjustments. It illustrates the intended workflow for a selected forecast. Open PDF

Workflow execution

Reuse diagnostics. Resume committed forecasts.

Separate execution studies examine repeated diagnostic computation and recovery after a controlled interruption.

Diagnostic feature reuse

2.24–2.98× under full-tool plans

Current-plan reuse preserves identical diagnostic outputs across six datasets. Speedups are 1.11–1.45× under fresh planning; measurements cover diagnostic computation.

Controlled interruption recovery

1.98× median paired speedup

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.

Diagnostic runtime and speedups for fresh planning and full-tool plans across BE, DE, ETTh, ETTm, WP, and SP
Diagnostic feature reuse. Independent computation, all-primitive reuse, and current-plan reuse produce identical diagnostic outputs. Open PDF

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

Repository structure follows the paper workflow.

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.

01

Anchorer Library

Build historical clusters and model-performance records for selecting and weighting the forecasting experts that produce the ensemble prior.

02

Experience Memory

Construct cross-domain Experience Memory from selected training trajectories, including tool schedules, observations, and forecasting responses.

03

SFT and RLVR Data

Export context-response pairs for SFT and forecasting contexts with numerical targets for response-level RLVR.

04

Forecast and Evaluate

Serve the trained model, forecast test windows, and evaluate predictions with the same metrics used in the paper.

Citation

BibTeX

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

Figure preview