Introduction
Accurate traffic flow forecasting is essential for modern intelligent transportation systems, influencing everything from route planning to traffic light optimization. While deep learning models like Graph Neural Networks (GNNs) have become standard, they often struggle with unexpected distribution shifts and complex, non-pair-wise spatial relationships. This paper introduces LEAF (Large Language Model Enhanced Traffic Flow Predictor), a framework that leverages the reasoning capabilities of Large Language Models (LLMs) to improve forecasting accuracy and adaptability.
The Shift from Generation to Discrimination
A key challenge in using LLMs for traffic forecasting is their inherent difficulty in generating precise numerical time-series data from scratch. Directly asking an LLM to predict future values often leads to poor results due to the complex spatio-temporal math involved.
As shown in Figure 1, LEAF shifts the LLM's role from a generator to a discriminator. Instead of producing a forecast, the LLM selects the most logical prediction from a set of mathematically sound options. This approach plays to the LLM's strengths in contextual reasoning and logic rather than its weaknesses in raw numerical generation.
The LEAF Framework
The LEAF architecture consists of three main components: a dual-branch predictor, a choice set constructor, and an LLM-based selector.
1. Dual-Branch Predictor
To capture the full complexity of traffic patterns, LEAF employs two neural network branches:
- Graph Neural Network (GNN): Models standard pair-wise relations between adjacent sensors.
- Hypergraph Neural Network (HGNN): Captures non-pair-wise group relations, such as regional traffic flows from residential to business districts.
2. Choice Set Construction
During inference, the predictor generates baseline forecasts. LEAF then applies various transformations—such as smoothing, trend adjustments (upward/downward), and scaling—to create a diverse "choice set" of potential future trajectories.
3. LLM-Based Selector and Iterative Refinement
A frozen LLM (e.g., LLaMA 3 70B) is provided with historical data, spatial/temporal context, and the choice set. It uses its "common sense" reasoning to select the most plausible prediction. For instance, it can deduce that a downward trend is likely at 7:00 PM as rush hour ends. This selection then serves as a pseudo-label to refine the underlying dual-branch predictor through a ranking loss, creating a self-improving feedback loop.
Experimental Results
LEAF was evaluated on the standard PEMS03, PEMS04, and PEMS08 datasets from California freeway systems. It consistently outperformed eight baseline models, including traditional GNNs and other LLM-based methods. On the PEMS08 dataset, LEAF achieved a Mean Absolute Error (MAE) of 24.68, significantly better than the best traditional GNN (27.22) and generative LLM baseline (26.42). Ablation studies confirmed that the LLM selector is the primary driver of these performance gains.
Conclusion
LEAF demonstrates that LLMs can be powerful tools for specialized numerical tasks when used as intelligent discriminators rather than simple generators. By combining the robust spatial modeling of GNNs/HGNNs with the contextual reasoning of LLMs, LEAF sets a new state-of-the-art in traffic flow forecasting. Future work may explore fine-tuning the LLM selector using parameter-efficient techniques like LoRA to further enhance its predictive logic.
Summary updated