FLAIRR-TS - Forecasting LLM-Agents with Iterative Refinement and Retrieval for Time Series

Gunjan Jalori, Preetika Verma, Sercan Ö ArikarXiv 2025 · DOI

TL;DR

This paper introduces FLAIRR-TS, a novel framework that uses a multi-agent system to dynamically refine prompts for Large Language Models (LLMs) at test time, significantly improving time series forecasting accuracy without any model training. By combining iterative refinement and retrieval-augmented context, FLAIRR-TS offers a scalable and automated solution to the challenging problem of prompt engineering for LLM-based forecasting.

What Problem Does This Paper Address?

Forecasting time series data, like predicting stock prices or weather patterns, is a critical task. While Large Language Models (LLMs) have shown impressive capabilities in understanding and generating text, their application to time series forecasting (TSF) has been hampered by the "prompt engineering bottleneck." The performance of a frozen LLM is highly sensitive to the natural language prompt it receives. Crafting optimal prompts for each new forecasting task is a laborious, ad-hoc process requiring significant domain expertise and iterative manual tuning. This limits the scalability and generalizability of LLMs for TSF. FLAIRR-TS aims to alleviate this burden by automating the prompt refinement process at inference time.

Methods

FLAIRR-TS employs an agentic system composed of three core agents:

  • Forecaster Agent (F): This agent, powered by an LLM, generates the initial time series forecast using a given prompt and augmented context.
  • Refiner Agent (R): This meta-optimizer agent analyzes the history of prompts and their corresponding forecast errors (e.g., Mean Absolute Error - MAE). Based on this analysis, it provides specific, actionable "Learnings" to improve the prompt for the next iteration. It also signals when to stop the refinement process if improvements plateau.
  • Retrieval Agent (R): Inspired by Retrieval Augmented Generation (RAG), this agent searches a historical database for segments of time series data that are semantically similar to the current input window. These retrieved segments are then used to augment the context provided to the Forecaster Agent, grounding its predictions in relevant historical patterns.

The core of FLAIRR-TS is an iterative cycle: the Forecaster generates a forecast, the Refiner evaluates it and suggests prompt improvements, and the Retrieval Agent provides relevant historical context. This process repeats, dynamically adapting the prompt to improve forecast accuracy without any weight updates to the LLM. The paper also introduces "Architected Strategy Prompts" (ASPs) as a way to explore the upper bounds of performance by manually designing specialized prompts that induce specific reasoning strategies.

Datasets

The experiments were conducted on a diverse set of widely-used time-series forecasting (TSF) benchmark datasets, spanning multiple domains and frequencies. These include:

  • ETT (ETTh1, ETTh2, ETTm1, ETTm2): Electricity Transformer Temperature data.
  • Electricity: Hourly household electricity consumption data.
  • Traffic: Hourly occupancy rates from California road-traffic sensors.
  • ILINet: Weekly Influenza-Like-Illness counts.
  • Weather: Hourly weather data from Chicago.

To ensure data integrity and avoid contamination from the LLM's pre-training data, the study specifically focused on ILINet and weather datasets, ensuring that test data originated from dates strictly after the LLM's knowledge cut-off.

Key Insights and Ideas

  • Automated Prompt Engineering is Feasible: The most significant insight is that LLMs can be guided to iteratively refine their own prompts for specific tasks like TSF, drastically reducing the need for manual intervention.
  • Agentic Systems Enhance LLM Capabilities: Decomposing the TSF task into specialized agents (Forecaster, Refiner, Retriever) allows for a more structured and effective approach to prompt optimization and context augmentation.
  • Retrieval Augmentation is Crucial for TSF: Grounding forecasts in similar historical patterns via retrieval significantly improves accuracy, especially when combined with iterative refinement.
  • Iterative Refinement Outperforms Static Approaches: The dynamic, step-by-step improvement of prompts leads to demonstrably better results than using a single, static prompt.
  • Architecture Agnostic Gains: The effectiveness of FLAIRR-TS was shown to hold across different LLM backbones (Gemini 2.5 Pro, Gemini 2 Flash, and DeepSeek-V3), suggesting the approach is broadly applicable.

Key Results

FLAIRR-TS consistently outperformed static domain-agnostic prompting and non-iterative retrieval-augmented baselines. In 14 out of 20 scenarios tested, FLAIRR and its ASP variants achieved the best performance, including all smaller horizon tasks. The method consistently surpassed the LSTPrompt baseline on all datasets. For example, on the ILI dataset, FLAIRR achieved MAE values as low as 0.189, significantly outperforming supervised models and prior prompt-based methods. The ablation study (Figure 2) clearly demonstrated that the combination of retrieval and iterative refinement (FLAIRR-TS) yielded the lowest MAE across multiple LLM backbones.

Limitations and Future Work

The authors acknowledge several limitations:

  • Analogue-Retrieval Assumption: FLAIRR-TS relies on the presence of semantically similar historical segments. In scenarios with novel events or cold-start predictions where such analogs are scarce, the refinement loop might be at higher risk of compounding errors.
  • Numerical Fidelity of LLMs: LLMs can sometimes struggle with numerical precision, especially for long or out-of-range sequences, potentially leading to hallucinations.
  • Inference Cost: The iterative nature of FLAIRR-TS involves multiple LLM calls per forecast, which can lead to higher latency and energy consumption, potentially making it prohibitive for real-time, high-frequency applications.

Future work directions include:

  • Quantitative Validation: Incorporating more direct quantitative measures for the Refiner-agent's feedback quality.
  • Hybrid Feedback Mechanisms: Exploring the use of pseudo-code or formulaic adjustments for Refiner-agent feedback, especially if LLM agents are equipped with calculator tools.
  • Advanced Analog Search: Investigating more sophisticated retrieval methods, such as learned embeddings or pattern descriptor matching, to find even more relevant historical cases.
  • Interactive Forecasting Systems: Deploying FLAIRR-TS in an interactive system where human analysts can intervene and collaborate with the agents, fostering trust and allowing for scrutiny of each refinement step.

Summary updated

BibTeX
@misc{jalori2025flairr,
  author = {Gunjan Jalori and Preetika Verma and Sercan Ö Arik},
  title = {{FLAIRR-TS - Forecasting LLM-Agents with Iterative Refinement and Retrieval for Time Series}},
  year = {2025},
  eprint = {2508.19279},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.19279},
}
Figure