Readme.md

September 1, 2025 ยท View on GitHub

TokenCast logoTokenCast: An LLM-Driven Framework for Context-Aware Time Series Forecasting via Symbolic Discretization

License Stars PRs Welcome

TokenCast is a novel framework that leverages Large Language Models (LLMs) for context-aware time series forecasting, by transforming continuous time series into discrete symbolic tokens. It enables a unified generative modeling over both temporal and textual modalities.

๐Ÿ“ โ€œFrom Values to Tokens: An LLM-Driven Framework for Context-aware Time Series Forecasting via Symbolic Discretizationโ€
Under review | ๐Ÿ“„ Paper


๐Ÿ” Overview

Traditional forecasting models struggle to effectively integrate heterogeneous contextual data like clinical notes, policy documents, or logs. TokenCast introduces a new paradigm:

  • Converts time series into discrete temporal tokens via dynamic vector quantization.
  • Embeds both temporal and textual tokens into a shared semantic space using a frozen pre-trained LLM.
  • Performs prompt-based generative forecasting using autoregressive language modeling.


โœจ Key Features

  • โœ… Discretized Temporal Modeling: Learnable, reversible tokenizer for symbolic time series.
  • ๐Ÿ”— Cross-Modality Alignment: Unified vocabulary space for both time and text tokens.
  • ๐Ÿ“ˆ Prompt-driven Generation: Forecasting with LLM via token-level instruction generation.
  • ๐Ÿ“Š Multi-domain Evaluation: Benchmarked across economic, health, web, stock, and environmental domains.
  • ๐ŸŒก๏ธ Uncertainty Quantification: Predictive intervals with temperature-controlled generation.

๐Ÿš€ Getting Started

1. Clone the repo

git clone https://github.com/Xiaoyu-Tao/TokenCast.git
cd TokenCast

2. Environment Setup

conda create -n tokencast python=3.10
conda activate tokencast
pip install -r requirements.txt

3. Prepare Data

TokenCast supports multiple publicly available datasets:

  • Economic (FRED-MD)
  • Health (Covid-19 mobility)
  • Web (Wikipedia pageviews)
  • Stock-NY & Stock-NA (NYSE/NASDAQ)
  • Nature (Environmental sensor data)

First, the training and evaluation datasets used in our experiments can be found in Google Drive. Then, create a directory named datasets and download the necessary datasets into it.

mkdir datasets

4. Train the Time Series Tokenizer

sh Tokenizer/scripts/Czelan.sh 

5. Align Embeddings with LLM

sh scripts/pretrain/Czelan.sh  

6. Fine-tune Forecasting Model

sh scripts/finetune/Czelan.sh 

๐Ÿ“Š Benchmark Results

Full Results: table1

Ablation Results: table2


๐Ÿ“š Citation

If you find this project useful, please consider citing our paper:

@inproceedings{tao2026tokencast,
  title={From Values to Tokens: An LLM-Driven Framework for Context-aware Time Series Forecasting via Symbolic Discretization},
  author={Tao, Xiaoyu and Zhang, Shilong and Cheng, Mingyue and Wang, Daoyu and Pan, Tingyue and Pan, Bokai and Zhang, Changqing and Wang, Shijin},
  booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
  year={2026}
}

๐Ÿค Acknowledgements

This project is developed by researchers from:

  • ๐Ÿง  University of Science and Technology of China (USTC)
  • ๐Ÿงฎ Tianjin University
  • ๐Ÿ—ฃ๏ธ iFLYTEK Research

๐Ÿ“ฌ Contact

For questions or collaborations, please contact:


๐Ÿ“Œ License

This project is released under the MIT License.