TL;DR
CastFlow is a dynamic, agentic framework for time series forecasting that resolves the conflict between logical reasoning and numerical precision by splitting responsibilities between two models. It uses a frozen large language model (LLM) to plan and reflect, alongside a fine-tuned local LLM that refines an ensemble forecast baseline using a multi-view diagnostic toolkit. Optimized via reinforcement learning with verifiable rewards, CastFlow shifts forecasting from one-shot generation to iterative, evidence-guided correction.
What Problem Does This Paper Address?
Traditional deep learning and recent LLM-based forecasting methods typically follow a "static generative paradigm." They take historical observations and attempt to map them directly to future values in a single pass. This one-shot approach suffers from several critical flaws: it limits the model's ability to extract complex temporal patterns, offers no room for iterative refinement, and fails to leverage ensemble forecasts.
Furthermore, current LLM approaches face a fundamental precision-reasoning dilemma. Training-free methods preserve an LLM's general-purpose reasoning and tool-use capabilities but lack numerical accuracy. Conversely, fine-tuning an LLM directly on numbers improves numerical precision but destroys its general reasoning abilities and cross-domain generalization. CastFlow tackles this by introducing a role-specialized agentic workflow that separates semantic reasoning from numerical execution.
Methods
CastFlow structures the forecasting process into an iterative loop consisting of four stages: Planning, Action, Forecasting, and Reflection.
[Input Data] ➔ [Planning (Frozen LLM)] ➔ [Action (Toolkit)] ➔ [Forecasting (Fine-tuned LLM)] ➔ [Reflection (Frozen LLM)] ➔ [Final Forecast]
The architecture relies on several novel components:
- Role-Specialized Cognitive Architecture: The framework splits parameter spaces. A large, frozen foundational model (e.g., Grok 4) handles general-purpose reasoning (Planning and Reflection). A smaller, tunable domain-specific model (Qwen3-4B) acts as the specialized numerical engine (Forecasting).
- Multi-View Toolkit: Contains 11 specialized tools across four categories:
- Foundational Anchorer: Uses a cluster-based retrieval mechanism to extract a reliable ensemble forecast baseline from a historical case library, ensuring the model never forecasts from scratch.
- Statistical and Spectral Profiler: Computes metrics like spectral entropy and median absolute deviation to determine data predictability.
- Dynamics Monitor: Tracks trends, structural changepoints, and lead-lag cross-channel correlations.
- Residual Diagnoser: Fits a proxy autoregressive model to isolate systematic biases (used only during training).
- Strategy Memory: A vector-indexed database that stores successful historical planning trajectories. It uses an append strategy (adding new successful paths as discrete entries) to preserve the diversity of refined experiences.
- Two-Stage Workflow-Oriented Training: The forecasting module is first trained via Supervised Fine-Tuning (SFT) on high-quality teacher trajectories to master structural protocols. It is then optimized using Reinforcement Learning with Verifiable Rewards (RLVR) via Group Relative Policy Optimization (GRPO). The reward function penalizes formatting errors and rewards the model based on how much it improves accuracy relative to the initial ensemble baseline.
Datasets
The authors evaluated CastFlow across 10 diverse, real-world multivariate time series benchmarks split chronologically (7:1:2 ratio):
- Electricity Markets (EPF Benchmark): BE, DE, FR, NP, and PJM (short-term forecasting).
- Power Grid: ETTh and ETTm (long-term forecasting).
- Renewable Energy Generation: Windy Power (WP) and Solar Power (SP).
- Streamflow: MOPEX.
Key Insights and Ideas
- Forecasting as Correction, Not Generation: Instead of forcing an LLM to generate continuous numerical values blindly, CastFlow treats forecasting as an evidence-guided correction task. The model modifies a statistically grounded ensemble baseline, which drastically improves numerical stability.
- The Necessity of Reflection: Ablation studies revealed that the Reflection module is the most critical safeguard. Without it, formatting inconsistencies or sequence length mismatches trigger naive fallback mechanisms (like mean imputation), causing catastrophic error spikes in volatile datasets like Windy Power.
- Append vs. Merge Memory: When updating the strategy memory, incrementally appending new successful trajectories as discrete entries outperforms merging them into existing cluster medoids. Merging tends to blur domain-specific procedural memory, reducing retrieval accuracy in highly volatile environments.
- Defeating Reward Hacking: During reinforcement learning, the model's average response length initially expanded to form comprehensive reasoning chains, but later stabilized within a bounded range. This decoupling of reward growth from verbosity proves the model learned genuine qualitative improvements rather than just "reward hacking" through meaningless text generation.
Key Results
CastFlow was compared against 21 baselines spanning statistical models (ARIMA), machine learning (XGBoost), deep learning (PatchTST, iTransformer), foundation models (Chronos, TimesFM), and other agentic LLM frameworks (AlphaCast, Time-R1).
- Long-Term Forecasting: CastFlow achieved the best overall results across all 5 long-term datasets, effectively mitigating the error accumulation common in traditional autoregressive models.
- Short-Term Forecasting: CastFlow outperformed all baselines on 4 out of 5 short-term datasets.
- Scale Efficiency: The fine-tuned 4B parameter local model consistently outperformed both its training-free counterpart and the much larger proprietary Grok 4 model, proving that domain-specific RLVR is more critical for precision than raw model size.
Limitations and Future Work
The framework underperformed slightly on the PJM electricity dataset, trailing behind baselines like Chronos and TimeXer. The authors attribute this to their cross-domain joint training strategy, which prioritizes distilling generalized reasoning rules over overfitting to the high-frequency volatilities unique to PJM. Additionally, ambiguous correlations between PJM’s exogenous variables and targets limited the toolkit's adjustment efficacy.
Future work is directed toward refining tool orchestration and improving the framework's adaptability to datasets with weak or deceptive exogenous correlations.
Summary updated