TL;DR
TokenCast is a novel framework that bridges the gap between continuous numerical time series and unstructured textual context by discretizing time series data into symbolic tokens. By integrating these temporal tokens directly into a Large Language Model's (LLM) native vocabulary, TokenCast enables unified cross-modal reasoning, achieving state-of-the-art context-aware forecasting and controllable uncertainty estimation.
What Problem Does This Paper Address?
In real-world time series forecasting (TSF)—whether predicting stock prices, energy demands, or patient health metrics—external context matters. Clinical notes, financial news, and weather alerts heavily influence future trends. However, effectively combining continuous numerical sequences with heterogeneous, unstructured text is notoriously difficult.
Traditional deep learning models assume homogeneous numerical inputs and struggle with text. Conversely, recent attempts to adapt LLMs for time series rely on "shallow fusion" strategies, such as using linear adapters to project numerical data into the LLM's latent space or using soft prompts to guide the model (as shown in Figure 1). These methods fail to resolve the structural discrepancies between text and numbers, and they bypass the LLM's native vocabulary mechanism, limiting its generative and reasoning capabilities.
Methods
TokenCast introduces a three-stage pipeline to treat time series forecasting as a multimodal discrete context understanding and generation problem:
- Decoupled & Dynamic Discretization: To prevent future information leakage over prediction horizons, the framework uses a Reversible Instance Normalization (RIN) layer that calculates statistics solely from historical data. A causal encoder maps the normalized continuous sequence into latent vectors, which a vector quantization (VQ) layer discretizes into temporal tokens using a learnable codebook.
- Vocabulary-Level Cross-Modality Alignment: Instead of using external projection layers, TokenCast directly appends the temporal tokens to the LLM's original vocabulary. The LLM backbone is frozen, and only this expanded, shared embedding layer is trained using an autoregressive next-token prediction objective. This forces the model to semantically align text and temporal tokens in a single space.
- Generative Fine-Tuning: The aligned LLM is fine-tuned using structured prompts containing domain knowledge, instructions, and statistical attributes. The model autoregressively predicts future temporal tokens, which are finally translated back into continuous numerical values using a frozen time series de-tokenizer.
Datasets
The authors evaluated TokenCast on six diverse, real-world datasets rich in contextual features:
- Economic: Macroeconomic research data containing 107 variables.
- Health: COVID-19 pandemic forecasting data with 948 variables.
- Web: Daily web traffic and user log data spanning 2,000 variables.
- Stock-NY & Stock-NA: Two subsets of stock market data with text context.
- Nature: Environmental and sap flow data (11 variables) characterized by strong periodicity but weaker textual context.
Key Insights and Ideas
- The Power of a Symbolic Intermediary: Tokenizing continuous data allows the LLM to treat time series exactly like language. This unlocks the model's native attention mechanisms for deep cross-modal interaction without requiring any architectural modifications to the LLM backbone.
- Granularity is a Double-Edged Sword: Intuitively, one might think a larger codebook (more tokens) yields better accuracy. However, the authors found that increasing token granularity often degrades downstream performance. A moderate codebook size (e.g., 64 or 128 tokens) strikes the best balance between reconstruction fidelity and task complexity.
- Context-Adaptive Decoding: A fascinating qualitative finding is that TokenCast's tokenizer exhibits context-adaptive behavior. The exact same token ID can decode into entirely different numerical segments depending on the surrounding contextual text, allowing for highly flexible and faithful reconstructions (see Figure 6).
- Controllable Uncertainty: Because TokenCast generates tokens autoregressively, adjusting the sampling temperature allows users to modulate the spread of predictive intervals, providing well-calibrated, controllable uncertainty-aware forecasting.
Key Results
TokenCast demonstrated superior performance against eight strong baselines (including Time-LLM, GPT4TS, and DLinear) across almost all context-rich scenarios:
- Context-Rich Superiority: On the Economic dataset, TokenCast achieved a Mean Squared Error (MSE) of 68.911, significantly outperforming the next-best LLM baseline, Time-LLM (81.542). It achieved similar dominant results on Health, Web, and Stock datasets.
- Periodicity vs. Context: Conventional models like TimeDART only won on the Nature dataset, which features strong physical periodicity and weak contextual text. This contrast highlights that TokenCast's true strength lies in deciphering complex, non-stationary patterns driven by external context.
Limitations and Future Work
While powerful, TokenCast's performance is sensitive to hyperparameter tuning, particularly the codebook size, which must be optimized per domain. Additionally, tokenizing long multivariate sequences can drastically increase prompt lengths, raising computational overhead.
For future work, the authors plan to scale this vocabulary-level alignment strategy to build general-purpose, multi-task time series foundation models capable of handling a broader array of multimodal inputs.
Summary updated