Representing Time Series as Structured Programs for LLM Reasoning
Summary
The Time-Series-to-Structured-Program (T2SP) representation is a deterministic, training-free method designed to enable large language models (LLMs) to effectively reason about time series data. Addressing the modality mismatch between raw numerical sequences and LLMs' native textual/code-like training, T2SP decomposes time series into trends, periods, and salient events, expressing them as a structured symbolic program. This approach shifts the burden of temporal-structure extraction from the LLM to the representation itself, allowing off-the-shelf LLMs to leverage their existing reasoning capabilities. Evaluated on editing, captioning, and question answering tasks, T2SP consistently improved performance, reduced reasoning time, and lowered failure rates compared to raw-string representations. It was tested across models like GPT-5.4, Claude-haiku-4.5, Gemini-3.1-flash-lite, and Qwen-3.5-9B, demonstrating superior fidelity and preservation in editing tasks, especially for sequence lengths beyond 256.
Key takeaway
For AI Engineers or Machine Learning Scientists working with LLMs on time-series analysis, you should consider adopting the T2SP representation. This training-free method allows your existing LLMs, including powerful closed-source models like GPT-5.4, to interpret and reason about temporal data more effectively. By converting raw time series into structured programs, you can achieve higher performance, reduce inference time, and lower failure rates on tasks like editing, captioning, and question answering, especially with longer sequences.
Key insights
Representing time series as structured symbolic programs enables LLMs to reason effectively without fine-tuning.
Principles
- Decompose time series into trend, periods, and events.
- Align data representation with LLM's native modalities.
- Shift structure extraction from model to representation.
Method
T2SP deterministically decomposes a raw time series into trend (B-splines), periodic components (sinusoids from Fourier spectrum), and events (spikes/Gaussians), then expresses these as a symbolic program.
In practice
- Apply T2SP for time-series editing tasks.
- Use T2SP with API-only LLMs.
- Improve LLM performance on long time series.
Topics
- Time Series Analysis
- Large Language Models
- T2SP Representation
- Symbolic AI
- Time Series Editing
- GPT-5.4
Best for: Research Scientist, AI Scientist, Machine Learning Engineer, AI Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by cs.AI updates on arXiv.org.