Manuscript Offprint

arXiv:2608.29640

LLMODE: Aligning ODEs with LLMs via Gated Token Injection for Irregular Spatio-Temporal Forecasting

Di Zhang, Jingyang Zhang, Ziqian Wang, Chi Zhang, Yikun Ban, Ziwei Zhang, Ruijie Wang

Di Zhang, Jingyang Zhang, Ziqian Wang, Chi Zhang, Yikun Ban, Ziwei Zhang, Ruijie Wang ∗^{*}

Beihang University

Beijing, China

ruijiew@buaa.edu.cn

Large language models (LLMs) have shown promise for spatio-temporal forecasting, but existing approaches often rely on regularly sampled token sequences and struggle with irregular observations because of temporal asynchrony, representation-space misalignment, and limited context windows. We propose LLMODE, a token-efficient framework for irregular spatio-temporal forecasting with a frozen LLM backbone. LLMODE first uses a graph-aware ODE encoder to reconstruct irregular graph observations as a continuous-time latent trajectory. A Fixed-Budget Perceiver Resampler then compresses this variable-length trajectory into a fixed number of dynamic memory tokens. In parallel, compact statistical descriptors are encoded and resampled into context memory tokens. A dual-source gated cross-attention module injects both memories into the frozen LLM, enabling controlled utilization of external spatio-temporal evidence. Experiments on three real-world urban datasets and two physical-dynamics benchmarks show competitive overall performance, with clearer advantages under sparse or dynamically complex irregular sampling. Additional evaluations on unseen urban regions further demonstrate strong zero-shot generalization without adaptation.

1 Introduction

Irregularly sampled spatio-temporal data are common in urban sensing and physical systems, as illustrated in Figure 1. Traffic flows, crime reports, mobility records, and interacting entities may be observed at non-uniform timestamps, with missing values and asynchronous updates across locations or objects. Because these observations evolve over relational structures, accurate forecasting must jointly model temporal irregularity, incomplete measurements, and graph-structured dependencies.

Large language models (LLMs) have recently been applied to spatio-temporal forecasting through token-based conditioning. UrbanGPT (Li et al. 2024a), for example, compresses spatio-temporal signals into soft tokens for a pretrained LLM. However, most LLM-based forecasters assume regularly sampled sequences and fixed-step tokenization, which obscure actual time gaps, missing intervals, and asynchronous node updates. ISTS-PLM (Zhang et al. 2025) introduces interval-aware time encodings for irregular time series, but remains token-discrete and primarily targets individual sequences. Extending such methods to graph-based

Figure

Observations

Queries

Graph

(a) Problem setup

Figure

(b) Semantic alignment

(c) Context-length constraint

Figure 1: (a) Problem setup for irregular spatio-temporal graph forecasting. (b) Challenge 1: Semantic alignment between soft tokens and LLM semantic space. "LLM reps" refer to the representations in the LLM's hidden space. (c) Challenge 2: Context-length constraint in conditioning LLMs.

forecasting is therefore non-trivial because spatial coupling and temporal irregularity must be handled simultaneously.

Neural ODEs offer a natural alternative by evolving latent states according to actual elapsed time, reconstructing trajectories between sparse observations, and supporting queries at arbitrary timestamps. Their integration with frozen LLMs nevertheless raises two challenges. First, ODE encoders produce long trajectories containing many locally smooth and redundant neighboring states. Directly exposing all states increases the token budget and attention cost while potentially diluting informative transitions. Second, compressed numerical tokens remain misaligned with the representation space learned through language pretraining. Direct concatenation neither explicitly retrieves evidence relevant to a prediction request nor controls how strongly that evidence modifies frozen hidden representations. Effective integration therefore requires compact memory construction and controlled,

∗^{*}Corresponding author.

prediction-aware evidence injection.

To address these challenges, we propose LLMODE, an ODE-enhanced frozen-LLM framework for irregular spatio-temporal forecasting. A graph-aware ODE encoder reconstructs asynchronous and partially observed graph sequences as a continuous-time latent trajectory without imposing a regular temporal grid. A Fixed-Budget Perceiver Resampler compresses this trajectory into dynamic memory tokens, using a dynamics-aware attention bias and explicit time labels to preserve informative changes and their temporal locations. In parallel, compact statistical descriptors are encoded and resampled into context memory tokens that provide complementary global information. A dual-source gated cross-attention module then injects both memories into selected layers of the frozen LLM. For each requested prediction timestamp, the LLM prompt contains a dedicated query-slot token, whose final hidden state is mapped to the corresponding forecast. Experiments against 11 baselines on three urban datasets and two physical-dynamics benchmarks show competitive overall performance, with more pronounced advantages under sparse or dynamically complex observations. On NYCbike zero-shot, LLMODE reduces token usage by 89.2% and achieves a 7.7×7.7\times inference speedup over UrbanGPT while maintaining strong generalization to unseen regions.

Our main contributions are as follows.

• We formulate irregular spatio-temporal graph forecasting with a frozen LLM and identify temporal irregularity, representation-space alignment, and context-length constraints as the central challenges.

• We propose LLMODE, which combines a graph-aware ODE encoder with a Fixed-Budget Perceiver Resampler to reconstruct continuous-time graph dynamics and compress them into dynamic memory tokens under a bounded token budget.

• We introduce dual-source gated cross-attention with gated feed-forward refinement to integrate dynamic and context memories into a frozen LLM in a controlled manner.

• Extensive experiments on urban and physical-dynamics benchmarks demonstrate competitive forecasting performance, improved robustness under sparse irregular observations, and strong zero-shot generalization to unseen regions.

References (46)